]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/linter/test_bandit.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / linter / test_bandit.vader
1 Before:
2   call ale#assert#SetUpLinterTest('python', 'bandit')
3   let b:bandit_flags = ' --format custom '
4   \   . '--msg-template "{line}:{test_id}:{severity}:{msg}" '
5
6 After:
7   call ale#assert#TearDownLinterTest()
8   unlet! b:bandit_flags
9
10 Execute(The bandit command callback should return default string):
11   AssertLinter 'bandit',
12   \ ale#Escape('bandit')
13   \ . b:bandit_flags
14   \ . ' -'
15
16 Execute(The bandit command callback should allow options):
17   let g:ale_python_bandit_options = '--configfile bandit.yaml'
18
19   AssertLinter 'bandit',
20   \ ale#Escape('bandit')
21   \ . b:bandit_flags
22   \ . ' --configfile bandit.yaml -'
23
24 Execute(The bandit executable should be configurable):
25   let g:ale_python_bandit_executable = '~/.local/bin/bandit'
26
27   AssertLinter '~/.local/bin/bandit',
28   \ ale#Escape('~/.local/bin/bandit')
29   \ . b:bandit_flags
30   \ . ' -'
31
32 Execute(Setting executable to 'pipenv' appends 'run bandit'):
33   let g:ale_python_bandit_executable = 'path/to/pipenv'
34
35   AssertLinter 'path/to/pipenv',
36   \ ale#Escape('path/to/pipenv')
37   \ . ' run bandit'
38   \ . b:bandit_flags
39   \ . ' -'
40
41 Execute(Pipenv is detected when python_bandit_auto_pipenv is set):
42   let g:ale_python_bandit_auto_pipenv = 1
43   call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
44
45   AssertLinter 'pipenv',
46   \ ale#Escape('pipenv')
47   \ . ' run bandit'
48   \ . b:bandit_flags
49   \ . ' -'
50
51 Execute(Setting executable to 'poetry' appends 'run bandit'):
52   let g:ale_python_bandit_executable = 'path/to/poetry'
53
54   AssertLinter 'path/to/poetry',
55   \ ale#Escape('path/to/poetry')
56   \ . ' run bandit'
57   \ . b:bandit_flags
58   \ . ' -'
59
60 Execute(Poetry is detected when python_bandit_auto_poetry is set):
61   let g:ale_python_bandit_auto_poetry = 1
62   call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
63
64   AssertLinter 'poetry',
65   \ ale#Escape('poetry')
66   \ . ' run bandit'
67   \ . b:bandit_flags
68   \ . ' -'
69
70 Execute(uv is used when python_bandit_auto_uv is set):
71   let g:ale_python_bandit_auto_uv = 1
72   call ale#test#SetFilename('../test-files/python/uv/whatever.py')
73
74   AssertLinter 'uv',
75   \ ale#Escape('uv')
76   \ . ' run bandit'
77   \ . b:bandit_flags
78   \ . ' -'
79
80 Execute(The bandit command callback should add .bandit by default):
81   silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_bandit/namespace/foo/bar.py')
82
83   let b:config_path = ale#path#Simplify(
84   \ g:dir . '/../test-files/python/with_bandit/.bandit'
85   \)
86
87   AssertLinter 'bandit',
88   \ ale#Escape('bandit')
89   \ . ' --ini ' . ale#Escape(b:config_path)
90   \ . b:bandit_flags
91   \ . ' -'
92
93 Execute(The bandit command callback should support not using .bandit):
94   silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_bandit/subdir/foo/bar.py')
95   let g:ale_python_bandit_use_config = 0
96
97   AssertLinter 'bandit',
98   \ ale#Escape('bandit')
99   \ . b:bandit_flags
100   \ . ' -'