diff options
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/haskell/hlint.vim | 15 | ||||
-rw-r--r-- | ale_linters/php/psalm.vim | 28 | ||||
-rw-r--r-- | ale_linters/scss/stylelint.vim | 8 |
3 files changed, 48 insertions, 3 deletions
diff --git a/ale_linters/haskell/hlint.vim b/ale_linters/haskell/hlint.vim index be40d92c..3ee864bf 100644 --- a/ale_linters/haskell/hlint.vim +++ b/ale_linters/haskell/hlint.vim @@ -1,6 +1,9 @@ " Author: jparoz <jesse.paroz@gmail.com> " Description: hlint for Haskell files +call ale#Set('haskell_hlint_executable', 'hlint') +call ale#Set('haskell_hlint_options', get(g:, 'hlint_options', '')) + function! ale_linters#haskell#hlint#Handle(buffer, lines) abort let l:output = [] @@ -26,9 +29,17 @@ function! ale_linters#haskell#hlint#Handle(buffer, lines) abort return l:output endfunction +function! ale_linters#haskell#hlint#GetCommand(buffer) abort + let l:hlintopts = '--color=never --json' + + return '%e' + \ . ' ' . ale#Var(a:buffer, 'haskell_hlint_options') + \ . ' ' . l:hlintopts . ' -' +endfunction + call ale#linter#Define('haskell', { \ 'name': 'hlint', -\ 'executable': 'hlint', -\ 'command': 'hlint --color=never --json -', +\ 'executable_callback': ale#VarFunc('haskell_hlint_executable'), +\ 'command_callback': 'ale_linters#haskell#hlint#GetCommand', \ 'callback': 'ale_linters#haskell#hlint#Handle', \}) diff --git a/ale_linters/php/psalm.vim b/ale_linters/php/psalm.vim new file mode 100644 index 00000000..cd20ab81 --- /dev/null +++ b/ale_linters/php/psalm.vim @@ -0,0 +1,28 @@ +" Author: richard marmorstein <https://github.com/twitchard> +" Description: plugin for Psalm, static analyzer for PHP + +call ale#Set('php_psalm_executable', 'psalm') + +function! ale_linters#php#psalm#Handle(buffer, lines) abort + " Matches patterns like the following: + let l:pattern = '^.*:\(\d\+\):\(\d\+\):\(\w\+\) - \(.*\)$' + let l:output = [] + + for l:match in ale#util#GetMatches(a:lines, l:pattern) + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'text': l:match[4], + \ 'type': l:match[3][:0] is# 'e' ? 'E' : 'W', + \}) + endfor + + return l:output +endfunction + +call ale#linter#Define('php', { +\ 'name': 'psalm', +\ 'command': '%e --diff --output-format=emacs %s', +\ 'executable_callback': ale#VarFunc('php_psalm_executable'), +\ 'callback': 'ale_linters#php#psalm#Handle', +\ 'lint_file': 1, +\}) diff --git a/ale_linters/scss/stylelint.vim b/ale_linters/scss/stylelint.vim index 6d183b4a..2bffa8e1 100644 --- a/ale_linters/scss/stylelint.vim +++ b/ale_linters/scss/stylelint.vim @@ -1,13 +1,19 @@ " Author: diartyz <diartyz@gmail.com> call ale#Set('scss_stylelint_executable', 'stylelint') +call ale#Set('scss_stylelint_options', '') call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables', 0)) +function! ale_linters#scss#stylelint#GetCommand(buffer) abort + return '%e ' . ale#Pad(ale#Var(a:buffer, 'scss_stylelint_options')) + \ . ' --stdin-filename %s' +endfunction + call ale#linter#Define('scss', { \ 'name': 'stylelint', \ 'executable_callback': ale#node#FindExecutableFunc('scss_stylelint', [ \ 'node_modules/.bin/stylelint', \ ]), -\ 'command': '%e --stdin-filename %s', +\ 'command_callback': 'ale_linters#scss#stylelint#GetCommand', \ 'callback': 'ale#handlers#css#HandleStyleLintFormat', \}) |