Skip to content

Use shellcheck #10

@danielhoherd

Description

@danielhoherd

Shellcheck (https://www.shellcheck.net) exists to find syntax errors in shell code, including bash and posix sh. It finds about 190 syntax problems within this repo, including 4 errors and 62 warnings. I would recommend using the a pre-commit shellcheck hook (https://github.com/koalaman/shellcheck-precommit), or run shellcheck as a CI action (https://github.com/marketplace/actions/shellcheck), in order to avoid giving users confidence that the scripts here will behave a certain way, but then fail because of some syntax nuance or outright syntax error. It looks like shellcheck has been used in this heavily before because there are over 3k instances of shellcheck in the code, but is not being enforced everywhere.

For instance, https://github.com/HariSekhon/DevOps-Bash-tools/blob/262f684d1e/gcp/gcp_service_accounts_credential_keys_expired.sh#L1 has existed in the repo for 3 years, but is almost certainly a human introduced typo which is an obvious syntax error, and really easy to fix once spotted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions