Commit 13d69d40 authored by John Koleszar's avatar John Koleszar
Browse files

lint-hunks: exit status for only affected lines

Prior to this patch, if there were any lint errors, this script would
exit with an error, even if those errors were not in the hunks being
tested by this script. This change makes it so that if any lint lines
are printed, an error is returned.

Change-Id: I69c8bef4367ccf25d287508f29e587b1f4426143
Showing with 2 additions and 3 deletions
...@@ -111,8 +111,6 @@ def main(argv=None): ...@@ -111,8 +111,6 @@ def main(argv=None):
lint = Subprocess(cpplint_cmd, expected_returncode=(0, 1), lint = Subprocess(cpplint_cmd, expected_returncode=(0, 1),
stdin=show.stdout, stderr=subprocess.PIPE) stdin=show.stdout, stderr=subprocess.PIPE)
lint_out = lint.communicate()[1] lint_out = lint.communicate()[1]
if lint.returncode == 1:
lint_failed = True
for line in lint_out.split("\n"): for line in lint_out.split("\n"):
fields = line.split(":") fields = line.split(":")
...@@ -122,8 +120,9 @@ def main(argv=None): ...@@ -122,8 +120,9 @@ def main(argv=None):
if warning_line_num in affected_lines: if warning_line_num in affected_lines:
print "%s:%d:%s"%(filename, warning_line_num, print "%s:%d:%s"%(filename, warning_line_num,
":".join(fields[2:])) ":".join(fields[2:]))
lint_failed = True
# Propagate lint's exit status # Set exit code if any relevant lint errors seen
if lint_failed: if lint_failed:
return 1 return 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment