[ADD][VIM] Shellcheck options for ALE

I want shellcheck to detect which shell is most appropriate on the `sh`
filetype, but explicitly use the `bash` dialect on `bash` and `zsh`
filetypes.

I also really don't like nullary conditions in shell, so I'll screen for
those too.

I might turn on the 'quote-safe-variables' check too, because I think
quoting variables is a good habit to take.
This commit is contained in:
Bruno BELANYI 2019-10-10 16:57:08 +02:00
parent f747005981
commit 4753e32c30
3 changed files with 18 additions and 0 deletions

View file

@ -1,2 +1,8 @@
" Use shfmt as ALE fixer for bash " Use shfmt as ALE fixer for bash
let b:ale_fixers=[ 'shfmt' ] let b:ale_fixers=[ 'shfmt' ]
" Indent with 4 spaces, simplify script, indent switch cases, use Bash variant
let b:ale_sh_shfmt_options='-i 4 -s -ci -ln bash'
" Use bash dialect explicitly, require explicit empty string test
let b:ale_sh_shellcheck_options='-s bash -o avoid-nullary-conditions'

View file

@ -1,2 +1,8 @@
" Use shfmt as ALE fixer for sh " Use shfmt as ALE fixer for sh
let b:ale_fixers=[ 'shfmt' ] let b:ale_fixers=[ 'shfmt' ]
" Indent with 4 spaces, simplify the code, indent switch cases, use POSIX
let b:ale_sh_shfmt_options='-i 4 -s -ci -ln posix'
" Require explicit empty string test
let b:ale_sh_shellcheck_options='-o avoid-nullary-conditions'

View file

@ -1,2 +1,8 @@
" Use shfmt as ALE fixer for zsh " Use shfmt as ALE fixer for zsh
let b:ale_fixers=[ 'shfmt' ] let b:ale_fixers=[ 'shfmt' ]
" Indent with 4 spaces, simplify script, indent switch cases, use Bash variant
let b:ale_sh_shfmt_options='-i 4 -s -ci -ln bash'
" Use bash dialect explicitly, require explicit empty string test
let b:ale_sh_shellcheck_options='-s bash -o avoid-nullary-conditions'