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")
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)
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