Update checkstyle workflow env to ubuntu-20.04

- `checkstyle` workflow uses ubuntu-20.04 environment
- improved `mancheck.sh` readability

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #12713
This commit is contained in:
Damian Szuberski
2021-11-02 21:02:57 +01:00
committed by Tony Hutter
parent ad15fb430a
commit 64e88992b6
9 changed files with 32 additions and 10 deletions
+15 -5
View File
@@ -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