Skip to content

fix: Follow Bash best practices in entrypoint #30

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

Merged
merged 4 commits into from
May 11, 2022

Conversation

Kurt-von-Laven
Copy link
Contributor

@Kurt-von-Laven Kurt-von-Laven commented May 7, 2022

Draw inspiration from Shellcheck.

  • Simplify command-line construction by building up arrays rather than passing empty strings via unquoted variables (c.f., SC2206).
  • Prefer [[ ]] to [ ] to prevent globbing and word splitting in tests.
  • Quote Bash variables elsewhere to prevent globbing and word splitting (c.f., SC2086).
  • Reorder code to start with set directive, fail fast, and colocate related sections.
  • Use consistent style recommended by shfmt for if/then/else blocks.
  • Use UPPER_CASE consistently for variable names.
  • Use single quotes consistently for string literals.
  • Use curly braces to delimit variables from surrounding string literals but not in isolation.

Fixes #28.

@Kurt-von-Laven Kurt-von-Laven changed the title fix(entrypoint): Follow Bash best practices fix: Follow Bash best practices in entrypoint May 7, 2022
@Kurt-von-Laven Kurt-von-Laven force-pushed the quote-variables branch 2 times, most recently from 08bc49a to b4d99c2 Compare May 10, 2022 18:52
- Simplify command-line construction by building up arrays rather than
  passing empty strings via unquoted variables.
- Prefer [[ ]] to [ ] to prevent globbing and word splitting in tests.
- Quote Bash variables elsewhere to prevent globbing and word splitting.
- Reorder code to start with set directive, fail fast, and colocate
  related sections.
- Use consistent style recommended by shfmt for if/then/else blocks.
- Use UPPER_CASE consistently for variable names.
- Use single quotes consistently for string literals.
- Use curly braces to delimit variables from surrounding string literals
  but not in isolation.
@woile woile merged commit 5d5be47 into commitizen-tools:master May 11, 2022
@woile
Copy link
Member

woile commented May 11, 2022

@Kurt-von-Laven Kurt-von-Laven deleted the quote-variables branch May 11, 2022 08:42
@Kurt-von-Laven
Copy link
Contributor Author

Yikes; thanks for the heads up. I've opened #35 to address this matter.

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.

Quote Bash Variables
2 participants