diff options
author | Joel Challis <[email protected]> | 2024-03-13 23:04:49 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2024-03-13 23:04:49 +0000 |
commit | af1ac6b1bd873986fe808dfd68420bc5f48dd43d (patch) | |
tree | 469c3ed1eacf0b37a89e21469edb84c6716a588f | |
parent | 6c95ec0c09f1ee908952280c8b2a1f13138c2d09 (diff) | |
download | qmk_firmware-af1ac6b1bd873986fe808dfd68420bc5f48dd43d.tar.gz qmk_firmware-af1ac6b1bd873986fe808dfd68420bc5f48dd43d.zip |
Reject duplicate matrix locations in LAYOUT macros (#23273)
-rw-r--r-- | lib/python/qmk/info.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 00da4936e1..99ac254e27 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -107,6 +107,15 @@ def _validate_layouts(keyboard, info_data): # noqa C901 if col >= col_num: _log_error(info_data, f'{layout_name}: Matrix column for key {index} ({key_name}) is {col} but must be less than {col_num}') + # Reject duplicate matrix locations + for layout_name, layout_data in layouts.items(): + seen = set() + for index, key_data in enumerate(layout_data['layout']): + key = f"{key_data['matrix']}" + if key in seen: + _log_error(info_data, f'{layout_name}: Matrix location for key {index} is not unique {key_data}') + seen.add(key) + # Warn if physical positions are offset (at least one key should be at x=0, and at least one key at y=0) for layout_name, layout_data in layouts.items(): offset_x = min([_get_key_left_position(k) for k in layout_data['layout']]) |