From 6845aae951d2aa6bb5d03952a788083b9c4d06e2 Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Thu, 21 Sep 2023 22:58:35 +0300 Subject: [PATCH] Deal with editor-config lints --- .editorconfig | 14 +++++++- .github/workflows/lint.yml | 2 +- build-aux/ax_prog_perl_modules.m4 | 53 ++++++++++++++-------------- build-aux/ax_progvar.m4 | 6 ++-- doc/sample_hooks/pre-merge-unclobber | 2 +- 5 files changed, 44 insertions(+), 33 deletions(-) diff --git a/.editorconfig b/.editorconfig index abd7452a..0ff3c66d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,7 +3,19 @@ root = true [*] end_of_line = lf insert_final_newline = true +charset = utf-8 +trim_trailing_whitespace = true + +[{Makefile*,*.mk,*.mk.in}] +indent_style = tab +indent_size = 4 + +[*.m4] +indent_style = space +indent_size = 8 + +[*.md] +trim_trailing_whitespace = false [{vcsh.in,completions/vcsh.*}] indent_style = tab -trim_trailing_whitespace = true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 24bb269e..0a60402d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,7 +10,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Lint code style - uses: editorconfig-checker/action-editorconfig-checker@v1.0.0 + uses: editorconfig-checker/action-editorconfig-checker@v2.0.0 shellcheck: runs-on: ubuntu-latest diff --git a/build-aux/ax_prog_perl_modules.m4 b/build-aux/ax_prog_perl_modules.m4 index 70b3230e..b13fcf6c 100644 --- a/build-aux/ax_prog_perl_modules.m4 +++ b/build-aux/ax_prog_perl_modules.m4 @@ -38,40 +38,39 @@ AU_ALIAS([AC_PROG_PERL_MODULES], [AX_PROG_PERL_MODULES]) AC_DEFUN([AX_PROG_PERL_MODULES],[dnl m4_define([ax_perl_modules]) -m4_foreach([ax_perl_module], m4_split(m4_normalize([$1])), - [ - m4_append([ax_perl_modules], - [']m4_bpatsubst(ax_perl_module,=,[ ])[' ]) - ]) +m4_foreach([ax_perl_module], m4_split(m4_normalize([$1])), [ + m4_append([ax_perl_modules], + [']m4_bpatsubst(ax_perl_module,=,[ ])[' ]) +]) # Make sure we have perl if test -z "$PERL"; then -AC_CHECK_PROG(PERL,perl,perl) + AC_CHECK_PROG(PERL,perl,perl) fi if test "x$PERL" != x; then - ax_perl_modules_failed=0 - for ax_perl_module in ax_perl_modules; do - AC_MSG_CHECKING(for perl module $ax_perl_module) + ax_perl_modules_failed=0 + for ax_perl_module in ax_perl_modules; do + AC_MSG_CHECKING(for perl module $ax_perl_module) - # Would be nice to log result here, but can't rely on autoconf internals - $PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1 - if test $? -ne 0; then - AC_MSG_RESULT(no); - ax_perl_modules_failed=1 - else - AC_MSG_RESULT(ok); - fi - done + # Would be nice to log result here, but can't rely on autoconf internals + $PERL -e "use $ax_perl_module; exit" > /dev/null 2>&1 + if test $? -ne 0; then + AC_MSG_RESULT(no); + ax_perl_modules_failed=1 + else + AC_MSG_RESULT(ok); + fi + done - # Run optional shell commands - if test "$ax_perl_modules_failed" = 0; then - : - $2 - else - : - $3 - fi + # Run optional shell commands + if test "$ax_perl_modules_failed" = 0; then + : + $2 + else + : + $3 + fi else - AC_MSG_WARN(could not find perl) + AC_MSG_WARN(could not find perl) fi])dnl diff --git a/build-aux/ax_progvar.m4 b/build-aux/ax_progvar.m4 index 131c8061..e584ed4a 100644 --- a/build-aux/ax_progvar.m4 +++ b/build-aux/ax_progvar.m4 @@ -1,5 +1,5 @@ AC_DEFUN([AX_PROGVAR], [ - test -n "$m4_toupper($1)" || { AC_PATH_PROG(m4_toupper($1), m4_default($2,$1)) } - test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required]) - ]) + test -n "$m4_toupper($1)" || { AC_PATH_PROG(m4_toupper($1), m4_default($2,$1)) } + test -n "$m4_toupper($1)" || AC_MSG_ERROR([m4_default($2,$1) is required]) +]) diff --git a/doc/sample_hooks/pre-merge-unclobber b/doc/sample_hooks/pre-merge-unclobber index 52610962..5d566e54 100755 --- a/doc/sample_hooks/pre-merge-unclobber +++ b/doc/sample_hooks/pre-merge-unclobber @@ -7,5 +7,5 @@ # the now-renamed files. for object in $(git ls-tree -r origin/master | awk '{print $4}'); do - [ -e "$object" ] && mv "$object" "$object.vcsh-unclobber" + [ -e "$object" ] && mv "$object" "$object.vcsh-unclobber" done