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
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+19-2Lines changed: 19 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@ However, participation requires adherence to fundamental ground rules:
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
41
* Shell scripts must be formatted before submission. Use consistent flags across the project to ensure uniform formatting.
42
+
* Python scripts must be formatted before submission. Use consistent flags across the project to ensure uniform formatting.
42
43
* External pull requests should include thorough documentation in the pull request comments for consideration.
43
44
* When composing documentation, code comments, and other materials in English,
44
45
please adhere to the American English (`en_US`) dialect.
@@ -48,9 +49,12 @@ However, participation requires adherence to fundamental ground rules:
48
49
Software requirement:
49
50
*[clang-format](https://clang.llvm.org/docs/ClangFormat.html) version 18 or later.
50
51
*[shfmt](https://github.com/mvdan/sh).
52
+
*[black](https://github.com/psf/black) version 25.1.0.
51
53
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
+
To maintain a uniform style across languages, run:
55
+
*`clang-format -i *.{c,h}` to apply the project’s C/C++ formatting rules from the up-to-date .clang-format file.
56
+
*`shfmt -w $(find . -type f -name "*.sh")` to clean and standardize all shell scripts.
57
+
*`black .` to enforce a consistent, idiomatic layout for Python code.
54
58
55
59
## Coding Style for Shell Script
56
60
@@ -65,6 +69,19 @@ Shell scripts must be clean, consistent, and portable. The following `shfmt` rul
65
69
* Add spaces around redirection operators (e.g., `>`, `>>`).
66
70
* Place binary operators (e.g., `&&`, `|`) on the next line when breaking lines.
67
71
72
+
## Coding Style for Python
73
+
74
+
Python scripts must be clean, consistent, and adhere to modern Python best practices. The following formatting rules are enforced project-wide using `black`:
75
+
76
+
* Use 4 spaces for indentation (never tabs).
77
+
* Limit lines to 80 characters maximum.
78
+
* Use double quotes for strings (unless single quotes avoid escaping).
79
+
* Use trailing commas in multi-line constructs.
80
+
* Format imports according to PEP 8 guidelines.
81
+
* Use Unix-style line endings (LF).
82
+
* Remove trailing whitespace at the end of lines.
83
+
* Ensure files end with a newline.
84
+
68
85
## Coding Style for Modern C
69
86
70
87
This coding style is a variant of the [K&R style](https://en.wikipedia.org/wiki/Indentation_style#K&R).
0 commit comments