-
-
Notifications
You must be signed in to change notification settings - Fork 40.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ | |
] | ||
|
||
subcommands = [ | ||
'qmk.cli.ci.validate_aliases', | ||
'qmk.cli.bux', | ||
'qmk.cli.c2json', | ||
'qmk.cli.cd', | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Validates the list of keyboard aliases. | ||
""" | ||
from pathlib import Path | ||
|
||
from milc import cli | ||
|
||
from qmk.constants import QMK_FIRMWARE | ||
from qmk.json_schema import json_load | ||
from qmk.keyboard import resolve_keyboard, keyboard_folder | ||
|
||
|
||
def _safe_keyboard_folder(target): | ||
try: | ||
return keyboard_folder(target) | ||
except Exception: | ||
return None | ||
|
||
|
||
@cli.subcommand('Validates the list of keyboard aliases.', hidden=True) | ||
def ci_validate_aliases(cli): | ||
aliases = json_load(Path('data/mappings/keyboard_aliases.hjson')) | ||
for alias in aliases.keys(): | ||
if alias == 'bm16a': | ||
pass | ||
target = aliases[alias].get('target', None) | ||
if not target or not (QMK_FIRMWARE / 'keyboards' / target).exists() or not resolve_keyboard(target) or not _safe_keyboard_folder(target): | ||
cli.log.error(f'Keyboard alias {alias} has a target that doesn\'t exist: {target}') |