From 562e420d3fa44b004cf286e6fb145a7d26e8804a Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Thu, 2 Oct 2025 10:28:33 -0300 Subject: [PATCH] prep --check: Add support to spellcheck is codespell is installed This commit add --codespell to checkpatch.pl is the codespell package is install. If b4 is installed with pipx you need to use --system-site-packages when calling install, otherwise it won't see the packages installed by your package manager. Signed-off-by: Marcos Paulo de Souza --- src/b4/ez.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/b4/ez.py b/src/b4/ez.py index 4d9f813..4a26fee 100644 --- a/src/b4/ez.py +++ b/src/b4/ez.py @@ -43,6 +43,12 @@ except ModuleNotFoundError: can_gfr = False +try: + import codespell_lib + can_codespell = True +except ModuleNotFoundError: + can_codespell = False + logger = b4.logger MAGIC_MARKER = '--- b4-submit-tracking ---' @@ -1808,7 +1814,8 @@ def get_check_cmds() -> Tuple[List[str], List[str]]: if topdir: checkpatch = os.path.join(topdir, 'scripts', 'checkpatch.pl') if os.access(checkpatch, os.X_OK): - ppcmds = [f'{checkpatch} -q --terse --no-summary --mailback --showfile'] + spell = "--codespell" if can_codespell else "" + ppcmds = [f'{checkpatch} -q --terse --no-summary --mailback --showfile {spell}'] # TODO: support for a whole-series check command, (pytest, etc) return ppcmds, scmds