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

dts-subscription.sh: shellcheck fixes #51

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

m-iwanicki
Copy link
Contributor

@m-iwanicki m-iwanicki commented Dec 5, 2024

Fixed most info warnings from shellcheck inside dts-subscription.sh script. As we are only using warning and error in our pre-commit a lot of fairly basic problems might go unchecked.
As we are using [ ] instead of [[ ]] at least in most places then we should always double quote variables if we don't want empty variables to error out e.g. as in: Dasharo/dasharo-issues#1156 (comment)
Left couple [ $? -eq ...] as is:

$ shellcheck include/dts-subscription.sh

In include/dts-subscription.sh line 151:
  if [ $? -ne 0 ]; then
       ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?.


In include/dts-subscription.sh line 180:
  [ $? -ne 0 ] && return 1
    ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?.


In include/dts-subscription.sh line 201:
  if [ $? -ne 0 ]; then
       ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?.

For more information:
  https://www.shellcheck.net/wiki/SC2181 -- Check exit code directly with e.g...

@m-iwanicki m-iwanicki self-assigned this Dec 5, 2024
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

Successfully merging this pull request may close these issues.

1 participant