[PATCH] scripts/checkpatch.pl: added test for repeated lines

From: Edwin van Vliet
Date: Sun Jul 10 2011 - 14:18:43 EST


Repeated lines may indicate a bug or code that needs clarification. If the
repeated line is intentional, an extra comment may be helpful for reviewers
since the repeated pattern is likely to draw attention.

Signed-off-by: Edwin van Vliet <edwin@xxxxxxxxxx>
---
scripts/checkpatch.pl | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b0aa2c6..4b50496 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1479,6 +1479,11 @@ sub process {
WARN("adding a line without newline at end of file\n" . $herecurr);
}

+# check for repeated lines which may indicate bugs or lack of clarity
+ if ($rawline eq $prevrawline) {
+ WARN("repeated line\n" . $herecurr);
+ }
+
# Blackfin: use hi/lo macros
if ($realfile =~ m@arch/blackfin/.*\.S$@) {
if ($line =~ /\.[lL][[:space:]]*=.*&[[:space:]]*0x[fF][fF][fF][fF]/) {
--
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/