Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linting for HELP_CATEGORIES #1545

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions tools/lint-hotkeys
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def main(fix: bool) -> None:
if fix:
generate_hotkeys_file()
else:
lint_help_categories()
lint_hotkeys_file()


Expand Down Expand Up @@ -80,6 +81,22 @@ def lint_hotkeys_file() -> None:
sys.exit(error_flag)


def lint_help_categories() -> None:
"""
Check if HELP_CATEGORIES contains all key categories
"""
missing_categories = [
binding["key_category"]
for binding in KEY_BINDINGS.values()
if binding["key_category"] not in HELP_CATEGORIES
]
if missing_categories:
print(
f"Missing categories in HELP_CATEGORIES (keys.py file): {missing_categories}"
)
sys.exit(1)


def generate_hotkeys_file() -> None:
"""
Generate OUTPUT_FILE based on help text description and
Expand Down
Loading