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

Comments starting with shellcheck throw SC1072 and SC1073 when they are not related to disabling rules #3160

Open
nickjj opened this issue Mar 16, 2025 · 0 comments

Comments

@nickjj
Copy link

nickjj commented Mar 16, 2025

This is with v0.10.0. It also happens with v0.8.0 so it doesn't seem specific to the latest version.

While creating an install script for shellcheck which curls down the latest shellcheck release I had this code:

  # shellcheck uses a different file name than what uname -m may output.
  [[ "${cpu_arch}" =~ ^arm ]] && cpu_arch="armv6hf"

I don't know if this strategy will work since I don't have a Linux arm64 device to test on but let's ignore that component for now.

This throws an error on the comment:

In install line 89:
  # shellcheck uses a different file name than what uname -m will output.
  ^-- SC1073 (error): Couldn't parse this shellcheck directive. Fix to allow more checks.
                   ^-- SC1072 (error): Expected '=' after directive key. Fix any mentioned problems and try again.

It took me a second to realize this is a problem because shellcheck uses comments to figure out if it should ignore something, but I wonder if something can be adjusted to try and determine if the comment line is related to setting a disable= and if not maybe it can be ignored?

The workaround is to reword the comment to start with ShellCheck which funny enough is a better choice anyways since it's referencing the name of the tool itself, not a directive but this feels like a "it's a feature not a bug but maybe it's actually a bug" type of thing?

What do you think?

Great tool btw, I've been using it for like 6 years and this is the first time it has surprised me.

@brother brother changed the title Comments starting with shellcheck throw SC0172 and SC0173 when they are not related to disabling rules Comments starting with shellcheck throw SC1072 and SC1073 when they are not related to disabling rules Mar 19, 2025
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