Skip to content

Commit

Permalink
shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrodrigues committed Jul 5, 2020
1 parent 4290789 commit 8a07203
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ jobs:
brew install vale
vale docs/
- name: Run ShellCheck
run: |
brew install shellcheck
shellcheck --color bin/brew
ven='./Library/Homebrew/vendor/*'
taps='./Library/Taps/*'
find . -type f -iname "*\.sh" -not -path "$ven" -not -path "$taps" -exec shellcheck --color {} \;
- name: Lint Dockerfile
if: matrix.os == 'ubuntu-latest'
run: |
Expand Down
3 changes: 2 additions & 1 deletion Library/Homebrew/brew.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash
# Force UTF-8 to avoid encoding issues for users with broken locale settings.
if [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]]
then
export LC_ALL="en_US.UTF-8"
fi

# USER isn't always set so provide a fall back for `brew` and subprocesses.
export USER=${USER:-`id -un`}
export USER=${USER:-$(id -un)}

# Where we store built products; a Cellar in HOMEBREW_PREFIX (often /usr/local
# for bottles) unless there's already a Cellar in HOMEBREW_REPOSITORY.
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/cmd/shellenv.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
#: * `shellenv`
#:
#: Print export statements. When run in a shell, this installation of Homebrew will be added to your `PATH`, `MANPATH`, and `INFOPATH`.
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/cmd/update-reset.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
#: * `update-reset` [<repository>]
#:
#: Fetch and reset Homebrew and all tap repositories (or any specified <repository>) using `git`(1) to their latest `origin/master`.
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/cmd/update.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
#: * `update`, `up` [<options>]
#:
#: Fetch the newest version of Homebrew and all formulae from GitHub using `git`(1) and perform any necessary migrations.
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/cmd/vendor-install.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
#: @hide_from_man_page
#: * `vendor-install` [<target>]
#:
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/utils/analytics.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
# Migrate analytics UUID to its new home in Homebrew repo's git config and
# remove the legacy UUID file if detected.
migrate-legacy-uuid-file() {
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/utils/lock.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
# create a lock using `flock(2)`. A name is required as first argument.
# the lock will be automatically unlocked when the shell process quits.
# Noted due to the fixed FD, a shell process can only create one lock.
Expand Down
3 changes: 2 additions & 1 deletion Library/Homebrew/utils/ruby.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
test_ruby () {
if [[ ! -x $1 ]]
then
Expand Down Expand Up @@ -44,7 +45,7 @@ If there's no Homebrew Portable Ruby available for your processor:
then
HOMEBREW_RUBY_PATH="$vendor_ruby_path"
[[ -z "$HOMEBREW_MACOS" ]] && TERMINFO_DIRS="$vendor_ruby_terminfo"
if [[ $vendor_ruby_current_version != $vendor_ruby_latest_version ]]
if [[ $vendor_ruby_current_version != "$vendor_ruby_latest_version" ]]
then
if ! brew vendor-install ruby
then
Expand Down
4 changes: 2 additions & 2 deletions bin/brew
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ symlink_target_directory() {
builtin enable compgen unset
for cmd in $(builtin compgen -A builtin)
do
builtin unset -f $cmd
builtin enable $cmd
builtin unset -f "$cmd"
builtin enable "$cmd"
done
unset cmd

Expand Down

0 comments on commit 8a07203

Please sign in to comment.