Logs an error if no Copyright message appears at the top of the file.
(filename, lines, error)
| 2478 | |
| 2479 | |
| 2480 | def CheckForCopyright(filename, lines, error): |
| 2481 | """Logs an error if no Copyright message appears at the top of the file.""" |
| 2482 | |
| 2483 | # We'll say it should occur by line 10. Don't forget there's a |
| 2484 | # placeholder line at the front. |
| 2485 | for line in range(1, min(len(lines), 11)): |
| 2486 | if re.search(r"Copyright", lines[line], re.IGNORECASE): |
| 2487 | break |
| 2488 | else: # means no copyright line was found |
| 2489 | error( |
| 2490 | filename, |
| 2491 | 0, |
| 2492 | "legal/copyright", |
| 2493 | 5, |
| 2494 | "No copyright message found. " |
| 2495 | 'You should have a line: "Copyright [year] <Copyright Owner>"', |
| 2496 | ) |
| 2497 | |
| 2498 | |
| 2499 | def GetIndentLevel(line): |
no test coverage detected
searching dependent graphs…