Flag invalid keyboard features during lint (#22832)

master
Joel Challis 2024-02-08 06:34:48 +00:00 committed by GitHub
parent ffc45ac80c
commit e7b84e1cf6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 0 deletions

View File

@ -13,6 +13,7 @@ from qmk.git import git_get_ignored_files
from qmk.c_parse import c_source_files from qmk.c_parse import c_source_files
CHIBIOS_CONF_CHECKS = ['chconf.h', 'halconf.h', 'mcuconf.h', 'board.h'] CHIBIOS_CONF_CHECKS = ['chconf.h', 'halconf.h', 'mcuconf.h', 'board.h']
INVALID_KB_FEATURES = set(['encoder_map', 'dip_switch_map', 'combo', 'tap_dance', 'via'])
def _list_defaultish_keymaps(kb): def _list_defaultish_keymaps(kb):
@ -69,6 +70,17 @@ def _handle_json_errors(kb, info):
return ok return ok
def _handle_invalid_features(kb, info):
"""Check for features that should never be enabled at the keyboard level
"""
ok = True
features = set(info.get('features', []))
for found in features & INVALID_KB_FEATURES:
ok = False
cli.log.error(f'{kb}: Invalid keyboard level feature detected - {found}')
return ok
def _chibios_conf_includenext_check(target): def _chibios_conf_includenext_check(target):
"""Check the ChibiOS conf.h for the correct inclusion of the next conf.h """Check the ChibiOS conf.h for the correct inclusion of the next conf.h
""" """
@ -154,6 +166,9 @@ def keyboard_check(kb):
ok = False ok = False
# Additional checks # Additional checks
if not _handle_invalid_features(kb, kb_info):
ok = False
rules_mk_assignment_errors = _rules_mk_assignment_only(kb) rules_mk_assignment_errors = _rules_mk_assignment_only(kb)
if rules_mk_assignment_errors: if rules_mk_assignment_errors:
ok = False ok = False