You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@yetus.apache.org by aw...@apache.org on 2020/04/10 16:17:52 UTC

[yetus] branch master updated: YETUS-962. markdownlint is smashing lines together (#106)

This is an automated email from the ASF dual-hosted git repository.

aw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yetus.git


The following commit(s) were added to refs/heads/master by this push:
     new 9f99186  YETUS-962. markdownlint is smashing lines together (#106)
9f99186 is described below

commit 9f99186b09b35e680ec68f069d211e28ca33526a
Author: Allen Wittenauer <aw...@apache.org>
AuthorDate: Fri Apr 10 09:17:42 2020 -0700

    YETUS-962. markdownlint is smashing lines together (#106)
---
 asf-site-src/README.md                               |  1 +
 .../in-progress/precommit-apidocs.html.md            |  1 -
 .../in-progress/precommit-bugsystems.html.md         |  2 +-
 .../in-progress/precommit-glossary.html.md           |  2 +-
 .../in-progress/precommit-robots.html.md             |  2 +-
 .../in-progress/precommit-smart-apply-patch.html.md  |  5 ++---
 .../in-progress/precommit-testformats.html.md        |  2 +-
 .../src/main/shell/test-patch.d/markdownlint.sh      | 20 +++++++++++---------
 8 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/asf-site-src/README.md b/asf-site-src/README.md
index 76a5df6..0a089b7 100644
--- a/asf-site-src/README.md
+++ b/asf-site-src/README.md
@@ -16,6 +16,7 @@
   specific language governing permissions and limitations
   under the License.
 -->
+
 # Apache Yetus Website
 
 This is the website for Apache Yetus.
diff --git a/asf-site-src/source/documentation/in-progress/precommit-apidocs.html.md b/asf-site-src/source/documentation/in-progress/precommit-apidocs.html.md
index 7b68109..e49a0d1 100644
--- a/asf-site-src/source/documentation/in-progress/precommit-apidocs.html.md
+++ b/asf-site-src/source/documentation/in-progress/precommit-apidocs.html.md
@@ -19,7 +19,6 @@
 
 # Precommit API Docs
 
-
 Following gives the downstream consumable API for precommit components.
 
 * [Core Functions](core/), common to both smart-apply-patch and test-patch.
diff --git a/asf-site-src/source/documentation/in-progress/precommit-bugsystems.html.md b/asf-site-src/source/documentation/in-progress/precommit-bugsystems.html.md
index d1eadec..a13ca19 100644
--- a/asf-site-src/source/documentation/in-progress/precommit-bugsystems.html.md
+++ b/asf-site-src/source/documentation/in-progress/precommit-bugsystems.html.md
@@ -124,4 +124,4 @@ JIRA issues are invoked by matching the command line option to a specific regula
 In order to write information on the issue, JIRA requires username and password authentication using the `--jira-user`/`--jira-password` options or the JIRA\_USER and JIRA\_PASSWORD variables in a personality.
 
 The default value for JIRA\_USER is the value of `--project` suffixed with QA.  For example,
-`--project=yetus` will set `JIRA_USER=yetusqa`.
\ No newline at end of file
+`--project=yetus` will set `JIRA_USER=yetusqa`.
diff --git a/asf-site-src/source/documentation/in-progress/precommit-glossary.html.md b/asf-site-src/source/documentation/in-progress/precommit-glossary.html.md
index acf5b23..fe9143d 100644
--- a/asf-site-src/source/documentation/in-progress/precommit-glossary.html.md
+++ b/asf-site-src/source/documentation/in-progress/precommit-glossary.html.md
@@ -19,7 +19,7 @@
 
 # Glossary
 
-## Generic/outside definitions:
+## Generic/outside definitions
 
 Apache's [new contributor documentation](https://community.apache.org/contributors/) and Maven's [glossary](https://maven.apache.org/glossary.html) are great places to start if you are new to Apache or Maven.
 
diff --git a/asf-site-src/source/documentation/in-progress/precommit-robots.html.md b/asf-site-src/source/documentation/in-progress/precommit-robots.html.md
index dd50b75..816baa4 100644
--- a/asf-site-src/source/documentation/in-progress/precommit-robots.html.md
+++ b/asf-site-src/source/documentation/in-progress/precommit-robots.html.md
@@ -291,4 +291,4 @@ If `--robot` is specified without an instance, a random number is generated and
 
 # Sentinel Mode
 
-If stuck Docker containers are a problem, a more aggressive robot may be enabled with the `--sentinel` option.  This option enables killing containers that have been running for over 24 hours as well.
\ No newline at end of file
+If stuck Docker containers are a problem, a more aggressive robot may be enabled with the `--sentinel` option.  This option enables killing containers that have been running for over 24 hours as well.
diff --git a/asf-site-src/source/documentation/in-progress/precommit-smart-apply-patch.html.md b/asf-site-src/source/documentation/in-progress/precommit-smart-apply-patch.html.md
index 35a621d..0ef8b3e 100644
--- a/asf-site-src/source/documentation/in-progress/precommit-smart-apply-patch.html.md
+++ b/asf-site-src/source/documentation/in-progress/precommit-smart-apply-patch.html.md
@@ -17,12 +17,11 @@
   under the License.
 -->
 
-smart-apply-patch
-=================
+# smart-apply-patch
 
 `smart-apply-patch` is a command to help apply patches easily.  It uses the same plug-ins and many of the same options as test-patch.  This means that it can, for example, fetch patches from JIRA and apply them to a local source tree.
 
-# Usage
+## Usage
 
 Its simplest form is used when a patch is stored in a local file:
 
diff --git a/asf-site-src/source/documentation/in-progress/precommit-testformats.html.md b/asf-site-src/source/documentation/in-progress/precommit-testformats.html.md
index 6eda542..c1bb1ec 100644
--- a/asf-site-src/source/documentation/in-progress/precommit-testformats.html.md
+++ b/asf-site-src/source/documentation/in-progress/precommit-testformats.html.md
@@ -45,4 +45,4 @@ Using the results stored by pluginname\_process\_tests, write them to the test r
 
 # Example
 
-For an example of how to write a test-format plugin, you can look at [junit plugin](https://github.com/apache/yetus/blob/master/precommit/test-patch.d/junit.sh) bundled in Apache Yetus.
\ No newline at end of file
+For an example of how to write a test-format plugin, you can look at [junit plugin](https://github.com/apache/yetus/blob/master/precommit/test-patch.d/junit.sh) bundled in Apache Yetus.
diff --git a/precommit/src/main/shell/test-patch.d/markdownlint.sh b/precommit/src/main/shell/test-patch.d/markdownlint.sh
index 884836d..a94ac09 100755
--- a/precommit/src/main/shell/test-patch.d/markdownlint.sh
+++ b/precommit/src/main/shell/test-patch.d/markdownlint.sh
@@ -47,23 +47,25 @@ function markdownlint_logic
 {
   declare repostatus=$1
   declare i
-  declare fn
+  declare line
   declare output
 
   pushd "${BASEDIR}" >/dev/null || return 1
 
   for i in "${MARKDOWNLINT_CHECKFILES[@]}"; do
     if [[ -f "${i}" ]]; then
-      fn=""
       while read -r; do
-        if [[ -z "${fn}" ]]; then
-          fn=$REPLY
-        elif [[ -n "${REPLY}" ]]; then
-          # (space)line:col(space)error/warning(space)text
-          output=$(echo "${REPLY}" | awk '{$1=$1":"; $2=$2":"; print $0;}')
-          # fn:line:col:(space)error/warning:(space)text
-          echo "${fn}:${output}" >> "${PATCH_DIR}/${repostatus}-markdownlint-result.txt"
+        if [[ "${REPLY}" =~ ^.*:[0-9]+:[0-9]+ ]]; then
+          # fn:line(space)MD333/key long description
+          line=${REPLY}
+        else
+          # fn:line(space)MD###/key long description
+          line=$(echo "${REPLY}" | "${SED}" 's, ,:0 ,')
         fi
+        #fn:line:col:MD###/key long description
+        output=$(echo "${line}" | "${SED}" 's, ,:,')
+
+        echo "${output}" >> "${PATCH_DIR}/${repostatus}-markdownlint-result.txt"
       done < <("${MARKDOWNLINT}" "${i}" 2>&1)
     fi
   done