verifiers.py (11403:e8949ea6961f) verifiers.py (11404:72b399971cbc)
1#!/usr/bin/env python
2#
3# Copyright (c) 2014, 2016 ARM Limited
4# All rights reserved
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 334 unchanged lines hidden (view full) ---

343 return style.normalized_len(line) <= 78
344
345 def fix(self, filename, regions=all_regions):
346 self.ui.write("Warning: cannot automatically fix overly long lines.\n")
347
348 def fix_line(self, line):
349 pass
350
1#!/usr/bin/env python
2#
3# Copyright (c) 2014, 2016 ARM Limited
4# All rights reserved
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 334 unchanged lines hidden (view full) ---

343 return style.normalized_len(line) <= 78
344
345 def fix(self, filename, regions=all_regions):
346 self.ui.write("Warning: cannot automatically fix overly long lines.\n")
347
348 def fix_line(self, line):
349 pass
350
351class ControlCharacters(LineVerifier):
352 languages = set(('C', 'C++', 'swig', 'python', 'asm', 'isa', 'scons'))
353 test_name = 'control character'
354 opt_name = 'ascii'
355
356 valid = ('\n', '\t')
357 invalid = "".join([chr(i) for i in range(0, 0x20) if chr(i) not in valid])
358
359 def check_line(self, line):
360 return self.fix_line(line) == line
361
362 def fix_line(self, line):
363 return line.translate(None, ControlCharacters.invalid)
364
351class BoolCompare(LineVerifier):
352 languages = set(('C', 'C++', 'python'))
353 test_name = 'boolean comparison'
354 opt_name = 'boolcomp'
355
356 regex = re.compile(r'\s*==\s*([Tt]rue|[Ff]alse)\b')
357
358 def check_line(self, line):

--- 21 unchanged lines hidden ---
365class BoolCompare(LineVerifier):
366 languages = set(('C', 'C++', 'python'))
367 test_name = 'boolean comparison'
368 opt_name = 'boolcomp'
369
370 regex = re.compile(r'\s*==\s*([Tt]rue|[Ff]alse)\b')
371
372 def check_line(self, line):

--- 21 unchanged lines hidden ---