Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup ChibiOS header inclusion search ordering. #19623

Merged
merged 10 commits into from
Jan 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Lint checks.
tzarc committed Jan 18, 2023

Verified

This commit was signed with the committer’s verified signature.
tzarc Nick Brassel
commit 73ac0677bffed5356287d59fd7929be0f669af73
15 changes: 15 additions & 0 deletions keyboards/handwired/onekey/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/* Copyright 2020 QMK
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
tzarc marked this conversation as resolved.
Show resolved Hide resolved
#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
24 changes: 24 additions & 0 deletions lib/python/qmk/cli/lint.py
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@
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,16 @@ def _handle_json_errors(kb, info):
return ok


def _chibios_conf_includenext_check(path):
"""Check the ChibiOS conf.h for the correct inclusion of the next conf.h
"""
target = Path(path)
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 {path}, should be `#include_next <{target.name}>` (use angle brackets, not quotes)'
return None
tzarc marked this conversation as resolved.
Show resolved Hide resolved


def _rules_mk_assignment_only(kb):
"""Check the keyboard-level rules.mk to ensure it only has assignments.
"""
@@ -121,6 +133,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(check_error)
tzarc marked this conversation as resolved.
Show resolved Hide resolved
ok = False

return ok


@@ -153,6 +171,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(check_error)
tzarc marked this conversation as resolved.
Show resolved Hide resolved
ok = False

return ok