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: continue parsing ignoring hard errors inside ((..)) or add a "don't parse" mark #3105

Open
4 tasks done
Kamilcuk opened this issue Dec 22, 2024 · 0 comments

Comments

@Kamilcuk
Copy link
Contributor

For bugs

  • Rule Id (if any, e.g. SC1000): SC1070, SC1073
  • My shellcheck version (shellcheck --version or "online"): online, 0.10.0
  • The rule's wiki page does not already cover this (e.g. https://shellcheck.net/wiki/SC2086)
  • I tried on https://www.shellcheck.net/ and verified that this is still a problem on the latest commit

For new checks and feature suggestions

Here's a snippet or screenshot that shows the problem:

There are some expressions that give shellcheck parsing errors, like:

Here's what shellcheck currently says:

In - line 2377:
                for (( i = 0, max = ${#a[@]} > ${#b[@]} ? ${#a[@]} : ${#b[@]}, max > ${4:-3} ? max = ${4:-3} : 0; i < max; ++i )); do
                ^-- SC1009 (info): The mentioned syntax error was in this for loop.
                    ^-- SC1073 (error): Couldn't parse this arithmetic for condition. Fix to allow more checks.
                                                                                                   ^-- SC1072 (error):  Fix any mentioned problems and try again.

Here's what I wanted or expected to see:

SC1070 and SC1073 are completely great, fine and understandable. The issue is it is impossible to ignore them. Either we ignore them, in which case the rest of the file is not analyzed at all, or we have a hard error forever.

It would be great if:

  • there would be something like #shellcheck parser=off #shellcheck parser=on with which I would be able to disable the shellcheck parser for problematic code.
    • which I am currently doing that with sed '/#shellcheck parser=off/,/#shellcheck parser=on/s/.*/:/'
  • or ignoring SC1070 or SC1073 would disable the parser for one expression. In this case, I would want shellcheck to just ignore everything between (( and )).

Thank you, shellcheck is amazing, great project, I'm using it daily.

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

1 participant