-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Format shell scripts using shfmt (#1638)
Shell scripts are now formatted using shfmt: https://github.com/mvdan/sh/blob/master/cmd/shfmt/shfmt.1.scd This is enforced in CI, and formatting can be applied locally using a new `make format` target. Notably, this also reformats the scripts to use tabs instead of spaces, since tabs are sadly the only way to be able to properly indent bash here documents (which is something the scripts here will be using a lot of soon) without having to resort to mixed tabs and spaces indentation in the same file. (Plus tabs is also the shfmt default style.) GUS-W-16808198.
- Loading branch information
Showing
26 changed files
with
893 additions
and
845 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# https://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = space | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.sh] | ||
binary_next_line = true | ||
# We sadly have to use tabs in shell scripts otherwise we can't indent here documents: | ||
# https://www.gnu.org/software/bash/manual/html_node/Redirections.html#Here-Documents | ||
indent_style = tab | ||
shell_variant = bash | ||
switch_case_indent = true | ||
|
||
# Catches scripts that we can't give a .sh file extension, such as the Buildpack API scripts. | ||
[**/bin/**] | ||
binary_next_line = true | ||
indent_style = tab | ||
shell_variant = bash | ||
switch_case_indent = true | ||
|
||
[.hatchet/repos/**] | ||
ignore = true | ||
|
||
# The setup-ruby GitHub Action creates this directory when caching is enabled, and if | ||
# its not ignored will cause false positives when running shfmt in the CI lint job. | ||
[vendor/bundle/**] | ||
ignore = true | ||
|
||
[Makefile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.