Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
24 lines (20 sloc) 775 Bytes
# -*- mode: python -*-
# Public Domain (-) 2010-2012 The Ampify Authors.
# See the Ampify UNLICENSE file for details.
@checker(include=['*.coffee', '*.java', '*.js', '*.go', '*.rc', '*.rs', '*.py'])
def stray_whitespace(changelist, files):
"""The following lines in %s have trailing whitespace:\n\n\t"""
for filename in files:
file = open(filename, 'rb')
stray_lines = []
line_number = 0
for line in file.readlines():
if not line:
line = line[:-1]
line_number += 1
if line != line.rstrip():
if stray_lines:
changelist.error(filename, '\n\t'.join(map(str, stray_lines)))
Something went wrong with that request. Please try again.