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

shellcheck #1041

Merged
merged 28 commits into from
Mar 2, 2022
Merged

shellcheck #1041

merged 28 commits into from
Mar 2, 2022

Conversation

AndreasLMeg
Copy link
Collaborator

There are many functionally important bash files in the system.
Therefore, special attention should be paid to syntax and coding guidelines.
I'm not very familiar with the bash specifics, so it would be particularly important to me to check it with external tools (experts).

For this I found bash -h and shellcheck.

Shellcheck is very precise, so I excluded all existing warnings at the beginning.
Please check, there may be potential errors

(please use squash to merge the PR)

Copy link
Collaborator

@EricClaeys EricClaeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndreasLMeg variables.sh has "set -a" which automatically exports all variables.
ON_TTY is used by some scripts that "source variables.sh"

@AndreasLMeg
Copy link
Collaborator Author

@EricClaeys I am aware that some anomalies probably cannot be fixed either.

#SC2034: ON_TTY appears unused. Verify use (or export if used externally).
#SC2046: Quote this to prevent word splitting.
#SC2086: Double quote to prevent globbing and word splitting.
#SC1090: Can't follow non-constant source. Use a directive to specify location.

That's why I defined the exceptions.
It is important to me that a second tool checks the bash scripts to check for possible errors in future changes.
It's nice if the known exceptions (-e) also help to clean up existing anomalies when the opportunity arises.

#SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails
#SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
#SC2006: Use $(...) notation instead of legacy backticked `...`.
#SC2196: egrep is non-standard and deprecated. Use grep -E instead.

@EricClaeys EricClaeys self-requested a review March 2, 2022 07:18
Copy link
Collaborator

@EricClaeys EricClaeys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@EricClaeys EricClaeys merged commit a9ab316 into AllskyTeam:master Mar 2, 2022
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.

None yet

2 participants