shellcheck icon indicating copy to clipboard operation
shellcheck copied to clipboard

Disable all shellcheck messages for part of file

Open ghost opened this issue 4 years ago • 2 comments

I like to use shellcheck to check my bashrc. However, over half of the code in there is auto-generated by the system and there are a lot of warnings. Is there a way to disable all shellcheck messages for the auto-generated part of the file and then re-enable all of them for the part I want? Perhaps something like this:

#!/bin/bash

# shellcheck disable *
# auto-generated stuff ...

# shellcheck enable *
# my configuration ...

ghost avatar Apr 02 '21 00:04 ghost

Isn't the following (with a shellcheck version >= 0.7.2):

# shellcheck disable=SC1000-SC9999

..from https://github.com/koalaman/shellcheck/issues/2252#issuecomment-886981920 a usable workaround for the missing shellcheck disable *?

For re-enabling you'd have to be painfully explicit if you do not want some of the rules though... :disappointed:

guillaume-d avatar Jan 13 '22 22:01 guillaume-d

https://github.com/koalaman/shellcheck/wiki/Directive#disable disable only silence the error, but parsing still stops at the same point, so no way to enable back the parsing afterward, it has stopped.

prahal avatar Oct 26 '25 02:10 prahal