solargraph 0.38.5 → 0.38.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f5704121cc7b82b0999302bb964ff7d2a0973e724fcbff4f0c2be6b3d800848
4
- data.tar.gz: b7341f99fa186eebc3803955912c34a841b0be13b77e4725a9f16f5af5b009d2
3
+ metadata.gz: 061561cbbc7728685d8db8a482d16004254b6abcefde23ad1c8666f1dc8d37fb
4
+ data.tar.gz: 5c2a8991b9b2a7264a63337fb2d427b0c62c96843c6014202b2247d6c727558b
5
5
  SHA512:
6
- metadata.gz: 9abc64fe7dff520bf58f3cb526013c9d2250adbae6ecd7eca22294d7eba4365c548bcd191c08974275186d13cbac421c9cc32cc53ddbe7fdedc549b00eacddd7
7
- data.tar.gz: db55ce70f037c55a3da7b5f6b060f2bf51d996e78aa51c701e987de9eb1227dc30a99d06248ee88d1f318632d050e9a07cca4435bf8e91f60a21c630a6f27a31
6
+ metadata.gz: fc5d80cf77ad1c3b505ea3ecfbaaf514d2c49c7b93654b1e1fbd3b692266e045f4578e7bb15f5594842f677709f0a91b568379950648141012c694597b969686
7
+ data.tar.gz: '09e24fd600309f0b4f76391d33ba929bc6d153224acef25c384639f1072b5f9cd999102bdcd63b46e4238ee4089423068ff25d5b93af57c64d40d425cf884008'
@@ -19,9 +19,8 @@ matrix:
19
19
  allow_failures:
20
20
  - rvm: 2.7
21
21
  os: osx
22
+ - rvm: jruby-head
22
23
 
23
- # Update RubyGems and Bundler due to error with Bundler 1.16.1 and RubyGems 2.7.3
24
- # See https://github.com/travis-ci/travis-ci/issues/8978
25
24
  before_install:
26
25
  - ruby ./travis-bundler.rb
27
26
  - bundle install
@@ -513,7 +513,7 @@ module Solargraph
513
513
  cls = qualify(sub)
514
514
  until fqsup.nil? || cls.nil?
515
515
  return true if cls == fqsup
516
- cls = qualify(store.get_superclass(cls), cls)
516
+ cls = qualify_superclass(cls)
517
517
  end
518
518
  false
519
519
  end
@@ -567,9 +567,8 @@ module Solargraph
567
567
  fqim = qualify(im, fqns)
568
568
  result.concat inner_get_methods(fqim, scope, visibility, deep, skip, true) unless fqim.nil?
569
569
  end
570
- sc = store.get_superclass(fqns)
571
- unless sc.nil?
572
- fqsc = qualify(sc, fqns.split('::')[0..-2].join('::'))
570
+ fqsc = qualify_superclass(fqns)
571
+ unless fqsc.nil?
573
572
  result.concat inner_get_methods(fqsc, scope, visibility, true, skip, no_core) unless fqsc.nil?
574
573
  end
575
574
  else
@@ -577,9 +576,8 @@ module Solargraph
577
576
  fqem = qualify(em, fqns)
578
577
  result.concat inner_get_methods(fqem, :instance, visibility, deep, skip, true) unless fqem.nil?
579
578
  end
580
- sc = store.get_superclass(fqns)
581
- unless sc.nil?
582
- fqsc = qualify(sc, fqns.split('::')[0..-2].join('::'))
579
+ fqsc = qualify_superclass(fqns)
580
+ unless fqsc.nil?
583
581
  result.concat inner_get_methods(fqsc, scope, visibility, true, skip, true) unless fqsc.nil?
584
582
  end
585
583
  unless no_core || fqns.empty?
@@ -608,9 +606,9 @@ module Solargraph
608
606
  store.get_includes(fqns).each do |is|
609
607
  result.concat inner_get_constants(qualify(is, fqns), [:public], skip)
610
608
  end
611
- sc = store.get_superclass(fqns)
612
- unless %w[Object BasicObject].include?(sc)
613
- result.concat inner_get_constants(store.get_superclass(fqns), [:public], skip)
609
+ fqsc = qualify_superclass(fqns)
610
+ unless %w[Object BasicObject].include?(fqsc)
611
+ result.concat inner_get_constants(fqsc, [:public], skip)
614
612
  end
615
613
  result
616
614
  end
@@ -627,6 +625,15 @@ module Solargraph
627
625
  qualify namespace, context.split('::')[0..-2].join('::')
628
626
  end
629
627
 
628
+ def qualify_superclass fqsub
629
+ sup = store.get_superclass(fqsub)
630
+ return nil if sup.nil?
631
+ parts = fqsub.split('::')
632
+ last = parts.pop
633
+ parts.pop if last == sup
634
+ qualify(sup, parts.join('::'))
635
+ end
636
+
630
637
  # @param name [String]
631
638
  # @param root [String]
632
639
  # @param skip [Array<String>]
@@ -28,7 +28,8 @@ module Solargraph
28
28
  @out.puts "Documenting #{name} #{version}"
29
29
  `yard gems #{name} #{version} #{@rebuild ? '--rebuild' : ''}`
30
30
  yd = YARD::Registry.yardoc_file_for_gem(name, "= #{version}")
31
- if !yd
31
+ # HACK: Ignore errors documenting bundler
32
+ if !yd && name != 'bundler'
32
33
  @out.puts "#{name} #{version} YARD documentation failed"
33
34
  failures += 1
34
35
  end
@@ -61,7 +62,7 @@ module Solargraph
61
62
  ]
62
63
  o, e, s = Open3.capture3(*cmd)
63
64
  if s.success?
64
- o && !o.empty? ? JSON.parse(o) : {}
65
+ o && !o.empty? ? JSON.parse(o.split("\n").last) : {}
65
66
  else
66
67
  Solargraph.logger.warn e
67
68
  raise BundleNotFoundError, "Failed to load gems from bundle at #{directory}"
@@ -105,22 +105,21 @@ module Solargraph
105
105
  def infer_first_defined pins, context, api_map
106
106
  type = ComplexType::UNDEFINED
107
107
  pins.each do |pin|
108
+ # Avoid infinite recursion
109
+ next if @@inference_stack.include?(pin.identity)
110
+ @@inference_stack.push pin.identity
108
111
  type = pin.typify(api_map)
112
+ @@inference_stack.pop
109
113
  break if type.defined?
110
114
  end
111
115
  if type.undefined?
112
116
  # Limit method inference recursion
113
117
  return type if @@inference_depth >= 2 && pins.first.is_a?(Pin::BaseMethod)
114
118
  @@inference_depth += 1
115
- name_count = {}
116
119
  pins.each do |pin|
117
- # Limit pin name hits for, e.g., variables with insane amounts of definitions
118
- name_count[pin.identity] ||= 0
119
- name_count[pin.identity] += 1
120
- next if name_count[pin.identity] >= 10
121
120
  # Avoid infinite recursion
122
- next if @@inference_stack.include?(pin)
123
- @@inference_stack.push pin
121
+ next if @@inference_stack.include?(pin.identity)
122
+ @@inference_stack.push pin.identity
124
123
  type = pin.probe(api_map)
125
124
  @@inference_stack.pop
126
125
  break if type.defined?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Solargraph
4
- VERSION = '0.38.5'
4
+ VERSION = '0.38.6'
5
5
  end
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.38.5
4
+ version: 0.38.6
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-01-27 00:00:00.000000000 Z
11
+ date: 2020-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backport