| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Generic presubmit checks that can be reused by other presubmit checks.""" | 5 """Generic presubmit checks that can be reused by other presubmit checks.""" |
| 6 | 6 |
| 7 import os as _os | 7 import os as _os |
| 8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) | 8 _HERE = _os.path.dirname(_os.path.abspath(__file__)) |
| 9 | 9 |
| 10 | 10 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 # - build/include_order : Not happening; #ifdefed includes. | 107 # - build/include_order : Not happening; #ifdefed includes. |
| 108 # - build/namespace : I'm surprised by how often we violate this rule. | 108 # - build/namespace : I'm surprised by how often we violate this rule. |
| 109 # - readability/casting : Mistakes a whole bunch of function pointer. | 109 # - readability/casting : Mistakes a whole bunch of function pointer. |
| 110 # - runtime/int : Can be fixed long term; volume of errors too high | 110 # - runtime/int : Can be fixed long term; volume of errors too high |
| 111 # - runtime/virtual : Broken now, but can be fixed in the future? | 111 # - runtime/virtual : Broken now, but can be fixed in the future? |
| 112 # - whitespace/braces : We have a lot of explicit scoping in chrome code. | 112 # - whitespace/braces : We have a lot of explicit scoping in chrome code. |
| 113 cpplint._SetFilters('-build/include,-build/include_order,-build/namespace,' | 113 cpplint._SetFilters('-build/include,-build/include_order,-build/namespace,' |
| 114 '-readability/casting,-runtime/int,-runtime/virtual,' | 114 '-readability/casting,-runtime/int,-runtime/virtual,' |
| 115 '-whitespace/braces') | 115 '-whitespace/braces') |
| 116 | 116 |
| 117 # Replace <hash_map> and <hash_set> as headers that need to be included |
| 118 # with "base/hash_tables.h" instead. |
| 119 cpplint._re_pattern_templates = [ |
| 120 (a, b, 'base/hash_tables.h') |
| 121 if header in ('<hash_map>', '<hash_set>') else (a, b, header) |
| 122 for (a, b, header) in cpplint._re_pattern_templates |
| 123 ] |
| 124 |
| 117 # We currently are more strict with normal code than unit tests; 4 and 5 are | 125 # We currently are more strict with normal code than unit tests; 4 and 5 are |
| 118 # the verbosity level that would normally be passed to cpplint.py through | 126 # the verbosity level that would normally be passed to cpplint.py through |
| 119 # --verbose=#. Hopefully, in the future, we can be more verbose. | 127 # --verbose=#. Hopefully, in the future, we can be more verbose. |
| 120 files = [f.AbsoluteLocalPath() for f in | 128 files = [f.AbsoluteLocalPath() for f in |
| 121 input_api.AffectedSourceFiles(source_file_filter)] | 129 input_api.AffectedSourceFiles(source_file_filter)] |
| 122 for file_name in files: | 130 for file_name in files: |
| 123 if _RE_IS_TEST.match(file_name): | 131 if _RE_IS_TEST.match(file_name): |
| 124 level = 5 | 132 level = 5 |
| 125 else: | 133 else: |
| 126 level = 4 | 134 level = 4 |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 snapshot("checking description") | 1015 snapshot("checking description") |
| 1008 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 1016 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 1009 input_api, output_api)) | 1017 input_api, output_api)) |
| 1010 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( | 1018 results.extend(input_api.canned_checks.CheckDoNotSubmitInDescription( |
| 1011 input_api, output_api)) | 1019 input_api, output_api)) |
| 1012 snapshot("checking do not submit in files") | 1020 snapshot("checking do not submit in files") |
| 1013 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( | 1021 results.extend(input_api.canned_checks.CheckDoNotSubmitInFiles( |
| 1014 input_api, output_api)) | 1022 input_api, output_api)) |
| 1015 snapshot("done") | 1023 snapshot("done") |
| 1016 return results | 1024 return results |
| OLD | NEW |