You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a snippet or screenshot that shows the problem:
#!/usr/bin/env bash# I don't want to check this one.# shellcheck check-sourced=falsesource messy.sh
# I would like to have this checked.# shellcheck check-sourced=truesource clean.sh
# The rest of the script goes hereecho"Hello, world!"
Here's what shellcheck currently says:
ShellCheck currently doesn't provide such directive.
In temp.sh line 4:
# shellcheck check-sourced=false
^-- SC1107 (warning): This directive is unknown. It will be ignored
In temp.sh line 8:
# shellcheck check-sourced=true
^-- SC1107 (warning): This directive is unknown. It will be ignored
Here's what I wanted or expected to see:
ShellCheck includes warning from clean.sh but not from messy.sh.
Motivation:
Developers sometimes want to include warnings from some sourced files but not from others. This is especially valid if messy.sh cannot be changed from the project scope.
This feature provide a workaround for Support for pre-declared "external" globals for sourced scripts to avoid SC2154 warnings. #356, by allowing developers to define a meta-script that sources the pre-sourced files before sourcing the target script to check. The directive proposed here helps exclude warnings from pre-sourced files, while include warnings from the target script.
The text was updated successfully, but these errors were encountered:
Per-source check-sourced would still be helpful when refactoring a codebase filled with un-lint scripts or excluding the warnings from an external shell library.
For bugs
shellcheck --version
or "online"):For new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
ShellCheck currently doesn't provide such directive.
Here's what I wanted or expected to see:
ShellCheck includes warning from
clean.sh
but not frommessy.sh
.Motivation:
messy.sh
cannot be changed from the project scope.source
s the pre-sourced files before sourcing the target script to check. The directive proposed here helps exclude warnings from pre-sourced files, while include warnings from the target script.The text was updated successfully, but these errors were encountered: