diff options
author | Damian Szuberski <[email protected]> | 2021-11-02 21:02:57 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-11-02 14:02:57 -0600 |
commit | 6d680e61ef6a6dfd6932c651a8421fdae3cdbd56 (patch) | |
tree | a622ffa7104b6991a145d0ab151bea7fa38c1293 /scripts/mancheck.sh | |
parent | 58bf6afd3f065274e0111ab9bab44828dd72c726 (diff) |
Update `checkstyle` workflow env to ubuntu-20.04
- `checkstyle` workflow uses ubuntu-20.04 environment
- improved `mancheck.sh` readability
Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: John Kennedy <[email protected]>
Signed-off-by: szubersk <[email protected]>
Closes #12713
Diffstat (limited to 'scripts/mancheck.sh')
-rwxr-xr-x | scripts/mancheck.sh | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/scripts/mancheck.sh b/scripts/mancheck.sh index 6ae1fc5be..0793cc48f 100755 --- a/scripts/mancheck.sh +++ b/scripts/mancheck.sh @@ -11,7 +11,9 @@ # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # -# shellcheck disable=SC2086 +# shellcheck disable=SC2086,SC2250 + +trap 'rm -f "$stdout_file" "$stderr_file" "$result_file"' EXIT if [ "$#" -eq 0 ]; then echo "Usage: $0 manpage-directory..." @@ -25,7 +27,6 @@ fi IFS=" " - files="$(find "$@" -type f -name '*[1-9]*')" || exit 1 add_excl="$(awk ' @@ -38,6 +39,15 @@ add_excl="$(awk ' # Redirect to file instead of 2>&1ing because mandoc flushes inconsistently(?) which tears lines # https://github.com/openzfs/zfs/pull/12129/checks?check_run_id=2701608671#step:5:3 -etmp="$(mktemp)" -! { mandoc -Tlint $files 2>"$etmp"; cat "$etmp"; rm -f "$etmp"; } | - grep -vE -e 'mandoc: outdated mandoc.db' -e 'STYLE: referenced manual not found' $add_excl >&2 +stdout_file="$(mktemp)" +stderr_file="$(mktemp)" +mandoc -Tlint $files 1>"$stdout_file" 2>"$stderr_file" +result_file="$(mktemp)" +grep -vhE -e 'mandoc: outdated mandoc.db' -e 'STYLE: referenced manual not found' $add_excl "$stdout_file" "$stderr_file" > "$result_file" + +if [ -s "$result_file" ]; then + cat "$result_file" + exit 1 +else + echo "no errors found" +fi |