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.
2 runtime ale_linters/sh/shell.vim
3 runtime ale_linters/sh/shellcheck.vim
6 call ale#linter#Reset()
12 Given(A file with a Bash hashbang):
15 Execute(/bin/bash should be detected appropriately):
16 AssertEqual 'bash', ale#handlers#sh#GetShellType(bufnr(''))
17 AssertEqual 'bash', ale_linters#sh#shell#GetExecutable(bufnr(''))
18 AssertEqual 'bash', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
20 Given(A file with /bin/sh):
21 #!/usr/bin/env sh -eu --foobar
23 Execute(/bin/sh should be detected appropriately):
24 AssertEqual 'sh', ale#handlers#sh#GetShellType(bufnr(''))
25 AssertEqual 'sh', ale_linters#sh#shell#GetExecutable(bufnr(''))
26 AssertEqual 'sh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
28 Given(A file with bash as an argument to env):
31 Execute(/usr/bin/env bash should be detected appropriately):
32 AssertEqual 'bash', ale#handlers#sh#GetShellType(bufnr(''))
33 AssertEqual 'bash', ale_linters#sh#shell#GetExecutable(bufnr(''))
34 AssertEqual 'bash', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
36 Given(A file with a tcsh hash bang and arguments):
37 #!/usr/bin/env tcsh -eu --foobar
39 Execute(tcsh should be detected appropriately):
40 AssertEqual 'tcsh', ale#handlers#sh#GetShellType(bufnr(''))
41 AssertEqual 'tcsh', ale_linters#sh#shell#GetExecutable(bufnr(''))
42 AssertEqual 'tcsh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
44 Given(A file with a zsh hash bang and arguments):
45 #!/usr/bin/env zsh -eu --foobar
47 Execute(zsh should be detected appropriately):
48 AssertEqual 'zsh', ale#handlers#sh#GetShellType(bufnr(''))
49 AssertEqual 'zsh', ale_linters#sh#shell#GetExecutable(bufnr(''))
50 AssertEqual 'zsh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
52 Given(A file with a csh hash bang and arguments):
53 #!/usr/bin/env csh -eu --foobar
55 Execute(csh should be detected appropriately):
56 AssertEqual 'csh', ale#handlers#sh#GetShellType(bufnr(''))
57 AssertEqual 'csh', ale_linters#sh#shell#GetExecutable(bufnr(''))
58 AssertEqual 'csh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
60 Given(A file with a ksh hashbang):
63 Execute(/bin/ksh should be detected appropriately):
64 AssertEqual 'ksh', ale#handlers#sh#GetShellType(bufnr(''))
65 AssertEqual 'ksh', ale_linters#sh#shell#GetExecutable(bufnr(''))
66 AssertEqual 'ksh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
68 Given(A file with a ksh as an argument to env):
71 Execute(ksh should be detected appropriately):
72 AssertEqual 'ksh', ale#handlers#sh#GetShellType(bufnr(''))
73 AssertEqual 'ksh', ale_linters#sh#shell#GetExecutable(bufnr(''))
74 AssertEqual 'ksh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
76 Given(A file with a sh hash bang and arguments):
77 #!/usr/bin/env sh -eu --foobar
79 Execute(sh should be detected appropriately):
80 AssertEqual 'sh', ale#handlers#sh#GetShellType(bufnr(''))
81 AssertEqual 'sh', ale_linters#sh#shell#GetExecutable(bufnr(''))
82 AssertEqual 'sh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
84 Given(A file without a hashbang):
86 Execute(The bash dialect should be used for shellcheck if b:is_bash is 1):
89 AssertEqual 'bash', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
91 Execute(The sh dialect should be used for shellcheck if b:is_sh is 1):
94 AssertEqual 'sh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
96 Execute(The ksh dialect should be used for shellcheck if b:is_kornshell is 1):
97 let b:is_kornshell = 1
99 AssertEqual 'ksh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
101 Execute(The filetype should be used as the default shell type when there is no hashbang line):
103 AssertEqual 'zsh', ale#handlers#sh#GetShellType(bufnr(''))
106 AssertEqual 'tcsh', ale#handlers#sh#GetShellType(bufnr(''))
109 AssertEqual '', ale#handlers#sh#GetShellType(bufnr(''))
111 Given(A file with /bin/ash):
114 Execute(The ash dialect should be used for the shell and the base function):
115 AssertEqual 'ash', ale#handlers#sh#GetShellType(bufnr(''))
116 AssertEqual 'ash', ale_linters#sh#shell#GetExecutable(bufnr(''))
118 Execute(dash should be used for shellcheck, which has no ash dialect):
119 AssertEqual 'dash', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
121 Given(A file with /bin/dash):
124 Execute(The dash dialect should be used for the shell and the base function):
125 AssertEqual 'dash', ale#handlers#sh#GetShellType(bufnr(''))
126 AssertEqual 'dash', ale_linters#sh#shell#GetExecutable(bufnr(''))
128 Execute(dash should be used for shellcheck):
129 AssertEqual 'dash', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
131 Given(A file with a Bash shellcheck shell directive):
132 # shellcheck shell=bash
134 Execute(bash dialect should be detected appropriately):
135 AssertEqual 'bash', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
137 Given(A file with a sh shellcheck shell directive):
140 Execute(sh dialect should be detected appropriately):
141 AssertEqual 'sh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
143 Given(A file with a tcsh shellcheck shell directive):
144 # shellcheck shell=tcsh
146 Execute(tcsh dialect should be detected appropriately):
147 AssertEqual 'tcsh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
149 Given(A file with a zsh shellcheck shell directive):
150 # shellcheck shell=zsh
152 Execute(zsh dialect should be detected appropriately):
153 AssertEqual 'zsh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
155 Given(A file with a csh shellcheck shell directive):
156 # shellcheck shell=csh
158 Execute(zsh dialect should be detected appropriately):
159 AssertEqual 'csh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
161 Given(A file with a ksh shellcheck shell directive):
162 # shellcheck shell=ksh
164 Execute(ksh dialect should be detected appropriately):
165 AssertEqual 'ksh', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
167 Given(A file with a dash shellcheck shell directive):
168 # shellcheck shell=dash
170 Execute(dash dialect should be detected appropriately):
171 AssertEqual 'dash', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))
173 Given(A file with a ash shellcheck shell directive):
174 # shellcheck shell=ash
176 Execute(dash dialect should be detected for ash that shellcheck does not support):
177 AssertEqual 'dash', ale#handlers#shellcheck#GetDialectArgument(bufnr(''))