[PATCH 0/2] checkpatch: Add support for Checkpatch-ignore patch footer

Brendan Jackman posted 2 patches 11 months, 1 week ago
Documentation/dev-tools/checkpatch.rst |  9 ++++++++-
scripts/checkpatch.pl                  | 11 ++++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
[PATCH 0/2] checkpatch: Add support for Checkpatch-ignore patch footer
Posted by Brendan Jackman 11 months, 1 week ago
Checkpatch sometimes has false positives. This makes it less useful for
automatic usage: tools like b4 [0] can run checkpatch on all of your
patches and give you a quick overview. When iterating on a branch, it's
tiresome to manually re-check that any errors are known false positives.

This patch adds a feature to record in the commit message that a patch
might produce a certain checkpatch error, and that this is an expected
false positive. Recording this information in the patch itself can also
highlight it to reviewers, so they can make a judgment as to whether
it's appropriate to ignore.

Signed-off-by: Brendan Jackman <jackmanb@google.com>
---
Brendan Jackman (2):
      checkpatch: Add support for Checkpatch-ignore patch footer
      docs: checkpatch: Document Checkpatch-ignore patch footer

 Documentation/dev-tools/checkpatch.rst |  9 ++++++++-
 scripts/checkpatch.pl                  | 11 ++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)
---
base-commit: eae581be230bec00287807017839b3b2cd83f9ff
change-id: 20250113-checkpatch-ignore-1096914844eb

Best regards,
-- 
Brendan Jackman <jackmanb@google.com>
Re: [PATCH 0/2] checkpatch: Add support for Checkpatch-ignore patch footer
Posted by Matthew Wilcox 11 months, 1 week ago
On Mon, Jan 13, 2025 at 04:04:21PM +0000, Brendan Jackman wrote:
> Checkpatch sometimes has false positives. This makes it less useful for
> automatic usage: tools like b4 [0] can run checkpatch on all of your
> patches and give you a quick overview. When iterating on a branch, it's
> tiresome to manually re-check that any errors are known false positives.
> 
> This patch adds a feature to record in the commit message that a patch
> might produce a certain checkpatch error, and that this is an expected
> false positive. Recording this information in the patch itself can also
> highlight it to reviewers, so they can make a judgment as to whether
> it's appropriate to ignore.

I think humans should always ignore checkpatch.  It's basically
worthless.
Re: [PATCH 0/2] checkpatch: Add support for Checkpatch-ignore patch footer
Posted by Brendan Jackman 11 months, 1 week ago
On Mon, 13 Jan 2025 at 17:20, Matthew Wilcox <willy@infradead.org> wrote:
> I think humans should always ignore checkpatch.  It's basically
> worthless.

Do you know of anything better? I guess it's feasible to build
something that's actually good at this job using tree-sitter or
something, maybe it exists. But outside of projects that just enforce
clang-format or whatever, checkpatch.pl is still the best (or perhaps
least bad) thing I've personally experienced.

I won't deny that most error types have only ever presented themselves
to me as noise. But the basic "don't do braces like that" and "you
have a stray space here" stuff has been useful.