libv8 6.3.292.48.1 → 6.7.288.46.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +10 -34
- data/CHANGELOG.md +16 -0
- data/README.md +9 -63
- data/Rakefile +2 -2
- data/ext/libv8/builder.rb +22 -87
- data/ext/libv8/extconf.rb +1 -1
- data/ext/libv8/paths.rb +5 -18
- data/lib/libv8/version.rb +1 -1
- data/spec/location_spec.rb +1 -2
- data/spec/spec_helper.rb +0 -1
- data/vendor/depot_tools/.gitattributes +1 -2
- data/vendor/depot_tools/OWNERS +0 -1
- data/vendor/depot_tools/PRESUBMIT.py +11 -6
- data/vendor/depot_tools/README.md +0 -1
- data/vendor/depot_tools/WATCHLISTS +0 -6
- data/vendor/depot_tools/auth.py +129 -87
- data/vendor/depot_tools/autoninja +11 -1
- data/vendor/depot_tools/autoninja.bat +7 -1
- data/vendor/depot_tools/autoninja.py +14 -6
- data/vendor/depot_tools/bootstrap/win/manifest.txt +1 -1
- data/vendor/depot_tools/bootstrap/win/manifest_bleeding_edge.txt +1 -1
- data/vendor/depot_tools/cipd +23 -2
- data/vendor/depot_tools/cipd.bat +2 -2
- data/vendor/depot_tools/cipd_client_version +1 -1
- data/vendor/depot_tools/cipd_manifest.txt +17 -7
- data/vendor/depot_tools/cit.py +7 -6
- data/vendor/depot_tools/cpplint.py +195 -35
- data/vendor/depot_tools/detect_host_arch.py +51 -0
- data/vendor/depot_tools/download_from_google_storage.py +85 -26
- data/vendor/depot_tools/fetch.py +11 -6
- data/vendor/depot_tools/fetch_configs/chromium.py +0 -1
- data/vendor/depot_tools/fetch_configs/goma_client.py +41 -0
- data/vendor/depot_tools/fetch_configs/infra.py +0 -1
- data/vendor/depot_tools/fetch_configs/infra_internal.py +0 -1
- data/vendor/depot_tools/gclient-new-workdir.py +4 -0
- data/vendor/depot_tools/gclient.py +732 -476
- data/vendor/depot_tools/gclient_eval.py +569 -58
- data/vendor/depot_tools/gclient_scm.py +258 -46
- data/vendor/depot_tools/gclient_utils.py +17 -1
- data/vendor/depot_tools/gerrit_util.py +46 -13
- data/vendor/depot_tools/git_cache.py +0 -2
- data/vendor/depot_tools/git_cl.py +176 -335
- data/vendor/depot_tools/git_common.py +19 -16
- data/vendor/depot_tools/git_footers.py +19 -5
- data/vendor/depot_tools/git_hyper_blame.py +9 -3
- data/vendor/depot_tools/git_new_branch.py +15 -3
- data/vendor/depot_tools/git_upstream_diff.py +7 -2
- data/vendor/depot_tools/gsutil.py +1 -1
- data/vendor/depot_tools/infra/config/cq.cfg +1 -2
- data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
- data/vendor/depot_tools/luci-auth +13 -0
- data/vendor/depot_tools/luci-auth.bat +8 -0
- data/vendor/depot_tools/man/html/depot_tools.html +0 -8
- data/vendor/depot_tools/man/html/git-upstream-diff.html +20 -3
- data/vendor/depot_tools/man/man1/git-upstream-diff.1 +27 -6
- data/vendor/depot_tools/man/man7/depot_tools.7 +0 -5
- data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +2 -2
- data/vendor/depot_tools/man/src/git-upstream-diff.txt +21 -3
- data/vendor/depot_tools/man/src/make_docs.sh +6 -0
- data/vendor/depot_tools/my_activity.py +283 -93
- data/vendor/depot_tools/owners.py +9 -4
- data/vendor/depot_tools/owners_finder.py +7 -3
- data/vendor/depot_tools/post_build_ninja_summary.py +322 -0
- data/vendor/depot_tools/presubmit_canned_checks.py +91 -106
- data/vendor/depot_tools/presubmit_support.py +219 -157
- data/vendor/depot_tools/prpc +13 -0
- data/vendor/depot_tools/prpc.bat +8 -0
- data/vendor/depot_tools/recipes/OWNERS +3 -1
- data/vendor/depot_tools/recipes/README.recipes.md +70 -111
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/__init__.py +12 -5
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/api.py +36 -68
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json +0 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{trychange_oauth2_json.json → no_apply_patch_on_gclient.json} +64 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{no_shallow.json → shallow.json} +1 -1
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json +0 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_empty_revision.json +0 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +0 -6
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +0 -7
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +0 -6
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json +44 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{trychange_oauth2_buildbot.json → tryjob_gerrit_branch_heads.json} +51 -5
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json +0 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +48 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.py +19 -26
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/bot_update.py +193 -155
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/test_api.py +9 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/api.py +2 -7
- data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +31 -5
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/basic.json +37 -19
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/buildbot.json +37 -19
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/revision.json +37 -19
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/tryserver.json +37 -23
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.py +4 -0
- data/vendor/depot_tools/recipes/recipe_modules/gerrit/api.py +40 -8
- data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +3 -3
- data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.py +6 -3
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/OWNERS +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/__init__.py +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/api.py +7 -56
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.py +15 -16
- data/vendor/depot_tools/recipes/recipes.py +4 -2
- data/vendor/depot_tools/recipes/trigger_recipe_roller.txt +12 -0
- data/vendor/depot_tools/roll_dep.py +35 -37
- data/vendor/depot_tools/support/chromite_wrapper +1 -1
- data/vendor/depot_tools/third_party/logilab/astroid/README.chromium +3 -3
- data/vendor/depot_tools/third_party/logilab/astroid/__pkginfo__.py +2 -2
- data/vendor/depot_tools/third_party/logilab/astroid/astpeephole.py +86 -0
- data/vendor/depot_tools/third_party/logilab/astroid/bases.py +53 -66
- data/vendor/depot_tools/third_party/logilab/astroid/brain/py2pytest.py +31 -31
- data/vendor/depot_tools/third_party/logilab/astroid/brain/pynose.py +39 -16
- data/vendor/depot_tools/third_party/logilab/astroid/brain/pysix_moves.py +225 -189
- data/vendor/depot_tools/third_party/logilab/astroid/inference.py +45 -41
- data/vendor/depot_tools/third_party/logilab/astroid/manager.py +1 -0
- data/vendor/depot_tools/third_party/logilab/astroid/modutils.py +2 -2
- data/vendor/depot_tools/third_party/logilab/astroid/node_classes.py +3 -2
- data/vendor/depot_tools/third_party/logilab/astroid/nodes.py +1 -0
- data/vendor/depot_tools/third_party/logilab/astroid/protocols.py +57 -3
- data/vendor/depot_tools/third_party/logilab/astroid/raw_building.py +1 -1
- data/vendor/depot_tools/third_party/logilab/astroid/rebuilder.py +21 -1
- data/vendor/depot_tools/third_party/logilab/astroid/scoped_nodes.py +58 -33
- data/vendor/depot_tools/third_party/pylint/README.chromium +2 -2
- data/vendor/depot_tools/third_party/pylint/__pkginfo__.py +3 -3
- data/vendor/depot_tools/third_party/pylint/checkers/base.py +6 -18
- data/vendor/depot_tools/third_party/pylint/checkers/classes.py +64 -63
- data/vendor/depot_tools/third_party/pylint/checkers/design_analysis.py +25 -57
- data/vendor/depot_tools/third_party/pylint/checkers/format.py +14 -10
- data/vendor/depot_tools/third_party/pylint/checkers/python3.py +142 -37
- data/vendor/depot_tools/third_party/pylint/checkers/spelling.py +10 -1
- data/vendor/depot_tools/third_party/pylint/checkers/stdlib.py +50 -7
- data/vendor/depot_tools/third_party/pylint/checkers/strings.py +1 -1
- data/vendor/depot_tools/third_party/pylint/epylint.py +2 -1
- data/vendor/depot_tools/third_party/pylint/gui.py +1 -1
- data/vendor/depot_tools/third_party/pylint/lint.py +88 -23
- data/vendor/depot_tools/third_party/pylint/reporters/html.py +37 -5
- data/vendor/depot_tools/third_party/pylint/testutils.py +1 -1
- data/vendor/depot_tools/third_party/pylint/utils.py +5 -0
- data/vendor/depot_tools/vpython +31 -1
- data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +35 -2
- data/vendor/depot_tools/win_toolchain/package_from_installed.py +0 -15
- data/vendor/depot_tools/yapf +17 -0
- data/vendor/depot_tools/{apply_issue.bat → yapf.bat} +2 -2
- metadata +16 -58
- data/ext/libv8/compiler.rb +0 -39
- data/ext/libv8/compiler/apple_llvm.rb +0 -22
- data/ext/libv8/compiler/clang.rb +0 -22
- data/ext/libv8/compiler/gcc.rb +0 -22
- data/ext/libv8/compiler/generic_compiler.rb +0 -66
- data/ext/libv8/make.rb +0 -13
- data/ext/libv8/patcher.rb +0 -21
- data/patches/0001-Build-a-standalone-static-library.patch +0 -26
- data/patches/0002-Don-t-compile-unnecessary-stuff.patch +0 -85
- data/patches/0003-Use-the-fPIC-flag-for-the-static-library.patch +0 -25
- data/patches/0004-Do-not-embed-debug-symbols-in-macOS-libraries.patch +0 -25
- data/patches/0005-Remove-TryInstallOptimizedCode.patch +0 -321
- data/patches/mingw-generate-makefiles.sh +0 -97
- data/spec/compiler/apple_llvm_spec.rb +0 -37
- data/spec/compiler/clang_spec.rb +0 -37
- data/spec/compiler/gcc_spec.rb +0 -37
- data/spec/compiler/generic_compiler_spec.rb +0 -50
- data/spec/compiler_spec.rb +0 -45
- data/spec/support/compiler_helpers.rb +0 -47
- data/vendor/depot_tools/apply_issue +0 -8
- data/vendor/depot_tools/apply_issue.py +0 -315
- data/vendor/depot_tools/man/html/git-cherry-pick-upload.html +0 -815
- data/vendor/depot_tools/man/man1/git-cherry-pick-upload.1 +0 -80
- data/vendor/depot_tools/man/src/_git-cherry-pick-upload_desc.helper.txt +0 -1
- data/vendor/depot_tools/man/src/git-cherry-pick-upload.demo.1.sh +0 -17
- data/vendor/depot_tools/man/src/git-cherry-pick-upload.txt +0 -35
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2.json +0 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json_win.json +0 -196
- data/vendor/depot_tools/recipes/recipe_modules/rietveld/__init__.py +0 -6
- data/vendor/depot_tools/recipes/recipe_modules/rietveld/api.py +0 -97
- data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/basic.json +0 -8
- data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/buildbot.json +0 -30
- data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/no_auth.json +0 -27
- data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.py +0 -38
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_rietveld_patch.json +0 -69
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_rietveld_patch_new.json +0 -69
- data/vendor/depot_tools/third_party/cq_client/OWNERS +0 -2
- data/vendor/depot_tools/third_party/cq_client/README.depot_tools.md +0 -2
- data/vendor/depot_tools/third_party/cq_client/README.md +0 -59
- data/vendor/depot_tools/third_party/cq_client/__init__.py +0 -3
- data/vendor/depot_tools/third_party/cq_client/v1/__init__.py +0 -3
- data/vendor/depot_tools/third_party/cq_client/v1/cq.pb.go +0 -810
- data/vendor/depot_tools/third_party/cq_client/v1/cq.proto +0 -281
- data/vendor/depot_tools/third_party/cq_client/v1/cq_pb2.py +0 -794
- data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_both.cfg +0 -71
- data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_gerrit.cfg +0 -58
- data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_rietveld.cfg +0 -60
- data/vendor/depot_tools/third_party/cq_client/v2/__init__.py +0 -3
- data/vendor/depot_tools/third_party/cq_client/v2/cq.pb.go +0 -792
- data/vendor/depot_tools/third_party/cq_client/v2/cq.proto +0 -270
- data/vendor/depot_tools/third_party/cq_client/v2/cq_pb2.py +0 -841
@@ -19,10 +19,10 @@ from __future__ import absolute_import
|
|
19
19
|
|
20
20
|
modname = distname = 'pylint'
|
21
21
|
|
22
|
-
numversion = (1, 4,
|
22
|
+
numversion = (1, 4, 5)
|
23
23
|
version = '.'.join([str(num) for num in numversion])
|
24
24
|
|
25
|
-
install_requires = ['logilab-common >= 0.53.0', 'astroid >= 1.3.
|
25
|
+
install_requires = ['logilab-common >= 0.53.0', 'astroid >= 1.3.6,<1.4.0', 'six']
|
26
26
|
|
27
27
|
license = 'GPL'
|
28
28
|
description = "python code static checker"
|
@@ -67,4 +67,4 @@ scripts = [join('bin', filename)
|
|
67
67
|
for filename in ('pylint', 'pylint-gui', "symilar", "epylint",
|
68
68
|
"pyreverse")]
|
69
69
|
|
70
|
-
include_dirs = ['test']
|
70
|
+
include_dirs = [join('pylint', 'test')]
|
@@ -497,11 +497,6 @@ functions, methods
|
|
497
497
|
'bad-function option). Usual black listed functions are the ones '
|
498
498
|
'like map, or filter , where Python offers now some cleaner '
|
499
499
|
'alternative like list comprehension.'),
|
500
|
-
'W0142': ('Used * or ** magic',
|
501
|
-
'star-args',
|
502
|
-
'Used when a function or method is called using `*args` or '
|
503
|
-
'`**kwargs` to dispatch arguments. This doesn\'t improve '
|
504
|
-
'readability and should be used with care.'),
|
505
500
|
'W0150': ("%s statement in finally block may swallow exception",
|
506
501
|
'lost-exception',
|
507
502
|
'Used when a break or a return statement is found inside the '
|
@@ -753,7 +748,7 @@ functions, methods
|
|
753
748
|
"""just print a warning on exec statements"""
|
754
749
|
self.add_message('exec-used', node=node)
|
755
750
|
|
756
|
-
@check_messages('bad-builtin', '
|
751
|
+
@check_messages('bad-builtin', 'eval-used',
|
757
752
|
'exec-used', 'missing-reversed-argument',
|
758
753
|
'bad-reversed-sequence')
|
759
754
|
def visit_callfunc(self, node):
|
@@ -774,18 +769,6 @@ functions, methods
|
|
774
769
|
self.add_message('eval-used', node=node)
|
775
770
|
if name in self.config.bad_functions:
|
776
771
|
self.add_message('bad-builtin', node=node, args=name)
|
777
|
-
if node.starargs or node.kwargs:
|
778
|
-
scope = node.scope()
|
779
|
-
if isinstance(scope, astroid.Function):
|
780
|
-
toprocess = [(n, vn) for (n, vn) in ((node.starargs, scope.args.vararg),
|
781
|
-
(node.kwargs, scope.args.kwarg)) if n]
|
782
|
-
if toprocess:
|
783
|
-
for cfnode, fargname in toprocess[:]:
|
784
|
-
if getattr(cfnode, 'name', None) == fargname:
|
785
|
-
toprocess.remove((cfnode, fargname))
|
786
|
-
if not toprocess:
|
787
|
-
return # star-args can be skipped
|
788
|
-
self.add_message('star-args', node=node.func)
|
789
772
|
|
790
773
|
@check_messages('assert-on-tuple')
|
791
774
|
def visit_assert(self, node):
|
@@ -1171,6 +1154,11 @@ class DocStringChecker(_BasicChecker):
|
|
1171
1154
|
lines = node.body[-1].lineno - node.body[0].lineno + 1
|
1172
1155
|
else:
|
1173
1156
|
lines = 0
|
1157
|
+
|
1158
|
+
if node_type == 'module' and not lines:
|
1159
|
+
# If the module has no body, there's no reason
|
1160
|
+
# to require a docstring.
|
1161
|
+
return
|
1174
1162
|
max_lines = self.config.docstring_min_length
|
1175
1163
|
|
1176
1164
|
if node_type != 'module' and max_lines > -1 and lines < max_lines:
|
@@ -107,9 +107,9 @@ def _is_attribute_property(name, klass):
|
|
107
107
|
MSGS = {
|
108
108
|
'F0202': ('Unable to check methods signature (%s / %s)',
|
109
109
|
'method-check-failed',
|
110
|
-
'Used when Pylint has been unable to check methods signature
|
111
|
-
compatibility for an unexpected reason. Please report this kind
|
112
|
-
if you don\'t make sense of it.'),
|
110
|
+
'Used when Pylint has been unable to check methods signature '
|
111
|
+
'compatibility for an unexpected reason. Please report this kind '
|
112
|
+
'if you don\'t make sense of it.'),
|
113
113
|
|
114
114
|
'E0202': ('An attribute defined in %s line %s hides this method',
|
115
115
|
'method-hidden',
|
@@ -118,35 +118,35 @@ MSGS = {
|
|
118
118
|
'client code.'),
|
119
119
|
'E0203': ('Access to member %r before its definition line %s',
|
120
120
|
'access-member-before-definition',
|
121
|
-
'Used when an instance member is accessed before it\'s actually
|
122
|
-
assigned.'),
|
121
|
+
'Used when an instance member is accessed before it\'s actually '
|
122
|
+
'assigned.'),
|
123
123
|
'W0201': ('Attribute %r defined outside __init__',
|
124
124
|
'attribute-defined-outside-init',
|
125
|
-
'Used when an instance attribute is defined outside the __init__
|
126
|
-
method.'),
|
125
|
+
'Used when an instance attribute is defined outside the __init__ '
|
126
|
+
'method.'),
|
127
127
|
|
128
128
|
'W0212': ('Access to a protected member %s of a client class', # E0214
|
129
129
|
'protected-access',
|
130
|
-
'Used when a protected member (i.e. class member with a name
|
131
|
-
beginning with an underscore) is access outside the class or a
|
132
|
-
descendant of the class where it\'s defined.'),
|
130
|
+
'Used when a protected member (i.e. class member with a name '
|
131
|
+
'beginning with an underscore) is access outside the class or a '
|
132
|
+
'descendant of the class where it\'s defined.'),
|
133
133
|
|
134
134
|
'E0211': ('Method has no argument',
|
135
135
|
'no-method-argument',
|
136
|
-
'Used when a method which should have the bound instance as
|
137
|
-
first argument has no argument defined.'),
|
136
|
+
'Used when a method which should have the bound instance as '
|
137
|
+
'first argument has no argument defined.'),
|
138
138
|
'E0213': ('Method should have "self" as first argument',
|
139
139
|
'no-self-argument',
|
140
|
-
'Used when a method has an attribute different the "self" as
|
141
|
-
first argument. This is considered as an error since this is
|
142
|
-
a so common convention that you shouldn\'t break it!'),
|
143
|
-
'C0202': ('Class method %s should have %s as first argument',
|
140
|
+
'Used when a method has an attribute different the "self" as '
|
141
|
+
'first argument. This is considered as an error since this is '
|
142
|
+
'a so common convention that you shouldn\'t break it!'),
|
143
|
+
'C0202': ('Class method %s should have %s as first argument',
|
144
144
|
'bad-classmethod-argument',
|
145
145
|
'Used when a class method has a first argument named differently '
|
146
146
|
'than the value specified in valid-classmethod-first-arg option '
|
147
147
|
'(default to "cls"), recommended to easily differentiate them '
|
148
148
|
'from regular instance methods.'),
|
149
|
-
'C0203': ('Metaclass method %s should have %s as first argument',
|
149
|
+
'C0203': ('Metaclass method %s should have %s as first argument',
|
150
150
|
'bad-mcs-method-argument',
|
151
151
|
'Used when a metaclass method has a first agument named '
|
152
152
|
'differently than the value specified in valid-classmethod-first'
|
@@ -167,58 +167,58 @@ MSGS = {
|
|
167
167
|
),
|
168
168
|
'R0201': ('Method could be a function',
|
169
169
|
'no-self-use',
|
170
|
-
'Used when a method doesn\'t use its bound instance, and so could
|
171
|
-
be written as a function.'
|
170
|
+
'Used when a method doesn\'t use its bound instance, and so could '
|
171
|
+
'be written as a function.'
|
172
172
|
),
|
173
173
|
|
174
174
|
'E0221': ('Interface resolved to %s is not a class',
|
175
175
|
'interface-is-not-class',
|
176
|
-
'Used when a class claims to implement an interface which is not
|
177
|
-
a class.'),
|
176
|
+
'Used when a class claims to implement an interface which is not '
|
177
|
+
'a class.'),
|
178
178
|
'E0222': ('Missing method %r from %s interface',
|
179
179
|
'missing-interface-method',
|
180
|
-
'Used when a method declared in an interface is missing from a
|
181
|
-
class implementing this interface'),
|
180
|
+
'Used when a method declared in an interface is missing from a '
|
181
|
+
'class implementing this interface'),
|
182
182
|
'W0221': ('Arguments number differs from %s %r method',
|
183
183
|
'arguments-differ',
|
184
|
-
'Used when a method has a different number of arguments than in
|
185
|
-
the implemented interface or in an overridden method.'),
|
184
|
+
'Used when a method has a different number of arguments than in '
|
185
|
+
'the implemented interface or in an overridden method.'),
|
186
186
|
'W0222': ('Signature differs from %s %r method',
|
187
187
|
'signature-differs',
|
188
|
-
'Used when a method signature is different than in the
|
189
|
-
implemented interface or in an overridden method.'),
|
188
|
+
'Used when a method signature is different than in the '
|
189
|
+
'implemented interface or in an overridden method.'),
|
190
190
|
'W0223': ('Method %r is abstract in class %r but is not overridden',
|
191
191
|
'abstract-method',
|
192
|
-
'Used when an abstract method (i.e. raise NotImplementedError) is
|
193
|
-
not overridden in concrete class.'
|
192
|
+
'Used when an abstract method (i.e. raise NotImplementedError) is '
|
193
|
+
'not overridden in concrete class.'
|
194
194
|
),
|
195
|
-
'F0220': ('failed to resolve interfaces implemented by %s (%s)',
|
195
|
+
'F0220': ('failed to resolve interfaces implemented by %s (%s)',
|
196
196
|
'unresolved-interface',
|
197
|
-
'Used when a Pylint as failed to find interfaces implemented by
|
198
|
-
|
197
|
+
'Used when a Pylint as failed to find interfaces implemented by '
|
198
|
+
' a class'),
|
199
199
|
|
200
200
|
|
201
201
|
'W0231': ('__init__ method from base class %r is not called',
|
202
202
|
'super-init-not-called',
|
203
|
-
'Used when an ancestor class method has an __init__ method
|
204
|
-
which is not called by a derived class.'),
|
203
|
+
'Used when an ancestor class method has an __init__ method '
|
204
|
+
'which is not called by a derived class.'),
|
205
205
|
'W0232': ('Class has no __init__ method',
|
206
206
|
'no-init',
|
207
|
-
'Used when a class has no __init__ method, neither its parent
|
208
|
-
classes.'),
|
207
|
+
'Used when a class has no __init__ method, neither its parent '
|
208
|
+
'classes.'),
|
209
209
|
'W0233': ('__init__ method from a non direct base class %r is called',
|
210
210
|
'non-parent-init-called',
|
211
|
-
'Used when an __init__ method is called on a class which is not
|
212
|
-
in the direct ancestors for the analysed class.'),
|
211
|
+
'Used when an __init__ method is called on a class which is not '
|
212
|
+
'in the direct ancestors for the analysed class.'),
|
213
213
|
'W0234': ('__iter__ returns non-iterator',
|
214
214
|
'non-iterator-returned',
|
215
|
-
'Used when an __iter__ method returns something which is not an
|
216
|
-
iterable (i.e. has no `%s` method)' % NEXT_METHOD),
|
215
|
+
'Used when an __iter__ method returns something which is not an '
|
216
|
+
'iterable (i.e. has no `%s` method)' % NEXT_METHOD),
|
217
217
|
'E0235': ('__exit__ must accept 3 arguments: type, value, traceback',
|
218
218
|
'bad-context-manager',
|
219
|
-
'Used when the __exit__ special method, belonging to a
|
220
|
-
|
221
|
-
|
219
|
+
'Used when the __exit__ special method, belonging to a '
|
220
|
+
'context manager, does not accept 3 arguments '
|
221
|
+
'(type, value, traceback).'),
|
222
222
|
'E0236': ('Invalid object %r in __slots__, must contain '
|
223
223
|
'only non empty strings',
|
224
224
|
'invalid-slots-object',
|
@@ -893,26 +893,27 @@ a metaclass class method.'}
|
|
893
893
|
expr.expr.func.name == 'super':
|
894
894
|
return
|
895
895
|
try:
|
896
|
-
klass
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
896
|
+
for klass in expr.expr.infer():
|
897
|
+
if klass is YES:
|
898
|
+
continue
|
899
|
+
# The infered klass can be super(), which was
|
900
|
+
# assigned to a variable and the `__init__`
|
901
|
+
# was called later.
|
902
|
+
#
|
903
|
+
# base = super()
|
904
|
+
# base.__init__(...)
|
905
|
+
|
906
|
+
if (isinstance(klass, astroid.Instance) and
|
907
|
+
isinstance(klass._proxied, astroid.Class) and
|
908
|
+
is_builtin_object(klass._proxied) and
|
909
|
+
klass._proxied.name == 'super'):
|
910
|
+
return
|
911
|
+
try:
|
912
|
+
del not_called_yet[klass]
|
913
|
+
except KeyError:
|
914
|
+
if klass not in to_call:
|
915
|
+
self.add_message('non-parent-init-called',
|
916
|
+
node=expr, args=klass.name)
|
916
917
|
except astroid.InferenceError:
|
917
918
|
continue
|
918
919
|
for klass, method in six.iteritems(not_called_yet):
|
@@ -18,7 +18,7 @@
|
|
18
18
|
import re
|
19
19
|
from collections import defaultdict
|
20
20
|
|
21
|
-
from astroid import
|
21
|
+
from astroid import If, InferenceError
|
22
22
|
|
23
23
|
from pylint.interfaces import IAstroidChecker
|
24
24
|
from pylint.checkers import BaseChecker
|
@@ -28,17 +28,6 @@ from pylint.checkers.utils import check_messages
|
|
28
28
|
IGNORED_ARGUMENT_NAMES = re.compile('_.*')
|
29
29
|
|
30
30
|
|
31
|
-
def class_is_abstract(klass):
|
32
|
-
"""return true if the given class node should be considered as an abstract
|
33
|
-
class
|
34
|
-
"""
|
35
|
-
for attr in klass.values():
|
36
|
-
if isinstance(attr, Function):
|
37
|
-
if attr.is_abstract(pass_is_abstract=False):
|
38
|
-
return True
|
39
|
-
return False
|
40
|
-
|
41
|
-
|
42
31
|
MSGS = {
|
43
32
|
'R0901': ('Too many ancestors (%s/%s)',
|
44
33
|
'too-many-ancestors',
|
@@ -75,14 +64,6 @@ MSGS = {
|
|
75
64
|
'too-many-statements',
|
76
65
|
'Used when a function or method has too many statements. You \
|
77
66
|
should then split it in smaller functions / methods.'),
|
78
|
-
|
79
|
-
'R0921': ('Abstract class not referenced',
|
80
|
-
'abstract-class-not-used',
|
81
|
-
'Used when an abstract class is not used as ancestor anywhere.'),
|
82
|
-
'R0922': ('Abstract class is only referenced %s times',
|
83
|
-
'abstract-class-little-used',
|
84
|
-
'Used when an abstract class is used less than X times as \
|
85
|
-
ancestor.'),
|
86
67
|
'R0923': ('Interface not implemented',
|
87
68
|
'interface-not-implemented',
|
88
69
|
'Used when an interface class is not implemented anywhere.'),
|
@@ -165,9 +146,7 @@ class MisdesignChecker(BaseChecker):
|
|
165
146
|
self.stats = None
|
166
147
|
self._returns = None
|
167
148
|
self._branches = None
|
168
|
-
self._used_abstracts = None
|
169
149
|
self._used_ifaces = None
|
170
|
-
self._abstracts = None
|
171
150
|
self._ifaces = None
|
172
151
|
self._stmts = 0
|
173
152
|
|
@@ -176,27 +155,17 @@ class MisdesignChecker(BaseChecker):
|
|
176
155
|
self.stats = self.linter.add_stats()
|
177
156
|
self._returns = []
|
178
157
|
self._branches = defaultdict(int)
|
179
|
-
self._used_abstracts = {}
|
180
158
|
self._used_ifaces = {}
|
181
|
-
self._abstracts = []
|
182
159
|
self._ifaces = []
|
183
160
|
|
184
|
-
# Check 'R0921', 'R0922', 'R0923'
|
185
161
|
def close(self):
|
186
|
-
"""check that
|
187
|
-
for abstract in self._abstracts:
|
188
|
-
if not abstract in self._used_abstracts:
|
189
|
-
self.add_message('abstract-class-not-used', node=abstract)
|
190
|
-
elif self._used_abstracts[abstract] < 2:
|
191
|
-
self.add_message('abstract-class-little-used', node=abstract,
|
192
|
-
args=self._used_abstracts[abstract])
|
162
|
+
"""check that interface classes are used"""
|
193
163
|
for iface in self._ifaces:
|
194
164
|
if not iface in self._used_ifaces:
|
195
165
|
self.add_message('interface-not-implemented', node=iface)
|
196
166
|
|
197
167
|
@check_messages('too-many-ancestors', 'too-many-instance-attributes',
|
198
168
|
'too-few-public-methods', 'too-many-public-methods',
|
199
|
-
'abstract-class-not-used', 'abstract-class-little-used',
|
200
169
|
'interface-not-implemented')
|
201
170
|
def visit_class(self, node):
|
202
171
|
"""check size of inheritance hierarchy and number of instance attributes
|
@@ -213,10 +182,8 @@ class MisdesignChecker(BaseChecker):
|
|
213
182
|
self.add_message('too-many-instance-attributes', node=node,
|
214
183
|
args=(len(node.instance_attrs),
|
215
184
|
self.config.max_attributes))
|
216
|
-
# update
|
217
|
-
if
|
218
|
-
self._abstracts.append(node)
|
219
|
-
elif node.type == 'interface' and node.name != 'Interface':
|
185
|
+
# update interface classes structures
|
186
|
+
if node.type == 'interface' and node.name != 'Interface':
|
220
187
|
self._ifaces.append(node)
|
221
188
|
for parent in node.ancestors(False):
|
222
189
|
if parent.name == 'Interface':
|
@@ -228,34 +195,36 @@ class MisdesignChecker(BaseChecker):
|
|
228
195
|
except InferenceError:
|
229
196
|
# XXX log ?
|
230
197
|
pass
|
231
|
-
for parent in node.ancestors():
|
232
|
-
try:
|
233
|
-
self._used_abstracts[parent] += 1
|
234
|
-
except KeyError:
|
235
|
-
self._used_abstracts[parent] = 1
|
236
198
|
|
237
|
-
@check_messages('too-
|
238
|
-
'too-few-public-methods', 'too-many-public-methods',
|
239
|
-
'abstract-class-not-used', 'abstract-class-little-used',
|
240
|
-
'interface-not-implemented')
|
199
|
+
@check_messages('too-few-public-methods', 'too-many-public-methods')
|
241
200
|
def leave_class(self, node):
|
242
201
|
"""check number of public methods"""
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
202
|
+
my_methods = sum(1 for method in node.mymethods()
|
203
|
+
if not method.name.startswith('_'))
|
204
|
+
all_methods = sum(1 for method in node.methods()
|
205
|
+
if not method.name.startswith('_'))
|
206
|
+
|
207
|
+
# Does the class contain less than n public methods ?
|
208
|
+
# This checks only the methods defined in the current class,
|
209
|
+
# since the user might not have control over the classes
|
210
|
+
# from the ancestors. It avoids some false positives
|
211
|
+
# for classes such as unittest.TestCase, which provides
|
212
|
+
# a lot of assert methods. It doesn't make sense to warn
|
213
|
+
# when the user subclasses TestCase to add his own tests.
|
214
|
+
if my_methods > self.config.max_public_methods:
|
249
215
|
self.add_message('too-many-public-methods', node=node,
|
250
|
-
args=(
|
216
|
+
args=(my_methods,
|
251
217
|
self.config.max_public_methods))
|
252
218
|
# stop here for exception, metaclass and interface classes
|
253
219
|
if node.type != 'class':
|
254
220
|
return
|
255
|
-
|
256
|
-
|
221
|
+
|
222
|
+
# Does the class contain more than n public methods ?
|
223
|
+
# This checks all the methods defined by ancestors and
|
224
|
+
# by the current class.
|
225
|
+
if all_methods < self.config.min_public_methods:
|
257
226
|
self.add_message('too-few-public-methods', node=node,
|
258
|
-
args=(
|
227
|
+
args=(all_methods,
|
259
228
|
self.config.min_public_methods))
|
260
229
|
|
261
230
|
@check_messages('too-many-return-statements', 'too-many-branches',
|
@@ -356,7 +325,6 @@ class MisdesignChecker(BaseChecker):
|
|
356
325
|
"""increments the branches counter"""
|
357
326
|
self._branches[node.scope()] += branchesnum
|
358
327
|
|
359
|
-
# FIXME: make a nice report...
|
360
328
|
|
361
329
|
def register(linter):
|
362
330
|
"""required method to auto register this checker """
|
@@ -303,7 +303,7 @@ class ContinuedLineState(object):
|
|
303
303
|
self.retained_warnings.append((token_position, state, valid_offsets))
|
304
304
|
|
305
305
|
def get_valid_offsets(self, idx):
|
306
|
-
"""
|
306
|
+
"""Returns the valid offsets for the token at the given position."""
|
307
307
|
# The closing brace on a dict or the 'for' in a dict comprehension may
|
308
308
|
# reset two indent levels because the dict value is ended implicitly
|
309
309
|
stack_top = -1
|
@@ -353,21 +353,22 @@ class ContinuedLineState(object):
|
|
353
353
|
def _continuation_inside_bracket(self, bracket, pos):
|
354
354
|
"""Extracts indentation information for a continued indent."""
|
355
355
|
indentation = _get_indent_length(self._tokens.line(pos))
|
356
|
-
|
356
|
+
token_start = self._tokens.start_col(pos)
|
357
|
+
next_token_start = self._tokens.start_col(pos + 1)
|
358
|
+
if self._is_block_opener and next_token_start - indentation == self._block_indent_size:
|
357
359
|
return _ContinuedIndent(
|
358
360
|
CONTINUED_BLOCK,
|
359
361
|
bracket,
|
360
362
|
pos,
|
361
|
-
_Offsets(
|
362
|
-
_BeforeBlockOffsets(self.
|
363
|
-
self._tokens.start_col(pos+1) + self._continuation_size))
|
363
|
+
_Offsets(token_start),
|
364
|
+
_BeforeBlockOffsets(next_token_start, next_token_start + self._continuation_size))
|
364
365
|
else:
|
365
366
|
return _ContinuedIndent(
|
366
367
|
CONTINUED,
|
367
368
|
bracket,
|
368
369
|
pos,
|
369
|
-
_Offsets(
|
370
|
-
_Offsets(
|
370
|
+
_Offsets(token_start),
|
371
|
+
_Offsets(next_token_start))
|
371
372
|
|
372
373
|
def pop_token(self):
|
373
374
|
self._cont_stack.pop()
|
@@ -442,7 +443,8 @@ class FormatChecker(BaseTokenChecker):
|
|
442
443
|
('expected-line-ending-format',
|
443
444
|
{'type': 'choice', 'metavar': '<empty or LF or CRLF>', 'default': '',
|
444
445
|
'choices': ['', 'LF', 'CRLF'],
|
445
|
-
'help': 'Expected format of line ending,
|
446
|
+
'help': ('Expected format of line ending, '
|
447
|
+
'e.g. empty (any line ending), LF or CRLF.')}),
|
446
448
|
)
|
447
449
|
|
448
450
|
def __init__(self, linter=None):
|
@@ -796,10 +798,12 @@ class FormatChecker(BaseTokenChecker):
|
|
796
798
|
# check if line ending is as expected
|
797
799
|
expected = self.config.expected_line_ending_format
|
798
800
|
if expected:
|
799
|
-
|
801
|
+
# reduce multiple \n\n\n\n to one \n
|
802
|
+
line_ending = reduce(lambda x, y: x + y if x != y else x, line_ending, "")
|
800
803
|
line_ending = 'LF' if line_ending == '\n' else 'CRLF'
|
801
804
|
if line_ending != expected:
|
802
|
-
self.add_message('unexpected-line-ending-format', args=(line_ending, expected),
|
805
|
+
self.add_message('unexpected-line-ending-format', args=(line_ending, expected),
|
806
|
+
line=line_num)
|
803
807
|
|
804
808
|
|
805
809
|
def _process_retained_warnings(self, tokens, current_pos):
|