Skip to content

Commit

Permalink
checkpatch: Announce the file where errors occur
Browse files Browse the repository at this point in the history
This makes finding the warning and error marks much easier.

Signed-off-by: Aaron Conole <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
apconole authored and blp committed Nov 29, 2016
1 parent ca3d4f5 commit 3239c79
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions utilities/checkpatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@

__errors = 0
__warnings = 0
print_file_name = None


def print_file():
global print_file_name
if print_file_name:
print("In file %s" % print_file_name)
print_file_name = None


def print_error(message, lineno=None):
global __errors
print_file()
if lineno is not None:
print("E(%d): %s" % (lineno, message))
else:
Expand All @@ -35,6 +44,7 @@ def print_error(message, lineno=None):

def print_warning(message, lineno=None):
global __warnings
print_file()
if lineno:
print("W(%d): %s" % (lineno, message))
else:
Expand Down Expand Up @@ -131,6 +141,7 @@ def balanced_parens(line):


def ovs_checkpatch_parse(text):
global print_file_name
lineno = 0
signatures = []
co_authors = []
Expand Down Expand Up @@ -162,6 +173,7 @@ def ovs_checkpatch_parse(text):
if match:
parse = parse + 1
current_file = match.group(2)
print_file_name = current_file
continue
elif parse == 0:
if scissors.match(line):
Expand All @@ -185,6 +197,7 @@ def ovs_checkpatch_parse(text):
newfile = hunks.match(line)
if newfile:
current_file = newfile.group(2)
print_file_name = current_file
continue
if not is_added_line(line):
continue
Expand Down

0 comments on commit 3239c79

Please sign in to comment.