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.
Files changed (195) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +10 -34
  3. data/CHANGELOG.md +16 -0
  4. data/README.md +9 -63
  5. data/Rakefile +2 -2
  6. data/ext/libv8/builder.rb +22 -87
  7. data/ext/libv8/extconf.rb +1 -1
  8. data/ext/libv8/paths.rb +5 -18
  9. data/lib/libv8/version.rb +1 -1
  10. data/spec/location_spec.rb +1 -2
  11. data/spec/spec_helper.rb +0 -1
  12. data/vendor/depot_tools/.gitattributes +1 -2
  13. data/vendor/depot_tools/OWNERS +0 -1
  14. data/vendor/depot_tools/PRESUBMIT.py +11 -6
  15. data/vendor/depot_tools/README.md +0 -1
  16. data/vendor/depot_tools/WATCHLISTS +0 -6
  17. data/vendor/depot_tools/auth.py +129 -87
  18. data/vendor/depot_tools/autoninja +11 -1
  19. data/vendor/depot_tools/autoninja.bat +7 -1
  20. data/vendor/depot_tools/autoninja.py +14 -6
  21. data/vendor/depot_tools/bootstrap/win/manifest.txt +1 -1
  22. data/vendor/depot_tools/bootstrap/win/manifest_bleeding_edge.txt +1 -1
  23. data/vendor/depot_tools/cipd +23 -2
  24. data/vendor/depot_tools/cipd.bat +2 -2
  25. data/vendor/depot_tools/cipd_client_version +1 -1
  26. data/vendor/depot_tools/cipd_manifest.txt +17 -7
  27. data/vendor/depot_tools/cit.py +7 -6
  28. data/vendor/depot_tools/cpplint.py +195 -35
  29. data/vendor/depot_tools/detect_host_arch.py +51 -0
  30. data/vendor/depot_tools/download_from_google_storage.py +85 -26
  31. data/vendor/depot_tools/fetch.py +11 -6
  32. data/vendor/depot_tools/fetch_configs/chromium.py +0 -1
  33. data/vendor/depot_tools/fetch_configs/goma_client.py +41 -0
  34. data/vendor/depot_tools/fetch_configs/infra.py +0 -1
  35. data/vendor/depot_tools/fetch_configs/infra_internal.py +0 -1
  36. data/vendor/depot_tools/gclient-new-workdir.py +4 -0
  37. data/vendor/depot_tools/gclient.py +732 -476
  38. data/vendor/depot_tools/gclient_eval.py +569 -58
  39. data/vendor/depot_tools/gclient_scm.py +258 -46
  40. data/vendor/depot_tools/gclient_utils.py +17 -1
  41. data/vendor/depot_tools/gerrit_util.py +46 -13
  42. data/vendor/depot_tools/git_cache.py +0 -2
  43. data/vendor/depot_tools/git_cl.py +176 -335
  44. data/vendor/depot_tools/git_common.py +19 -16
  45. data/vendor/depot_tools/git_footers.py +19 -5
  46. data/vendor/depot_tools/git_hyper_blame.py +9 -3
  47. data/vendor/depot_tools/git_new_branch.py +15 -3
  48. data/vendor/depot_tools/git_upstream_diff.py +7 -2
  49. data/vendor/depot_tools/gsutil.py +1 -1
  50. data/vendor/depot_tools/infra/config/cq.cfg +1 -2
  51. data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
  52. data/vendor/depot_tools/luci-auth +13 -0
  53. data/vendor/depot_tools/luci-auth.bat +8 -0
  54. data/vendor/depot_tools/man/html/depot_tools.html +0 -8
  55. data/vendor/depot_tools/man/html/git-upstream-diff.html +20 -3
  56. data/vendor/depot_tools/man/man1/git-upstream-diff.1 +27 -6
  57. data/vendor/depot_tools/man/man7/depot_tools.7 +0 -5
  58. data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +2 -2
  59. data/vendor/depot_tools/man/src/git-upstream-diff.txt +21 -3
  60. data/vendor/depot_tools/man/src/make_docs.sh +6 -0
  61. data/vendor/depot_tools/my_activity.py +283 -93
  62. data/vendor/depot_tools/owners.py +9 -4
  63. data/vendor/depot_tools/owners_finder.py +7 -3
  64. data/vendor/depot_tools/post_build_ninja_summary.py +322 -0
  65. data/vendor/depot_tools/presubmit_canned_checks.py +91 -106
  66. data/vendor/depot_tools/presubmit_support.py +219 -157
  67. data/vendor/depot_tools/prpc +13 -0
  68. data/vendor/depot_tools/prpc.bat +8 -0
  69. data/vendor/depot_tools/recipes/OWNERS +3 -1
  70. data/vendor/depot_tools/recipes/README.recipes.md +70 -111
  71. data/vendor/depot_tools/recipes/recipe_modules/bot_update/__init__.py +12 -5
  72. data/vendor/depot_tools/recipes/recipe_modules/bot_update/api.py +36 -68
  73. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json +0 -8
  74. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{trychange_oauth2_json.json → no_apply_patch_on_gclient.json} +64 -10
  75. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{no_shallow.json → shallow.json} +1 -1
  76. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json +0 -8
  77. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_empty_revision.json +0 -8
  78. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +0 -6
  79. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +0 -7
  80. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +0 -6
  81. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json +44 -0
  82. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{trychange_oauth2_buildbot.json → tryjob_gerrit_branch_heads.json} +51 -5
  83. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json +0 -8
  84. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +48 -8
  85. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.py +19 -26
  86. data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/bot_update.py +193 -155
  87. data/vendor/depot_tools/recipes/recipe_modules/bot_update/test_api.py +9 -0
  88. data/vendor/depot_tools/recipes/recipe_modules/gclient/api.py +2 -7
  89. data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +31 -5
  90. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/basic.json +37 -19
  91. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/buildbot.json +37 -19
  92. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/revision.json +37 -19
  93. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/tryserver.json +37 -23
  94. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.py +4 -0
  95. data/vendor/depot_tools/recipes/recipe_modules/gerrit/api.py +40 -8
  96. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +3 -3
  97. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.py +6 -3
  98. data/vendor/depot_tools/recipes/recipe_modules/gitiles/OWNERS +0 -1
  99. data/vendor/depot_tools/recipes/recipe_modules/tryserver/__init__.py +0 -1
  100. data/vendor/depot_tools/recipes/recipe_modules/tryserver/api.py +7 -56
  101. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +0 -1
  102. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.py +15 -16
  103. data/vendor/depot_tools/recipes/recipes.py +4 -2
  104. data/vendor/depot_tools/recipes/trigger_recipe_roller.txt +12 -0
  105. data/vendor/depot_tools/roll_dep.py +35 -37
  106. data/vendor/depot_tools/support/chromite_wrapper +1 -1
  107. data/vendor/depot_tools/third_party/logilab/astroid/README.chromium +3 -3
  108. data/vendor/depot_tools/third_party/logilab/astroid/__pkginfo__.py +2 -2
  109. data/vendor/depot_tools/third_party/logilab/astroid/astpeephole.py +86 -0
  110. data/vendor/depot_tools/third_party/logilab/astroid/bases.py +53 -66
  111. data/vendor/depot_tools/third_party/logilab/astroid/brain/py2pytest.py +31 -31
  112. data/vendor/depot_tools/third_party/logilab/astroid/brain/pynose.py +39 -16
  113. data/vendor/depot_tools/third_party/logilab/astroid/brain/pysix_moves.py +225 -189
  114. data/vendor/depot_tools/third_party/logilab/astroid/inference.py +45 -41
  115. data/vendor/depot_tools/third_party/logilab/astroid/manager.py +1 -0
  116. data/vendor/depot_tools/third_party/logilab/astroid/modutils.py +2 -2
  117. data/vendor/depot_tools/third_party/logilab/astroid/node_classes.py +3 -2
  118. data/vendor/depot_tools/third_party/logilab/astroid/nodes.py +1 -0
  119. data/vendor/depot_tools/third_party/logilab/astroid/protocols.py +57 -3
  120. data/vendor/depot_tools/third_party/logilab/astroid/raw_building.py +1 -1
  121. data/vendor/depot_tools/third_party/logilab/astroid/rebuilder.py +21 -1
  122. data/vendor/depot_tools/third_party/logilab/astroid/scoped_nodes.py +58 -33
  123. data/vendor/depot_tools/third_party/pylint/README.chromium +2 -2
  124. data/vendor/depot_tools/third_party/pylint/__pkginfo__.py +3 -3
  125. data/vendor/depot_tools/third_party/pylint/checkers/base.py +6 -18
  126. data/vendor/depot_tools/third_party/pylint/checkers/classes.py +64 -63
  127. data/vendor/depot_tools/third_party/pylint/checkers/design_analysis.py +25 -57
  128. data/vendor/depot_tools/third_party/pylint/checkers/format.py +14 -10
  129. data/vendor/depot_tools/third_party/pylint/checkers/python3.py +142 -37
  130. data/vendor/depot_tools/third_party/pylint/checkers/spelling.py +10 -1
  131. data/vendor/depot_tools/third_party/pylint/checkers/stdlib.py +50 -7
  132. data/vendor/depot_tools/third_party/pylint/checkers/strings.py +1 -1
  133. data/vendor/depot_tools/third_party/pylint/epylint.py +2 -1
  134. data/vendor/depot_tools/third_party/pylint/gui.py +1 -1
  135. data/vendor/depot_tools/third_party/pylint/lint.py +88 -23
  136. data/vendor/depot_tools/third_party/pylint/reporters/html.py +37 -5
  137. data/vendor/depot_tools/third_party/pylint/testutils.py +1 -1
  138. data/vendor/depot_tools/third_party/pylint/utils.py +5 -0
  139. data/vendor/depot_tools/vpython +31 -1
  140. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +35 -2
  141. data/vendor/depot_tools/win_toolchain/package_from_installed.py +0 -15
  142. data/vendor/depot_tools/yapf +17 -0
  143. data/vendor/depot_tools/{apply_issue.bat → yapf.bat} +2 -2
  144. metadata +16 -58
  145. data/ext/libv8/compiler.rb +0 -39
  146. data/ext/libv8/compiler/apple_llvm.rb +0 -22
  147. data/ext/libv8/compiler/clang.rb +0 -22
  148. data/ext/libv8/compiler/gcc.rb +0 -22
  149. data/ext/libv8/compiler/generic_compiler.rb +0 -66
  150. data/ext/libv8/make.rb +0 -13
  151. data/ext/libv8/patcher.rb +0 -21
  152. data/patches/0001-Build-a-standalone-static-library.patch +0 -26
  153. data/patches/0002-Don-t-compile-unnecessary-stuff.patch +0 -85
  154. data/patches/0003-Use-the-fPIC-flag-for-the-static-library.patch +0 -25
  155. data/patches/0004-Do-not-embed-debug-symbols-in-macOS-libraries.patch +0 -25
  156. data/patches/0005-Remove-TryInstallOptimizedCode.patch +0 -321
  157. data/patches/mingw-generate-makefiles.sh +0 -97
  158. data/spec/compiler/apple_llvm_spec.rb +0 -37
  159. data/spec/compiler/clang_spec.rb +0 -37
  160. data/spec/compiler/gcc_spec.rb +0 -37
  161. data/spec/compiler/generic_compiler_spec.rb +0 -50
  162. data/spec/compiler_spec.rb +0 -45
  163. data/spec/support/compiler_helpers.rb +0 -47
  164. data/vendor/depot_tools/apply_issue +0 -8
  165. data/vendor/depot_tools/apply_issue.py +0 -315
  166. data/vendor/depot_tools/man/html/git-cherry-pick-upload.html +0 -815
  167. data/vendor/depot_tools/man/man1/git-cherry-pick-upload.1 +0 -80
  168. data/vendor/depot_tools/man/src/_git-cherry-pick-upload_desc.helper.txt +0 -1
  169. data/vendor/depot_tools/man/src/git-cherry-pick-upload.demo.1.sh +0 -17
  170. data/vendor/depot_tools/man/src/git-cherry-pick-upload.txt +0 -35
  171. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2.json +0 -8
  172. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json_win.json +0 -196
  173. data/vendor/depot_tools/recipes/recipe_modules/rietveld/__init__.py +0 -6
  174. data/vendor/depot_tools/recipes/recipe_modules/rietveld/api.py +0 -97
  175. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/basic.json +0 -8
  176. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/buildbot.json +0 -30
  177. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/no_auth.json +0 -27
  178. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.py +0 -38
  179. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_rietveld_patch.json +0 -69
  180. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_rietveld_patch_new.json +0 -69
  181. data/vendor/depot_tools/third_party/cq_client/OWNERS +0 -2
  182. data/vendor/depot_tools/third_party/cq_client/README.depot_tools.md +0 -2
  183. data/vendor/depot_tools/third_party/cq_client/README.md +0 -59
  184. data/vendor/depot_tools/third_party/cq_client/__init__.py +0 -3
  185. data/vendor/depot_tools/third_party/cq_client/v1/__init__.py +0 -3
  186. data/vendor/depot_tools/third_party/cq_client/v1/cq.pb.go +0 -810
  187. data/vendor/depot_tools/third_party/cq_client/v1/cq.proto +0 -281
  188. data/vendor/depot_tools/third_party/cq_client/v1/cq_pb2.py +0 -794
  189. data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_both.cfg +0 -71
  190. data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_gerrit.cfg +0 -58
  191. data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_rietveld.cfg +0 -60
  192. data/vendor/depot_tools/third_party/cq_client/v2/__init__.py +0 -3
  193. data/vendor/depot_tools/third_party/cq_client/v2/cq.pb.go +0 -792
  194. data/vendor/depot_tools/third_party/cq_client/v2/cq.proto +0 -270
  195. data/vendor/depot_tools/third_party/cq_client/v2/cq_pb2.py +0 -841
@@ -1,5 +1,5 @@
1
- URL: http://www.pylint.org/
2
- Version: 1.4.1
1
+ URL: https://www.pylint.org/
2
+ Version: 1.4.5
3
3
  License: GPL
4
4
  License File: LICENSE.txt
5
5
 
@@ -19,10 +19,10 @@ from __future__ import absolute_import
19
19
 
20
20
  modname = distname = 'pylint'
21
21
 
22
- numversion = (1, 4, 1)
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.3', 'six']
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', 'star-args', 'eval-used',
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', # E0212
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', # E0214
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)', # W0224
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
- a class'),
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
- context manager, does not accept 3 arguments \
221
- (type, value, traceback).'),
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 = next(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__` was called later.
901
- #
902
- # base = super()
903
- # base.__init__(...)
904
-
905
- if (isinstance(klass, astroid.Instance) and
906
- isinstance(klass._proxied, astroid.Class) and
907
- is_builtin_object(klass._proxied) and
908
- klass._proxied.name == 'super'):
909
- return
910
- try:
911
- del not_called_yet[klass]
912
- except KeyError:
913
- if klass not in to_call:
914
- self.add_message('non-parent-init-called',
915
- node=expr, args=klass.name)
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 Function, If, InferenceError
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 abstract/interface classes are used"""
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 abstract / interface classes structures
217
- if class_is_abstract(node):
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-many-ancestors', 'too-many-instance-attributes',
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
- nb_public_methods = 0
244
- for method in node.mymethods():
245
- if not method.name.startswith('_'):
246
- nb_public_methods += 1
247
- # Does the class contain less than 20 public methods ?
248
- if nb_public_methods > self.config.max_public_methods:
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=(nb_public_methods,
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
- # Does the class contain more than 5 public methods ?
256
- if nb_public_methods < self.config.min_public_methods:
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=(nb_public_methods,
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
- """"Returns the valid offsets for the token at the given position."""
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
- if self._is_block_opener and self._tokens.start_col(pos+1) - indentation == self._block_indent_size:
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(self._tokens.start_col(pos)),
362
- _BeforeBlockOffsets(self._tokens.start_col(pos+1),
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(self._tokens.start_col(pos)),
370
- _Offsets(self._tokens.start_col(pos+1)))
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, e.g. empty (any line ending), LF or CRLF.'}),
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
- line_ending = reduce(lambda x, y: x + y if x != y else x, line_ending, "") # reduce multiple \n\n\n\n to one \n
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), line=line_num)
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):