|
|
@ -19,12 +19,16 @@ FILES_TO_EXCLUDE = [ |
|
|
|
'Shared/Levels.cs'] |
|
|
|
|
|
|
|
|
|
|
|
num_errors = 0 |
|
|
|
|
|
|
|
|
|
|
|
def emit_error(filename, line_num, error): |
|
|
|
global num_errors |
|
|
|
num_errors += 1 |
|
|
|
print('%s:%d: %s' % (filename, line_num, error)) |
|
|
|
|
|
|
|
|
|
|
|
def lint_csharp(filename): |
|
|
|
errors = [] |
|
|
|
with open(filename) as f: |
|
|
|
for i, line in enumerate(f): |
|
|
|
line_num = i + 1 |
|
|
@ -57,11 +61,17 @@ def main(args): |
|
|
|
# Remove generated files (of which there's lots). |
|
|
|
for exclusion_pattern in FILES_TO_EXCLUDE: |
|
|
|
csharp_files = [x for x in csharp_files if exclusion_pattern not in x] |
|
|
|
print('checking %d files' % len(csharp_files)) |
|
|
|
|
|
|
|
for filename in csharp_files: |
|
|
|
lint_csharp(filename) |
|
|
|
|
|
|
|
print('checked %d files and found %d errors' % ( |
|
|
|
len(csharp_files), num_errors)) |
|
|
|
|
|
|
|
if num_errors: |
|
|
|
return 1 |
|
|
|
return 0 |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
main(sys.argv[1:]) |
|
|
|
sys.exit(main(sys.argv[1:])) |