mirror of https://github.com/dense-analysis/ale
commit
d1023e9c2c
|
@ -118,6 +118,7 @@ name. That seems to be the fairest way to arrange this table.
|
||||||
| Stylus | [stylelint](https://github.com/stylelint/stylelint) |
|
| Stylus | [stylelint](https://github.com/stylelint/stylelint) |
|
||||||
| SQL | [sqlint](https://github.com/purcell/sqlint) |
|
| SQL | [sqlint](https://github.com/purcell/sqlint) |
|
||||||
| Swift | [swiftlint](https://swift.org/) |
|
| Swift | [swiftlint](https://swift.org/) |
|
||||||
|
| Tcl | [nagelfar](http://nagelfar.sourceforge.net)|
|
||||||
| Texinfo | [proselint](http://proselint.com/)|
|
| Texinfo | [proselint](http://proselint.com/)|
|
||||||
| Text^ | [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
| Text^ | [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
||||||
| TypeScript | [eslint](http://eslint.org/), [tslint](https://github.com/palantir/tslint), tsserver, typecheck |
|
| TypeScript | [eslint](http://eslint.org/), [tslint](https://github.com/palantir/tslint), tsserver, typecheck |
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
" Author: Nick James <github@nsjuk.xyz>
|
||||||
|
" Description: nagelfar linter for tcl files
|
||||||
|
|
||||||
|
call ale#Set('tcl_nagelfar_executable', 'nagelfar.tcl')
|
||||||
|
call ale#Set('tcl_nagelfar_options', '')
|
||||||
|
|
||||||
|
function! ale_linters#tcl#nagelfar#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'tcl_nagelfar_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#tcl#nagelfar#GetCommand(buffer) abort
|
||||||
|
let l:options = ale#Var(a:buffer, 'tcl_nagelfar_options')
|
||||||
|
|
||||||
|
return ale#Escape(ale_linters#tcl#nagelfar#GetExecutable(a:buffer))
|
||||||
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
|
\ . ' %s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#tcl#nagelfar#Handle(buffer, lines) abort
|
||||||
|
" Matches patterns like the following:
|
||||||
|
" Line 5: W Found constant "bepa" which is also a variable.
|
||||||
|
" Line 13: E Wrong number of arguments (3) to "set"
|
||||||
|
" Line 93: N Close brace not aligned with line 90 (4 0)
|
||||||
|
|
||||||
|
let l:pattern = '^Line\s\+\([0-9]\+\): \([NEW]\) \(.*\)$'
|
||||||
|
let l:output = []
|
||||||
|
|
||||||
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'type': l:match[2] ==# 'N' ? 'W' : l:match[2],
|
||||||
|
\ 'text': l:match[3],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('tcl', {
|
||||||
|
\ 'name': 'nagelfar',
|
||||||
|
\ 'output_stream': 'stdout',
|
||||||
|
\ 'executable_callback': 'ale_linters#tcl#nagelfar#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale_linters#tcl#nagelfar#GetCommand',
|
||||||
|
\ 'callback': 'ale_linters#tcl#nagelfar#Handle',
|
||||||
|
\ 'lint_file': 1,
|
||||||
|
\})
|
|
@ -0,0 +1,25 @@
|
||||||
|
===============================================================================
|
||||||
|
ALE Tcl Integration *ale-tcl-options*
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
nagelfar *ale-tcl-nagelfar*
|
||||||
|
|
||||||
|
g:ale_tcl_nagelfar_executable *g:ale_tcl_nagelfar_executable*
|
||||||
|
*b:ale_tcl_nagelfar_executable*
|
||||||
|
Type: |String|
|
||||||
|
Default: `'nagelfar.tcl'`
|
||||||
|
|
||||||
|
This variable can be changed to change the path to nagelfar.
|
||||||
|
|
||||||
|
|
||||||
|
g:ale_tcl_nagelfar_options *g:ale_tcl_nagelfar_options*
|
||||||
|
*b:ale_tcl_nagelfar_options*
|
||||||
|
Type: |String|
|
||||||
|
Default: `''`
|
||||||
|
|
||||||
|
This variable can be changed to modify flags given to nagelfar.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
|
@ -108,6 +108,8 @@ CONTENTS *ale-contents*
|
||||||
rpmlint.............................|ale-spec-rpmlint|
|
rpmlint.............................|ale-spec-rpmlint|
|
||||||
stylus................................|ale-stylus-options|
|
stylus................................|ale-stylus-options|
|
||||||
stylelint...........................|ale-stylus-stylelint|
|
stylelint...........................|ale-stylus-stylelint|
|
||||||
|
tcl...................................|ale-tcl-options|
|
||||||
|
nagelfar............................|ale-tcl-nagelfar|
|
||||||
tex...................................|ale-tex-options|
|
tex...................................|ale-tex-options|
|
||||||
chktex..............................|ale-tex-chktex|
|
chktex..............................|ale-tex-chktex|
|
||||||
lacheck.............................|ale-tex-lacheck|
|
lacheck.............................|ale-tex-lacheck|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
Before:
|
||||||
|
Save g:ale_tcl_nagelfar_executable
|
||||||
|
Save g:ale_tcl_nagelfar_options
|
||||||
|
|
||||||
|
unlet! g:ale_tcl_nagelfar_executable
|
||||||
|
unlet! b:ale_tcl_nagelfar_executable
|
||||||
|
unlet! g:ale_tcl_nagelfar_options
|
||||||
|
unlet! b:ale_tcl_nagelfar_options
|
||||||
|
|
||||||
|
runtime ale_linters/tcl/nagelfar.vim
|
||||||
|
|
||||||
|
After:
|
||||||
|
Restore
|
||||||
|
unlet! b:command_tail
|
||||||
|
unlet! b:ale_tcl_nagelfar_executable
|
||||||
|
unlet! b:ale_tcl_nagelfar_options
|
||||||
|
call ale#linter#Reset()
|
||||||
|
|
||||||
|
Execute(The executable should be configurable):
|
||||||
|
AssertEqual 'nagelfar.tcl', ale_linters#tcl#nagelfar#GetExecutable(bufnr(''))
|
||||||
|
|
||||||
|
let b:ale_tcl_nagelfar_executable = 'foobar'
|
||||||
|
|
||||||
|
AssertEqual 'foobar', ale_linters#tcl#nagelfar#GetExecutable(bufnr(''))
|
||||||
|
|
||||||
|
Execute(The executable should be used in the command):
|
||||||
|
AssertEqual
|
||||||
|
\ ale#Escape('nagelfar.tcl') . ' %s',
|
||||||
|
\ ale_linters#tcl#nagelfar#GetCommand(bufnr(''))
|
||||||
|
|
||||||
|
let b:ale_tcl_nagelfar_executable = 'foobar'
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ ale#Escape('foobar') . ' %s',
|
||||||
|
\ ale_linters#tcl#nagelfar#GetCommand(bufnr(''))
|
||||||
|
|
||||||
|
Execute(The options should be configurable):
|
||||||
|
let b:ale_tcl_nagelfar_options = '--something'
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ ale#Escape('nagelfar.tcl') . ' --something %s',
|
||||||
|
\ ale_linters#tcl#nagelfar#GetCommand(bufnr(''))
|
|
@ -0,0 +1,171 @@
|
||||||
|
Before:
|
||||||
|
runtime ale_linters/tcl/nagelfar.vim
|
||||||
|
|
||||||
|
Execute(The nagelfar handler should parse lines correctly):
|
||||||
|
AssertEqual
|
||||||
|
\ [
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 5,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Found constant "bepa" which is also a variable.'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 7,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Unknown variable "cep"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 7,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Unknown command "se"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 8,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Unknown variable "epa"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 10,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Unknown variable "depa"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 10,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Suspicious variable name "$depa"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 11,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Suspicious variable name "$cepa"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 13,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Wrong number of arguments (3) to "set"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 13,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Found constant "bepa" which is also a variable.'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 13,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Found constant "cepa" which is also a variable.'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 18,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Badly formed if statement'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 24,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Unknown subcommand "gurka" to "info"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 31,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Switch pattern starting with #. This could be a bad comment.'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 31,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Unknown command "This"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 31,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Unknown command "bad"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 34,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Unknown command "miffo"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 55,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Suspicious variable name "$bepa"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 56,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Suspicious variable name "$apa"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 61,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Could not complete statement.'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 67,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Could not complete statement.'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 70,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Wrong number of arguments (4) to "proc"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 72,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Wrong number of arguments (1) to "if"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 75,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Unbalanced close brace found'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 82,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Unbalanced close brace found'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 88,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Could not complete statement.'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 90,
|
||||||
|
\ 'type': 'E',
|
||||||
|
\ 'text': 'Wrong number of arguments (1) to "if"'
|
||||||
|
\ },
|
||||||
|
\ {
|
||||||
|
\ 'lnum': 93,
|
||||||
|
\ 'type': 'W',
|
||||||
|
\ 'text': 'Close brace not aligned with line 90 (4 0)'
|
||||||
|
\ },
|
||||||
|
\ ],
|
||||||
|
\ ale_linters#tcl#nagelfar#Handle(bufnr(''), [
|
||||||
|
\ 'Line 5: W Found constant "bepa" which is also a variable.',
|
||||||
|
\ 'Line 7: E Unknown variable "cep"',
|
||||||
|
\ 'Line 7: W Unknown command "se"',
|
||||||
|
\ 'Line 8: E Unknown variable "epa"',
|
||||||
|
\ 'Line 10: E Unknown variable "depa"',
|
||||||
|
\ 'Line 10: N Suspicious variable name "$depa"',
|
||||||
|
\ 'Line 11: N Suspicious variable name "$cepa"',
|
||||||
|
\ 'Line 13: E Wrong number of arguments (3) to "set"',
|
||||||
|
\ 'Line 13: W Found constant "bepa" which is also a variable.',
|
||||||
|
\ 'Line 13: W Found constant "cepa" which is also a variable.',
|
||||||
|
\ 'Line 18: E Badly formed if statement',
|
||||||
|
\ 'Line 24: E Unknown subcommand "gurka" to "info"',
|
||||||
|
\ 'Line 31: W Switch pattern starting with #. This could be a bad comment.',
|
||||||
|
\ 'Line 31: W Unknown command "This"',
|
||||||
|
\ 'Line 31: W Unknown command "bad"',
|
||||||
|
\ 'Line 34: W Unknown command "miffo"',
|
||||||
|
\ 'Line 55: N Suspicious variable name "$bepa"',
|
||||||
|
\ 'Line 56: N Suspicious variable name "$apa"',
|
||||||
|
\ 'Line 61: E Could not complete statement.',
|
||||||
|
\ 'Line 67: E Could not complete statement.',
|
||||||
|
\ 'Line 70: E Wrong number of arguments (4) to "proc"',
|
||||||
|
\ 'Line 72: E Wrong number of arguments (1) to "if"',
|
||||||
|
\ 'Line 75: E Unbalanced close brace found',
|
||||||
|
\ 'Line 82: E Unbalanced close brace found',
|
||||||
|
\ 'Line 88: E Could not complete statement.',
|
||||||
|
\ 'Line 90: E Wrong number of arguments (1) to "if"',
|
||||||
|
\ 'Line 93: N Close brace not aligned with line 90 (4 0)',
|
||||||
|
\ ])
|
Loading…
Reference in New Issue