Open lamyergeier opened 2 years ago
I would like this functionality as well - especially for integration with editors/IDEs (Visual Studio Code/VSCode is my current preference). It automatically runs shellcheck on all my shell files - which is usually what I want - but I have, in my current project, a couple of specific .sh files which I intentionally want to be "bad formatted/poor quality".
Yes, I could add # shellcheck disable=all
at the start of the file(s), as per #1996's comment but it would be easier to either have a .shellcheckignore
in the style of .gitignore
/.dockerignore
or to allow .shellcheckrc
to have a list of files/directories to ignore.
(currently shellcheck 0.8.0)
Would love to see this
me too
Ditto. Would increase adoption (easing configuration of CI in the tool/external to the collateral) in older repositories.
me too
Greetings!
In case of Visual Studio Code ("VSCode"; as of version 1.83.1
, 2023-10-10
) and Shellcheck extension, it's possible to configure the extension to ignore specific locations due to the approach the extension is implemented, i.e. exposed class constructor parameter ignorePatterns
.
From the extension documentation (as of version 0.34.0
, 2023-08-27
):
The
shellcheck.ignorePatterns
works exactly the same assearch.exclude
, read more about glob patterns hereFor example:
{ "shellcheck.ignorePatterns": { "**/*.zsh": true, "**/*.zsh*": true, "**/.git/*.sh": true, "**/folder/**/*.sh": true } }
To add additional ignore patterns atop the default patterns, you have to copy the default ignore patterns and then add yours to the end of the list (#1196).
Just in case, the above JSON excerpt may be also stated in VSCode User and Workspace Settings.
Please keep it safe and stay sublime!
Best and kind regards ✨
- "Shellcheck VSCode extension": '.../src/utils/filematcher.ts'#L2; - "JSHint": '.../jshint-server/src/server.ts'#L258; - "JSHint" GitHub repository; - #2849.
Hello
Just to mention such feature would be nice i.e. being able to start shellcheck in the console (not from within VSCode) with the possibility to exclude folders like with --exclude "folder1,folder2,folder3"
.
Here and there I see workarounds like using find xxxx | grep xxx | xargs xxx
but these are slow and didn't return the correct exit code. Indeed if a shell script contains errors, I would like the get an exitCode different than 0 but, with find
I get, I suppose, the exitCode of the last scanned file and this is perhaps 0
even when shellcheck has detected a lot of warnings before.
I have a slightly different use case:
the project generates a shell completion script by combining a static file completions/something.bash
, completions/something.fish
, …, and a second part dynamically generated from Python argparse
config. The static script looks like a shell script, it even has the header with a license comment and she-bang, but does not define all variables. I'd like to configure shellcheck to ignore this partial script. I do not want to silence the warnings in the file, because then they'd also be silenced in the combined script.
Hi,
I have a .env
file that I want to ignore (because its not a script in the first place).
I have githooks using shellcheck.
When I encrypt my .env
with sops, the comment get encrypted and shellcheck is triggered and I have no way to ignore it.
Anyone has an idea why this issue is not addressed? I cannot find any good reason not to add a .shellcheckignore
or something similar.
I'm willing to contribute if someone have the time to give me direction.
For bugs
shellcheck --version
or "online"): 0.8.0For new checks and feature suggestions
[x] https://www.shellcheck.net/ (i.e. the latest commit) currently gives no useful warnings about this
[x] I searched through https://github.com/koalaman/shellcheck/issues and didn't find anything related
New directive to ignore file · Issue #1996 · koalaman/shellcheck, can be used to ignore files by modifying them i.e. by adding
# shellcheck disable=all
. But, I want to ignore certain files without modifying them.Motivation: I don't want to touch files created by others.
How can I ignore a list of files? Is it posible to include that list in
.shellcheckrc
?