diff options
author | Zach White <skullydazed@gmail.com> | 2020-11-07 09:56:08 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-07 09:56:08 -0800 |
commit | 4d33d72975f2d63c7b6ff6fd4aa7e0f4c4347583 (patch) | |
tree | afc9f0ebeeefed8405443cbe8636458d6c4c18d2 /lib/python/qmk/path.py | |
parent | 7ce5402417b0332569bf48cf2c51e412cd35a18a (diff) | |
download | qmk_firmware-4d33d72975f2d63c7b6ff6fd4aa7e0f4c4347583.tar.gz qmk_firmware-4d33d72975f2d63c7b6ff6fd4aa7e0f4c4347583.zip |
New command: qmk lint (#10761)
* Basic qmk lint command
* check for keymap readme
* change the workflow from qmk info to qmk lint
* add a strict mode
* parsing -> parse
* document qmk lint
* small info logging cleanup
* Apply suggestions from code review
Co-authored-by: Ryan <fauxpark@gmail.com>
* honor --strict in more places
* change the job name to lint
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'lib/python/qmk/path.py')
-rw-r--r-- | lib/python/qmk/path.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/python/qmk/path.py b/lib/python/qmk/path.py index 591fad034..54def1d5d 100644 --- a/lib/python/qmk/path.py +++ b/lib/python/qmk/path.py | |||
@@ -28,15 +28,21 @@ def under_qmk_firmware(): | |||
28 | return None | 28 | return None |
29 | 29 | ||
30 | 30 | ||
31 | def keymap(keyboard): | 31 | def keyboard(keyboard_name): |
32 | """Returns the path to a keyboard's directory relative to the qmk root. | ||
33 | """ | ||
34 | return Path('keyboards') / keyboard_name | ||
35 | |||
36 | |||
37 | def keymap(keyboard_name): | ||
32 | """Locate the correct directory for storing a keymap. | 38 | """Locate the correct directory for storing a keymap. |
33 | 39 | ||
34 | Args: | 40 | Args: |
35 | 41 | ||
36 | keyboard | 42 | keyboard_name |
37 | The name of the keyboard. Example: clueboard/66/rev3 | 43 | The name of the keyboard. Example: clueboard/66/rev3 |
38 | """ | 44 | """ |
39 | keyboard_folder = Path('keyboards') / keyboard | 45 | keyboard_folder = keyboard(keyboard_name) |
40 | 46 | ||
41 | for i in range(MAX_KEYBOARD_SUBFOLDERS): | 47 | for i in range(MAX_KEYBOARD_SUBFOLDERS): |
42 | if (keyboard_folder / 'keymaps').exists(): | 48 | if (keyboard_folder / 'keymaps').exists(): |
@@ -45,7 +51,7 @@ def keymap(keyboard): | |||
45 | keyboard_folder = keyboard_folder.parent | 51 | keyboard_folder = keyboard_folder.parent |
46 | 52 | ||
47 | logging.error('Could not find the keymaps directory!') | 53 | logging.error('Could not find the keymaps directory!') |
48 | raise NoSuchKeyboardError('Could not find keymaps directory for: %s' % keyboard) | 54 | raise NoSuchKeyboardError('Could not find keymaps directory for: %s' % keyboard_name) |
49 | 55 | ||
50 | 56 | ||
51 | def normpath(path): | 57 | def normpath(path): |