-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Lint: prepare lib/utilities
for shellcheck
#1933
Conversation
8cf2192
to
c2d0a0c
Compare
545932f
to
fa017bf
Compare
e61622e
to
a891206
Compare
lib/utilities
for shellcheck
lib/utilities
for shellcheck
a891206
to
629ab96
Compare
@cornfeedhobo another PR if you're looking for something to read 😆 |
3f40cb4
to
9bb19f7
Compare
I like this, this requires a rebase, but looks great overall. You can also add some tests to |
9bb19f7
to
df1b8e1
Compare
Rebased to current master and all tests pass, including |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @gaelicWizard!
Looking forward for a bats PR 😄
bc700d4
to
3adb998
Compare
SC2059
Account for plugins with names that contain periods.
Use fewer subprocesses and newline-delimited not space-delimited.
Use fewer subprocesses and return newline-delimited, not space-delimited.
Use `sort -u` instead of `sort | uniq`
Use fewer subprocesses, return newline-delimited instead of space-delimited, and use `sort -u` instead of `uniq | sort`
Use fewer subprocesses, return newline-delimited instead of space-delimited, and use `sort -u` instead of `uniq | sort`
1. Executing `'/usr/bin/grep'` does *not* return the path to grep... 2. use `type -p` instead of external binary `which`. 3. Simplify parameter definition. 4. Why was there a space after `%s`?
Alsö, lose a spurious `cat`
My apologies to future `git blame` hunters ♥
Use `${BASH_IT_LOAD_PRIORITY_SEPARATOR}`
3adb998
to
1f2d3f4
Compare
# filename without path | ||
filename="${1##*/}" | ||
# filename without path or priority | ||
filename="${filename##*${BASH_IT_LOAD_PRIORITY_SEPARATOR?}}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this generates SC2295 warning, somehow this slipped here @gaelicWizard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go figure! I've got a few tiny changes to utilities pending, so I'll throw that in there.
* master: (113 commits) skip go tests when go is not available plugins: Add ble.sh plugin clean up pyenv plugin Lint: prepare `lib/utilities` for `shellcheck` (Bash-it#1933) plugin/base: improvements (Bash-it#1930) plugins/percol: `bind` completion/git: `shfmt` && `shellcheck` completion/git: expand search range plugin/percol: `shellcheck` & `shfmt` plugins/percol: use `_command_exists` completion/pip: simplify code flow plugin/less-pretty-cat: remove `|| cat` completion/wpscan: simplify code flow (whitespace) plugins/less-pretty-cat: simplify code flow plugins/less-pretty-cat: use `_command_exists` lib/helpers: cite `_bash-it-find-in-ancestor()` gradle: adopt `_bash_it_find_in_ancestor()` lib/helpers: new function `_bash-it-find-in-ancestor()` completion/laravel: simplify code flow plugin/ruby: add missing parameter error message ...
* master: (113 commits) skip go tests when go is not available plugins: Add ble.sh plugin clean up pyenv plugin Lint: prepare `lib/utilities` for `shellcheck` (Bash-it#1933) plugin/base: improvements (Bash-it#1930) plugins/percol: `bind` completion/git: `shfmt` && `shellcheck` completion/git: expand search range plugin/percol: `shellcheck` & `shfmt` plugins/percol: use `_command_exists` completion/pip: simplify code flow plugin/less-pretty-cat: remove `|| cat` completion/wpscan: simplify code flow (whitespace) plugins/less-pretty-cat: simplify code flow plugins/less-pretty-cat: use `_command_exists` lib/helpers: cite `_bash-it-find-in-ancestor()` gradle: adopt `_bash_it_find_in_ancestor()` lib/helpers: new function `_bash-it-find-in-ancestor()` completion/laravel: simplify code flow plugin/ruby: add missing parameter error message ...
…autosave-history-plml * 'master' of https://github.com/bash-it/bash-it: (114 commits) ci: Bump go to 1.17 from 1.14 skip go tests when go is not available plugins: Add ble.sh plugin clean up pyenv plugin Lint: prepare `lib/utilities` for `shellcheck` (Bash-it#1933) plugin/base: improvements (Bash-it#1930) plugins/percol: `bind` completion/git: `shfmt` && `shellcheck` completion/git: expand search range plugin/percol: `shellcheck` & `shfmt` plugins/percol: use `_command_exists` completion/pip: simplify code flow plugin/less-pretty-cat: remove `|| cat` completion/wpscan: simplify code flow (whitespace) plugins/less-pretty-cat: simplify code flow plugins/less-pretty-cat: use `_command_exists` lib/helpers: cite `_bash-it-find-in-ancestor()` gradle: adopt `_bash_it_find_in_ancestor()` lib/helpers: new function `_bash-it-find-in-ancestor()` completion/laravel: simplify code flow ...
* lib/utilities: shellcheck SC2059 * lib/utilities: fix `_bash-it-get-component-type-from-path()` Account for plugins with names that contain periods. * lib/utilities: fix `_bash-it-array-dedup()` Use fewer subprocesses and newline-delimited not space-delimited. * lib/utilities: fix `_bash-it-component-list()` Use fewer subprocesses and return newline-delimited, not space-delimited. * lib/utilities: fix `_bash-it-component-list-matching()` Use `sort -u` instead of `sort | uniq` * lib/utilities: fix `_bash-it-component-list-enabled()` Use fewer subprocesses, return newline-delimited instead of space-delimited, and use `sort -u` instead of `uniq | sort` * lib/utilities: fix `_bash-it-component-list-disabled()` Use fewer subprocesses, return newline-delimited instead of space-delimited, and use `sort -u` instead of `uniq | sort` * lib/utilities: fix `_bash-it-grep()` 1. Executing `'/usr/bin/grep'` does *not* return the path to grep... 2. use `type -p` instead of external binary `which`. 3. Simplify parameter definition. 4. Why was there a space after `%s`? * lib/utilities: use `_bash-it-grep` Alsö, lose a spurious `cat` * lib/utilities: lint `_bash-it-component-help` * lib/utilities: lint `_bash-it-component-cache-file()` * lib/utilities: `shfmt` My apologies to future `git blame` hunters ♥ * lib/helpers: fix `_bash-it-get-component-name-from-path()` Use `${BASH_IT_LOAD_PRIORITY_SEPARATOR}`
Description
This is a partial PR covering only the
lib/utilities
portion of #1917 in support of #1696.Motivation and Context
My
shellcheck
branch (#1917) got a bit large, so I'm splitting it up. Each change is split out in to its own commit, so it should be easy to review that way. There are no intended behavior changes whatsoever; this is almost entirely quoting things, plus a few improvements to functions.How Has This Been Tested?
The full test suite and
shellcheck
have run on #1917 and this is part of my main branch.Types of changes
Checklist:
clean_files.txt
and formatted it usinglint_clean_files.sh
.