How can I force ALE to treat zsh files as Bourne shell for the purposes of linting #5145
-
|
Hi! I would like for Vim ALE to treat zsh scripts as bash or sh for the purposes of linting, but I have not figured out how to do that yet. I have two two kinds of zsh scripts, those that end in But when I test it by unquoting a variable, it does not do anything. Is what I want possible? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
The clue in your Enabled Linters: ['shell']That is not ShellCheck. It means ALE is using the let g:ale_linters = {
\ 'zsh': ['shellcheck'],
\}
let g:ale_sh_shellcheck_dialect = 'bash'Use If this is only for one buffer/filetype override, this also works: let b:ale_linter_aliases = 'sh'
let b:ale_linters = ['shellcheck']
let b:ale_sh_shellcheck_dialect = 'bash'Then run One caveat: this deliberately asks ShellCheck to parse your zsh files as bash/POSIX shell. That is fine for the style of checks you described, but zsh-specific syntax can produce false positives. |
Beta Was this translation helpful? Give feedback.
zshis already aliased toshby ALE's default linter aliases, so the alias is probably not the missing part here.The clue in your
:ALEInfois this line:That is not ShellCheck. It means ALE is using the
shelllinter path, so diagnostics such as unquoted variables will usually not appear. Enable ShellCheck explicitly and force the dialect you want:Use
'sh'instead of'bash'if you want POSIXshrules.If this is only for one buffer/filetype override, this also works: