Skip to content

Commit 9b76d55

Browse files
committed
Add linter tool
This introduces lint.py, a standalone static analysis tool for Kconfig files that detects: - Symbols that can never be enabled (no prompt/defaults/select/imply) - Unused symbols (not referenced in Kconfig or source code) - Pointless menuconfig entries (empty menus) - Symbols only defined in defconfig files - Missing CONFIG_ prefixes in source code references
1 parent 4c71161 commit 9b76d55

File tree

2 files changed

+462
-0
lines changed

2 files changed

+462
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,17 @@ All but two (`genconfig` and `setconfig`) mirror functionality available in the
5858
- [listnewconfig](listnewconfig.py)
5959
- [genconfig](genconfig.py)
6060
- [setconfig](setconfig.py)
61+
- [lint](lint.py)
6162

6263
`genconfig` is intended to be run at build time.
6364
It generates a C header from the configuration and, optionally,
6465
additional data that can be used to rebuild only the files referencing Kconfig symbols whose values have changed.
6566

67+
`lint.py` is a standalone linter for Kconfig files that performs static analysis to detect potential issues
68+
such as unused symbols, symbols that can never be enabled, pointless menuconfig entries, and missing CONFIG_
69+
prefixes in source code. Run it directly with `python3 lint.py <Kconfig>` or see `python3 lint.py --help`
70+
for available checks.
71+
6672
Starting with Kconfiglib version 12.2.0, all utilities are compatible with both Python 2 and Python 3.
6773
Previously, `menuconfig.py` was limited to Python 3, so it now offers improved backward compatibility.
6874

0 commit comments

Comments
 (0)