Index: presubmit_canned_checks.py |
diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py |
index 7897effd7896702a06d975ae25997754cb8d6048..b8cbd94d33102ae27c9db27b1ed87dce3bb00f35 100755 |
--- a/presubmit_canned_checks.py |
+++ b/presubmit_canned_checks.py |
@@ -68,6 +68,18 @@ def CheckDoNotSubmit(input_api, output_api): |
) |
+def CheckChangeHasNoCR(input_api, output_api): |
+ """Checks that there are no \r, \r\n (CR or CRLF) characters in any of the |
+ text files to be submitted. |
+ """ |
+ outputs = [] |
+ for f in input_api.AffectedTextFiles(): |
+ if '\r' in input_api.ReadFile(f, 'rb'): |
+ outputs.append(output_api.PresubmitPromptWarning( |
+ "Found a CR character in %s" % f.LocalPath())) |
+ return outputs |
+ |
+ |
def CheckChangeHasNoTabs(input_api, output_api): |
"""Checks that there are no tab characters in any of the text files to be |
submitted. |