File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,8 @@ def lint_hotkeys_file() -> None:
39
39
existing OUTPUT_FILE
40
40
"""
41
41
hotkeys_file_string = get_hotkeys_file_string ()
42
+ error_flag = 0 if is_every_key_category_valid () else 1
42
43
# To lint keys description
43
- error_flag = 0
44
44
categories = read_help_categories ()
45
45
for action in HELP_CATEGORIES :
46
46
check_duplicate_keys_list : List [str ] = []
@@ -91,6 +91,24 @@ def generate_hotkeys_file() -> None:
91
91
print (f"Hot Keys list saved in { OUTPUT_FILE } " )
92
92
93
93
94
+ def is_every_key_category_valid () -> bool :
95
+ """
96
+ Check for typos in key categories in KEYS_FILE
97
+ """
98
+ error_flag = False
99
+ for key , binding in KEY_BINDINGS .items ():
100
+ key_category = binding .get ("key_category" )
101
+ if key_category not in HELP_CATEGORIES :
102
+ print (
103
+ f"Invalid key_category '{ key_category } ' for key '{ key } '."
104
+ f" Choose a category from:\n { ', ' .join (HELP_CATEGORIES .keys ())} \n "
105
+ )
106
+ error_flag = True
107
+ if not error_flag :
108
+ print ("All key bindings have valid categories." )
109
+ return not error_flag
110
+
111
+
94
112
def get_hotkeys_file_string () -> str :
95
113
"""
96
114
Construct string in form for output to OUTPUT_FILE based on help text
You can’t perform that action at this time.
0 commit comments