Skip to content
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

Feature request: shellcheck -O --override-ignores #1417

Open
TinCanTech opened this issue Dec 15, 2018 · 8 comments
Open

Feature request: shellcheck -O --override-ignores #1417

TinCanTech opened this issue Dec 15, 2018 · 8 comments

Comments

@TinCanTech
Copy link

Over ride all embedded ignores.

Obviously, this can be done by other methods but an option seems appropriate.
(The name -O --override-ignores is only an example)

@TinCanTech
Copy link
Author

TinCanTech commented Jan 9, 2019

This idea does not appear to be gaining traction so I shall elaborate.
In reverse order:

  • Scissors: Inserting # shellcheck foo directly into the source code.
    #shellcheck disable=2086
    #shellcheck disable=1090
    #shellcheck source=foo/bar
  • Paper: Defining command line directives.
    $ shellcheck --exclude SC2086, sometimes it helps ..
    #shellcheck source=foo/bar, can not be defined here.
  • Rock: (Currently absent) Ignoring Scissors.
    Allowing for full Scissor integration and true baseline checks.

Now a script can be fully checked with and without inlines
and the source remains unchanged.

"How does shellcheck react to my script .. ? =uncensored="

@TinCanTech
Copy link
Author

This will also allow running in a CI environment with a guaranteed baseline.
(eg. No over-looked ignores)

@scovetta
Copy link

I like this feature because, at least to me, ShellCheck (and most other static analysis / linters) serve two audiences:

  • the author, who uses it to write more solid code,
  • the user, who can see how solid the code they receive is.

Without an "ignore all ignores", you only really get a guarantee on the first.

@gromgit
Copy link

gromgit commented Jan 15, 2020

Without an "ignore all ignores", you only really get a guarantee on the first.

I'd argue that even the first isn't guaranteed, because it's certainly possible for authors to change their code into a b0rken state that deserve the same warnings, but are now silenced by stale disables.

Obsolete directive comments ("Oi Shellcheck, shaddap already!") are more dangerous than obsolete descriptive comments ("I'm doing this in an unconventional way because XYZ").

TinCanTech added a commit to TinCanTech/easy-tls that referenced this issue Mar 17, 2020
Signed-off-by: Richard Bonhomme <tincanteksup@gmail.com>
@TinCanTech
Copy link
Author

I have waited long enough !

To my mind, this seems to be a "no brainer"

I can see no logical (or otherwise) argument against it.

@TinCanTech
Copy link
Author

I was hoping -o might achieve this but alas, it does not.

Suggestion:

  • -o 2154,always
  • -o all,always

etc.

@koalaman
Copy link
Owner

I'm on board, the backlog is just huge

@koalaman koalaman reopened this Nov 15, 2021
@TinCanTech
Copy link
Author

I may be wrong but I believe this FR has been fulfilled and probably exceeded!

I use export SHELLCHECK_OPTS="--shell=sh -x -o all and it appears to include every shellcheck objection that I wanted to see and some more besides.

I suppose that -o all does not necessarily equate to -o default (Ignore inline # shellcheck directives). However, the difference to that original spec. is expanding the check. If/when I want every shellcheck objection then that is the correct verbosity level, IMO. Tell me every thing.

Also, I think that coding a -o default level is unnecessary, unless it's easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants