From 305e648d63024affc0227d75b44f7030e979fccf Mon Sep 17 00:00:00 2001 From: Chris Friedt Date: Wed, 15 Jan 2025 12:19:37 -0800 Subject: [PATCH] scripts: ci: check_compliance: ignore patch and diff files Was getting several false positives about whitespace at line endings with check_compliance.py because it was analyzing .patch and .diff files as source. Signed-off-by: Chris Friedt --- scripts/ci/check_compliance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index be2f99cee9c..70691f7d6f0 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -224,7 +224,7 @@ class CheckPatch(ComplianceTest): cmd = [checkpatch] cmd.extend(['--mailback', '--no-tree', '-']) - diff = subprocess.Popen(('git', 'diff', '--no-ext-diff', COMMIT_RANGE), + diff = subprocess.Popen(('git', 'diff', '--no-ext-diff', '--', ':!*.diff', ':!*.patch', COMMIT_RANGE), stdout=subprocess.PIPE, cwd=GIT_TOP) try: @@ -1327,7 +1327,7 @@ class GitDiffCheck(ComplianceTest): for shaidx in get_shas(COMMIT_RANGE): # Ignore non-zero return status code # Reason: `git diff --check` sets the return code to the number of offending lines - diff = git("diff", f"{shaidx}^!", "--check", ignore_non_zero=True) + diff = git("diff", f"{shaidx}^!", "--check", "--", ":!*.diff", ":!*.patch", ignore_non_zero=True) lines = p.findall(diff) lines = map(lambda x: f"{shaidx}: {x}", lines)