media/webrtc/trunk/tools/gyp/PRESUBMIT.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/webrtc/trunk/tools/gyp/PRESUBMIT.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,109 @@
     1.4 +# Copyright (c) 2012 Google Inc. All rights reserved.
     1.5 +# Use of this source code is governed by a BSD-style license that can be
     1.6 +# found in the LICENSE file.
     1.7 +
     1.8 +
     1.9 +"""Top-level presubmit script for GYP.
    1.10 +
    1.11 +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
    1.12 +for more details about the presubmit API built into gcl.
    1.13 +"""
    1.14 +
    1.15 +
    1.16 +PYLINT_BLACKLIST = [
    1.17 +    # TODO: fix me.
    1.18 +    # From SCons, not done in google style.
    1.19 +    'test/lib/TestCmd.py',
    1.20 +    'test/lib/TestCommon.py',
    1.21 +    'test/lib/TestGyp.py',
    1.22 +    # Needs style fix.
    1.23 +    'pylib/gyp/generator/scons.py',
    1.24 +    'pylib/gyp/generator/xcode.py',
    1.25 +]
    1.26 +
    1.27 +
    1.28 +PYLINT_DISABLED_WARNINGS = [
    1.29 +    # TODO: fix me.
    1.30 +    # Many tests include modules they don't use.
    1.31 +    'W0611',
    1.32 +    # Include order doesn't properly include local files?
    1.33 +    'F0401',
    1.34 +    # Some use of built-in names.
    1.35 +    'W0622',
    1.36 +    # Some unused variables.
    1.37 +    'W0612',
    1.38 +    # Operator not preceded/followed by space.
    1.39 +    'C0323',
    1.40 +    'C0322',
    1.41 +    # Unnecessary semicolon.
    1.42 +    'W0301',
    1.43 +    # Unused argument.
    1.44 +    'W0613',
    1.45 +    # String has no effect (docstring in wrong place).
    1.46 +    'W0105',
    1.47 +    # Comma not followed by space.
    1.48 +    'C0324',
    1.49 +    # Access to a protected member.
    1.50 +    'W0212',
    1.51 +    # Bad indent.
    1.52 +    'W0311',
    1.53 +    # Line too long.
    1.54 +    'C0301',
    1.55 +    # Undefined variable.
    1.56 +    'E0602',
    1.57 +    # Not exception type specified.
    1.58 +    'W0702',
    1.59 +    # No member of that name.
    1.60 +    'E1101',
    1.61 +    # Dangerous default {}.
    1.62 +    'W0102',
    1.63 +    # Others, too many to sort.
    1.64 +    'W0201', 'W0232', 'E1103', 'W0621', 'W0108', 'W0223', 'W0231',
    1.65 +    'R0201', 'E0101', 'C0321',
    1.66 +    # ************* Module copy
    1.67 +    # W0104:427,12:_test.odict.__setitem__: Statement seems to have no effect
    1.68 +    'W0104',
    1.69 +]
    1.70 +
    1.71 +
    1.72 +def CheckChangeOnUpload(input_api, output_api):
    1.73 +  report = []
    1.74 +  report.extend(input_api.canned_checks.PanProjectChecks(
    1.75 +      input_api, output_api))
    1.76 +  return report
    1.77 +
    1.78 +
    1.79 +def CheckChangeOnCommit(input_api, output_api):
    1.80 +  report = []
    1.81 +  license = (
    1.82 +      r'.*? Copyright \(c\) %(year)s Google Inc\. All rights reserved\.\n'
    1.83 +      r'.*? Use of this source code is governed by a BSD-style license that '
    1.84 +        r'can be\n'
    1.85 +      r'.*? found in the LICENSE file\.\n'
    1.86 +  ) % {
    1.87 +      'year': input_api.time.strftime('%Y'),
    1.88 +  }
    1.89 +
    1.90 +  report.extend(input_api.canned_checks.PanProjectChecks(
    1.91 +      input_api, output_api, license_header=license))
    1.92 +  report.extend(input_api.canned_checks.CheckTreeIsOpen(
    1.93 +      input_api, output_api,
    1.94 +      'http://gyp-status.appspot.com/status',
    1.95 +      'http://gyp-status.appspot.com/current'))
    1.96 +
    1.97 +  import sys
    1.98 +  old_sys_path = sys.path
    1.99 +  try:
   1.100 +    sys.path = ['pylib', 'test/lib'] + sys.path
   1.101 +    report.extend(input_api.canned_checks.RunPylint(
   1.102 +        input_api,
   1.103 +        output_api,
   1.104 +        black_list=PYLINT_BLACKLIST,
   1.105 +        disabled_warnings=PYLINT_DISABLED_WARNINGS))
   1.106 +  finally:
   1.107 +    sys.path = old_sys_path
   1.108 +  return report
   1.109 +
   1.110 +
   1.111 +def GetPreferredTrySlaves():
   1.112 +  return ['gyp-win32', 'gyp-win64', 'gyp-linux', 'gyp-mac']

mercurial