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

Because of SC1124 I can't ignore SC2016 #3120

Open
4 tasks done
SamuelMarks opened this issue Jan 12, 2025 · 1 comment
Open
4 tasks done

Because of SC1124 I can't ignore SC2016 #3120

SamuelMarks opened this issue Jan 12, 2025 · 1 comment

Comments

@SamuelMarks
Copy link

SamuelMarks commented Jan 12, 2025

For bugs

For new checks and feature suggestions

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

#!/bin/sh

dollar_par_count=0
case "${1}" in
  '$(')
  # shellcheck disable=SC2003
  dollar_par_count="$(expr "${dollar_par_count}" + 1)" ;;
esac
printf 'dollar_par_count = %d\n' "${dollar_par_count}"

Here's what shellcheck currently says:

Expressions don't expand in single quotes, use double quotes for that.

Here's what I wanted or expected to see:

Some way of disabling this warning. I'm writing a simple shell parser; following https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html to ensure it's complete… but I also want to use shellcheck.

@brother
Copy link
Collaborator

brother commented Jan 13, 2025

And you do not want to have the directive for the complete case for various reasons. If someone want to support directives per case branch....

(adding the disable before the case works fine for silencing the error in the example)

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

2 participants