Skip to content

Commit 7e66f45

Browse files
committed
lint-hotkeys: Add linting for HELP_CATEGORIES.
- Implemented a linting check to ensure all `key_category` values in `KEY_BINDINGS` are present in the `HELP_CATEGORIES` dictionary. - Added functionality to print any missing categories if they are not found in `HELP_CATEGORIES`.
1 parent 7116761 commit 7e66f45

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tools/lint-hotkeys

+17
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def main(fix: bool) -> None:
3030
if fix:
3131
generate_hotkeys_file()
3232
else:
33+
lint_help_categories()
3334
lint_hotkeys_file()
3435

3536

@@ -80,6 +81,22 @@ def lint_hotkeys_file() -> None:
8081
sys.exit(error_flag)
8182

8283

84+
def lint_help_categories() -> None:
85+
"""
86+
Check if HELP_CATEGORIES contains all key categories
87+
"""
88+
missing_categories = [
89+
binding["key_category"]
90+
for binding in KEY_BINDINGS.values()
91+
if binding["key_category"] not in HELP_CATEGORIES
92+
]
93+
if missing_categories:
94+
print(
95+
f"Missing categories in HELP_CATEGORIES (keys.py file): {missing_categories}"
96+
)
97+
sys.exit(1)
98+
99+
83100
def generate_hotkeys_file() -> None:
84101
"""
85102
Generate OUTPUT_FILE based on help text description and

0 commit comments

Comments
 (0)