Skip to content

Commit 4352f87

Browse files
zvecrzykrah
authored andcommitted
Promote 'layouts require matrix data' to api error (qmk#17349)
1 parent 560fb15 commit 4352f87

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

lib/python/qmk/cli/lint.py

-7
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,6 @@ def lint(cli):
116116
if not keymap_check(kb, cli.config.lint.keymap):
117117
ok = False
118118

119-
# Check if all non-data driven macros exist in <keyboard.h>
120-
for layout, data in keyboard_info['layouts'].items():
121-
# Matrix data should be a list with exactly two integers: [0, 1]
122-
if not data['c_macro'] and not all('matrix' in key_data.keys() or len(key_data) == 2 or all(isinstance(n, int) for n in key_data) for key_data in data['layout']):
123-
cli.log.error(f'{kb}: "{layout}" has no "matrix" definition in either "info.json" or "<keyboard>.h"!')
124-
ok = False
125-
126119
# Report status
127120
if not ok:
128121
failed.append(kb)

lib/python/qmk/info.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,11 @@ def merge_info_jsons(keyboard, info_data):
797797
for new_key, existing_key in zip(layout['layout'], info_data['layouts'][layout_name]['layout']):
798798
existing_key.update(new_key)
799799
else:
800-
layout['c_macro'] = False
801-
info_data['layouts'][layout_name] = layout
800+
if not all('matrix' in key_data.keys() for key_data in layout['layout']):
801+
_log_error(info_data, f'Layout "{layout_name}" has no "matrix" definition in either "info.json" or "<keyboard>.h"!')
802+
else:
803+
layout['c_macro'] = False
804+
info_data['layouts'][layout_name] = layout
802805

803806
# Update info_data with the new data
804807
if 'layouts' in new_info_data:

0 commit comments

Comments
 (0)