Skip to content

clang-format requests fixing lines that are not part of change but surround it in diff #89561

Open
@de-nordic

Description

@de-nordic

Describe the bug
When running ./scripts/ci/check_compliance.py on changes to be posted for review clang format requests fixing lines that the commits do not actually change.
I am using here #88467 PR to as an example, after rebasing it to Zephyr main 2707fa2.

Using command:
git diff HEAD~3
from Zephyr root, I got diff that contains:

Image

Where you can clearly see that macro spi_nor_cmd_write has not been altered; yet, when compliance check is run with:
git diff HEAD~3 | ./scripts/ci/check_compliance.py
part of output contains:

Image
which errors out on the same macro and requests fixing it, even though author of the commit did not touch the line.

To Reproduce

git fetch origin pull/88467/head
git checkout -b check_88467 FETCH_HEAD
git fetch origin main
git rebase origin/main
git diff HEAD~3 | ./scripts/ci/check_compliance.py

You probably also want to run pip update with the scripts/requirements-complience.txt as input.
Note that you now have extra branch check_88467 you probably want to remove.

Expected behavior
Stick to changed lines only.

Impact
Getting annoyed, by request to fix things that have not been touched, with failing compliance check.

Environment (please complete the following information):

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions