OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Simple Code Hygiene tool meant to be run as a presubmit test or standalone | 6 """Simple Code Hygiene tool meant to be run as a presubmit test or standalone |
7 | 7 |
8 Usage: | 8 Usage: |
9 ./code_hygiene.py <file1> <file2> ... | 9 ./code_hygiene.py <file1> <file2> ... |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 ',-build/include_order' | 51 ',-build/include_order' |
52 ',-readability/casting' | 52 ',-readability/casting' |
53 ',-readability/check' | 53 ',-readability/check' |
54 ',-readability/multiline_comment' | 54 ',-readability/multiline_comment' |
55 ',-runtime/sizeof' | 55 ',-runtime/sizeof' |
56 ',-runtime/threadsafe_fn' | 56 ',-runtime/threadsafe_fn' |
57 ',-whitespace/newline' | 57 ',-whitespace/newline' |
58 ] | 58 ] |
59 | 59 |
60 # http://pychecker.sourceforge.net/ | 60 # http://pychecker.sourceforge.net/ |
61 PYTHON_CHECKER = ['pychecker'] | 61 PYTHON_CHECKER = ['pychecker', '-stdlib'] |
62 | 62 |
63 RE_IGNORE = re.compile(r'@IGNORE_LINES_FOR_CODE_HYGIENE\[([0-9]+)\]') | 63 RE_IGNORE = re.compile(r'@IGNORE_LINES_FOR_CODE_HYGIENE\[([0-9]+)\]') |
64 | 64 |
65 # ====================================================================== | 65 # ====================================================================== |
66 def Debug(s): | 66 def Debug(s): |
67 if VERBOSE: | 67 if VERBOSE: |
68 print s | 68 print s |
69 | 69 |
70 | 70 |
71 def RunCommand(cmd): | 71 def RunCommand(cmd): |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 num_error += 1 | 554 num_error += 1 |
555 continue | 555 continue |
556 | 556 |
557 errors, warnings = CheckFile(filename, True) | 557 errors, warnings = CheckFile(filename, True) |
558 if errors: | 558 if errors: |
559 num_error += 1 | 559 num_error += 1 |
560 return num_error | 560 return num_error |
561 | 561 |
562 if __name__ == '__main__': | 562 if __name__ == '__main__': |
563 sys.exit(main(sys.argv[1:])) | 563 sys.exit(main(sys.argv[1:])) |
OLD | NEW |