-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Should SC2312 warn on testing pipelines? #3025
Comments
In fact, this fires on any usage of a pipeline: #!/bin/bash
# shellcheck enable=all
echo "hello world" | grep hello | grep world I wouldn't consider the "corrected" script to be idiomatic bash, especially considering f() { echo "hello world" | grep hello | grep world; } where the user has left the return code to implicitly be that of the final command, which might be surprising -- perhaps warn to |
For bugs
shellcheck --version
or "online"): 0.10.0 and onlineFor new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
Here's what I wanted or expected to see:
Either nothing (after all, the fact that I'm testing the result of the pipeline indicates I am capturing the return value, albeit only of the last command), or a tailored warning indicating that the test as written will make me blind to which command failed.
Judging by the wiki page, the intent of the warning is more to flag that command substitutions can fail and leave null strings in their place. If this is the intent, then the wording of the warning doesn't communicate it efectively.
The text was updated successfully, but these errors were encountered: