Index: runtime/PRESUBMIT.py |
diff --git a/runtime/PRESUBMIT.py b/runtime/PRESUBMIT.py |
index 0170f2f98d67efb2b22f06ea1775c7b328b525f8..e2396f4d3169929e2819f886c2490fa054c264fa 100644 |
--- a/runtime/PRESUBMIT.py |
+++ b/runtime/PRESUBMIT.py |
@@ -5,6 +5,7 @@ |
import os |
import cpplint |
import re |
+import StringIO |
# memcpy does not handle overlapping memory regions. Even though this |
# is well documented it seems to be used in error quite often. To avoid |
@@ -49,7 +50,18 @@ def CheckGn(input_api, output_api): |
def CheckFormatted(input_api, output_api): |
- return input_api.canned_checks.CheckPatchFormatted(input_api, output_api) |
+ def convert_warning_to_error(presubmit_result): |
+ if not presubmit_result.fatal: |
+ # Convert this warning to an error. |
+ stream = StringIO.StringIO() |
+ presubmit_result.handle(stream) |
+ messages = stream.getvalue().split('\n') |
zra
2016/11/27 04:04:55
I don't remember exactly how the messages look, bu
kustermann
2016/11/30 21:40:32
The goal is not to prevent the "Continue (y/N)" li
|
+ message = messages[0] if messages else 'Unknown formatting error.' |
zra
2016/11/27 04:04:55
Did you see this happen? Instead of printing 'Unkn
kustermann
2016/11/30 21:40:32
Done - It was just a precaution, I'll let it throw
|
+ return output_api.PresubmitError(message) |
+ return presubmit_result |
+ |
+ results = input_api.canned_checks.CheckPatchFormatted(input_api, output_api) |
+ return [convert_warning_to_error(r) for r in results] |
def CheckChangeOnUpload(input_api, output_api): |