diff options
author | w0rp <devw0rp@gmail.com> | 2018-07-24 10:05:44 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-07-24 10:05:44 +0100 |
commit | d368f090aeeca3545dd03b1bfe4bff5e6a95d7e2 (patch) | |
tree | 01cb50e7de53bd94f162a59bdefb0a21c08699e6 /test | |
parent | 95be2bf1ff9221eb74dc028ca616412305b2bc85 (diff) | |
download | ale-d368f090aeeca3545dd03b1bfe4bff5e6a95d7e2.zip |
#1754 Require snake_case names for linters in the codebase
Diffstat (limited to 'test')
-rwxr-xr-x | test/script/custom-linting-rules | 9 | ||||
-rw-r--r-- | test/test_filetype_linter_defaults.vader | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/test/script/custom-linting-rules b/test/script/custom-linting-rules index 51cf5680..69c4a7a1 100755 --- a/test/script/custom-linting-rules +++ b/test/script/custom-linting-rules @@ -52,12 +52,17 @@ directories=("$@") check_errors() { regex="$1" message="$2" + include_arg='' + + if [ $# -gt 2 ]; then + include_arg="--include $3" + fi for directory in "${directories[@]}"; do while IFS= read -r match; do RETURN_CODE=1 echo "$match $message" - done < <(grep -n "$regex" "$directory"/**/*.vim \ + done < <(grep -n "$regex" $include_arg "$directory"/**/*.vim \ | grep -v 'no-custom-checks' \ | grep -o '^[^:]\+:[0-9]\+' \ | sed 's:^\./::') @@ -75,6 +80,7 @@ if (( FIX_ERRORS )); then done fi +# The arguments are: regex, explanation, [filename_filter] check_errors \ '^function.*) *$' \ 'Function without abort keyword (See :help except-compat)' @@ -95,5 +101,6 @@ 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/*' exit $RETURN_CODE diff --git a/test/test_filetype_linter_defaults.vader b/test/test_filetype_linter_defaults.vader index ea4a05fb..4f190226 100644 --- a/test/test_filetype_linter_defaults.vader +++ b/test/test_filetype_linter_defaults.vader @@ -22,7 +22,7 @@ Execute(The defaults for the csh filetype should be correct): AssertEqual [], GetLinterNames('csh') Execute(The defaults for the go filetype should be correct): - AssertEqual ['gofmt', 'golint', 'go vet'], GetLinterNames('go') + AssertEqual ['gofmt', 'golint', 'govet'], GetLinterNames('go') let g:ale_linters_explicit = 1 |