"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/node-gyp/gyp/PRESUBMIT.py" (7 Feb 2017, 3662 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # Copyright (c) 2012 Google Inc. All rights reserved.
    2 # Use of this source code is governed by a BSD-style license that can be
    3 # found in the LICENSE file.
    4 
    5 
    6 """Top-level presubmit script for GYP.
    7 
    8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
    9 for more details about the presubmit API built into gcl.
   10 """
   11 
   12 
   13 PYLINT_BLACKLIST = [
   14     # TODO: fix me.
   15     # From SCons, not done in google style.
   16     'test/lib/TestCmd.py',
   17     'test/lib/TestCommon.py',
   18     'test/lib/TestGyp.py',
   19 ]
   20 
   21 
   22 PYLINT_DISABLED_WARNINGS = [
   23     # TODO: fix me.
   24     # Many tests include modules they don't use.
   25     'W0611',
   26     # Possible unbalanced tuple unpacking with sequence.
   27     'W0632',
   28     # Attempting to unpack a non-sequence.
   29     'W0633',
   30     # Include order doesn't properly include local files?
   31     'F0401',
   32     # Some use of built-in names.
   33     'W0622',
   34     # Some unused variables.
   35     'W0612',
   36     # Operator not preceded/followed by space.
   37     'C0323',
   38     'C0322',
   39     # Unnecessary semicolon.
   40     'W0301',
   41     # Unused argument.
   42     'W0613',
   43     # String has no effect (docstring in wrong place).
   44     'W0105',
   45     # map/filter on lambda could be replaced by comprehension.
   46     'W0110',
   47     # Use of eval.
   48     'W0123',
   49     # Comma not followed by space.
   50     'C0324',
   51     # Access to a protected member.
   52     'W0212',
   53     # Bad indent.
   54     'W0311',
   55     # Line too long.
   56     'C0301',
   57     # Undefined variable.
   58     'E0602',
   59     # Not exception type specified.
   60     'W0702',
   61     # No member of that name.
   62     'E1101',
   63     # Dangerous default {}.
   64     'W0102',
   65     # Cyclic import.
   66     'R0401',
   67     # Others, too many to sort.
   68     'W0201', 'W0232', 'E1103', 'W0621', 'W0108', 'W0223', 'W0231',
   69     'R0201', 'E0101', 'C0321',
   70     # ************* Module copy
   71     # W0104:427,12:_test.odict.__setitem__: Statement seems to have no effect
   72     'W0104',
   73 ]
   74 
   75 
   76 def CheckChangeOnUpload(input_api, output_api):
   77   report = []
   78   report.extend(input_api.canned_checks.PanProjectChecks(
   79       input_api, output_api))
   80   return report
   81 
   82 
   83 def CheckChangeOnCommit(input_api, output_api):
   84   report = []
   85 
   86   # Accept any year number from 2009 to the current year.
   87   current_year = int(input_api.time.strftime('%Y'))
   88   allowed_years = (str(s) for s in reversed(xrange(2009, current_year + 1)))
   89   years_re = '(' + '|'.join(allowed_years) + ')'
   90 
   91   # The (c) is deprecated, but tolerate it until it's removed from all files.
   92   license = (
   93       r'.*? Copyright (\(c\) )?%(year)s Google Inc\. All rights reserved\.\n'
   94       r'.*? Use of this source code is governed by a BSD-style license that '
   95         r'can be\n'
   96       r'.*? found in the LICENSE file\.\n'
   97   ) % {
   98       'year': years_re,
   99   }
  100 
  101   report.extend(input_api.canned_checks.PanProjectChecks(
  102       input_api, output_api, license_header=license))
  103   report.extend(input_api.canned_checks.CheckTreeIsOpen(
  104       input_api, output_api,
  105       'http://gyp-status.appspot.com/status',
  106       'http://gyp-status.appspot.com/current'))
  107 
  108   import os
  109   import sys
  110   old_sys_path = sys.path
  111   try:
  112     sys.path = ['pylib', 'test/lib'] + sys.path
  113     blacklist = PYLINT_BLACKLIST
  114     if sys.platform == 'win32':
  115       blacklist = [os.path.normpath(x).replace('\\', '\\\\')
  116                    for x in PYLINT_BLACKLIST]
  117     report.extend(input_api.canned_checks.RunPylint(
  118         input_api,
  119         output_api,
  120         black_list=blacklist,
  121         disabled_warnings=PYLINT_DISABLED_WARNINGS))
  122   finally:
  123     sys.path = old_sys_path
  124   return report
  125 
  126 
  127 TRYBOTS = [
  128     'linux_try',
  129     'mac_try',
  130     'win_try',
  131 ]
  132 
  133 
  134 def GetPreferredTryMasters(_, change):
  135   return {
  136       'client.gyp': { t: set(['defaulttests']) for t in TRYBOTS },
  137   }