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

Various style fixes in mason.sh #489

Merged
merged 5 commits into from
Feb 7, 2018
Merged

Various style fixes in mason.sh #489

merged 5 commits into from
Feb 7, 2018

Conversation

WesleyAC
Copy link
Contributor

I noticed a few style sort of issues in mason.sh, and fixed a few of them:

  • Change backtick substitution to $(...)
  • Add doublequotes around some variables to prevent globbing + splitting
  • Add -r flag to read
  • Change a use of -a for boolean and to &&, since it's easier to reason about

It might make sense to run some sort of linting tool as part of your test suite to catch things like this. There are many different scripts available to do this, and I've definitely caught real bugs when using them in the past.

I don't have the test suite fully working on my computer (even on master), but all of these changes are fairly safe and I think Travis should build it when I submit this PR.

WesleyAC and others added 5 commits October 20, 2017 03:35
This replaces all instances of backtick substitution with $() substitution,
since it has less surprises and undefined behaviour.
Using && for boolean and is preferred over -a for portable shell scripts
because the -a syntax can be ambiguous, while the && syntax is not.
This is to prevent read from mangling backslashes
@springmeyer
Copy link
Contributor

Thank you for this PR @WesleyAC - looks great, and I'm grateful for the fixes. Just rebased and will merge once green. And yes, we should definitely run the code through something like https://www.shellcheck.net. I've ticketed that idea at #549

@springmeyer springmeyer merged commit 8764af8 into mapbox:master Feb 7, 2018
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.

2 participants