Skip to content

Commit

Permalink
checkpatch: Correct line count in error messages.
Browse files Browse the repository at this point in the history
As part of some previous checkpatch work, we discovered that checkpatch
isn't always reporting correct line numbers. As it turns out, Python's
splitlines function considers several characters to be new lines which
common text editors do not typically consider to be new lines. For
example, form feed characters, which this code base uses to cluster
functionality.

Signed-off-by: Mike Pattrick <[email protected]>
Acked-by: Paolo Valerio <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
mkp-rh authored and igsilya committed Jan 4, 2022
1 parent 28ef253 commit d652fc6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion utilities/checkpatch.py
Original file line number Diff line number Diff line change
@@ -765,12 +765,16 @@ def ovs_checkpatch_parse(text, filename, author=None, committer=None):

reset_counters()

for line in text.splitlines():
for line in text.split("\n"):
if current_file != previous_file:
previous_file = current_file

lineno = lineno + 1
total_line = total_line + 1

if line == "\f":
# Form feed
continue
if len(line) <= 0:
continue

0 comments on commit d652fc6

Please sign in to comment.