You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Leverage shfmt as the standard formatter for shell scripts in this repo.
- add `.editorconfig` with formatting rules and apply shfmt in
.ci/check-format.sh. The formatting rules are as follows:
* Use spaces for indentation
* Indent with 4 spaces
* Use Unix-style line endings (LF)
* Remove trailing whitespace at the end of lines
* Ensure the file ends with a newline
* Place the opening brace of a function on the next line
* Indent case statements within switch blocks
* Add spaces around redirection operators (e.g., >, >>)
* Place binary operators (e.g., &&, |) on the next line when breaking
lines
- update CONTRIBUTING.md with usage instructions (all contributors
should use it to ensure consistent shell script style).
The early exit behavior (set -e) in .ci/check-format.sh has been removed
to allow collecting all formatting mismatches in a single run. The
script’s exit code is now the sum of the line-level mismatch count from
clang-format-18 and the file-level mismatch count from shfmt, which
should be 0 if all files are properly formatted.
All existing shell scripts are reformatted with the formatting rules.
This repository consistently contains an up-to-date `.clang-format` file with rules that match the explained ones.
50
-
For maintaining a uniform coding style, execute the command `clang-format -i *.{c,h}`.
51
+
This repository consistently contains an up-to-date `.clang-format` file with rules that match the explained ones and uses shell script formatting supported by `shfmt`.
52
+
For maintaining a uniform coding style, execute the command `clang-format -i *.{c,h}` and `shfmt -w $(find . -type f -name "*.sh")`.
0 commit comments