diff options
author | Misha Brukman <brukman+llvm@gmail.com> | 2009-02-20 22:28:45 +0000 |
---|---|---|
committer | Misha Brukman <brukman+llvm@gmail.com> | 2009-02-20 22:28:45 +0000 |
commit | c035e90b2350842ccdb4d1903d452d0067da9909 (patch) | |
tree | aaed73c693c25306766514df724863a8f9e44a33 /utils | |
parent | 862ad597f2bbba8f703b24784a04d44aa9abe0e9 (diff) | |
download | external_llvm-c035e90b2350842ccdb4d1903d452d0067da9909.zip external_llvm-c035e90b2350842ccdb4d1903d452d0067da9909.tar.gz external_llvm-c035e90b2350842ccdb4d1903d452d0067da9909.tar.bz2 |
Only strip the newline character at the end of the lines that we're considering
for length and for trailing whitespace; otherwise, the whitespace themselves
will also be removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65182 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/lint/common_lint.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/lint/common_lint.py b/utils/lint/common_lint.py index 18263838..e08c93c 100644 --- a/utils/lint/common_lint.py +++ b/utils/lint/common_lint.py @@ -15,7 +15,7 @@ def VerifyLineLength(filename, lines, max_length): """ line_num = 1 for line in lines: - length = len(line.rstrip()) + length = len(line.rstrip('\n')) if length > max_length: print '%s:%d:Line exceeds %d chars (%d)' % (filename, line_num, max_length, length) @@ -32,7 +32,7 @@ def VerifyTrailingWhitespace(filename, lines): trailing_whitespace_re = re.compile(r'\s+$') line_num = 1 for line in lines: - if trailing_whitespace_re.match(line.rstrip()): + if trailing_whitespace_re.match(line.rstrip('\n')): print '%s:%d:Trailing whitespace' % (filename, line_num) line_num += 1 |