Skip to content

Commit

Permalink
Promote 'layouts require matrix data' to api error (qmk#17349)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored and ModProg committed Jul 1, 2022
1 parent ec0e5e5 commit 9b12977
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
7 changes: 0 additions & 7 deletions lib/python/qmk/cli/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,6 @@ def lint(cli):
if not keymap_check(kb, cli.config.lint.keymap):
ok = False

# Check if all non-data driven macros exist in <keyboard.h>
for layout, data in keyboard_info['layouts'].items():
# Matrix data should be a list with exactly two integers: [0, 1]
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']):
cli.log.error(f'{kb}: "{layout}" has no "matrix" definition in either "info.json" or "<keyboard>.h"!')
ok = False

# Report status
if not ok:
failed.append(kb)
Expand Down
7 changes: 5 additions & 2 deletions lib/python/qmk/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,11 @@ def merge_info_jsons(keyboard, info_data):
for new_key, existing_key in zip(layout['layout'], info_data['layouts'][layout_name]['layout']):
existing_key.update(new_key)
else:
layout['c_macro'] = False
info_data['layouts'][layout_name] = layout
if not all('matrix' in key_data.keys() for key_data in layout['layout']):
_log_error(info_data, f'Layout "{layout_name}" has no "matrix" definition in either "info.json" or "<keyboard>.h"!')
else:
layout['c_macro'] = False
info_data['layouts'][layout_name] = layout

# Update info_data with the new data
if 'layouts' in new_info_data:
Expand Down

0 comments on commit 9b12977

Please sign in to comment.