Open ale5000-git opened 1 year ago
We also hit this false positive in https://github.com/ohmybash/oh-my-bash/pull/402#discussion_r1111634730. The pattern if <some test command>; then return xxx 2>/dev/null || exit xxx; fi
is an idiom for the scripts that can be used for both executables and source scripts. Because of this false positive information, users would try to remove || exit xxx
in PRs, which would break the script. This is harmful. Could anyone support the detection of this case and suppress the information?
For bugs
shellcheck --version
or "online"): onlineFor new checks and feature suggestions
Here's a snippet or screenshot that shows the problem:
Here's what shellcheck currently says:
SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly).
Here's what I wanted or expected to see:
No message, since I want to support both being executed and being sourced.
return
will apply when sourced whileexit
will apply when executed.