Improve the qmk lint readme check (#13941)

* improve lint readme check

* improve if
This commit is contained in:
Zach White 2021-08-10 07:48:22 -07:00 committed by GitHub
parent 9a0118c603
commit ed84a4e7e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@ from milc import cli
from qmk.decorators import automagic_keyboard, automagic_keymap from qmk.decorators import automagic_keyboard, automagic_keymap
from qmk.info import info_json from qmk.info import info_json
from qmk.keyboard import keyboard_completer from qmk.keyboard import find_readme, keyboard_completer
from qmk.keymap import locate_keymap from qmk.keymap import locate_keymap
from qmk.path import is_keyboard, keyboard from qmk.path import is_keyboard, keyboard
@ -31,7 +31,8 @@ def lint(cli):
ok = True ok = True
keyboard_path = keyboard(cli.config.lint.keyboard) keyboard_path = keyboard(cli.config.lint.keyboard)
keyboard_info = info_json(cli.config.lint.keyboard) keyboard_info = info_json(cli.config.lint.keyboard)
readme_path = keyboard_path / 'readme.md' readme_path = find_readme(cli.config.lint.keyboard)
missing_readme_path = keyboard_path / 'readme.md'
# Check for errors in the info.json # Check for errors in the info.json
if keyboard_info['parse_errors']: if keyboard_info['parse_errors']:
@ -43,9 +44,9 @@ def lint(cli):
cli.log.error('Warnings found when generating info.json (Strict mode enabled.)') cli.log.error('Warnings found when generating info.json (Strict mode enabled.)')
# Check for a readme.md and warn if it doesn't exist # Check for a readme.md and warn if it doesn't exist
if not readme_path.exists(): if not readme_path:
ok = False ok = False
cli.log.error('Missing %s', readme_path) cli.log.error('Missing %s', missing_readme_path)
# Keymap specific checks # Keymap specific checks
if cli.config.lint.keymap: if cli.config.lint.keymap: