Skip to content

Commit 4342500

Browse files
committed
Teach scripts/detect_indentation_issues.py about Kconfig
The script was detecting problems in Kconfig help text, where the lines begin with <tab><space><space>. Fix the script to cut down on false positives. Generated-by: Claude AI Signed-off-by: Chuck Lever <[email protected]>
1 parent e93004f commit 4342500

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/detect_indentation_issues.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ def check_file_indentation(file_path):
3434

3535
# Special rules for certain file types
3636
file_ext = Path(file_path).suffix.lower()
37+
file_name = Path(file_path).name
3738
is_yaml = file_ext in [".yml", ".yaml"]
38-
is_makefile = "Makefile" in Path(file_path).name or file_ext == ".mk"
39+
is_makefile = "Makefile" in file_name or file_ext == ".mk"
3940
is_python = file_ext == ".py"
41+
is_kconfig = file_name.startswith("Kconfig")
4042

4143
# Check each line for issues
4244
for line_num, line in enumerate(lines, 1):
@@ -69,6 +71,11 @@ def check_file_indentation(file_path):
6971
issues.append(
7072
f"Line {line_num}: Tab character in Python file (PEP 8 recommends spaces)"
7173
)
74+
elif is_kconfig:
75+
# Kconfig files use tabs for indentation and tab+spaces for help text
76+
# The pattern "\t " (tab followed by 2 spaces) is valid for help text
77+
# So we don't flag this as mixed indentation
78+
pass
7279
else:
7380
# For other files, check for mixed indentation
7481
if leading_ws:

0 commit comments

Comments
 (0)