diff options
author | Joel Challis <git@zvecr.com> | 2021-05-09 21:39:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-09 22:39:48 +0200 |
commit | 3f854e16acc880b9c9ccab2244dc585705dfac1e (patch) | |
tree | 881528153ff7aea5a0bbff39ef40278ef9103e36 /lib/python | |
parent | 4fa32f0f042eecdb662d6d56d508e03cb6ff83c9 (diff) | |
download | qmk_firmware-3f854e16acc880b9c9ccab2244dc585705dfac1e.tar.gz qmk_firmware-3f854e16acc880b9c9ccab2244dc585705dfac1e.zip |
Catch 'LAYOUTS = all' in lint (#12848)
Co-authored-by: Zach White <skullydazed@drpepper.org>
Diffstat (limited to 'lib/python')
-rw-r--r-- | lib/python/qmk/info.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index e2350b7f7..47c8bff7a 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py | |||
@@ -19,6 +19,12 @@ true_values = ['1', 'on', 'yes'] | |||
19 | false_values = ['0', 'off', 'no'] | 19 | false_values = ['0', 'off', 'no'] |
20 | 20 | ||
21 | 21 | ||
22 | def _valid_community_layout(layout): | ||
23 | """Validate that a declared community list exists | ||
24 | """ | ||
25 | return (Path('layouts/default') / layout).exists() | ||
26 | |||
27 | |||
22 | def info_json(keyboard): | 28 | def info_json(keyboard): |
23 | """Generate the info.json data for a specific keyboard. | 29 | """Generate the info.json data for a specific keyboard. |
24 | """ | 30 | """ |
@@ -71,6 +77,13 @@ def info_json(keyboard): | |||
71 | if not info_data.get('layouts'): | 77 | if not info_data.get('layouts'): |
72 | _log_error(info_data, 'No LAYOUTs defined! Need at least one layout defined in the keyboard.h or info.json.') | 78 | _log_error(info_data, 'No LAYOUTs defined! Need at least one layout defined in the keyboard.h or info.json.') |
73 | 79 | ||
80 | # Filter out any non-existing community layouts | ||
81 | for layout in info_data.get('community_layouts', []): | ||
82 | if not _valid_community_layout(layout): | ||
83 | # Ignore layout from future checks | ||
84 | info_data['community_layouts'].remove(layout) | ||
85 | _log_error(info_data, 'Claims to support a community layout that does not exist: %s' % (layout)) | ||
86 | |||
74 | # Make sure we supply layout macros for the community layouts we claim to support | 87 | # Make sure we supply layout macros for the community layouts we claim to support |
75 | for layout in info_data.get('community_layouts', []): | 88 | for layout in info_data.get('community_layouts', []): |
76 | layout_name = 'LAYOUT_' + layout | 89 | layout_name = 'LAYOUT_' + layout |