forked from forks/qmk_firmware
Produce warning if keyboard is not configured via keyboard.json
(#23321)
This commit is contained in:
parent
6f53d10960
commit
573db7a0ee
|
@ -83,6 +83,25 @@ def _find_invalid_encoder_index(info_data):
|
|||
return ret
|
||||
|
||||
|
||||
def _validate_build_target(keyboard, info_data):
|
||||
"""Non schema checks
|
||||
"""
|
||||
keyboard_json_path = Path('keyboards') / keyboard / 'keyboard.json'
|
||||
config_files = find_info_json(keyboard)
|
||||
|
||||
# keyboard.json can only exist at the deepest part of the tree
|
||||
keyboard_json_count = 0
|
||||
for info_file in config_files:
|
||||
if info_file.name == 'keyboard.json':
|
||||
keyboard_json_count += 1
|
||||
if info_file != keyboard_json_path:
|
||||
_log_error(info_data, f'Invalid keyboard.json location detected: {info_file}.')
|
||||
|
||||
# Moving forward keyboard.json should be used as a build target
|
||||
if keyboard_json_count == 0:
|
||||
_log_warning(info_data, 'Build marker "keyboard.json" not found.')
|
||||
|
||||
|
||||
def _validate_layouts(keyboard, info_data): # noqa C901
|
||||
"""Non schema checks
|
||||
"""
|
||||
|
@ -181,6 +200,7 @@ def _validate(keyboard, info_data):
|
|||
validate(info_data, 'qmk.api.keyboard.v1')
|
||||
|
||||
# Additional validation
|
||||
_validate_build_target(keyboard, info_data)
|
||||
_validate_layouts(keyboard, info_data)
|
||||
_validate_keycodes(keyboard, info_data)
|
||||
_validate_encoders(keyboard, info_data)
|
||||
|
@ -890,14 +910,6 @@ def merge_info_jsons(keyboard, info_data):
|
|||
"""
|
||||
config_files = find_info_json(keyboard)
|
||||
|
||||
# keyboard.json can only exist at the deepest part of the tree
|
||||
keyboard_json_count = 0
|
||||
for index, info_file in enumerate(config_files):
|
||||
if Path(info_file).name == 'keyboard.json':
|
||||
keyboard_json_count += 1
|
||||
if index != 0 or keyboard_json_count > 1:
|
||||
_log_error(info_data, f'Invalid keyboard.json location detected: {info_file}.')
|
||||
|
||||
for info_file in config_files:
|
||||
# Load and validate the JSON data
|
||||
new_info_data = json_load(info_file)
|
||||
|
|
Loading…
Reference in a new issue