Skip to content

Commit 2d35833

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 2d35833

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: tools/lint-hotkeys

+16
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,21 @@ 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'] for binding in KEY_BINDINGS.values()
90+
if binding['key_category'] not in HELP_CATEGORIES
91+
]
92+
if missing_categories:
93+
print(
94+
f"Missing categories in HELP_CATEGORIES (keys.py file): {missing_categories}"
95+
)
96+
sys.exit(1)
97+
98+
8399
def generate_hotkeys_file() -> None:
84100
"""
85101
Generate OUTPUT_FILE based on help text description and

0 commit comments

Comments
 (0)