The patch titled Subject: checkpatch: add test for assignment at start of line has been added to the -mm tree. Its filename is checkpatch-add-test-for-assignment-at-start-of-line.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/checkpatch-add-test-for-assignment-at-start-of-line.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/checkpatch-add-test-for-assignment-at-start-of-line.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Joe Perches <joe@xxxxxxxxxxx> Subject: checkpatch: add test for assignment at start of line Kernel style seems to prefer line wrapping an assignment with the assignment operator on the previous line like: <leading tabs> identifier = expression; over <leading tabs> identifier = expression; somewhere around a 50:1 ratio $ git grep -P "[^=]=\s*$" -- "*.[ch]" | wc -l 52008 $ git grep -P "^\s+[\*\/\+\|\%\-]?=[^=>]" | wc -l 1161 So add a --strict test for that condition. Link: http://lkml.kernel.org/r/1522275726.2210.12.camel@xxxxxxxxxxx Signed-off-by: Joe Perches <joe@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff -puN scripts/checkpatch.pl~checkpatch-add-test-for-assignment-at-start-of-line scripts/checkpatch.pl --- a/scripts/checkpatch.pl~checkpatch-add-test-for-assignment-at-start-of-line +++ a/scripts/checkpatch.pl @@ -3063,6 +3063,12 @@ sub process { } } +# check for assignments on the start of a line + if ($sline =~ /^\+\s+($Assignment)[^=]/) { + CHK("ASSIGNMENT_CONTINUATIONS", + "Assignment operator '$1' should be on the previous line\n" . $hereprev); + } + # check for && or || at the start of a line if ($rawline =~ /^\+\s*(&&|\|\|)/) { CHK("LOGICAL_CONTINUATIONS", _ Patches currently in -mm which might be from joe@xxxxxxxxxxx are checkpatch-improve-parse_email-signature-checking.patch checkpatch-improve-get_quoted_string-for-trace_event-macros.patch checkpatch-test-symbolic_perms-multiple-times-per-line.patch checkpatch-add-test-for-assignment-at-start-of-line.patch maintainers-update-bouncing-aacraid-adapteccom-addresses.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html