| OLD | NEW |
| 1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 1 # Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 2 # | 2 # |
| 3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
| 4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
| 5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
| 6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
| 7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
| 8 | 8 |
| 9 import json | 9 import json |
| 10 import os | 10 import os |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 for f in input_api.AffectedSourceFiles(source_file_filter): | 248 for f in input_api.AffectedSourceFiles(source_file_filter): |
| 249 # Note that moved/renamed files also count as added. | 249 # Note that moved/renamed files also count as added. |
| 250 if f.Action() == 'A' or _IsLintWhitelisted(whitelist_dirs, f.LocalPath()): | 250 if f.Action() == 'A' or _IsLintWhitelisted(whitelist_dirs, f.LocalPath()): |
| 251 files.append(f.AbsoluteLocalPath()) | 251 files.append(f.AbsoluteLocalPath()) |
| 252 | 252 |
| 253 for file_name in files: | 253 for file_name in files: |
| 254 cpplint.ProcessFile(file_name, verbosity_level) | 254 cpplint.ProcessFile(file_name, verbosity_level) |
| 255 | 255 |
| 256 if cpplint._cpplint_state.error_count > 0: | 256 if cpplint._cpplint_state.error_count > 0: |
| 257 if input_api.is_committing: | 257 if input_api.is_committing: |
| 258 # TODO(kjellander): Change back to PresubmitError below when we're | 258 res_type = output_api.PresubmitError |
| 259 # confident with the lint settings. | |
| 260 res_type = output_api.PresubmitPromptWarning | |
| 261 else: | 259 else: |
| 262 res_type = output_api.PresubmitPromptWarning | 260 res_type = output_api.PresubmitPromptWarning |
| 263 result = [res_type('Changelist failed cpplint.py check.')] | 261 result = [res_type('Changelist failed cpplint.py check.')] |
| 264 | 262 |
| 265 return result | 263 return result |
| 266 | 264 |
| 267 def _CheckNoSourcesAbove(input_api, gn_files, output_api): | 265 def _CheckNoSourcesAbove(input_api, gn_files, output_api): |
| 268 # Disallow referencing source files with paths above the GN file location. | 266 # Disallow referencing source files with paths above the GN file location. |
| 269 source_pattern = input_api.re.compile(r' +sources \+?= \[(.*?)\]', | 267 source_pattern = input_api.re.compile(r' +sources \+?= \[(.*?)\]', |
| 270 re.MULTILINE | re.DOTALL) | 268 re.MULTILINE | re.DOTALL) |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 input_api, output_api)) | 559 input_api, output_api)) |
| 562 results.extend(input_api.canned_checks.CheckChangeHasDescription( | 560 results.extend(input_api.canned_checks.CheckChangeHasDescription( |
| 563 input_api, output_api)) | 561 input_api, output_api)) |
| 564 results.extend(_CheckChangeHasBugField(input_api, output_api)) | 562 results.extend(_CheckChangeHasBugField(input_api, output_api)) |
| 565 results.extend(input_api.canned_checks.CheckChangeHasTestField( | 563 results.extend(input_api.canned_checks.CheckChangeHasTestField( |
| 566 input_api, output_api)) | 564 input_api, output_api)) |
| 567 results.extend(input_api.canned_checks.CheckTreeIsOpen( | 565 results.extend(input_api.canned_checks.CheckTreeIsOpen( |
| 568 input_api, output_api, | 566 input_api, output_api, |
| 569 json_url='http://webrtc-status.appspot.com/current?format=json')) | 567 json_url='http://webrtc-status.appspot.com/current?format=json')) |
| 570 return results | 568 return results |
| OLD | NEW |