On Wed, Oct 30, 2019 at 10:18:44AM -0700, Joe Perches wrote:
On Wed, 2019-10-30 at 09:35 -0700, Brendan Higgins wrote:
Agreed. I can see the point of not wanting to write an exception into checkpatch for every exception of it's general rules; however, it would be nice if there was a way to maybe have a special comment or something that could turn off a checkpatch error. That way, a checkpatch error/warning always means some action should be taken, and if a rule is being ignored, there is always documentation as to why.
That couldn't work when a comment which may exist in a file is out of scope of the patch context.
Sorry, I don't understand exactly what you mean. Can you elaborate?
If it wasn't obvious, I am not proposing that David should make the changed I described now for this patch. I know what I proposed would not be an easy thing to implement, especially given the opinions that it is likely to solicit.
Nevertheless, in the long term, I have seen other projects allow a comment that would cause style checkers or static analysis tools to ignore the designated line. Maybe we could implement this as a line comment that suppresses a checkpatch warning of a certain kind on the line. So here, we might have something like:
static void list_test_list_for_each_prev(struct kunit *test) /* checkpatch: disable=for-each-format */
We would also probably want to require an explanation either in the checkpatch comment or the line above, but then you have to worry about that comment not being included in a patch that only updates the offending line.
Anyway, it's just an idea. I know that we don't currently assume that all checkpatch errors/warnings require some action, but it might be cool if they did.
Cheers