solargraph 0.56.2 → 0.58.0

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.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/linting.yml +127 -0
  3. data/.github/workflows/plugins.yml +183 -7
  4. data/.github/workflows/rspec.yml +55 -5
  5. data/.github/workflows/typecheck.yml +6 -3
  6. data/.gitignore +5 -0
  7. data/.overcommit.yml +72 -0
  8. data/.rspec +1 -0
  9. data/.rubocop.yml +66 -0
  10. data/.rubocop_todo.yml +1279 -0
  11. data/.yardopts +1 -0
  12. data/CHANGELOG.md +69 -0
  13. data/README.md +8 -4
  14. data/Rakefile +125 -13
  15. data/bin/solargraph +8 -5
  16. data/lib/solargraph/api_map/cache.rb +3 -2
  17. data/lib/solargraph/api_map/constants.rb +279 -0
  18. data/lib/solargraph/api_map/index.rb +49 -31
  19. data/lib/solargraph/api_map/source_to_yard.rb +13 -4
  20. data/lib/solargraph/api_map/store.rb +144 -26
  21. data/lib/solargraph/api_map.rb +217 -245
  22. data/lib/solargraph/bench.rb +1 -0
  23. data/lib/solargraph/complex_type/type_methods.rb +6 -0
  24. data/lib/solargraph/complex_type/unique_type.rb +19 -12
  25. data/lib/solargraph/complex_type.rb +24 -3
  26. data/lib/solargraph/convention/active_support_concern.rb +111 -0
  27. data/lib/solargraph/convention/base.rb +17 -0
  28. data/lib/solargraph/convention/data_definition/data_assignment_node.rb +1 -0
  29. data/lib/solargraph/convention/data_definition/data_definition_node.rb +4 -2
  30. data/lib/solargraph/convention/data_definition.rb +2 -1
  31. data/lib/solargraph/convention/gemspec.rb +1 -1
  32. data/lib/solargraph/convention/struct_definition/struct_assignment_node.rb +1 -0
  33. data/lib/solargraph/convention/struct_definition/struct_definition_node.rb +3 -1
  34. data/lib/solargraph/convention/struct_definition.rb +36 -13
  35. data/lib/solargraph/convention.rb +31 -2
  36. data/lib/solargraph/diagnostics/rubocop.rb +6 -1
  37. data/lib/solargraph/diagnostics/rubocop_helpers.rb +5 -3
  38. data/lib/solargraph/doc_map.rb +44 -13
  39. data/lib/solargraph/environ.rb +9 -2
  40. data/lib/solargraph/equality.rb +1 -0
  41. data/lib/solargraph/gem_pins.rb +21 -11
  42. data/lib/solargraph/language_server/host/dispatch.rb +2 -0
  43. data/lib/solargraph/language_server/host/message_worker.rb +3 -0
  44. data/lib/solargraph/language_server/host.rb +12 -5
  45. data/lib/solargraph/language_server/message/base.rb +2 -1
  46. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +1 -1
  47. data/lib/solargraph/language_server/message/text_document/definition.rb +2 -0
  48. data/lib/solargraph/language_server/message/text_document/formatting.rb +19 -2
  49. data/lib/solargraph/language_server/message/text_document/type_definition.rb +1 -0
  50. data/lib/solargraph/language_server/message/workspace/did_change_workspace_folders.rb +2 -0
  51. data/lib/solargraph/language_server/progress.rb +8 -0
  52. data/lib/solargraph/language_server/request.rb +4 -1
  53. data/lib/solargraph/library.rb +11 -18
  54. data/lib/solargraph/location.rb +3 -0
  55. data/lib/solargraph/logging.rb +11 -2
  56. data/lib/solargraph/page.rb +3 -0
  57. data/lib/solargraph/parser/comment_ripper.rb +8 -1
  58. data/lib/solargraph/parser/flow_sensitive_typing.rb +33 -5
  59. data/lib/solargraph/parser/node_processor/base.rb +1 -1
  60. data/lib/solargraph/parser/node_processor.rb +6 -2
  61. data/lib/solargraph/parser/parser_gem/class_methods.rb +3 -13
  62. data/lib/solargraph/parser/parser_gem/flawed_builder.rb +1 -0
  63. data/lib/solargraph/parser/parser_gem/node_chainer.rb +3 -1
  64. data/lib/solargraph/parser/parser_gem/node_methods.rb +5 -16
  65. data/lib/solargraph/parser/parser_gem/node_processors/and_node.rb +1 -0
  66. data/lib/solargraph/parser/parser_gem/node_processors/block_node.rb +3 -2
  67. data/lib/solargraph/parser/parser_gem/node_processors/if_node.rb +2 -0
  68. data/lib/solargraph/parser/parser_gem/node_processors/masgn_node.rb +3 -0
  69. data/lib/solargraph/parser/parser_gem/node_processors/opasgn_node.rb +64 -8
  70. data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +12 -3
  71. data/lib/solargraph/parser/parser_gem/node_processors/send_node.rb +36 -16
  72. data/lib/solargraph/parser/region.rb +3 -0
  73. data/lib/solargraph/parser/snippet.rb +2 -0
  74. data/lib/solargraph/pin/base.rb +77 -14
  75. data/lib/solargraph/pin/base_variable.rb +6 -5
  76. data/lib/solargraph/pin/block.rb +3 -2
  77. data/lib/solargraph/pin/callable.rb +14 -1
  78. data/lib/solargraph/pin/closure.rb +5 -7
  79. data/lib/solargraph/pin/common.rb +6 -2
  80. data/lib/solargraph/pin/constant.rb +2 -0
  81. data/lib/solargraph/pin/local_variable.rb +1 -2
  82. data/lib/solargraph/pin/method.rb +28 -9
  83. data/lib/solargraph/pin/method_alias.rb +3 -0
  84. data/lib/solargraph/pin/parameter.rb +24 -10
  85. data/lib/solargraph/pin/proxy_type.rb +5 -1
  86. data/lib/solargraph/pin/reference/override.rb +15 -1
  87. data/lib/solargraph/pin/reference/superclass.rb +5 -0
  88. data/lib/solargraph/pin/reference.rb +17 -0
  89. data/lib/solargraph/pin/search.rb +6 -1
  90. data/lib/solargraph/pin/signature.rb +2 -0
  91. data/lib/solargraph/pin/symbol.rb +5 -0
  92. data/lib/solargraph/pin_cache.rb +64 -4
  93. data/lib/solargraph/position.rb +3 -0
  94. data/lib/solargraph/range.rb +5 -0
  95. data/lib/solargraph/rbs_map/conversions.rb +29 -6
  96. data/lib/solargraph/rbs_map/core_fills.rb +18 -0
  97. data/lib/solargraph/rbs_map/core_map.rb +14 -7
  98. data/lib/solargraph/rbs_map.rb +14 -1
  99. data/lib/solargraph/shell.rb +85 -1
  100. data/lib/solargraph/source/chain/call.rb +7 -3
  101. data/lib/solargraph/source/chain/constant.rb +3 -66
  102. data/lib/solargraph/source/chain/if.rb +1 -1
  103. data/lib/solargraph/source/chain/link.rb +11 -2
  104. data/lib/solargraph/source/chain/or.rb +1 -1
  105. data/lib/solargraph/source/chain.rb +11 -2
  106. data/lib/solargraph/source/change.rb +2 -2
  107. data/lib/solargraph/source/cursor.rb +2 -3
  108. data/lib/solargraph/source/source_chainer.rb +1 -1
  109. data/lib/solargraph/source.rb +6 -3
  110. data/lib/solargraph/source_map/clip.rb +18 -26
  111. data/lib/solargraph/source_map/data.rb +4 -0
  112. data/lib/solargraph/source_map/mapper.rb +2 -2
  113. data/lib/solargraph/source_map.rb +28 -16
  114. data/lib/solargraph/type_checker/param_def.rb +2 -0
  115. data/lib/solargraph/type_checker/rules.rb +30 -8
  116. data/lib/solargraph/type_checker.rb +301 -186
  117. data/lib/solargraph/version.rb +1 -1
  118. data/lib/solargraph/workspace/config.rb +21 -5
  119. data/lib/solargraph/workspace/require_paths.rb +97 -0
  120. data/lib/solargraph/workspace.rb +30 -67
  121. data/lib/solargraph/yard_map/mapper/to_method.rb +4 -3
  122. data/lib/solargraph/yard_map/mapper/to_namespace.rb +1 -0
  123. data/lib/solargraph/yard_map/to_method.rb +2 -1
  124. data/lib/solargraph/yardoc.rb +39 -3
  125. data/lib/solargraph.rb +2 -0
  126. data/rbs/fills/bundler/0/bundler.rbs +4271 -0
  127. data/rbs/fills/open3/0/open3.rbs +172 -0
  128. data/rbs/fills/rubygems/0/basic_specification.rbs +326 -0
  129. data/rbs/fills/rubygems/0/errors.rbs +364 -0
  130. data/rbs/fills/rubygems/0/spec_fetcher.rbs +107 -0
  131. data/rbs/fills/rubygems/0/specification.rbs +1753 -0
  132. data/rbs/fills/{tuple.rbs → tuple/tuple.rbs} +2 -3
  133. data/rbs_collection.yaml +4 -4
  134. data/sig/shims/ast/0/node.rbs +5 -0
  135. data/sig/shims/ast/2.4/.rbs_meta.yaml +9 -0
  136. data/sig/shims/ast/2.4/ast.rbs +73 -0
  137. data/sig/shims/parser/3.2.0.1/builders/default.rbs +195 -0
  138. data/sig/shims/parser/3.2.0.1/manifest.yaml +7 -0
  139. data/sig/shims/parser/3.2.0.1/parser.rbs +201 -0
  140. data/sig/shims/parser/3.2.0.1/polyfill.rbs +4 -0
  141. data/sig/shims/thor/1.2.0.1/.rbs_meta.yaml +9 -0
  142. data/sig/shims/thor/1.2.0.1/manifest.yaml +7 -0
  143. data/sig/shims/thor/1.2.0.1/thor.rbs +17 -0
  144. data/solargraph.gemspec +26 -5
  145. metadata +181 -13
  146. data/lib/.rubocop.yml +0 -22
  147. data/lib/solargraph/parser/node_methods.rb +0 -97
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82754cd0869fed91a86a2bfb08ca0f54d6468f942620cddd3148bad99724ad88
4
- data.tar.gz: 4e017a78936b0d24eaa6d5db7edcd01ea2b43d6cb365eb5b4892576a141ca2b7
3
+ metadata.gz: e56c80fcd3d09dfa44076f993bc9b9109499f5aca4453b2bec161257161791d6
4
+ data.tar.gz: e1063c87d37ac58f04cf790e40e6e01b5044d74ab2fa102b1a80a133ad47111b
5
5
  SHA512:
6
- metadata.gz: 304fb86181925f916d7119da44b85a3753fc33d961da8a61c5525dbcb8d814a87baeeb9767d17b7ec6548c3ffe725bfda6eafbfd7ea75e8bdddf3f1a1a5c103b
7
- data.tar.gz: 73d437e753be70628008f09a7846cba5e16fd47d045017b41c0b301d8a5b34ca04a45127a37c6eada4e61287944ca1af659ecab8df4681bab42a8ecc37d73bc4
6
+ metadata.gz: c4bf24a5265c55ce29e24ae70fd5504250aec4f684b7f2aa220ed96292feda346ad0d0ad9116399a59a57ae69e6846b8cca6b5ee7946690fa49a34b90777b913
7
+ data.tar.gz: d4c04335686f8d5af07fa7b0a581e96c197ad605bdd4b5a5eeb5fd41fe4ddca8c14a89b19c4b0acf5257909d2e45864929aacaf98d19c6459109f815a383c5b1
@@ -0,0 +1,127 @@
1
+ ---
2
+ # To debug locally:
3
+ # npm install -g act
4
+ # act pull_release -j overcommit
5
+
6
+ name: Linting
7
+
8
+ on:
9
+ workflow_dispatch: {}
10
+ pull_request:
11
+ branches: [ master ]
12
+ push:
13
+ branches:
14
+ - 'main'
15
+ tags:
16
+ - 'v*'
17
+
18
+ permissions:
19
+ pull-requests: write
20
+ contents: read
21
+
22
+ jobs:
23
+ overcommit:
24
+ runs-on: ubuntu-latest
25
+ steps:
26
+ - uses: actions/checkout@v2
27
+ # Number of commits to fetch. 0 indicates all history for all branches and tags.
28
+ with:
29
+ fetch-depth: 0
30
+
31
+ - uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: 3.4
34
+ bundler: latest
35
+ bundler-cache: true
36
+ cache-version: 2025-06-06
37
+
38
+ - name: Update to best available RBS
39
+ run: |
40
+ bundle update rbs # use latest available for this Ruby version
41
+
42
+ - name: Restore cache of gem annotations
43
+ id: dot-cache-restore
44
+ uses: actions/cache/restore@v4
45
+ with:
46
+ key: |
47
+ 2025-06-26-09-${{ runner.os }}-dot-cache-${{ hashFiles('Gemfile.lock') }}
48
+ restore-keys: |
49
+ 2025-06-26-09-${{ runner.os }}-dot-cache
50
+ 2025-06-26-09-${{ runner.os }}-dot-cache-
51
+ path: |
52
+ /home/runner/.cache/solargraph
53
+
54
+ - name: Install gem types
55
+ run: bundle exec rbs collection install
56
+
57
+ - name: Overcommit
58
+ run: |
59
+ bundle exec overcommit --sign
60
+ SOLARGRAPH_ASSERTS=on bundle exec overcommit --run --diff origin/master
61
+ rubocop:
62
+ name: rubocop
63
+ runs-on: ubuntu-latest
64
+ steps:
65
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
66
+ - uses: ruby/setup-ruby@1a615958ad9d422dd932dc1d5823942ee002799f # v1.227.0
67
+ with:
68
+ ruby-version: '3.3'
69
+ bundler-cache: true
70
+ - uses: reviewdog/action-rubocop@fcb74ba274da10b18d038d0bcddaae3518739634 # v2.21.2
71
+ with:
72
+ reporter: github-pr-check
73
+ skip_install: true
74
+ use_bundler: true
75
+ rubocop_extensions: 'rubocop-rspec:gemfile rubocop-rake:gemfile rubocop-yard:gemfile'
76
+ rubocop_flags: '-c .rubocop.yml'
77
+ fail_level: info
78
+ rubocop_version: Gemfile
79
+ level: info
80
+ rbs_validate:
81
+ name: rbs validate
82
+ runs-on: ubuntu-latest
83
+
84
+ steps:
85
+ - uses: actions/checkout@v3
86
+ - name: Set up Ruby
87
+ uses: ruby/setup-ruby@v1
88
+ with:
89
+ ruby-version: 3.4
90
+ bundler-cache: false
91
+
92
+ - name: Install gems
93
+ run: bundle install
94
+
95
+ - name: Run rbs validate
96
+ run: bundle exec rbs validate
97
+ rubocop_todo:
98
+ name: .rubocop_todo.yml
99
+ runs-on: ubuntu-latest
100
+
101
+ steps:
102
+ - uses: actions/checkout@v3
103
+ - name: Set up Ruby
104
+ uses: ruby/setup-ruby@v1
105
+ with:
106
+ ruby-version: 3.4
107
+ bundler-cache: false
108
+
109
+ - name: Install gems
110
+ run: bundle install
111
+
112
+ - name: Run RuboCop
113
+ run: bundle exec rubocop -c .rubocop.yml
114
+
115
+ - name: Run RuboCop against todo file
116
+ continue-on-error: true
117
+ run: |
118
+ cmd="bundle exec rubocop --auto-gen-config --exclude-limit=5 --no-offense-counts --no-auto-gen-timestamp"
119
+ ${cmd:?}
120
+ set +e
121
+ if [ -n "$(git status --porcelain)" ]
122
+ then
123
+ git status --porcelain
124
+ git diff -u .
125
+ >&2 echo "Please address any new issues, then run '${cmd:?}' and push up any improvements"
126
+ exit 1
127
+ fi
@@ -1,16 +1,21 @@
1
- name: Plugin Backwards Compatibility Tests
1
+ ---
2
+ name: Plugin
3
+
4
+ # To debug locally:
5
+ # npm install -g act
6
+ # cd /Users/broz/src/solargraph/ && act pull_request -j run_solargraph_rails_specs # e.g.
2
7
 
3
8
  on:
4
9
  push:
5
- branches: [ master ]
10
+ branches: [master]
6
11
  pull_request:
7
- branches: [ master ]
12
+ branches: [master]
8
13
 
9
14
  permissions:
10
15
  contents: read
11
16
 
12
17
  jobs:
13
- test:
18
+ regression:
14
19
  runs-on: ubuntu-latest
15
20
 
16
21
  steps:
@@ -18,8 +23,8 @@ jobs:
18
23
  - name: Set up Ruby
19
24
  uses: ruby/setup-ruby@v1
20
25
  with:
21
- ruby-version: '3.0'
22
- bundler-cache: false
26
+ ruby-version: 3.4
27
+ bundler-cache: true
23
28
  - uses: awalsh128/cache-apt-pkgs-action@latest
24
29
  with:
25
30
  packages: yq
@@ -29,14 +34,185 @@ jobs:
29
34
  echo 'gem "solargraph-rails"' > .Gemfile
30
35
  echo 'gem "solargraph-rspec"' >> .Gemfile
31
36
  bundle install
37
+ bundle update rbs
32
38
  - name: Configure to use plugins
33
39
  run: |
34
40
  bundle exec solargraph config
35
41
  yq -yi '.plugins += ["solargraph-rails"]' .solargraph.yml
36
42
  yq -yi '.plugins += ["solargraph-rspec"]' .solargraph.yml
37
43
  - name: Install gem types
38
- run: bundle exec rbs collection install
44
+ run: bundle exec rbs collection update
45
+ - name: Ensure typechecking still works
46
+ run: bundle exec solargraph typecheck --level typed
47
+ - name: Ensure specs still run
48
+ run: bundle exec rake spec
49
+ rails:
50
+ runs-on: ubuntu-latest
51
+
52
+ steps:
53
+ - uses: actions/checkout@v3
54
+ - name: Set up Ruby
55
+ uses: ruby/setup-ruby@v1
56
+ with:
57
+ ruby-version: 3.4
58
+ bundler-cache: false
59
+ - uses: awalsh128/cache-apt-pkgs-action@latest
60
+ with:
61
+ packages: yq
62
+ version: 1.0
63
+ - name: Install gems
64
+ run: |
65
+ echo 'gem "solargraph-rails"' > .Gemfile
66
+ bundle install
67
+ bundle update rbs
68
+ - name: Configure to use plugins
69
+ run: |
70
+ bundle exec solargraph config
71
+ yq -yi '.plugins += ["solargraph-rails"]' .solargraph.yml
72
+ - name: Install gem types
73
+ run: bundle exec rbs collection update
74
+ - name: Ensure typechecking still works
75
+ run: bundle exec solargraph typecheck --level typed
76
+ - name: Ensure specs still run
77
+ run: bundle exec rake spec
78
+ rspec:
79
+ runs-on: ubuntu-latest
80
+
81
+ steps:
82
+ - uses: actions/checkout@v3
83
+ - name: Set up Ruby
84
+ uses: ruby/setup-ruby@v1
85
+ with:
86
+ ruby-version: 3.4
87
+ bundler-cache: false
88
+ - uses: awalsh128/cache-apt-pkgs-action@latest
89
+ with:
90
+ packages: yq
91
+ version: 1.0
92
+ - name: Install gems
93
+ run: |
94
+ echo 'gem "solargraph-rspec"' >> .Gemfile
95
+ bundle install
96
+ bundle update rbs
97
+ - name: Configure to use plugins
98
+ run: |
99
+ bundle exec solargraph config
100
+ yq -yi '.plugins += ["solargraph-rspec"]' .solargraph.yml
101
+ - name: Install gem types
102
+ run: bundle exec rbs collection update
39
103
  - name: Ensure typechecking still works
40
104
  run: bundle exec solargraph typecheck --level typed
41
105
  - name: Ensure specs still run
42
106
  run: bundle exec rake spec
107
+
108
+ run_solargraph_rspec_specs:
109
+ # check out solargraph-rspec as well as this project, and point the former to use the latter as a local gem
110
+ runs-on: ubuntu-latest
111
+ env:
112
+ SOLARGRAPH_CACHE: ${{ github.workspace }}/../solargraph-rspec/vendor/solargraph/cache
113
+ BUNDLE_PATH: ${{ github.workspace }}/../solargraph-rspec/vendor/bundle
114
+ steps:
115
+ - uses: actions/checkout@v3
116
+ - name: clone https://github.com/lekemula/solargraph-rspec/
117
+ run: |
118
+ cd ..
119
+ # git clone https://github.com/lekemula/solargraph-rspec.git
120
+
121
+ # pending https://github.com/lekemula/solargraph-rspec/pull/30
122
+ git clone https://github.com/apiology/solargraph-rspec.git
123
+ cd solargraph-rspec
124
+ git checkout reset_closures
125
+ - name: Set up Ruby
126
+ uses: ruby/setup-ruby@v1
127
+ with:
128
+ ruby-version: '3.1'
129
+ rubygems: latest
130
+ bundler-cache: false
131
+ - name: Install gems
132
+ run: |
133
+ set -x
134
+
135
+ cd ../solargraph-rspec
136
+ echo "gem 'solargraph', path: '../solargraph'" >> Gemfile
137
+ bundle config path ${{ env.BUNDLE_PATH }}
138
+ bundle install --jobs 4 --retry 3
139
+ bundle exec appraisal install
140
+ # @todo some kind of appraisal/bundle conflict?
141
+ # https://github.com/castwide/solargraph/actions/runs/19038710934/job/54369767122?pr=1116
142
+ # /home/runner/work/solargraph/solargraph-rspec/vendor/bundle/ruby/3.1.0/gems/bundler-2.6.9/lib/bundler/runtime.rb:317:in
143
+ # `check_for_activated_spec!': You have already activated date
144
+ # 3.5.0, but your Gemfile requires date 3.4.1. Prepending
145
+ # `bundle exec` to your command may solve
146
+ # this. (Gem::LoadError)
147
+ bundle exec appraisal update date
148
+ # For some reason on ruby 3.1 it defaults to an old version: 1.3.2
149
+ # https://github.com/lekemula/solargraph-rspec/actions/runs/17814581205/job/50645370316?pr=22
150
+ # We update manually to the latest
151
+ bundle exec appraisal update rspec-rails
152
+ - name: Configure .solargraph.yml
153
+ run: |
154
+ cd ../solargraph-rspec
155
+ cp .solargraph.yml.example .solargraph.yml
156
+ - name: Solargraph generate RSpec gems YARD and RBS pins
157
+ run: |
158
+ cd ../solargraph-rspec
159
+ bundle exec appraisal rbs collection update
160
+ rspec_gems=$(bundle exec appraisal ruby -r './lib/solargraph-rspec' -e 'puts Solargraph::Rspec::Gems.gem_names.join(" ")' 2>/dev/null | tail -n1)
161
+ bundle exec appraisal solargraph gems $rspec_gems
162
+ - name: Run specs
163
+ run: |
164
+ cd ../solargraph-rspec
165
+ bundle exec appraisal rspec --format progress
166
+
167
+ run_solargraph_rails_specs:
168
+ # check out solargraph-rails as well as this project, and point the former to use the latter as a local gem
169
+ runs-on: ubuntu-latest
170
+ steps:
171
+ - uses: actions/checkout@v3
172
+ - name: clone solargraph-rails
173
+ run: |
174
+ cd ..
175
+ git clone https://github.com/iftheshoefritz/solargraph-rails.git
176
+ cd solargraph-rails
177
+ - name: Set up Ruby
178
+ uses: ruby/setup-ruby@v1
179
+ with:
180
+ # solargraph-rails supports Ruby 3.0+
181
+ ruby-version: '3.0'
182
+ bundler-cache: false
183
+ bundler: latest
184
+ env:
185
+ MATRIX_RAILS_VERSION: "7.0"
186
+ - name: Install gems
187
+ run: |
188
+ set -x
189
+ BUNDLE_PATH="${GITHUB_WORKSPACE:?}/vendor/bundle"
190
+ export BUNDLE_PATH
191
+ cd ../solargraph-rails
192
+ echo "gem 'solargraph', path: '${GITHUB_WORKSPACE:?}'" >> Gemfile
193
+ bundle install
194
+ bundle update rbs
195
+ RAILS_DIR="$(pwd)/spec/rails7"
196
+ export RAILS_DIR
197
+ cd ${RAILS_DIR}
198
+ bundle install
199
+ bundle exec --gemfile ../../Gemfile rbs --version
200
+ bundle exec --gemfile ../../Gemfile rbs collection install
201
+ cd ../../
202
+ # bundle exec rbs collection init
203
+ # bundle exec rbs collection install
204
+ env:
205
+ MATRIX_RAILS_VERSION: "7.0"
206
+ MATRIX_RAILS_MAJOR_VERSION: '7'
207
+ - name: Run specs
208
+ run: |
209
+ BUNDLE_PATH="${GITHUB_WORKSPACE:?}/vendor/bundle"
210
+ export BUNDLE_PATH
211
+ cd ../solargraph-rails
212
+ bundle exec solargraph --version
213
+ bundle info solargraph
214
+ bundle info rbs
215
+ bundle info yard
216
+ ALLOW_IMPROVEMENTS=true bundle exec rake spec
217
+ env:
218
+ MATRIX_RAILS_VERSION: "7.0"
@@ -17,21 +17,71 @@ permissions:
17
17
  contents: read
18
18
 
19
19
  jobs:
20
- test:
21
-
20
+ rspec:
22
21
  runs-on: ubuntu-latest
23
22
  strategy:
24
23
  matrix:
25
- ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', 'head']
26
-
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']
26
+ # Ruby 3.0 doesn't work with RBS 3.9.4 or 4.0.0.dev.4
27
+ exclude:
28
+ - 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
34
+ - ruby-version: '4.0'
35
+ rbs-version: '3.6.1'
36
+ - ruby-version: '4.0'
37
+ rbs-version: '4.0.0.dev.4'
27
38
  steps:
28
39
  - uses: actions/checkout@v3
29
40
  - name: Set up Ruby
30
41
  uses: ruby/setup-ruby@v1
31
42
  with:
32
43
  ruby-version: ${{ matrix.ruby-version }}
44
+ # see https://github.com/castwide/solargraph/actions/runs/19391419903/job/55485410493?pr=1119
45
+ #
46
+ # match version in Gemfile.lock and use same version below
47
+ bundler: 2.5.23
48
+ bundler-cache: false
49
+ - name: Set rbs version
50
+ run: echo "gem 'rbs', '${{ matrix.rbs-version }}'" >> .Gemfile
51
+ # /home/runner/.rubies/ruby-head/lib/ruby/gems/3.5.0+2/gems/rbs-3.9.4/lib/rbs.rb:11:
52
+ # warning: tsort was loaded from the standard library,
53
+ # but will no longer be part of the default gems
54
+ # starting from Ruby 3.6.0
55
+ - name: Work around legacy rbs deprecation on ruby > 3.4
56
+ run: echo "gem 'tsort'" >> .Gemfile
57
+ - name: Install gems
58
+ run: |
59
+ bundle _2.5.23_ install
60
+ bundle update rbs # use latest available for this Ruby version
61
+ bundle list
62
+ bundle exec solargraph pin 'Bundler::Dsl#source'
63
+ - name: Update types
64
+ run: |
65
+ bundle exec rbs collection update
66
+ - name: Run tests
67
+ run: bundle exec rake spec
68
+ undercover:
69
+ runs-on: ubuntu-latest
70
+ steps:
71
+ - uses: actions/checkout@v3
72
+ with:
73
+ # fetch all history for all branches and tags so we can
74
+ # compare against origin/master
75
+ fetch-depth: 0
76
+ - name: Set up Ruby
77
+ uses: ruby/setup-ruby@v1
78
+ with:
79
+ ruby-version: '3.4'
33
80
  bundler-cache: false
34
81
  - name: Install gems
35
82
  run: bundle install
36
83
  - name: Run tests
37
- run: bundle exec rspec
84
+ run: bundle exec rake spec
85
+ - name: Check PR coverage
86
+ run: bundle exec rake undercover
87
+ continue-on-error: true
@@ -17,7 +17,8 @@ permissions:
17
17
  contents: read
18
18
 
19
19
  jobs:
20
- test:
20
+ solargraph_typed:
21
+ name: Solargraph / strong
21
22
 
22
23
  runs-on: ubuntu-latest
23
24
 
@@ -29,8 +30,10 @@ jobs:
29
30
  ruby-version: 3.4
30
31
  bundler-cache: false
31
32
  - name: Install gems
32
- run: bundle install
33
+ run: |
34
+ bundle install
35
+ bundle update rbs # use latest available for this Ruby version
33
36
  - name: Install gem types
34
37
  run: bundle exec rbs collection install
35
38
  - name: Typecheck self
36
- run: SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level typed
39
+ run: SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level strong
data/.gitignore CHANGED
@@ -9,3 +9,8 @@
9
9
  doc
10
10
  coverage
11
11
  /tmp/
12
+ /rspec-examples.txt
13
+ /.ruby-version
14
+ /Makefile
15
+ /.pryrc
16
+ /.rspec-local
data/.overcommit.yml ADDED
@@ -0,0 +1,72 @@
1
+ ---
2
+ # Use this file to configure the Overcommit hooks you wish to use. This will
3
+ # extend the default configuration defined in:
4
+ # https://github.com/sds/overcommit/blob/master/config/default.yml
5
+ #
6
+ # At the topmost level of this YAML file is a key representing type of hook
7
+ # being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
8
+ # customize each hook, such as whether to only run it on certain files (via
9
+ # `include`), whether to only display output if it fails (via `quiet`), etc.
10
+ #
11
+ # For a complete list of hooks, see:
12
+ # https://github.com/sds/overcommit/tree/master/lib/overcommit/hook
13
+ #
14
+ # For a complete list of options that you can use to customize hooks, see:
15
+ # https://github.com/sds/overcommit#configuration
16
+ #
17
+ # Uncomment the following lines to make the configuration take effect.
18
+
19
+ PreCommit:
20
+ RuboCop:
21
+ enabled: true
22
+
23
+ Solargraph:
24
+ enabled: true
25
+ exclude:
26
+ - 'spec/**/*'
27
+
28
+ FixMe:
29
+ enabled: true
30
+ exclude:
31
+ # don't freak out over line below
32
+ - '.overcommit.yml'
33
+ # from upstream
34
+ - 'rbs/fills/rubygems/0/basic_specification.rbs'
35
+ keywords: ['FIXME', 'TODO', 'XXX']
36
+
37
+ # creates false positives in CI
38
+ AuthorName:
39
+ enabled: false
40
+
41
+ # creates false positives in CI
42
+ AuthorEmail:
43
+ enabled: false
44
+
45
+ ALL:
46
+ # if you change the next line to 'report', and you make changes to
47
+ # a file, overcommit will have you make the entire file pass
48
+ #
49
+ problem_on_unmodified_line: warn
50
+ # on_warn: fail
51
+ exclude:
52
+ - lib/solargraph/rails/annotations/**/*
53
+ - vendor/**/*
54
+ - ".bundle/**/*"
55
+ - 'core.*'
56
+
57
+ verify_signatures: false
58
+
59
+ #
60
+ # TrailingWhitespace:
61
+ # enabled: true
62
+ # exclude:
63
+ # - '**/db/structure.sql' # Ignore trailing whitespace in generated files
64
+ #
65
+ #PostCheckout:
66
+ # ALL: # Special hook name that customizes all hooks of this type
67
+ # quiet: true # Change all post-checkout hooks to only display output on failure
68
+ #
69
+ # IndexTags:
70
+ # enabled: true # Generate a tags file with `ctags` each time HEAD changes
71
+
72
+ gemfile: Gemfile
data/.rspec CHANGED
@@ -1,2 +1,3 @@
1
1
  --color
2
2
  --require spec_helper
3
+ --profile
data/.rubocop.yml ADDED
@@ -0,0 +1,66 @@
1
+ ---
2
+ inherit_from: .rubocop_todo.yml
3
+
4
+ # The behavior of RuboCop can be controlled via the .rubocop.yml
5
+ # configuration file. It makes it possible to enable/disable
6
+ # certain cops (checks) and to alter their behavior if they accept
7
+ # any parameters. The file can be placed either in your home
8
+ # directory or in some project directory.
9
+ #
10
+ # RuboCop will start looking for the configuration file in the directory
11
+ # where the inspected file is and continue its way up to the root directory.
12
+ #
13
+ # See https://docs.rubocop.org/rubocop/configuration
14
+ AllCops:
15
+ NewCops: enable
16
+ Exclude:
17
+ - "spec/fixtures/invalid_byte.rb"
18
+ - "spec/fixtures/invalid_node_comment.rb"
19
+ - "spec/fixtures/invalid_utf8.rb"
20
+ - "vendor/**/*"
21
+ - "vendor/**/.*"
22
+ TargetRubyVersion: 3.0
23
+
24
+ # We don't use the spec/solargraph directory
25
+ RSpec/SpecFilePathFormat:
26
+ Enabled: false
27
+
28
+ Style/MethodDefParentheses:
29
+ EnforcedStyle: require_no_parentheses
30
+
31
+ Layout/EmptyLineAfterGuardClause:
32
+ Enabled: false
33
+
34
+ Lint/UnusedMethodArgument:
35
+ AllowUnusedKeywordArguments: true
36
+
37
+ Metrics/ParameterLists:
38
+ Max: 7
39
+ CountKeywordArgs: false
40
+
41
+ # we tend to use @@ and the risk doesn't seem high
42
+ Style/ClassVars:
43
+ Enabled: false
44
+
45
+ #
46
+ # Set a relaxed standard on harder-to-address item for ease of
47
+ # contribution - if you are good at refactoring, we welcome PRs to
48
+ # improve existing code!
49
+ #
50
+ Metrics/AbcSize:
51
+ Max: 65
52
+ Metrics/MethodLength:
53
+ Max: 60
54
+ Metrics/ClassLength:
55
+ Max: 500
56
+ Metrics/CyclomaticComplexity:
57
+ Max: 23
58
+ Metrics/PerceivedComplexity:
59
+ Max: 29
60
+ RSpec/ExampleLength:
61
+ Max: 17
62
+
63
+ plugins:
64
+ - rubocop-rspec
65
+ - rubocop-rake
66
+ - rubocop-yard