shellcheck only enable single rule

64 Views Asked by At

shellcheck currently yields a lot of errors when analyzing one of my scripts. To get an overview I'd like to go through each error one by one. Is there a way I can disable all rules but one when using shellcheck?

1

There are 1 best solutions below

0
that other guy On

Yes, you can do this with -i/--include:

$ shellcheck --help
Usage: shellcheck [OPTIONS...] FILES...
  -i CODE1,CODE2..    --include=CODE1,CODE2..    Consider only given types of warnings

For example, to only show "SC2154: variable is referenced but not assigned":

shellcheck --include SC2154 myscript