devtools: Add `fix-style-errors` script by @sangbida.
What changed, and why it matters
This commit adds a new developer helper script that automatically fixes code style problems in Python and C files and corrects spelling mistakes. It is a tooling addition for maintainers and contributors, not a change to the wallet, network, or cryptographic code of Core Lightning. There is no security issue visible in the commit itself.
No security action required. Reviewers may optionally verify that the script is only used on intended source files and that running it in a dirty working tree does not accidentally overwrite uncommitted changes, as already noted by the in-script warning.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The new devtools/fix-style-errors shell script iterates over supplied file paths and runs ruff (Python lint/format), clang-format (C formatting), and codespell (spelling fixes). It redirects stderr to /dev/null for clang-format and codespell. The script is marked destructive and intended as an auxiliary to pre-commit hooks. No runtime, consensus, or cryptographic code is modified.
Changed components
devtools/fix-style-errorsInspect captured patch +18 / −0
diff --git a/devtools/fix-style-errors b/devtools/fix-style-errors
new file mode 100755
index 00000000..628e6812
--- /dev/null
+++ b/devtools/fix-style-errors
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# Takes a list of files and applies style fixes for Python using `ruff` and C using
+# `clang-format`. Also corrects spelling using `codespell`. This tool is an auxiliary to the
+# `pre-commit` hooks found in:
+# `.pre-commit-config.yaml`
+#
+# WARNING: Changes are destructive. Ensure a clean working environment before running.
+#
+# By: @sangbida
+
+for file in "$@"; do
+ case "$file" in
+ *.py) ruff check --fix "$file"; ruff format "$file" ;;
+ *.c|*.h) clang-format -i "$file" 2>/dev/null ;;
+ esac
+ codespell -w "$file" 2>/dev/null
+done
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.