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

Add GitHub Actions with ShellCheck #951

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

asbjornu
Copy link

@asbjornu asbjornu commented Jul 8, 2021

This PR adds a GitHub Action workflow with bewuethr/shellcheck-action to execute ShellCheck against all shell scripts in the repository. A Dependabot config file to keep the GitHub Actions workflow up to date is also added and all the ShellCheck errors are fixed or ignored as appropriate.

Fix SC2197: fgrep is non-standard and deprecated. Use grep -F instead.

https://www.shellcheck.net/wiki/SC2197
Fix SC2164: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

https://www.shellcheck.net/wiki/SC2164
Fix SC2128: Expanding an array without an index only gives the first element.

https://www.shellcheck.net/wiki/SC2128
Ignore SC1090: ShellCheck can't follow non-constant source. Use a directive to specify location.

https://www.shellcheck.net/wiki/SC1090

See the following discussion for why SC1090 is disabled and not fixed:

koalaman/shellcheck#507
Fix SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.

https://www.shellcheck.net/wiki/SC2166
Fix SC2162: read without -r will mangle backslashes.

https://www.shellcheck.net/wiki/SC2162
Fix SC2091: Remove surrounding $() to avoid executing output (or use eval if intentional).

https://www.shellcheck.net/wiki/SC2091
Ignore SC2034: foo appears unused. Verify use (or export if used externally).

https://www.shellcheck.net/wiki/SC2034
Ignore SC2154: yellow is referenced but not assigned.

https://www.shellcheck.net/wiki/SC2154
Fix SC2155: Declare and assign separately to avoid masking return values.

https://www.shellcheck.net/wiki/SC2155
Fix SC1018: This is a unicode non-breaking space. Delete and retype it.

https://www.shellcheck.net/wiki/SC1018
Fix SC2124: Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.

https://www.shellcheck.net/wiki/SC2124
Fix SC2199: Arrays implicitly concatenate in [[ ]]. Use a loop (or explicit * instead of @).

https://www.shellcheck.net/wiki/SC2199
Fix SC2181: Check exit code directly with e.g. 'if mycmd;', not indirectly with $?.

https://www.shellcheck.net/wiki/SC2181
Fix SC2046: Quote this to prevent word splitting.

https://www.shellcheck.net/wiki/SC2046
Ignore SC2139: This expands when defined, not when used. Consider escaping.

https://www.shellcheck.net/wiki/SC2139
Fix SC2140: Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?

https://www.shellcheck.net/wiki/SC2140
Okeanos added a commit to Okeanos/dotfiles that referenced this pull request Nov 28, 2021
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

1 participant