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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 # Justifications for each filter: | 103 # Justifications for each filter: |
104 # | 104 # |
105 # - build/include : Too many; fix in the future. | 105 # - build/include : Too many; fix in the future. |
106 # - build/include_order : Not happening; #ifdefed includes. | 106 # - build/include_order : Not happening; #ifdefed includes. |
107 # - build/namespace : I'm surprised by how often we violate this rule. | 107 # - build/namespace : I'm surprised by how often we violate this rule. |
108 # - readability/casting : Mistakes a whole bunch of function pointer. | 108 # - readability/casting : Mistakes a whole bunch of function pointer. |
109 # - runtime/int : Can be fixed long term; volume of errors too high | 109 # - runtime/int : Can be fixed long term; volume of errors too high |
110 # - runtime/virtual : Broken now, but can be fixed in the future? | 110 # - runtime/virtual : Broken now, but can be fixed in the future? |
111 # - whitespace/braces : We have a lot of explicit scoping in chrome code. | 111 # - whitespace/braces : We have a lot of explicit scoping in chrome code. |
| 112 # - readability/inheritance : Temporary, while the OVERRIDE and FINAL fixup |
| 113 # is in progress. |
112 cpplint._SetFilters('-build/include,-build/include_order,-build/namespace,' | 114 cpplint._SetFilters('-build/include,-build/include_order,-build/namespace,' |
113 '-readability/casting,-runtime/int,-runtime/virtual,' | 115 '-readability/casting,-runtime/int,-runtime/virtual,' |
114 '-whitespace/braces') | 116 '-whitespace/braces,-readability/inheritance') |
115 | 117 |
116 # We currently are more strict with normal code than unit tests; 4 and 5 are | 118 # We currently are more strict with normal code than unit tests; 4 and 5 are |
117 # the verbosity level that would normally be passed to cpplint.py through | 119 # the verbosity level that would normally be passed to cpplint.py through |
118 # --verbose=#. Hopefully, in the future, we can be more verbose. | 120 # --verbose=#. Hopefully, in the future, we can be more verbose. |
119 files = [f.AbsoluteLocalPath() for f in | 121 files = [f.AbsoluteLocalPath() for f in |
120 input_api.AffectedSourceFiles(source_file_filter)] | 122 input_api.AffectedSourceFiles(source_file_filter)] |
121 for file_name in files: | 123 for file_name in files: |
122 if _RE_IS_TEST.match(file_name): | 124 if _RE_IS_TEST.match(file_name): |
123 level = 5 | 125 level = 5 |
124 else: | 126 else: |
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1101 def CheckPatchFormatted(input_api, output_api): | 1103 def CheckPatchFormatted(input_api, output_api): |
1102 import git_cl | 1104 import git_cl |
1103 cmd = ['cl', 'format', '--dry-run', input_api.PresubmitLocalPath()] | 1105 cmd = ['cl', 'format', '--dry-run', input_api.PresubmitLocalPath()] |
1104 code, _ = git_cl.RunGitWithCode(cmd, suppress_stderr=True) | 1106 code, _ = git_cl.RunGitWithCode(cmd, suppress_stderr=True) |
1105 if code == 2: | 1107 if code == 2: |
1106 return [output_api.PresubmitPromptWarning( | 1108 return [output_api.PresubmitPromptWarning( |
1107 'Your patch is not formatted, please run git cl format.')] | 1109 'Your patch is not formatted, please run git cl format.')] |
1108 # As this is just a warning, ignore all other errors if the user | 1110 # As this is just a warning, ignore all other errors if the user |
1109 # happens to have a broken clang-format, doesn't use git, etc etc. | 1111 # happens to have a broken clang-format, doesn't use git, etc etc. |
1110 return [] | 1112 return [] |
OLD | NEW |