summaryrefslogtreecommitdiff
path: root/test/script
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2022-04-01 14:35:07 +0100
committerw0rp <devw0rp@gmail.com>2022-04-01 14:35:07 +0100
commitd3df00b89803f1891a772c47fc8eda6a1e9e1baa (patch)
treebe1b852b1e06925be3e06711475d0d663603230b /test/script
parentb3d1d6eecfb5eb08787501294979dc6ba2426c35 (diff)
downloadale-d3df00b89803f1891a772c47fc8eda6a1e9e1baa.zip
Fix test for echoing messages
The previous linter rule about stray echo lines has been restored, and now all problems for custom linting rules can be ignored by adding a comment above problem lines.
Diffstat (limited to 'test/script')
-rwxr-xr-xtest/script/custom-linting-rules13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/script/custom-linting-rules b/test/script/custom-linting-rules
index d3f5e3f3..486a0db7 100755
--- a/test/script/custom-linting-rules
+++ b/test/script/custom-linting-rules
@@ -73,6 +73,17 @@ check_errors() {
for directory in "${directories[@]}"; do
# shellcheck disable=SC2086
while read -r; do
+ line=$(cut -d ":" -f2 <<< "$REPLY")
+
+ if ((line > 1)); then
+ line=$((line - 1))
+ file=$(cut -d ":" -f1 <<< "$REPLY")
+
+ if sed -n "${line},${line}p" $file | grep -q '^ *" *no-custom-checks$'; then
+ continue
+ fi
+ fi
+
RETURN_CODE=1
echo "$REPLY $message"
done < <(grep -H -n "$regex" $include_arg $exclude_arg "$directory"/**/*.vim \
@@ -125,7 +136,7 @@ check_errors '==#' "Use 'is#' instead of '==#'. 0 ==# 'foobar' is true"
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 '^ *:\?echo' "Stray echo line. Ignore with \" no-custom-checks if needed"
check_errors '^ *:\?redir' 'User execute() instead of redir'
# Exclusions for grandfathered-in exceptions
exclusions="clojure/clj_kondo.vim elixir/elixir_ls.vim go/golangci_lint.vim swift/swiftformat.vim"