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.
To retain a very similar functionality to what exists now, we will split on "\r?\n" and strip off the other characters that previously splitlines was splitting on. Signed-off-by: Mike Pattrick <[email protected]> --- utilities/checkpatch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index bf95358d5..2a3c0f768 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -765,12 +765,13 @@ def ovs_checkpatch_parse(text, filename, author=None, committer=None): reset_counters() - for line in text.splitlines(): + for line in re.split("\r?\n", text): if current_file != previous_file: previous_file = current_file lineno = lineno + 1 total_line = total_line + 1 + line = line.rstrip("\u2029\u2028\x85\x1e\x1d\x1c\x0c\x0b") if len(line) <= 0: continue -- 2.27.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
