-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
When using --include=SC2250 (or other optional checks), ShellCheck silently produces no output instead of warning the user that the check needs to be enabled first with --enable.
This creates a confusing user experience where the --include flag appears to not work, when in reality it requires an undocumented additional flag to function.
This is particularly problematic when users are trying to enforce specific coding standards, as they may incorrectly assume their checks are being applied when they are actually being silently ignored.
- The rule's wiki page does not already cover this
- I have cloned the repo and installed with cabal and this is still a problem.
Here's a snippet or screenshot that shows the problem:
#!/bin/bash
set -- "-$ASCII_CONVERSION" "$@"Here's what shellcheck currently says with just --include:
$ shellcheck --include=SC2250 test.sh
# No outputHere's what shellcheck says with both flags:
$ shellcheck --enable=all --include=SC2250 test.sh
In test.sh line 2:
set -- "-$ASCII_CONVERSION" "$@"
^---------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required.Here's what I wanted or expected to see:
The --include flag should either:
- Work independently for all check codes, including optional ones, OR
- Provide a clear error message when trying to include an optional check without enabling it
The current behavior is confusing because:
- The manual doesn't clearly state that
--includewon't work for optional checks without--enable - There's no warning or error when trying to include an optional check without enabling it
- Using
--includealone silently fails instead of indicating that the check needs to be enabled first
This makes debugging and configuring ShellCheck more difficult than necessary, especially for users who are trying to enforce specific coding standards.
Additional Context:
The manual does document both flags separately but doesn't explicitly state their interdependency:
--includeis described as explicitly including specified codes--enableis described as enabling optional checks- There's no mention that
--includewon't work for optional checks without--enable
A user would reasonably expect that --include=SC2250 would either:
- Include and enable the check
- Or produce an error message explaining why no warnings are generated
Instead, it silently produces no output, leading to confusion about whether the check is working at all.