(exclude_testing: bool = False, limit_days: int = 10, limit_lines: int = 10)
| 51 | |
| 52 | |
| 53 | def main(exclude_testing: bool = False, limit_days: int = 10, limit_lines: int = 10): |
| 54 | file_lines = collect() |
| 55 | |
| 56 | if exclude_testing: |
| 57 | keys = filter(lambda k: "testing" not in k, file_lines.keys()) |
| 58 | file_lines = {key: file_lines[key] for key in keys} |
| 59 | |
| 60 | for filename, lines in sorted(file_lines.items()): |
| 61 | lines = sorted(file_lines[filename], reverse=True) |
| 62 | |
| 63 | # Filter lines older than x days |
| 64 | if limit_days: |
| 65 | lines = [line for line in lines if line_age(line) <= limit_days] |
| 66 | |
| 67 | if lines: |
| 68 | print("-" * 50) |
| 69 | print("File: {}".format(filename)) |
| 70 | |
| 71 | # Print lines up to the limit |
| 72 | for line in lines[:limit_lines]: |
| 73 | print(" " + line) |
| 74 | |
| 75 | if limit_lines < len(lines): |
| 76 | print("Showing {} out of {} lines".format(limit_lines, len(lines))) |
| 77 | |
| 78 | |
| 79 | if __name__ == "__main__": |
no test coverage detected