Skip to content

Commit 8ba7f22

Browse files
committed
Merge branch 'v0.59' into speed_up_specs
2 parents ffc25d6 + 3296a3c commit 8ba7f22

File tree

76 files changed

+2676
-832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2676
-832
lines changed

.envrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# current git branch
2+
SOLARGRAPH_FORCE_VERSION=0.0.1.dev-$(git rev-parse --abbrev-ref HEAD | tr -d '\n' | tr -d '/' | tr -d '-'| tr -d '_')
3+
export SOLARGRAPH_FORCE_VERSION

.github/workflows/rspec.yml

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,51 @@ jobs:
2121
runs-on: ubuntu-latest
2222
strategy:
2323
matrix:
24-
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', '4.0']
25-
rbs-version: ['3.6.1', '3.9.5', '4.0.0.dev.4']
24+
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', '4.0', 'head']
25+
rbs-version: ['3.6.1', '3.8.1', '3.9.5', '3.10.0', '4.0.0.dev.4']
2626
# Ruby 3.0 doesn't work with RBS 3.9.4 or 4.0.0.dev.4
2727
exclude:
28+
# only include the 3.0 variants we include later
2829
- ruby-version: '3.0'
29-
rbs-version: '3.9.5'
30-
- ruby-version: '3.0'
31-
rbs-version: '4.0.0.dev.4'
32-
# Missing require in 'rbs collection update' - hopefully
33-
# fixed in next RBS release
30+
# only include the 3.1 variants we include later
31+
- ruby-version: '3.1'
32+
# only include the 3.2 variants we include later
33+
- ruby-version: '3.2'
34+
# only include the 3.3 variants we include later
35+
- ruby-version: '3.3'
36+
# only include the 3.4 variants we include later
37+
- ruby-version: '3.4'
38+
# only include the 4.0 variants we include later
3439
- ruby-version: '4.0'
40+
# Don't exclude 'head' - let's test all RBS versions we
41+
# can there.
42+
#
43+
#
44+
# Just exclude some odd-ball compatibility issues we can't
45+
# work around:
46+
#
47+
# https://github.com/castwide/solargraph/actions/runs/20627923548/job/59241444380?pr=1102
48+
- ruby-version: 'head'
3549
rbs-version: '3.6.1'
36-
- ruby-version: '4.0'
50+
- ruby-version: 'head'
51+
rbs-version: '3.8.1'
52+
- ruby-version: 'head'
53+
rbs-version: '4.0.0.dev.4'
54+
include:
55+
- ruby-version: '3.0'
56+
rbs-version: '3.6.1'
57+
- ruby-version: '3.1'
58+
rbs-version: '3.6.1'
59+
- ruby-version: '3.2'
60+
rbs-version: '3.8.1'
61+
- ruby-version: '3.3'
62+
rbs-version: '3.9.5'
63+
- ruby-version: '3.3'
64+
rbs-version: '3.10.0'
65+
- ruby-version: '3.4'
3766
rbs-version: '4.0.0.dev.4'
67+
- ruby-version: '4.0'
68+
rbs-version: '3.10.0'
3869
steps:
3970
- uses: actions/checkout@v3
4071
- name: Set up Ruby

.rubocop_todo.yml

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ Layout/ElseAlignment:
8080
# Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
8181
Layout/EmptyLineBetweenDefs:
8282
Exclude:
83-
- 'lib/solargraph/doc_map.rb'
8483
- 'lib/solargraph/language_server/message/initialize.rb'
8584
- 'lib/solargraph/pin/delegated_method.rb'
8685

@@ -107,7 +106,6 @@ Layout/EndOfLine:
107106
Exclude:
108107
- 'Gemfile'
109108
- 'Rakefile'
110-
- 'lib/solargraph/source/encoding_fixes.rb'
111109
- 'solargraph.gemspec'
112110

113111
# This cop supports safe autocorrection (--autocorrect).
@@ -215,11 +213,6 @@ Layout/SpaceAfterComma:
215213
Layout/SpaceAroundEqualsInParameterDefault:
216214
Enabled: false
217215

218-
# This cop supports safe autocorrection (--autocorrect).
219-
Layout/SpaceAroundKeyword:
220-
Exclude:
221-
- 'spec/rbs_map/conversions_spec.rb'
222-
223216
# This cop supports safe autocorrection (--autocorrect).
224217
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals.
225218
# SupportedStylesForExponentOperator: space, no_space
@@ -362,7 +355,6 @@ Lint/NonAtomicFileOperation:
362355
# This cop supports safe autocorrection (--autocorrect).
363356
Lint/ParenthesesAsGroupedExpression:
364357
Exclude:
365-
- 'lib/solargraph.rb'
366358
- 'lib/solargraph/parser/parser_gem/node_chainer.rb'
367359
- 'spec/language_server/host_spec.rb'
368360
- 'spec/source_map/clip_spec.rb'
@@ -490,7 +482,6 @@ Metrics/ParameterLists:
490482
- 'lib/solargraph/pin/callable.rb'
491483
- 'lib/solargraph/type_checker.rb'
492484
- 'lib/solargraph/yard_map/mapper/to_method.rb'
493-
- 'lib/solargraph/yard_map/to_method.rb'
494485

495486
# Configuration parameters: AllowedMethods, AllowedPatterns, Max.
496487
Metrics/PerceivedComplexity:
@@ -576,7 +567,6 @@ RSpec/BeforeAfterAll:
576567
- '**/spec/rails_helper.rb'
577568
- '**/spec/support/**/*.rb'
578569
- 'spec/api_map_spec.rb'
579-
- 'spec/doc_map_spec.rb'
580570
- 'spec/language_server/host/dispatch_spec.rb'
581571
- 'spec/language_server/protocol_spec.rb'
582572

@@ -623,7 +613,6 @@ RSpec/ExampleWording:
623613
# This cop supports safe autocorrection (--autocorrect).
624614
RSpec/ExcessiveDocstringSpacing:
625615
Exclude:
626-
- 'spec/rbs_map/conversions_spec.rb'
627616
- 'spec/source/chain/call_spec.rb'
628617

629618
# This cop supports safe autocorrection (--autocorrect).
@@ -639,21 +628,10 @@ RSpec/ExpectActual:
639628
RSpec/HookArgument:
640629
Enabled: false
641630

642-
# This cop supports safe autocorrection (--autocorrect).
643-
# Configuration parameters: .
644-
# SupportedStyles: is_expected, should
645-
RSpec/ImplicitExpect:
646-
EnforcedStyle: should
647-
648631
# Configuration parameters: AssignmentOnly.
649632
RSpec/InstanceVariable:
650633
Enabled: false
651634

652-
# This cop supports safe autocorrection (--autocorrect).
653-
RSpec/LeadingSubject:
654-
Exclude:
655-
- 'spec/rbs_map/conversions_spec.rb'
656-
657635
RSpec/LeakyConstantDeclaration:
658636
Exclude:
659637
- 'spec/complex_type_spec.rb'
@@ -688,7 +666,11 @@ RSpec/NotToNot:
688666
- 'spec/rbs_map/core_map_spec.rb'
689667

690668
RSpec/PendingWithoutReason:
691-
Enabled: false
669+
Exclude:
670+
- 'spec/api_map_spec.rb'
671+
- 'spec/doc_map_spec.rb'
672+
- 'spec/pin/local_variable_spec.rb'
673+
- 'spec/type_checker/levels/strict_spec.rb'
692674

693675
# This cop supports unsafe autocorrection (--autocorrect-all).
694676
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
@@ -942,7 +924,6 @@ Style/MapIntoArray:
942924
Exclude:
943925
- 'lib/solargraph/diagnostics/update_errors.rb'
944926
- 'lib/solargraph/parser/parser_gem/node_chainer.rb'
945-
- 'lib/solargraph/type_checker/param_def.rb'
946927

947928
# This cop supports unsafe autocorrection (--autocorrect-all).
948929
Style/MapToHash:
@@ -1016,7 +997,6 @@ Style/Next:
1016997
- 'lib/solargraph/parser/parser_gem/node_processors/send_node.rb'
1017998
- 'lib/solargraph/pin/signature.rb'
1018999
- 'lib/solargraph/source_map/clip.rb'
1019-
- 'lib/solargraph/type_checker/checks.rb'
10201000

10211001
# This cop supports safe autocorrection (--autocorrect).
10221002
# Configuration parameters: Strict, AllowedNumbers, AllowedPatterns.
@@ -1144,7 +1124,7 @@ Style/SafeNavigation:
11441124
# Configuration parameters: Max.
11451125
Style/SafeNavigationChainLength:
11461126
Exclude:
1147-
- 'lib/solargraph/doc_map.rb'
1127+
- 'lib/solargraph/workspace/gemspecs.rb'
11481128

11491129
# This cop supports unsafe autocorrection (--autocorrect-all).
11501130
Style/SlicingWithRange:
@@ -1175,7 +1155,6 @@ Style/StringLiterals:
11751155
# This cop supports safe autocorrection (--autocorrect).
11761156
Style/SuperArguments:
11771157
Exclude:
1178-
- 'lib/solargraph/pin/base_variable.rb'
11791158
- 'lib/solargraph/pin/callable.rb'
11801159
- 'lib/solargraph/pin/method.rb'
11811160
- 'lib/solargraph/pin/signature.rb'
@@ -1217,7 +1196,12 @@ Style/TrailingCommaInArrayLiteral:
12171196
# Configuration parameters: EnforcedStyleForMultiline.
12181197
# SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
12191198
Style/TrailingCommaInHashLiteral:
1220-
Enabled: false
1199+
Exclude:
1200+
- 'lib/solargraph/pin/base_variable.rb'
1201+
- 'lib/solargraph/pin/callable.rb'
1202+
- 'lib/solargraph/pin/closure.rb'
1203+
- 'lib/solargraph/pin/parameter.rb'
1204+
- 'lib/solargraph/rbs_map/conversions.rb'
12211205

12221206
# This cop supports safe autocorrection (--autocorrect).
12231207
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, AllowedMethods.
@@ -1265,12 +1249,7 @@ YARD/MismatchName:
12651249
Enabled: false
12661250

12671251
YARD/TagTypeSyntax:
1268-
Exclude:
1269-
- 'lib/solargraph/api_map/constants.rb'
1270-
- 'lib/solargraph/language_server/host.rb'
1271-
- 'lib/solargraph/parser/comment_ripper.rb'
1272-
- 'lib/solargraph/pin/method.rb'
1273-
- 'lib/solargraph/type_checker.rb'
1252+
Enabled: false
12741253

12751254
# This cop supports safe autocorrection (--autocorrect).
12761255
# Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Plug-ins and extensions are available for the following editors:
5151

5252
Solargraph's behavior can be controlled via optional [configuration](https://solargraph.org/guides/configuration) files. The highest priority file is a `.solargraph.yml` file at the root of the project. If not present, any global configuration at `~/.config/solargraph/config.yml` will apply. The path to the global configuration can be overridden with the `SOLARGRAPH_GLOBAL_CONFIG` environment variable.
5353

54+
Use `bundle exec solargraph config` to create a configuration file.
55+
5456
### Plugins
5557

5658
Solargraph supports [plugins](https://solargraph.org/guides/plugins) that implement their own Solargraph features, such as diagnostics reporters and conventions to provide LSP features and type-checking, e.g. for frameworks which use metaprogramming and/or DSLs.

lib/solargraph.rb

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ class InvalidRubocopVersionError < RuntimeError; end
5555

5656
CHDIR_MUTEX = Mutex.new
5757

58-
# @param type [Symbol] Type of assert.
59-
def self.asserts_on?(type)
58+
def self.asserts_on?
6059
if ENV['SOLARGRAPH_ASSERTS'].nil? || ENV['SOLARGRAPH_ASSERTS'].empty?
6160
false
6261
elsif ENV['SOLARGRAPH_ASSERTS'] == 'on'
@@ -72,7 +71,26 @@ def self.asserts_on?(type)
7271
# @param block [Proc] A block that returns a message to log
7372
# @return [void]
7473
def self.assert_or_log(type, msg = nil, &block)
75-
raise (msg || block.call) if asserts_on?(type) && ![:combine_with_visibility].include?(type)
74+
if asserts_on?
75+
# @type [String, nil]
76+
msg ||= block.call
77+
78+
raise "No message given for #{type.inspect}" if msg.nil?
79+
80+
# conditional aliases to handle compatibility corner cases
81+
return if type == :alias_target_missing && msg.include?('highline/compatibility.rb')
82+
return if type == :alias_target_missing && msg.include?('lib/json/add/date.rb')
83+
# @todo :combine_with_visibility is not ready for prime time -
84+
# lots of disagreements found in practice that heuristics need
85+
# to be created for and/or debugging needs to resolve in pin
86+
# generation.
87+
# @todo :api_map_namespace_pin_stack triggers in a badly handled
88+
# self type case - 'keeps track of self type in method
89+
# parameters in subclass' in call_spec.rb
90+
return if %i[api_map_namespace_pin_stack combine_with_visibility].include?(type)
91+
92+
raise msg
93+
end
7694
logger.info msg, &block
7795
end
7896

0 commit comments

Comments
 (0)