solargraph 0.54.4 → 0.58.3

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 (238) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +2 -0
  3. data/.github/workflows/linting.yml +127 -0
  4. data/.github/workflows/plugins.yml +185 -6
  5. data/.github/workflows/rspec.yml +55 -5
  6. data/.github/workflows/typecheck.yml +8 -3
  7. data/.gitignore +8 -0
  8. data/.overcommit.yml +72 -0
  9. data/.rspec +1 -0
  10. data/.rubocop.yml +66 -0
  11. data/.rubocop_todo.yml +1279 -0
  12. data/.yardopts +1 -0
  13. data/CHANGELOG.md +143 -0
  14. data/README.md +20 -6
  15. data/Rakefile +125 -13
  16. data/bin/solargraph +3 -0
  17. data/lib/solargraph/api_map/cache.rb +110 -109
  18. data/lib/solargraph/api_map/constants.rb +279 -0
  19. data/lib/solargraph/api_map/index.rb +193 -167
  20. data/lib/solargraph/api_map/source_to_yard.rb +97 -88
  21. data/lib/solargraph/api_map/store.rb +384 -241
  22. data/lib/solargraph/api_map.rb +945 -875
  23. data/lib/solargraph/bench.rb +45 -28
  24. data/lib/solargraph/complex_type/type_methods.rb +228 -217
  25. data/lib/solargraph/complex_type/unique_type.rb +482 -386
  26. data/lib/solargraph/complex_type.rb +444 -394
  27. data/lib/solargraph/convention/active_support_concern.rb +111 -0
  28. data/lib/solargraph/convention/base.rb +20 -3
  29. data/lib/solargraph/convention/data_definition/data_assignment_node.rb +61 -0
  30. data/lib/solargraph/convention/data_definition/data_definition_node.rb +91 -0
  31. data/lib/solargraph/convention/data_definition.rb +105 -0
  32. data/lib/solargraph/convention/gemfile.rb +15 -15
  33. data/lib/solargraph/convention/gemspec.rb +23 -22
  34. data/lib/solargraph/convention/rakefile.rb +17 -17
  35. data/lib/solargraph/convention/struct_definition/struct_assignment_node.rb +61 -0
  36. data/lib/solargraph/convention/struct_definition/struct_definition_node.rb +102 -0
  37. data/lib/solargraph/convention/struct_definition.rb +164 -0
  38. data/lib/solargraph/convention.rb +78 -47
  39. data/lib/solargraph/converters/dd.rb +17 -17
  40. data/lib/solargraph/converters/dl.rb +15 -15
  41. data/lib/solargraph/converters/dt.rb +15 -15
  42. data/lib/solargraph/converters/misc.rb +1 -1
  43. data/lib/solargraph/diagnostics/require_not_found.rb +53 -53
  44. data/lib/solargraph/diagnostics/rubocop.rb +118 -113
  45. data/lib/solargraph/diagnostics/rubocop_helpers.rb +68 -66
  46. data/lib/solargraph/diagnostics/type_check.rb +55 -55
  47. data/lib/solargraph/diagnostics/update_errors.rb +41 -41
  48. data/lib/solargraph/doc_map.rb +439 -188
  49. data/lib/solargraph/environ.rb +9 -2
  50. data/lib/solargraph/equality.rb +34 -33
  51. data/lib/solargraph/gem_pins.rb +98 -72
  52. data/lib/solargraph/language_server/error_codes.rb +20 -20
  53. data/lib/solargraph/language_server/host/diagnoser.rb +89 -89
  54. data/lib/solargraph/language_server/host/dispatch.rb +130 -128
  55. data/lib/solargraph/language_server/host/message_worker.rb +112 -106
  56. data/lib/solargraph/language_server/host/sources.rb +99 -99
  57. data/lib/solargraph/language_server/host.rb +878 -861
  58. data/lib/solargraph/language_server/message/base.rb +97 -96
  59. data/lib/solargraph/language_server/message/client/register_capability.rb +15 -15
  60. data/lib/solargraph/language_server/message/completion_item/resolve.rb +60 -60
  61. data/lib/solargraph/language_server/message/extended/check_gem_version.rb +114 -112
  62. data/lib/solargraph/language_server/message/extended/document.rb +23 -20
  63. data/lib/solargraph/language_server/message/extended/document_gems.rb +32 -32
  64. data/lib/solargraph/language_server/message/extended/download_core.rb +19 -19
  65. data/lib/solargraph/language_server/message/extended/search.rb +20 -20
  66. data/lib/solargraph/language_server/message/initialize.rb +191 -191
  67. data/lib/solargraph/language_server/message/text_document/completion.rb +56 -56
  68. data/lib/solargraph/language_server/message/text_document/definition.rb +40 -38
  69. data/lib/solargraph/language_server/message/text_document/document_highlight.rb +16 -16
  70. data/lib/solargraph/language_server/message/text_document/document_symbol.rb +26 -26
  71. data/lib/solargraph/language_server/message/text_document/formatting.rb +148 -131
  72. data/lib/solargraph/language_server/message/text_document/hover.rb +58 -58
  73. data/lib/solargraph/language_server/message/text_document/prepare_rename.rb +11 -11
  74. data/lib/solargraph/language_server/message/text_document/references.rb +16 -16
  75. data/lib/solargraph/language_server/message/text_document/rename.rb +19 -19
  76. data/lib/solargraph/language_server/message/text_document/signature_help.rb +24 -24
  77. data/lib/solargraph/language_server/message/text_document/type_definition.rb +25 -24
  78. data/lib/solargraph/language_server/message/workspace/did_change_configuration.rb +35 -35
  79. data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +40 -40
  80. data/lib/solargraph/language_server/message/workspace/did_change_workspace_folders.rb +26 -24
  81. data/lib/solargraph/language_server/message/workspace/workspace_symbol.rb +23 -23
  82. data/lib/solargraph/language_server/message.rb +94 -94
  83. data/lib/solargraph/language_server/progress.rb +8 -0
  84. data/lib/solargraph/language_server/request.rb +27 -24
  85. data/lib/solargraph/language_server/transport/data_reader.rb +74 -74
  86. data/lib/solargraph/language_server/uri_helpers.rb +49 -49
  87. data/lib/solargraph/library.rb +683 -662
  88. data/lib/solargraph/location.rb +82 -58
  89. data/lib/solargraph/logging.rb +37 -27
  90. data/lib/solargraph/page.rb +92 -89
  91. data/lib/solargraph/parser/comment_ripper.rb +69 -56
  92. data/lib/solargraph/parser/flow_sensitive_typing.rb +255 -0
  93. data/lib/solargraph/parser/node_processor/base.rb +92 -87
  94. data/lib/solargraph/parser/node_processor.rb +62 -45
  95. data/lib/solargraph/parser/parser_gem/class_methods.rb +149 -157
  96. data/lib/solargraph/parser/parser_gem/flawed_builder.rb +19 -18
  97. data/lib/solargraph/parser/parser_gem/node_chainer.rb +166 -164
  98. data/lib/solargraph/parser/parser_gem/node_methods.rb +486 -495
  99. data/lib/solargraph/parser/parser_gem/node_processors/alias_node.rb +2 -1
  100. data/lib/solargraph/parser/parser_gem/node_processors/and_node.rb +22 -0
  101. data/lib/solargraph/parser/parser_gem/node_processors/args_node.rb +59 -57
  102. data/lib/solargraph/parser/parser_gem/node_processors/begin_node.rb +15 -15
  103. data/lib/solargraph/parser/parser_gem/node_processors/block_node.rb +46 -43
  104. data/lib/solargraph/parser/parser_gem/node_processors/casgn_node.rb +2 -1
  105. data/lib/solargraph/parser/parser_gem/node_processors/cvasgn_node.rb +2 -1
  106. data/lib/solargraph/parser/parser_gem/node_processors/def_node.rb +53 -50
  107. data/lib/solargraph/parser/parser_gem/node_processors/defs_node.rb +37 -36
  108. data/lib/solargraph/parser/parser_gem/node_processors/gvasgn_node.rb +2 -1
  109. data/lib/solargraph/parser/parser_gem/node_processors/if_node.rb +23 -0
  110. data/lib/solargraph/parser/parser_gem/node_processors/ivasgn_node.rb +40 -38
  111. data/lib/solargraph/parser/parser_gem/node_processors/lvasgn_node.rb +29 -28
  112. data/lib/solargraph/parser/parser_gem/node_processors/masgn_node.rb +59 -53
  113. data/lib/solargraph/parser/parser_gem/node_processors/namespace_node.rb +8 -7
  114. data/lib/solargraph/parser/parser_gem/node_processors/opasgn_node.rb +98 -0
  115. data/lib/solargraph/parser/parser_gem/node_processors/orasgn_node.rb +17 -16
  116. data/lib/solargraph/parser/parser_gem/node_processors/resbody_node.rb +38 -36
  117. data/lib/solargraph/parser/parser_gem/node_processors/sclass_node.rb +52 -42
  118. data/lib/solargraph/parser/parser_gem/node_processors/send_node.rb +291 -259
  119. data/lib/solargraph/parser/parser_gem/node_processors/sym_node.rb +3 -1
  120. data/lib/solargraph/parser/parser_gem/node_processors/until_node.rb +29 -0
  121. data/lib/solargraph/parser/parser_gem/node_processors/while_node.rb +29 -0
  122. data/lib/solargraph/parser/parser_gem/node_processors.rb +70 -56
  123. data/lib/solargraph/parser/parser_gem.rb +12 -12
  124. data/lib/solargraph/parser/region.rb +69 -66
  125. data/lib/solargraph/parser/snippet.rb +17 -15
  126. data/lib/solargraph/parser.rb +23 -22
  127. data/lib/solargraph/pin/base.rb +729 -378
  128. data/lib/solargraph/pin/base_variable.rb +126 -118
  129. data/lib/solargraph/pin/block.rb +104 -101
  130. data/lib/solargraph/pin/breakable.rb +9 -0
  131. data/lib/solargraph/pin/callable.rb +231 -147
  132. data/lib/solargraph/pin/closure.rb +72 -57
  133. data/lib/solargraph/pin/common.rb +79 -70
  134. data/lib/solargraph/pin/constant.rb +45 -43
  135. data/lib/solargraph/pin/conversions.rb +123 -123
  136. data/lib/solargraph/pin/delegated_method.rb +120 -101
  137. data/lib/solargraph/pin/documenting.rb +114 -98
  138. data/lib/solargraph/pin/instance_variable.rb +34 -34
  139. data/lib/solargraph/pin/keyword.rb +20 -15
  140. data/lib/solargraph/pin/local_variable.rb +75 -67
  141. data/lib/solargraph/pin/method.rb +672 -527
  142. data/lib/solargraph/pin/method_alias.rb +34 -31
  143. data/lib/solargraph/pin/namespace.rb +115 -107
  144. data/lib/solargraph/pin/parameter.rb +275 -212
  145. data/lib/solargraph/pin/proxy_type.rb +39 -29
  146. data/lib/solargraph/pin/reference/override.rb +47 -29
  147. data/lib/solargraph/pin/reference/require.rb +2 -2
  148. data/lib/solargraph/pin/reference/superclass.rb +15 -10
  149. data/lib/solargraph/pin/reference.rb +39 -22
  150. data/lib/solargraph/pin/search.rb +61 -56
  151. data/lib/solargraph/pin/signature.rb +61 -17
  152. data/lib/solargraph/pin/singleton.rb +1 -1
  153. data/lib/solargraph/pin/symbol.rb +53 -47
  154. data/lib/solargraph/pin/until.rb +18 -0
  155. data/lib/solargraph/pin/while.rb +18 -0
  156. data/lib/solargraph/pin.rb +44 -41
  157. data/lib/solargraph/pin_cache.rb +245 -0
  158. data/lib/solargraph/position.rb +132 -107
  159. data/lib/solargraph/range.rb +112 -98
  160. data/lib/solargraph/rbs_map/conversions.rb +823 -646
  161. data/lib/solargraph/rbs_map/core_fills.rb +84 -50
  162. data/lib/solargraph/rbs_map/core_map.rb +58 -28
  163. data/lib/solargraph/rbs_map/stdlib_map.rb +43 -33
  164. data/lib/solargraph/rbs_map.rb +163 -93
  165. data/lib/solargraph/server_methods.rb +16 -16
  166. data/lib/solargraph/shell.rb +363 -269
  167. data/lib/solargraph/source/chain/array.rb +37 -33
  168. data/lib/solargraph/source/chain/block_symbol.rb +1 -1
  169. data/lib/solargraph/source/chain/block_variable.rb +1 -1
  170. data/lib/solargraph/source/chain/call.rb +337 -303
  171. data/lib/solargraph/source/chain/class_variable.rb +13 -13
  172. data/lib/solargraph/source/chain/constant.rb +26 -89
  173. data/lib/solargraph/source/chain/global_variable.rb +13 -13
  174. data/lib/solargraph/source/chain/hash.rb +34 -33
  175. data/lib/solargraph/source/chain/head.rb +1 -1
  176. data/lib/solargraph/source/chain/if.rb +28 -28
  177. data/lib/solargraph/source/chain/instance_variable.rb +13 -13
  178. data/lib/solargraph/source/chain/link.rb +109 -98
  179. data/lib/solargraph/source/chain/literal.rb +48 -28
  180. data/lib/solargraph/source/chain/or.rb +23 -23
  181. data/lib/solargraph/source/chain/q_call.rb +11 -11
  182. data/lib/solargraph/source/chain/variable.rb +13 -13
  183. data/lib/solargraph/source/chain/z_super.rb +30 -30
  184. data/lib/solargraph/source/chain.rb +291 -252
  185. data/lib/solargraph/source/change.rb +82 -82
  186. data/lib/solargraph/source/cursor.rb +166 -167
  187. data/lib/solargraph/source/encoding_fixes.rb +23 -23
  188. data/lib/solargraph/source/source_chainer.rb +194 -194
  189. data/lib/solargraph/source/updater.rb +55 -55
  190. data/lib/solargraph/source.rb +498 -495
  191. data/lib/solargraph/source_map/clip.rb +226 -232
  192. data/lib/solargraph/source_map/data.rb +34 -30
  193. data/lib/solargraph/source_map/mapper.rb +259 -255
  194. data/lib/solargraph/source_map.rb +212 -217
  195. data/lib/solargraph/type_checker/checks.rb +124 -120
  196. data/lib/solargraph/type_checker/param_def.rb +37 -35
  197. data/lib/solargraph/type_checker/problem.rb +32 -32
  198. data/lib/solargraph/type_checker/rules.rb +84 -62
  199. data/lib/solargraph/type_checker.rb +814 -672
  200. data/lib/solargraph/version.rb +5 -5
  201. data/lib/solargraph/views/_method.erb +10 -10
  202. data/lib/solargraph/views/_namespace.erb +3 -3
  203. data/lib/solargraph/views/document.erb +10 -10
  204. data/lib/solargraph/workspace/config.rb +255 -239
  205. data/lib/solargraph/workspace/require_paths.rb +97 -0
  206. data/lib/solargraph/workspace.rb +220 -239
  207. data/lib/solargraph/yard_map/helpers.rb +44 -16
  208. data/lib/solargraph/yard_map/mapper/to_constant.rb +7 -5
  209. data/lib/solargraph/yard_map/mapper/to_method.rb +130 -94
  210. data/lib/solargraph/yard_map/mapper/to_namespace.rb +31 -28
  211. data/lib/solargraph/yard_map/mapper.rb +79 -78
  212. data/lib/solargraph/yard_map/to_method.rb +89 -86
  213. data/lib/solargraph/yard_tags.rb +20 -20
  214. data/lib/solargraph/yardoc.rb +87 -52
  215. data/lib/solargraph.rb +105 -72
  216. data/rbs/fills/bundler/0/bundler.rbs +4271 -0
  217. data/rbs/fills/open3/0/open3.rbs +172 -0
  218. data/rbs/fills/rubygems/0/basic_specification.rbs +326 -0
  219. data/rbs/fills/rubygems/0/errors.rbs +364 -0
  220. data/rbs/fills/rubygems/0/spec_fetcher.rbs +107 -0
  221. data/rbs/fills/rubygems/0/specification.rbs +1753 -0
  222. data/rbs/fills/tuple/tuple.rbs +149 -0
  223. data/rbs/shims/ast/0/node.rbs +5 -0
  224. data/rbs/shims/ast/2.4/.rbs_meta.yaml +9 -0
  225. data/rbs/shims/ast/2.4/ast.rbs +73 -0
  226. data/rbs/shims/parser/3.2.0.1/builders/default.rbs +195 -0
  227. data/rbs/shims/parser/3.2.0.1/manifest.yaml +7 -0
  228. data/rbs/shims/parser/3.2.0.1/parser.rbs +201 -0
  229. data/rbs/shims/parser/3.2.0.1/polyfill.rbs +4 -0
  230. data/rbs/shims/thor/1.2.0.1/.rbs_meta.yaml +9 -0
  231. data/rbs/shims/thor/1.2.0.1/manifest.yaml +7 -0
  232. data/rbs/shims/thor/1.2.0.1/thor.rbs +17 -0
  233. data/rbs_collection.yaml +19 -0
  234. data/solargraph.gemspec +27 -5
  235. metadata +215 -18
  236. data/lib/.rubocop.yml +0 -22
  237. data/lib/solargraph/cache.rb +0 -77
  238. data/lib/solargraph/parser/node_methods.rb +0 -83
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 469236908941a1221785c7add8041544e118731b99e8a81b766856b96acbb307
4
- data.tar.gz: 6f2cf614a67abd04e53bb3a30a5ce2bc51b6b9cac16c474818e959c1e4c582ab
3
+ metadata.gz: 2e2913913dac1fa336d5f2a7ac51a5cc7d7afb085fc14e0aea405ec4fc6f482c
4
+ data.tar.gz: 180f4779d6e070e919c8d4d1af3d4c72edb79370cbb9592671213db049254d2b
5
5
  SHA512:
6
- metadata.gz: 22777792098e88c264a08e8a9785df73e00b1ed20fbfb4efe0988f9cb8aa5deec93ae520961672f2848ac7b2bf02fefccbb83a14e0c9092c2e18bd861d938f0b
7
- data.tar.gz: f154c4badced68ac0ab43bfe43c380009787c424f909801da183fdaf63e9a818daf62eb7ddb904172b9f91957d634758732460aab317235bf163c9d26921f452
6
+ metadata.gz: d30d4d79505a7bd37d906bd8eaf5351426e21a87ae23e922677a149dd946536c05a02debf70e1198d2f8b75dbf0a4941f9a2df34aa9ce2938b35da6458477fa5
7
+ data.tar.gz: 18a7d22d68a432c3b4e7c75385852a3f6f875a77269cabdfef4e91d229c93275236f04df50d5ff527cee7ba3a3100f41151e6f50f3d5947df0cbba83a304252e
data/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ *.rb text eol=lf
2
+ bin/* text eol=lf
@@ -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,12 +34,186 @@ 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
43
+ - name: Install gem types
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
37
103
  - name: Ensure typechecking still works
38
104
  run: bundle exec solargraph typecheck --level typed
39
105
  - name: Ensure specs still run
40
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.2'
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
+ # This job uses 3.2 due to a problem compiling sqlite3 in earlier versions
182
+ ruby-version: '3.2'
183
+ bundler-cache: false
184
+ bundler: latest
185
+ env:
186
+ MATRIX_RAILS_VERSION: "7.0"
187
+ - name: Install gems
188
+ run: |
189
+ set -x
190
+ BUNDLE_PATH="${GITHUB_WORKSPACE:?}/vendor/bundle"
191
+ export BUNDLE_PATH
192
+ cd ../solargraph-rails
193
+ echo "gem 'solargraph', path: '${GITHUB_WORKSPACE:?}'" >> Gemfile
194
+ bundle install
195
+ bundle update rbs
196
+ RAILS_DIR="$(pwd)/spec/rails7"
197
+ export RAILS_DIR
198
+ cd ${RAILS_DIR}
199
+ bundle install
200
+ bundle exec --gemfile ../../Gemfile rbs --version
201
+ bundle exec --gemfile ../../Gemfile rbs collection install
202
+ cd ../../
203
+ # bundle exec rbs collection init
204
+ # bundle exec rbs collection install
205
+ env:
206
+ MATRIX_RAILS_VERSION: "7.0"
207
+ MATRIX_RAILS_MAJOR_VERSION: '7'
208
+ - name: Run specs
209
+ run: |
210
+ BUNDLE_PATH="${GITHUB_WORKSPACE:?}/vendor/bundle"
211
+ export BUNDLE_PATH
212
+ cd ../solargraph-rails
213
+ bundle exec solargraph --version
214
+ bundle info solargraph
215
+ bundle info rbs
216
+ bundle info yard
217
+ ALLOW_IMPROVEMENTS=true bundle exec rake spec
218
+ env:
219
+ 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,6 +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
36
+ - name: Install gem types
37
+ run: bundle exec rbs collection install
33
38
  - name: Typecheck self
34
- run: bundle exec solargraph typecheck --level typed
39
+ run: SOLARGRAPH_ASSERTS=on bundle exec solargraph typecheck --level strong
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
+ /.gem_rbs_collection
2
+ /rbs_collection.lock.yaml
1
3
  /Gemfile.lock
2
4
  .Gemfile
3
5
  .idea
@@ -7,3 +9,9 @@
7
9
  doc
8
10
  coverage
9
11
  /tmp/
12
+ /rspec-examples.txt
13
+ /.ruby-version
14
+ /Makefile
15
+ /.pryrc
16
+ /.rspec-local
17
+ vendor/cache
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