Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Unified Diff: runtime/PRESUBMIT.py

Issue 2525633002: VM: Enforce correctly formatted C++ code (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698