From 327f7ee9a74f1740106d46e65e909208a1372ad3 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Thu, 19 Jan 2023 12:05:29 +1100 Subject: Fixup ChibiOS header inclusion search ordering. (#19623) * Add STM32F446-Nucleo onekey. * Fixup onekey build for F446, all keymaps. * Fixup board inclusion search ordering. --- lib/python/qmk/cli/lint.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lib/python/qmk/cli') diff --git a/lib/python/qmk/cli/lint.py b/lib/python/qmk/cli/lint.py index c67809a697..897a6c4c0d 100644 --- a/lib/python/qmk/cli/lint.py +++ b/lib/python/qmk/cli/lint.py @@ -12,6 +12,8 @@ from qmk.path import is_keyboard, keyboard from qmk.git import git_get_ignored_files from qmk.c_parse import c_source_files +CHIBIOS_CONF_CHECKS = ['chconf.h', 'halconf.h', 'mcuconf.h', 'board.h'] + def _list_defaultish_keymaps(kb): """Return default like keymaps for a given keyboard @@ -64,6 +66,15 @@ def _handle_json_errors(kb, info): return ok +def _chibios_conf_includenext_check(target): + """Check the ChibiOS conf.h for the correct inclusion of the next conf.h + """ + for i, line in enumerate(target.open()): + if f'#include_next "{target.name}"' in line: + return f'Found `#include_next "{target.name}"` on line {i} of {target}, should be `#include_next <{target.name}>` (use angle brackets, not quotes)' + return None + + def _rules_mk_assignment_only(kb): """Check the keyboard-level rules.mk to ensure it only has assignments. """ @@ -121,6 +132,12 @@ def keymap_check(kb, km): cli.log.error(f'{kb}/{km}: The file "{file}" does not have a license header!') ok = False + if file.name in CHIBIOS_CONF_CHECKS: + check_error = _chibios_conf_includenext_check(file) + if check_error is not None: + cli.log.error(f'{kb}/{km}: {check_error}') + ok = False + return ok @@ -153,6 +170,12 @@ def keyboard_check(kb): cli.log.error(f'{kb}: The file "{file}" does not have a license header!') ok = False + if file.name in CHIBIOS_CONF_CHECKS: + check_error = _chibios_conf_includenext_check(file) + if check_error is not None: + cli.log.error(f'{kb}: {check_error}') + ok = False + return ok -- cgit v1.2.3