diff --git a/autoload/syntastic/preprocess.vim b/autoload/syntastic/preprocess.vim index aacb4fd3..52ec865a 100644 --- a/autoload/syntastic/preprocess.vim +++ b/autoload/syntastic/preprocess.vim @@ -8,6 +8,37 @@ set cpo&vim " Public functions {{{1 +function! syntastic#preprocess#bandit(errors) abort " {{{2 + let out = [] + let json = s:_decode_JSON(join(a:errors, '')) + + if type(json) == type({}) && has_key(json, 'results') && type(json['results']) == type([]) + for issue in json['results'] + if type(issue) == type({}) + try + call add(out, + \ issue['filename'] . ':' . + \ issue['line_number'] . ':' . + \ { 'LOW': 'I', 'MEDIUM': 'W', 'HIGH': 'E' }[issue['issue_severity']] . ':' . + \ issue['test_id'][1:] . ':' . + \ issue['issue_text'] . + \ ' [' . issue['test_name'] . '] (confidence: ' . issue['issue_confidence'] . ')') + catch /\m^Vim\%((\a\+)\)\=:E716/ + call syntastic#log#warn('checker python/bandit: unrecognized error item ' . string(issue)) + let out = [] + break + endtry + else + call syntastic#log#warn('checker python/bandit: unrecognized error item ' . string(issue)) + endif + endfor + else + call syntastic#log#warn('checker python/bandit: unrecognized error format (crashed checker?)') + endif + + return out +endfunction " }}}2 + function! syntastic#preprocess#cabal(errors) abort " {{{2 let out = [] let star = 0 diff --git a/doc/syntastic-checkers.txt b/doc/syntastic-checkers.txt index aa9f770a..d1cdc4b0 100644 --- a/doc/syntastic-checkers.txt +++ b/doc/syntastic-checkers.txt @@ -4695,20 +4695,49 @@ SYNTAX CHECKERS FOR PYTHON *syntastic-checkers-python* The following checkers are available for Python (filetype "python"): - 1. flake8...................|syntastic-python-flake8| - 2. Frosted..................|syntastic-python-frosted| - 3. mypy.....................|syntastic-python-mypy| - 4. Prospector...............|syntastic-python-prospector| - 5. py3kwarn.................|syntastic-python-py3kwarn| - 6. pycodestyle..............|syntastic-python-pycodestyle| - 7. pydocstyle...............|syntastic-python-pydocstyle| - 8. Pyflakes.................|syntastic-python-pyflakes| - 9. Pylama...................|syntastic-python-pylama| - 10. Pylint..................|syntastic-python-pylint| - 11. python..................|syntastic-python-python| + 1. Bandit...................|syntastic-python-bandit| + 2. flake8...................|syntastic-python-flake8| + 3. Frosted..................|syntastic-python-frosted| + 4. mypy.....................|syntastic-python-mypy| + 5. Prospector...............|syntastic-python-prospector| + 6. py3kwarn.................|syntastic-python-py3kwarn| + 7. pycodestyle..............|syntastic-python-pycodestyle| + 8. pydocstyle...............|syntastic-python-pydocstyle| + 9. Pyflakes.................|syntastic-python-pyflakes| + 10. Pylama..................|syntastic-python-pylama| + 11. Pylint..................|syntastic-python-pylint| + 12. python..................|syntastic-python-python| ------------------------------------------------------------------------------ -1. flake8 *syntastic-python-flake8* +1. Bandit *syntastic-python-bandit* + +Name: bandit +Maintainer: LCD 47 + +"Bandit" is an AST-based static analyzer for Python from OpenStack Security +Group (http://openstack.org). See the project's official documentation for +details: + + https://wiki.openstack.org/wiki/Security/Projects/Bandit + +Installation~ + +Install it with "pip": > + pip install bandit +< +Checker options~ + +This checker is initialised using the "makeprgBuild()" function and thus it +accepts the standard options described at |syntastic-config-makeprg|. + +Note~ + +In order to check all files in a project, rather than the current file: > + let g:syntastic_python_bandit_fname = ['/path/to/project'] + let g:syntastic_python_bandit_args = '-r' +< +------------------------------------------------------------------------------ +2. flake8 *syntastic-python-flake8* Name: flake8 Maintainers: Sylvain Soliman @@ -4728,7 +4757,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. ------------------------------------------------------------------------------ -2. Frosted *syntastic-python-frosted* +3. Frosted *syntastic-python-frosted* Name: frosted Maintainer: LCD 47 @@ -4744,7 +4773,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. ------------------------------------------------------------------------------ -3. mypy *syntastic-python-mypy* +4. mypy *syntastic-python-mypy* Name: mypy Maintainer: Russ Hewgill @@ -4760,7 +4789,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. ------------------------------------------------------------------------------ -4. Prospector *syntastic-python-prospector* +5. Prospector *syntastic-python-prospector* Name: prospector Maintainer: LCD 47 @@ -4783,7 +4812,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. ------------------------------------------------------------------------------ -5. py3kwarn *syntastic-python-py3kwarn* +6. py3kwarn *syntastic-python-py3kwarn* Name: py3kwarn Author: Liam Curry @@ -4799,7 +4828,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. ------------------------------------------------------------------------------ -6. pycodestyle *syntastic-python-pycodestyle* +7. pycodestyle *syntastic-python-pycodestyle* Name: pycodestyle Maintainer: LCD 47 @@ -4816,7 +4845,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. ------------------------------------------------------------------------------ -7. pydocstyle *syntastic-python-pydocstyle* +8. pydocstyle *syntastic-python-pydocstyle* Name: pydocstyle Maintainer: LCD 47 @@ -4834,7 +4863,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. ------------------------------------------------------------------------------ -8. Pyflakes *syntastic-python-pyflakes* +9. Pyflakes *syntastic-python-pyflakes* Name: pyflakes Authors: Martin Grenfell @@ -4852,7 +4881,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. ------------------------------------------------------------------------------ -9. Pylama *syntastic-python-pylama* +10. Pylama *syntastic-python-pylama* Name: pylama Maintainer: LCD 47 @@ -4878,7 +4907,7 @@ This checker is initialised using the "makeprgBuild()" function and thus it accepts the standard options described at |syntastic-config-makeprg|. ------------------------------------------------------------------------------ -10. Pylint *syntastic-python-pylint* +11. Pylint *syntastic-python-pylint* Name: pylint Author: Parantapa Bhattacharya @@ -4908,7 +4937,7 @@ recognise any messages. Example: > \ '--msg-template="{path}:{line}:{column}:{C}: [{symbol} {msg_id}] {msg}"' < ------------------------------------------------------------------------------ -11. python *syntastic-python-python* +12. python *syntastic-python-python* Name: python Maintainer: LCD 47 diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index b3316729..a6894b18 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.8.0-45' +let g:_SYNTASTIC_VERSION = '3.8.0-46' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1