summaryrefslogtreecommitdiff
path: root/util/style
diff options
context:
space:
mode:
Diffstat (limited to 'util/style')
-rw-r--r--util/style/verifiers.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/util/style/verifiers.py b/util/style/verifiers.py
index a9c78b413..8626cc7ce 100644
--- a/util/style/verifiers.py
+++ b/util/style/verifiers.py
@@ -348,6 +348,20 @@ class LineLength(LineVerifier):
def fix_line(self, line):
pass
+class ControlCharacters(LineVerifier):
+ languages = set(('C', 'C++', 'swig', 'python', 'asm', 'isa', 'scons'))
+ test_name = 'control character'
+ opt_name = 'ascii'
+
+ valid = ('\n', '\t')
+ invalid = "".join([chr(i) for i in range(0, 0x20) if chr(i) not in valid])
+
+ def check_line(self, line):
+ return self.fix_line(line) == line
+
+ def fix_line(self, line):
+ return line.translate(None, ControlCharacters.invalid)
+
class BoolCompare(LineVerifier):
languages = set(('C', 'C++', 'python'))
test_name = 'boolean comparison'