def _no_trailing_whitespace(relative_path, contents, linter_options):
    r"""Check that every file ends with a single \n."""
    del relative_path
    del linter_options

    trailing_whitespace = re.compile(r"(?<![ \t\r\n])[ \t]+$")

    for index, line in enumerate(contents):
        for space in trailing_whitespace.finditer(line):
            assert space.end() == len(line) - 1
            return LinterFailure("Trailing whitespace",
                                 index + 1,
                                 line[:space.start()] + line[space.end():])
def _no_trailing_whitespace ( relative_path , contents , linter_options ) : del relative_path del linter_options trailing_whitespace = re . compile ( r"(?<![ \t\r\n])[ \t]+$" ) for index , line in enumerate ( contents ) : for space in trailing_whitespace . finditer ( line ) : assert space . end ( ) == len ( line ) - 1 return LinterFailure ( "Trailing whitespace" , index + 1 , line [ : space . start ( ) ] + line [ space . end ( ) : ] )
r"""Check that every file ends with a single \n.