There were two issues when indicating which lines caused some warnings/errors:
- Removing an empty line was causing line number to be wrong due to the
  [^\-] within the __regex_subtracted_line.
- Removing multilines commands in test files (.at).

Fixes: 937c930b2311 ("checkpatch: Ensure ovn-nbctl/sbctl commands have a 
check.")

Signed-off-by: Xavier Simonart <[email protected]>
---
 utilities/checkpatch.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index a7360e47a..58bdf90b9 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -169,7 +169,7 @@ def reset_counters():
 __parenthesized_constructs = 'if|for|while|switch|[_A-Z]+FOR_*EACH[_A-Z0-9]*'
 
 __regex_added_line = re.compile(r'^\+{1,2}[^\+][\w\W]*')
-__regex_subtracted_line = re.compile(r'^\-{1,2}[^\-][\w\W]*')
+__regex_subtracted_line = re.compile(r'^\-{1,2}(?!\-)[\w\W]*')
 __regex_leading_with_whitespace_at_all = re.compile(r'^\s+')
 __regex_leading_with_spaces = re.compile(r'^ +[\S]+')
 __regex_trailing_whitespace = re.compile(r'[^\S]+$')
@@ -937,6 +937,9 @@ def ovs_checkpatch_parse(text, filename, author=None, 
committer=None):
         total_line = total_line + 1
 
         if current_file.endswith(".at"):
+            if current_line:
+                if line.startswith("-"):
+                    lineno = lineno - 1
             if line.endswith("\\"):
                 current_line += line[:-1]
                 continue
-- 
2.47.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to