summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/asciidoc/writegood.vim7
-rw-r--r--ale_linters/go/gobuild.vim3
-rw-r--r--ale_linters/go/govet.vim3
-rw-r--r--ale_linters/haskell/cabal_ghc.vim3
-rw-r--r--ale_linters/haskell/ghc-mod.vim6
-rw-r--r--ale_linters/haskell/stack_build.vim3
-rw-r--r--ale_linters/haskell/stack_ghc.vim3
-rw-r--r--ale_linters/help/writegood.vim7
-rw-r--r--ale_linters/html/writegood.vim9
-rw-r--r--ale_linters/markdown/remark_lint.vim4
-rw-r--r--ale_linters/markdown/writegood.vim7
-rw-r--r--ale_linters/nroff/writegood.vim7
-rw-r--r--ale_linters/po/writegood.vim7
-rw-r--r--ale_linters/pod/writegood.vim7
-rw-r--r--ale_linters/rst/writegood.vim7
-rw-r--r--ale_linters/sml/smlnj_cm.vim3
-rw-r--r--ale_linters/tex/writegood.vim7
-rw-r--r--ale_linters/texinfo/writegood.vim7
-rw-r--r--ale_linters/text/writegood.vim7
-rw-r--r--ale_linters/xhtml/writegood.vim7
-rw-r--r--autoload/ale/handlers/writegood.vim11
-rwxr-xr-xtest/script/custom-linting-rules9
-rw-r--r--test/test_filetype_linter_defaults.vader2
23 files changed, 52 insertions, 84 deletions
diff --git a/ale_linters/asciidoc/writegood.vim b/ale_linters/asciidoc/writegood.vim
index c986cc6c..a29b7e9c 100644
--- a/ale_linters/asciidoc/writegood.vim
+++ b/ale_linters/asciidoc/writegood.vim
@@ -1,9 +1,4 @@
" Author: Sumner Evans <sumner.evans98@gmail.com>
" Description: write-good for AsciiDoc files
-call ale#linter#Define('asciidoc', {
-\ 'name': 'write-good',
-\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
-\ 'command_callback': 'ale#handlers#writegood#GetCommand',
-\ 'callback': 'ale#handlers#writegood#Handle',
-\})
+call ale#handlers#writegood#DefineLinter('asciidoc')
diff --git a/ale_linters/go/gobuild.vim b/ale_linters/go/gobuild.vim
index 068877a3..c4608071 100644
--- a/ale_linters/go/gobuild.vim
+++ b/ale_linters/go/gobuild.vim
@@ -70,7 +70,8 @@ function! ale_linters#go#gobuild#Handler(buffer, lines) abort
endfunction
call ale#linter#Define('go', {
-\ 'name': 'go build',
+\ 'name': 'gobuild',
+\ 'aliases': ['go build'],
\ 'executable': 'go',
\ 'command_chain': [
\ {'callback': 'ale_linters#go#gobuild#GoEnv', 'output_stream': 'stdout'},
diff --git a/ale_linters/go/govet.vim b/ale_linters/go/govet.vim
index edf9eb66..e94e6ecd 100644
--- a/ale_linters/go/govet.vim
+++ b/ale_linters/go/govet.vim
@@ -9,7 +9,8 @@ function! ale_linters#go#govet#GetCommand(buffer) abort
endfunction
call ale#linter#Define('go', {
-\ 'name': 'go vet',
+\ 'name': 'govet',
+\ 'aliases': ['go vet'],
\ 'output_stream': 'stderr',
\ 'executable': 'go',
\ 'command_callback': 'ale_linters#go#govet#GetCommand',
diff --git a/ale_linters/haskell/cabal_ghc.vim b/ale_linters/haskell/cabal_ghc.vim
index 79fd8ff9..003adf5d 100644
--- a/ale_linters/haskell/cabal_ghc.vim
+++ b/ale_linters/haskell/cabal_ghc.vim
@@ -10,7 +10,8 @@ function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort
endfunction
call ale#linter#Define('haskell', {
-\ 'name': 'cabal-ghc',
+\ 'name': 'cabal_ghc',
+\ 'aliases': ['cabal-ghc'],
\ 'output_stream': 'stderr',
\ 'executable': 'cabal',
\ 'command_callback': 'ale_linters#haskell#cabal_ghc#GetCommand',
diff --git a/ale_linters/haskell/ghc-mod.vim b/ale_linters/haskell/ghc-mod.vim
index 1b15d8c2..eb032f50 100644
--- a/ale_linters/haskell/ghc-mod.vim
+++ b/ale_linters/haskell/ghc-mod.vim
@@ -2,14 +2,16 @@
" Description: ghc-mod for Haskell files
call ale#linter#Define('haskell', {
-\ 'name': 'ghc-mod',
+\ 'name': 'ghc_mod',
+\ 'aliases': ['ghc-mod'],
\ 'executable': 'ghc-mod',
\ 'command': 'ghc-mod --map-file %s=%t check %s',
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
\})
call ale#linter#Define('haskell', {
-\ 'name': 'stack-ghc-mod',
+\ 'name': 'stack_ghc_mod',
+\ 'aliases': ['stack-ghc-mod'],
\ 'executable': 'stack',
\ 'command': 'stack exec ghc-mod -- --map-file %s=%t check %s',
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
diff --git a/ale_linters/haskell/stack_build.vim b/ale_linters/haskell/stack_build.vim
index 44e2e86f..f5bdf4b8 100644
--- a/ale_linters/haskell/stack_build.vim
+++ b/ale_linters/haskell/stack_build.vim
@@ -13,7 +13,8 @@ function! ale_linters#haskell#stack_build#GetCommand(buffer) abort
endfunction
call ale#linter#Define('haskell', {
-\ 'name': 'stack-build',
+\ 'name': 'stack_build',
+\ 'aliases': ['stack-build'],
\ 'output_stream': 'stderr',
\ 'executable': 'stack',
\ 'command_callback': 'ale_linters#haskell#stack_build#GetCommand',
diff --git a/ale_linters/haskell/stack_ghc.vim b/ale_linters/haskell/stack_ghc.vim
index 0367dc24..d702aa68 100644
--- a/ale_linters/haskell/stack_ghc.vim
+++ b/ale_linters/haskell/stack_ghc.vim
@@ -2,7 +2,8 @@
" Description: ghc for Haskell files, using Stack
call ale#linter#Define('haskell', {
-\ 'name': 'stack-ghc',
+\ 'name': 'stack_ghc',
+\ 'aliases': ['stack-ghc'],
\ 'output_stream': 'stderr',
\ 'executable': 'stack',
\ 'command': 'stack ghc -- -fno-code -v0 %t',
diff --git a/ale_linters/help/writegood.vim b/ale_linters/help/writegood.vim
index 11254cd2..eeb21a73 100644
--- a/ale_linters/help/writegood.vim
+++ b/ale_linters/help/writegood.vim
@@ -1,9 +1,4 @@
" Author: Sumner Evans <sumner.evans98@gmail.com>
" Description: write-good for vim Help files
-call ale#linter#Define('help', {
-\ 'name': 'write-good',
-\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
-\ 'command_callback': 'ale#handlers#writegood#GetCommand',
-\ 'callback': 'ale#handlers#writegood#Handle',
-\})
+call ale#handlers#writegood#DefineLinter('help')
diff --git a/ale_linters/html/writegood.vim b/ale_linters/html/writegood.vim
index 9fae8821..6a2bd8e5 100644
--- a/ale_linters/html/writegood.vim
+++ b/ale_linters/html/writegood.vim
@@ -1,9 +1,4 @@
" Author: Sumner Evans <sumner.evans98@gmail.com>
-" Description: write-good for nroff files
+" Description: write-good for html files
-call ale#linter#Define('html', {
-\ 'name': 'write-good',
-\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
-\ 'command_callback': 'ale#handlers#writegood#GetCommand',
-\ 'callback': 'ale#handlers#writegood#Handle',
-\})
+call ale#handlers#writegood#DefineLinter('html')
diff --git a/ale_linters/markdown/remark_lint.vim b/ale_linters/markdown/remark_lint.vim
index 195b0f5a..d9c2efb6 100644
--- a/ale_linters/markdown/remark_lint.vim
+++ b/ale_linters/markdown/remark_lint.vim
@@ -1,3 +1,4 @@
+scriptencoding utf-8
" Author rhysd https://rhysd.github.io/, Dirk Roorda (dirkroorda), Adrián González Rus (@adrigzr)
" Description: remark-lint for Markdown files
call ale#Set('markdown_remark_lint_executable', 'remark')
@@ -43,7 +44,8 @@ function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort
endfunction
call ale#linter#Define('markdown', {
-\ 'name': 'remark-lint',
+\ 'name': 'remark_lint',
+\ 'aliases': ['remark-lint'],
\ 'executable_callback': 'ale_linters#markdown#remark_lint#GetExecutable',
\ 'command_callback': 'ale_linters#markdown#remark_lint#GetCommand',
\ 'callback': 'ale_linters#markdown#remark_lint#Handle',
diff --git a/ale_linters/markdown/writegood.vim b/ale_linters/markdown/writegood.vim
index 21dbff1a..7108e7ac 100644
--- a/ale_linters/markdown/writegood.vim
+++ b/ale_linters/markdown/writegood.vim
@@ -1,9 +1,4 @@
" Author: Sumner Evans <sumner.evans98@gmail.com>
" Description: write-good for Markdown files
-call ale#linter#Define('markdown', {
-\ 'name': 'write-good',
-\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
-\ 'command_callback': 'ale#handlers#writegood#GetCommand',
-\ 'callback': 'ale#handlers#writegood#Handle',
-\})
+call ale#handlers#writegood#DefineLinter('markdown')
diff --git a/ale_linters/nroff/writegood.vim b/ale_linters/nroff/writegood.vim
index d318fb28..bcf344f6 100644
--- a/ale_linters/nroff/writegood.vim
+++ b/ale_linters/nroff/writegood.vim
@@ -1,9 +1,4 @@
" Author: Sumner Evans <sumner.evans98@gmail.com>
" Description: write-good for nroff files
-call ale#linter#Define('nroff', {
-\ 'name': 'write-good',
-\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
-\ 'command_callback': 'ale#handlers#writegood#GetCommand',
-\ 'callback': 'ale#handlers#writegood#Handle',
-\})
+call ale#handlers#writegood#DefineLinter('nroff')
diff --git a/ale_linters/po/writegood.vim b/ale_linters/po/writegood.vim
index 5a01cb66..14686473 100644
--- a/ale_linters/po/writegood.vim
+++ b/ale_linters/po/writegood.vim
@@ -1,9 +1,4 @@
" Author: Cian Butler https://github.com/butlerx
" Description: write-good for PO files
-call ale#linter#Define('po', {
-\ 'name': 'write-good',
-\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
-\ 'command_callback': 'ale#handlers#writegood#GetCommand',
-\ 'callback': 'ale#handlers#writegood#Handle',
-\})
+call ale#handlers#writegood#DefineLinter('po')
diff --git a/ale_linters/pod/writegood.vim b/ale_linters/pod/writegood.vim
index 14ed5c0c..9f5461e6 100644
--- a/ale_linters/pod/writegood.vim
+++ b/ale_linters/pod/writegood.vim
@@ -1,9 +1,4 @@
" Author: Sumner Evans <sumner.evans98@gmail.com>
" Description: write-good for Pod files
-call ale#linter#Define('pod', {
-\ 'name': 'write-good',
-\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
-\ 'command_callback': 'ale#handlers#writegood#GetCommand',
-\ 'callback': 'ale#handlers#writegood#Handle',
-\})
+call ale#handlers#writegood#DefineLinter('pod')
diff --git a/ale_linters/rst/writegood.vim b/ale_linters/rst/writegood.vim
index 12137dbf..26b1152a 100644
--- a/ale_linters/rst/writegood.vim
+++ b/ale_linters/rst/writegood.vim
@@ -1,9 +1,4 @@
" Author: Sumner Evans <sumner.evans98@gmail.com>
" Description: write-good for reStructuredText files
-call ale#linter#Define('rst', {
-\ 'name': 'write-good',
-\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
-\ 'command_callback': 'ale#handlers#writegood#GetCommand',
-\ 'callback': 'ale#handlers#writegood#Handle',
-\})
+call ale#handlers#writegood#DefineLinter('rst')
diff --git a/ale_linters/sml/smlnj_cm.vim b/ale_linters/sml/smlnj_cm.vim
index 96cd7bd9..7a482307 100644
--- a/ale_linters/sml/smlnj_cm.vim
+++ b/ale_linters/sml/smlnj_cm.vim
@@ -9,7 +9,8 @@ endfunction
" Using CM requires that we set "lint_file: 1", since it reads the files
" from the disk itself.
call ale#linter#Define('sml', {
-\ 'name': 'smlnj-cm',
+\ 'name': 'smlnj_cm',
+\ 'aliases': ['smlnj-cm'],
\ 'executable_callback': 'ale#handlers#sml#GetExecutableSmlnjCm',
\ 'lint_file': 1,
\ 'command_callback': 'ale_linters#sml#smlnj_cm#GetCommand',
diff --git a/ale_linters/tex/writegood.vim b/ale_linters/tex/writegood.vim
index dc59de2e..c1aeace9 100644
--- a/ale_linters/tex/writegood.vim
+++ b/ale_linters/tex/writegood.vim
@@ -1,9 +1,4 @@
" Author: Sumner Evans <sumner.evans98@gmail.com>
" Description: write-good for TeX files
-call ale#linter#Define('tex', {
-\ 'name': 'write-good',
-\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
-\ 'command_callback': 'ale#handlers#writegood#GetCommand',
-\ 'callback': 'ale#handlers#writegood#Handle',
-\})
+call ale#handlers#writegood#DefineLinter('tex')
diff --git a/ale_linters/texinfo/writegood.vim b/ale_linters/texinfo/writegood.vim
index 8104c634..4427f056 100644
--- a/ale_linters/texinfo/writegood.vim
+++ b/ale_linters/texinfo/writegood.vim
@@ -1,9 +1,4 @@
" Author: Sumner Evans <sumner.evans98@gmail.com>
" Description: write-good for Texinfo files
-call ale#linter#Define('texinfo', {
-\ 'name': 'write-good',
-\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
-\ 'command_callback': 'ale#handlers#writegood#GetCommand',
-\ 'callback': 'ale#handlers#writegood#Handle',
-\})
+call ale#handlers#writegood#DefineLinter('texinfo')
diff --git a/ale_linters/text/writegood.vim b/ale_linters/text/writegood.vim
index ff76ce42..81b935d4 100644
--- a/ale_linters/text/writegood.vim
+++ b/ale_linters/text/writegood.vim
@@ -1,9 +1,4 @@
" Author: Sumner Evans <sumner.evans98@gmail.com>
" Description: write-good for text files
-call ale#linter#Define('text', {
-\ 'name': 'write-good',
-\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
-\ 'command_callback': 'ale#handlers#writegood#GetCommand',
-\ 'callback': 'ale#handlers#writegood#Handle',
-\})
+call ale#handlers#writegood#DefineLinter('text')
diff --git a/ale_linters/xhtml/writegood.vim b/ale_linters/xhtml/writegood.vim
index 83d1863b..1fcba182 100644
--- a/ale_linters/xhtml/writegood.vim
+++ b/ale_linters/xhtml/writegood.vim
@@ -1,9 +1,4 @@
" Author: Sumner Evans <sumner.evans98@gmail.com>
" Description: write-good for XHTML files
-call ale#linter#Define('xhtml', {
-\ 'name': 'write-good',
-\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
-\ 'command_callback': 'ale#handlers#writegood#GetCommand',
-\ 'callback': 'ale#handlers#writegood#Handle',
-\})
+call ale#handlers#writegood#DefineLinter('xhtml')
diff --git a/autoload/ale/handlers/writegood.vim b/autoload/ale/handlers/writegood.vim
index aee7c4de..aff66d5f 100644
--- a/autoload/ale/handlers/writegood.vim
+++ b/autoload/ale/handlers/writegood.vim
@@ -59,3 +59,14 @@ function! ale#handlers#writegood#Handle(buffer, lines) abort
return l:output
endfunction
+
+" Define the writegood linter for a given filetype.
+function! ale#handlers#writegood#DefineLinter(filetype) abort
+ call ale#linter#Define(a:filetype, {
+ \ 'name': 'writegood',
+ \ 'aliases': ['write-good'],
+ \ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
+ \ 'command_callback': 'ale#handlers#writegood#GetCommand',
+ \ 'callback': 'ale#handlers#writegood#Handle',
+ \})
+endfunction
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