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

Linting with shellcheck #32

Merged
merged 7 commits into from
Apr 23, 2019
Merged

Linting with shellcheck #32

merged 7 commits into from
Apr 23, 2019

Conversation

virgilwashere
Copy link
Contributor

@virgilwashere virgilwashere commented Apr 7, 2019

What's in this PR?

  • Linting with shellcheck
  • Update Unicode PASS/FAIL output
  • Repo scaffolding - shellscript filetype

Linting with shellcheck

  • [SC2196] Use grep -E. egrep is non-standard and deprecated.
  • [SC2086] Double quoting and curly braces
  • [SC2059] printf syntax
  • [SC2002] Useless cat

Update Unicode PASS/FAIL output

  • NEW variables for 'checkmark' and 'fancy x' and tput colours
    • eg: checkmark = \342\234\223 (or $'\u2713')
    • eg: PASS=${txtbold}${txtgreen}${checkmark}${txtreset}
    • update printf statements to use %b for unicode variables.
  • Using readonly variables for
    • $BINARY_NAME and $VERSION
    • $PASS and $FAIL
  • refactor .hasrc file reading
    • [SC2002] Useless cat
  • Add new BATS tests for Unicode output
    • Add same unicode variables from has binary to .hastest.bats

Repo scaffolding - shellscript filetype

  • Add shellscripts to .editorconfig
  • Add shellscripts to .gitattributes

Double quote to prevent globbing and word splitting.
Don't use variables in the printf format string.
Use printf "..%s.." "$foo".

Update matching test to not assume whitespace is <space>
Consider 'cmd < file | ..' or 'cmd file | ..' instead.
- [x] NEW variables for 'checkmark' and 'fancy x' and tput colours
  - [x] eg: `checkmark` = `\342\234\223`
  - [x] eg: `PASS=${txtbold}${txtgreen}${checkmark}${txtreset}`
  - [x] update `printf` statements to use `%b` for unicode variables.
- [x] Using readonly variables for
  - [x] $BINARY_NAME and $VERSION
  - [x] $PASS and $FAIL
- [x] refactor `.hasrc` file reading
  - [x] [SC2002] Useless cat
- [x] Add new BATS tests for Unicode output
- [x] Add shellscripts to `.editorconfig`
- [x] Add shellscripts to `.gitattributes`
@virgilwashere
Copy link
Contributor Author

Looks like I get to play unicode output parsing with travis :)

I'll get back to you.

@kdabir kdabir merged commit f5981b9 into kdabir:master Apr 23, 2019
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