diff options
author | D. Ben Knoble <ben.knoble+github@gmail.com> | 2021-01-23 12:29:05 -0500 |
---|---|---|
committer | D. Ben Knoble <ben.knoble+github@gmail.com> | 2021-01-23 12:29:05 -0500 |
commit | 2c1c5b06d9554592370f0ad651c21b61334123e4 (patch) | |
tree | 1198a97028e8b9bbf8021aed0a13a06ffbc9f402 /test/script/custom-linting-rules | |
parent | 10d2b8797c3d4336729f5f6f75edab53733d7642 (diff) | |
parent | 9fd9435cd525b1d3c4470db0d514f72ed31cfece (diff) | |
download | ale-2c1c5b06d9554592370f0ad651c21b61334123e4.zip |
Merge branch 'master' into fix-swipl
* master: (133 commits)
Add rnix-lsp for Nix diagnostics and completion
add spectral support for json
add spectral handler
add spectral linter for yaml
doc: Fix linter issues
doc: Add documentation for Deno
feat: Add Deno lsp support
feat: Add Deno fmt fixer
Add document for apkbuild filetype
Add tests for atools handler, basic and dealing with Error and Warning
Test default linters for apkbuild
Document new default linters for apkbuild
Make apkbuild_lint and secfixes_check default for apkbuild filetype
document support for apkbuild-lint and secfixes-check for apkbuild
Add linters for apkbuild-lint and secfixes-check from atools
Add handler for the output of atools
Fix typos
Add command callback tests
Add support for standalone files
Fix linting errors
...
Diffstat (limited to 'test/script/custom-linting-rules')
-rwxr-xr-x | test/script/custom-linting-rules | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/test/script/custom-linting-rules b/test/script/custom-linting-rules index 981a9459..86294f71 100755 --- a/test/script/custom-linting-rules +++ b/test/script/custom-linting-rules @@ -53,17 +53,29 @@ check_errors() { regex="$1" message="$2" include_arg='' + exclude_arg='' if [ $# -gt 2 ]; then include_arg="--include $3" fi + if [ $# -gt 3 ]; then + shift + shift + shift + + while (( "$#" )); do + exclude_arg="$exclude_arg --exclude $1" + shift + done + fi + for directory in "${directories[@]}"; do # shellcheck disable=SC2086 while read -r; do RETURN_CODE=1 echo "$REPLY $message" - done < <(grep -H -n "$regex" $include_arg "$directory"/**/*.vim \ + done < <(grep -H -n "$regex" $include_arg $exclude_arg "$directory"/**/*.vim \ | grep -v 'no-custom-checks' \ | grep -o '^[^:]\+:[0-9]\+' \ | sed 's:^\./::') @@ -92,7 +104,7 @@ if (( FIX_ERRORS )); then done fi -# The arguments are: regex, explanation, [filename_filter] +# The arguments are: regex, explanation, [filename_filter], [list, of, exclusions] check_errors \ '^function.*) *$' \ 'Function without abort keyword (See :help except-compat)' @@ -114,7 +126,10 @@ check_errors '==?' "Use 'is?' instead of '==?'. 0 ==? 'foobar' is true" check_errors '!=#' "Use 'isnot#' instead of '!=#'. 0 !=# 'foobar' is false" check_errors '!=?' "Use 'isnot?' instead of '!=?'. 0 !=? 'foobar' is false" check_errors '^ *:\?echo' "Stray echo line. Use \`execute echo\` if you want to echo something" -check_errors $'name.:.*\'[a-z_]*[^a-z_0-9][a-z_0-9]*\',$' 'Use snake_case names for linters' '*/ale_linters/*' +# Exclusions for grandfathered-in exceptions +exclusions="clojure/clj_kondo.vim elixir/elixir_ls.vim go/golangci_lint.vim swift/swiftformat.vim" +# shellcheck disable=SC2086 +check_errors $'name.:.*\'[a-z_]*[^a-z_0-9][a-z_0-9]*\',$' 'Use snake_case names for linters' '*/ale_linters/*' $exclusions # Checks for improving type checks. check_errors $'\\(==.\\?\\|is\\) type([\'"]\+)' "Use 'is v:t_string' instead" check_errors '\(==.\?\|is\) type([0-9]\+)' "Use 'is v:t_number' instead" |