llvm.org GIT mirror llvm / 4c4c952
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 Misha Brukman 11 years ago
1 changed file(s) with 2 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
1414 """
1515 line_num = 1
1616 for line in lines:
17 length = len(line.rstrip())
17 length = len(line.rstrip('\n'))
1818 if length > max_length:
1919 print '%s:%d:Line exceeds %d chars (%d)' % (filename, line_num,
2020 max_length, length)
3131 trailing_whitespace_re = re.compile(r'\s+$')
3232 line_num = 1
3333 for line in lines:
34 if trailing_whitespace_re.match(line.rstrip()):
34 if trailing_whitespace_re.match(line.rstrip('\n')):
3535 print '%s:%d:Trailing whitespace' % (filename, line_num)
3636 line_num += 1
3737