solargraph 0.40.1 → 0.40.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e02cce6c25457bb0284d221d1a9bef97730b7d7be18129cdee0dcfa1aae9c02b
4
- data.tar.gz: 5143879ae0f89fd7ca608646cfe96fccc1e6c15afd7940fc7948dff358f286f3
3
+ metadata.gz: 70d201ad10b41bf9e0322370c2de7fa8c0efa25d8746b5b7cb3d1adc81902721
4
+ data.tar.gz: 7547665a359af045b4c9d1a0991d4dec4b37c621e7baf15b20656228ce69fa1f
5
5
  SHA512:
6
- metadata.gz: 7c868fd6c6bb344f532eeee02ef06f9b80df086b51a49e408f5c04961303524f36d6b27cfae37b200a92bf0b65e15a3e68be029aad66bf912dd1aa73b1f48714
7
- data.tar.gz: 6a9cbcd839ab51d1c71d83a30a73464f337faffda715059e91de57a3519783793574901f23d738c83a49d1116d41268c4992fa304c08d8892e394e12bb5011c8
6
+ metadata.gz: 4f79d086cf827d4bfa0a1c24c002a7487e742a0de65e5094126c9cb0dd12ca43aa08ec7e62debf074577adf81b8cd0d7e8916ee90676a3d2a5f0e8bfa6e9296c
7
+ data.tar.gz: 15afa63bb7bf32dfa51dff97432c8a8070d6521a364097b4f399e5a5962b25f9d86d336e26aad3810c66de01ba5ec273224030628d56b6640db60f10501cc578
@@ -1,3 +1,7 @@
1
+ ## 0.40.2 - January 18, 2021
2
+ - Type checker ignores splatted calls in arity (#396)
3
+ - Allow Parser 3.0 (#400)
4
+
1
5
  ## 0.40.1 - December 28, 2020
2
6
  - Use temp directory for RuboCop formatting (#397)
3
7
  - NodeMethods reads splatted hashes (#396)
@@ -1,7 +1,7 @@
1
1
  Layout/EndOfLine:
2
2
  EnforcedStyle: lf
3
- Style/MethodDefParentheses:
4
- Enabled: false
3
+ # Style/MethodDefParentheses:
4
+ # Enabled: false
5
5
  Layout/EmptyLineAfterGuardClause:
6
6
  Enabled: false
7
7
  Layout/SpaceAroundMethodCallOperator:
@@ -123,6 +123,10 @@ module Solargraph
123
123
  Parser.is_ast_node?(node.children[0]) && node.children[0].type == :kwsplat
124
124
  end
125
125
 
126
+ def splatted_call? node
127
+ Parser.is_ast_node?(node.children[0]) && node.children[0].type == :kwsplat && node.children[0].children[0].type != :hash
128
+ end
129
+
126
130
  # @todo Temporarily here for testing. Move to Solargraph::Parser.
127
131
  def call_nodes_from node
128
132
  return [] unless node.is_a?(::Parser::AST::Node)
@@ -106,11 +106,18 @@ module Solargraph
106
106
  end
107
107
 
108
108
  def splatted_hash? node
109
+ splatted_node?(node) && node.children[0].children[1].type == :HASH
110
+ end
111
+
112
+ def splatted_node? node
109
113
  node?(node.children[0]) &&
110
114
  [:ARRAY, :LIST].include?(node.children[0].type) &&
111
115
  node.children[0].children[0].nil? &&
112
- node?(node.children[0].children[1]) &&
113
- node.children[0].children[1].type == :HASH
116
+ node?(node.children[0].children[1])
117
+ end
118
+
119
+ def splatted_call? node
120
+ splatted_node?(node) && node.children[0].children[1].type != :HASH
114
121
  end
115
122
 
116
123
  def node? node
@@ -334,6 +334,8 @@ module Solargraph
334
334
  result
335
335
  end
336
336
 
337
+ # @param [Pin::Method]
338
+ # @return [Hash]
337
339
  def param_hash(pin)
338
340
  tags = pin.docstring.tags(:param)
339
341
  return {} if tags.empty?
@@ -346,6 +348,7 @@ module Solargraph
346
348
  end
347
349
 
348
350
  # @param [Array<Pin::Method>]
351
+ # @return [Hash]
349
352
  def first_param_hash(pins)
350
353
  pins.each do |pin|
351
354
  result = param_hash(pin)
@@ -413,24 +416,28 @@ module Solargraph
413
416
  end
414
417
  settled_kwargs = 0
415
418
  unless unchecked.empty?
416
- kwargs = convert_hash(unchecked.last.node)
417
- if pin.parameters.any? { |param| [:kwarg, :kwoptarg].include?(param.decl) || param.kwrestarg? }
418
- if kwargs.empty?
419
- add_params += 1
420
- else
421
- unchecked.pop
422
- pin.parameters.each do |param|
423
- next unless param.keyword?
424
- if kwargs.key?(param.name.to_sym)
425
- kwargs.delete param.name.to_sym
426
- settled_kwargs += 1
427
- elsif param.decl == :kwarg
428
- return [Problem.new(location, "Missing keyword argument #{param.name} to #{pin.path}")]
419
+ if Parser.is_ast_node?(unchecked.last.node) && splatted_call?(unchecked.last.node)
420
+ settled_kwargs = pin.parameters.count(&:keyword?)
421
+ else
422
+ kwargs = convert_hash(unchecked.last.node)
423
+ if pin.parameters.any? { |param| [:kwarg, :kwoptarg].include?(param.decl) || param.kwrestarg? }
424
+ if kwargs.empty?
425
+ add_params += 1
426
+ else
427
+ unchecked.pop
428
+ pin.parameters.each do |param|
429
+ next unless param.keyword?
430
+ if kwargs.key?(param.name.to_sym)
431
+ kwargs.delete param.name.to_sym
432
+ settled_kwargs += 1
433
+ elsif param.decl == :kwarg
434
+ return [Problem.new(location, "Missing keyword argument #{param.name} to #{pin.path}")]
435
+ end
436
+ end
437
+ kwargs.clear if pin.parameters.any?(&:kwrestarg?)
438
+ unless kwargs.empty?
439
+ return [Problem.new(location, "Unrecognized keyword argument #{kwargs.keys.first} to #{pin.path}")]
429
440
  end
430
- end
431
- kwargs.clear if pin.parameters.any?(&:kwrestarg?)
432
- unless kwargs.empty?
433
- return [Problem.new(location, "Unrecognized keyword argument #{kwargs.keys.first} to #{pin.path}")]
434
441
  end
435
442
  end
436
443
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solargraph
4
- VERSION = '0.40.1'
4
+ VERSION = '0.40.2'
5
5
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.add_runtime_dependency 'jaro_winkler', '~> 1.5'
27
27
  s.add_runtime_dependency 'kramdown', '~> 2.3'
28
28
  s.add_runtime_dependency 'kramdown-parser-gfm', '~> 1.1'
29
- s.add_runtime_dependency 'parser', '~> 2.3'
29
+ s.add_runtime_dependency 'parser', '~> 3.0'
30
30
  s.add_runtime_dependency 'reverse_markdown', '>= 1.0.5', '< 3'
31
31
  s.add_runtime_dependency 'rubocop', '>= 0.52'
32
32
  s.add_runtime_dependency 'thor', '~> 1.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.40.1
4
+ version: 0.40.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-28 00:00:00.000000000 Z
11
+ date: 2021-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backport
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.3'
117
+ version: '3.0'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '2.3'
124
+ version: '3.0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: reverse_markdown
127
127
  requirement: !ruby/object:Gem::Requirement