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
*[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