summaryrefslogtreecommitdiffstats
path: root/tools/hacking.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-18 17:51:06 +0000
committerGerrit Code Review <review@openstack.org>2013-01-18 17:51:06 +0000
commite03374725f5e8cc14a453a9c0311f563af776a76 (patch)
tree8be7c222613c8e48fead3cc8d31c125be1a257f8 /tools/hacking.py
parente3a729b7c8873146d00d915a07094d327f97d184 (diff)
parent6556b8650f11ceebe0c59fe88e6c6bdf65e439b5 (diff)
downloadnova-e03374725f5e8cc14a453a9c0311f563af776a76.tar.gz
nova-e03374725f5e8cc14a453a9c0311f563af776a76.tar.xz
nova-e03374725f5e8cc14a453a9c0311f563af776a76.zip
Merge "don't allow crs in the code"
Diffstat (limited to 'tools/hacking.py')
-rwxr-xr-xtools/hacking.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/hacking.py b/tools/hacking.py
index ed22956eb..cfdd1b5b1 100755
--- a/tools/hacking.py
+++ b/tools/hacking.py
@@ -359,6 +359,19 @@ def nova_docstring_multiline_end(physical_line):
return (pos, "N403: multi line docstring end on new line")
+def nova_no_cr(physical_line):
+ r"""Check that we only use newlines not cariage returns.
+
+ Okay: import os\nimport sys
+ # pep8 doesn't yet replace \r in strings, will work on an
+ # upstream fix
+ N901 import os\r\nimport sys
+ """
+ pos = physical_line.find('\r')
+ if pos != -1 and pos == (len(physical_line) - 2):
+ return (pos, "N901: Windows style line endings not allowed in code")
+
+
FORMAT_RE = re.compile("%(?:"
"%|" # Ignore plain percents
"(\(\w+\))?" # mapping key