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

style: use long shfmt arguments. #13290

Merged
merged 1 commit into from
May 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions Library/Homebrew/style.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,16 +240,8 @@ def run_shfmt(files, fix: false)
files.delete(HOMEBREW_REPOSITORY/"completions/bash/brew")
files.delete(HOMEBREW_REPOSITORY/"Dockerfile")

# shfmt options:
# -i 2 : indent by 2 spaces
# -ci : indent switch cases
# -ln bash : language variant to parse ("bash")
# -w : write result to file instead of stdout (inplace fixing)
# "--" is needed for `utils/shfmt.sh`
args = ["-i", "2", "-ci", "-ln", "bash", "--", *files]

# Do inplace fixing
args.unshift("-w") if fix # need to add before "--"
args = ["--language-dialect", "bash", "--indent", "2", "--case-indent", "--", *files]
args.unshift("--write") if fix # need to add before "--"

system shfmt, *args
$CHILD_STATUS.success?
Expand Down