This fixes issue #936 by linting the whole package

This commit is contained in:
Sander van Harmelen 2018-02-15 12:23:36 +01:00
parent fcb7932d7d
commit ab5257c344
4 changed files with 97 additions and 1 deletions

View file

@ -0,0 +1,41 @@
Before:
Save b:ale_go_staticcheck_options
Save b:ale_go_staticcheck_lint_package
let b:ale_go_staticcheck_options = ''
let b:ale_go_staticcheck_lint_package = 0
runtime ale_linters/go/staticcheck.vim
call ale#test#SetDirectory('/testplugin/test/command_callback')
call ale#test#SetFilename('test.go')
After:
Restore
call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(The staticcheck callback should return the right defaults):
AssertEqual
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . 'staticcheck '
\ . ale#Escape(expand('%' . ':t')),
\ ale_linters#go#staticcheck#GetCommand(bufnr(''))
Execute(The staticcheck callback should use configured options):
let b:ale_go_staticcheck_options = '-test'
AssertEqual
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . 'staticcheck '
\ . '-test ' . ale#Escape(expand('%' . ':t')),
\ ale_linters#go#staticcheck#GetCommand(bufnr(''))
Execute(The staticcheck `lint_package` option should use the correct command):
let b:ale_go_staticcheck_lint_package = 1
AssertEqual
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . 'staticcheck .',
\ ale_linters#go#staticcheck#GetCommand(bufnr(''))