Logs an error if no Copyright message appears at the top of the file.
(filename, lines, error)
| 2433 | |
| 2434 | |
| 2435 | def CheckForCopyright(filename, lines, error): |
| 2436 | """Logs an error if no Copyright message appears at the top of the file.""" |
| 2437 | |
| 2438 | # We'll say it should occur by line 10. Don't forget there's a |
| 2439 | # placeholder line at the front. |
| 2440 | for line in range(1, min(len(lines), 11)): |
| 2441 | if re.search(r"Copyright", lines[line], re.IGNORECASE): |
| 2442 | break |
| 2443 | else: # means no copyright line was found |
| 2444 | error( |
| 2445 | filename, |
| 2446 | 0, |
| 2447 | "legal/copyright", |
| 2448 | 5, |
| 2449 | "No copyright message found. " |
| 2450 | 'You should have a line: "Copyright [year] <Copyright Owner>"', |
| 2451 | ) |
| 2452 | |
| 2453 | |
| 2454 | def GetIndentLevel(line): |