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 formatting rules and usage instructions.
Contributors must ensure consistent shell script style before code
submission.
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.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+23-7Lines changed: 23 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,16 +38,32 @@ However, participation requires adherence to fundamental ground rules:
38
38
* Code must strictly adhere to the established C coding style (refer to the guidelines below).
39
39
While there is some flexibility in basic style, it is crucial to stick to the current coding standards.
40
40
Complex algorithmic constructs without proper comments will not be accepted.
41
+
* Shell scripts must be formatted before submission. Use consistent flags across the project to ensure uniform formatting.
41
42
* External pull requests should include thorough documentation in the pull request comments for consideration.
42
43
* When composing documentation, code comments, and other materials in English,
43
44
please adhere to the American English (`en_US`) dialect.
44
45
This variant should be considered the standard for all documentation efforts.
45
46
For instance, opt for "initialize" over "initialise" and "color" rather than "colour".
46
47
47
-
Software requirement: [clang-format](https://clang.llvm.org/docs/ClangFormat.html) version 18 or later.
48
+
Software requirement:
49
+
*[clang-format](https://clang.llvm.org/docs/ClangFormat.html) version 18 or later.
50
+
*[shfmt](https://github.com/mvdan/sh).
48
51
49
-
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}`.
52
+
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`.
53
+
For maintaining a uniform coding style, execute the command `clang-format -i *.{c,h}` and `shfmt -w $(find . -type f -name "*.sh")`.
54
+
55
+
## Coding Style for Shell Script
56
+
57
+
Shell scripts must be clean, consistent, and portable. The following `shfmt` rules(check `.editorconfig` file) are enforced project-wide:
58
+
* Use spaces for indentation.
59
+
* Indent with 4 spaces.
60
+
* Use Unix-style line endings (LF).
61
+
* Remove trailing whitespace at the end of lines.
62
+
* Ensure the file ends with a newline.
63
+
* Place the opening brace of a function on the next line.
64
+
* Indent `case` statements within `switch` blocks.
65
+
* Add spaces around redirection operators (e.g., `>`, `>>`).
66
+
* Place binary operators (e.g., `&&`, `|`) on the next line when breaking lines.
51
67
52
68
## Coding Style for Modern C
53
69
@@ -877,22 +893,22 @@ Author: Jim Huang <jserv@ccns.ncku.edu.tw>
877
893
Date: Mon Feb 24 13:08:32 2025 +0800
878
894
879
895
Introduce CPU architecture filtering in scheduler
880
-
896
+
881
897
In environments with mixed CPU architectures, it is crucial to ensure
882
898
that an instance runs only on a host with a compatible CPU
883
899
type—preventing, for example, a RISC-V instance from being scheduled on
884
900
an Arm host.
885
-
901
+
886
902
This new scheduler filter enforces that requirement by comparing an
887
903
instance's architecture against the host's allowed architectures. For
888
904
the libvirt driver, the host's guest capabilities are queried, and the
889
905
permitted architectures are recorded in the permitted_instances_types
890
906
list within the host's cpu_info dictionary.
891
-
907
+
892
908
The filter systematically excludes hosts that do not support the
893
909
instance's CPU architecture. Additionally, RISC-V has been added to the
894
910
set of acceptable architectures for scheduling.
895
-
911
+
896
912
Note that the CPU architecture filter is disabled by default.
0 commit comments