Ejemplo n.º 1
0
def run():
    executables = filter(is_executable, paths())
    failures = list(filter(lambda e: not has_correct_header(e), executables))

    if len(failures) != 0:
        output = '\n'.join([display_path(path) for path in failures])
        return Failure("Bad shebangs found in these files:", output)

    return Success("All executable shebangs are correct")
Ejemplo n.º 2
0
def run():
    executables = filter(is_executable, paths())
    failures = list(filter(lambda e: not has_correct_header(e), executables))

    if len(failures) == 0:
        return Success("All executable shebangs are correct")
    else:
        output = '\n'.join([display_path(path) for path in failures])
        return Failure("Bad shebangs found in these files:", output)
Ejemplo n.º 3
0
def display_failure(failure):
    path, line_number, match = failure
    line = match.group(1) + display_trailing_whitespace(match.group(2))
    return display_path(path) + colon() + str(line_number) + colon() + line