solargraph-rails 1.1.2 → 1.2.1

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/linter.yml +94 -0
  3. data/.github/workflows/test.yml +185 -0
  4. data/.github/workflows/typecheck.yml +83 -0
  5. data/.overcommit.yml +51 -0
  6. data/.rubocop.yml +334 -0
  7. data/.rubocop_todo.yml +784 -0
  8. data/.solargraph.yml +8 -2
  9. data/CHANGELOG.md +51 -1
  10. data/DEVELOPMENT.md +8 -19
  11. data/Gemfile +22 -9
  12. data/README.md +39 -25
  13. data/bin/overcommit +27 -0
  14. data/bin/rubocop +27 -0
  15. data/ci/auto_yard/plugins.rb +0 -1
  16. data/lib/solargraph/rails/annotate.rb +10 -0
  17. data/lib/solargraph/rails/annotations/action_controller.rb +57 -5
  18. data/lib/solargraph/rails/annotations/action_text.rb +11 -0
  19. data/lib/solargraph/rails/annotations/active_job.rb +276 -0
  20. data/lib/solargraph/rails/annotations/active_model.rb +18 -0
  21. data/lib/solargraph/rails/annotations/active_record.rb +54 -3
  22. data/lib/solargraph/rails/annotations/active_storage.rb +113 -0
  23. data/lib/solargraph/rails/annotations/active_support.rb +3 -0
  24. data/lib/solargraph/rails/annotations/array.rb +7 -0
  25. data/lib/solargraph/rails/annotations/class.rb +2 -0
  26. data/lib/solargraph/rails/annotations/date.rb +8 -0
  27. data/lib/solargraph/rails/annotations/module.rb +13 -0
  28. data/lib/solargraph/rails/annotations/object.rb +3 -0
  29. data/lib/solargraph/rails/annotations/rails.rb +4 -0
  30. data/lib/solargraph/rails/annotations/time.rb +6 -2
  31. data/lib/solargraph/rails/delegate.rb +44 -10
  32. data/lib/solargraph/rails/model.rb +252 -31
  33. data/lib/solargraph/rails/rails_api.rb +2 -2
  34. data/lib/solargraph/rails/schema.rb +27 -8
  35. data/lib/solargraph/rails/util.rb +45 -4
  36. data/lib/solargraph/rails/version.rb +1 -1
  37. data/lib/solargraph-rails.rb +1 -1
  38. data/script/generate_definitions.rb +49 -24
  39. data/solargraph-rails.gemspec +14 -5
  40. metadata +64 -17
  41. data/.github/workflows/ruby.yml +0 -76
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 136534eb40ae838dfcc2a78abb2e6e0bc0c9cf187c6b1d86095dda51e876aa24
4
- data.tar.gz: d90e381a7a65f81900252347da41b2b2b46721e9f3e57930a90c9e00f0b480b4
3
+ metadata.gz: 340a0d1ac34fa10db4c2ebddb4ceb55c803f33a19a42f606ebc5e294eac68505
4
+ data.tar.gz: c4653edadf0fb829a7c040b70aaf6697e504337f5a6337635f03e6b3652a551a
5
5
  SHA512:
6
- metadata.gz: 770b2ae68e6baa102d4474925394e05750580bed3726abb7e965a04f320d4ac14d3108dd8a0360ae340971b522579178dcf2fca6df15cbdab2d3ecc2bc0a488f
7
- data.tar.gz: 641c7f310938d271bcaeb58dc4aefbca9d5d61aa53f4a33272c38025cbf5a6e2da469920441c2f22d17dbae7ebc926ec5aedbfae6feea0622a84968784cc009d
6
+ metadata.gz: a35c2b38aeb0a51a4f5b1009e2d601878d30802361444d837e99428e3898cefe70940e7439ac99602c28a55587214f283be185c57b4c9805ebece4e18c972d72
7
+ data.tar.gz: c47bd5684b92f1b4edbbf6eb0874c8ba7abe53cacb7f8f1fdd43cadd34b2af0b3d1da5dfc2b75c9a54aa2298ac7ea88d8afee47985cee225a6c3903ea667ad9f
@@ -0,0 +1,94 @@
1
+ ---
2
+ # To debug locally:
3
+ # npm install -g act
4
+ # act pull_release -j overcommit
5
+ #
6
+
7
+ name: Linter
8
+
9
+ on:
10
+ workflow_dispatch: {}
11
+ pull_request:
12
+ branches: [main]
13
+ push:
14
+ branches:
15
+ - 'main'
16
+ tags:
17
+ - 'v*'
18
+
19
+ permissions:
20
+ pull-requests: write
21
+
22
+ jobs:
23
+ overcommit:
24
+ runs-on: ubuntu-latest
25
+ strategy:
26
+ matrix:
27
+ versions:
28
+ # ruby 3.2 is minimum Ruby supported by Rails 8.0
29
+ - ruby: "3.2"
30
+ rails-major: "8"
31
+ rails-minor: "0"
32
+ run_coverage: true
33
+ solargraph-version:
34
+ - "0.57.alpha"
35
+ fail-fast: false
36
+ steps:
37
+ - uses: actions/checkout@v2
38
+ # Number of commits to fetch. 0 indicates all history for all branches and tags.
39
+ with:
40
+ fetch-depth: 0
41
+
42
+ - uses: ruby/setup-ruby@v1
43
+ with:
44
+ ruby-version: 3.4
45
+ bundler: latest
46
+ bundler-cache: true
47
+ cache-version: ${{ matrix.solargraph-version }}-${{ matrix.versions.rails-major }}.${{ matrix.versions.rails-minor }}-2025-06-06
48
+ env:
49
+ MATRIX_SOLARGRAPH_VERSION: ${{ matrix.solargraph-version }}
50
+ MATRIX_RAILS_VERSION: ${{ matrix.versions.rails-major }}.${{ matrix.versions.rails-minor }}
51
+ MATRIX_RAILS_MAJOR_VERSION: ${{ matrix.versions.rails-major }}
52
+
53
+ - name: Restore cache of gem annotations
54
+ id: dot-cache-restore
55
+ uses: actions/cache/restore@v4
56
+ with:
57
+ key: |
58
+ 2025-06-26-09-${{ runner.os }}-dot-cache-${{ matrix.solargraph-version }}-${{ matrix.versions.rails-major }}--${{ matrix.versions.rails-minor }}-${{ hashFiles('spec/**/Gemfile.lock') }}-${{ hashFiles('Gemfile.lock') }}
59
+ restore-keys: |
60
+ 2025-06-26-09-${{ runner.os }}-dot-cache-${{ matrix.solargraph-version }}-${{ matrix.versions.rails-major }}-${{ matrix.versions.rails-minor }}-${{ hashFiles('spec/**/Gemfile.lock') }}-
61
+ 2025-06-26-09-${{ runner.os }}-dot-cache-${{ matrix.solargraph-version }}-${{ matrix.versions.rails-major }}-${{ matrix.versions.rails-minor }}-
62
+ 2025-06-26-09-${{ runner.os }}-dot-cache-${{ matrix.solargraph-version }}-${{ matrix.versions.rails-major }}-
63
+ 2025-06-26-09-${{ runner.os }}-dot-cache-${{ matrix.solargraph-version }}-
64
+ path: |
65
+ /home/runner/.cache/solargraph
66
+
67
+ - name: Overcommit
68
+ run: |
69
+ bundle exec overcommit --sign
70
+ bundle exec overcommit --run --diff origin/main
71
+ env:
72
+ MATRIX_SOLARGRAPH_VERSION: ${{ matrix.solargraph-version }}
73
+ MATRIX_RAILS_VERSION: ${{ matrix.versions.rails-major }}.${{ matrix.versions.rails-minor }}
74
+ MATRIX_RAILS_MAJOR_VERSION: ${{ matrix.versions.rails-major }}
75
+ rubocop:
76
+ name: rubocop
77
+ runs-on: ubuntu-latest
78
+ env:
79
+ BUNDLE_ONLY: rubocop
80
+ steps:
81
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
82
+ - uses: ruby/setup-ruby@1a615958ad9d422dd932dc1d5823942ee002799f # v1.227.0
83
+ with:
84
+ ruby-version: '3.3'
85
+ bundler-cache: true
86
+ - uses: reviewdog/action-rubocop@fcb74ba274da10b18d038d0bcddaae3518739634 # v2.21.2
87
+ with:
88
+ reporter: github-pr-check
89
+ skip_install: true
90
+ use_bundler: true
91
+ rubocop_extensions: 'rubocop-performance:gemfile rubocop-rspec:gemfile rubocop-rake:gemfile rubocop-yard:gemfile'
92
+ fail_level: info
93
+ rubocop_version: Gemfile
94
+ level: info
@@ -0,0 +1,185 @@
1
+ # To debug locally:
2
+ # npm install -g act
3
+ # act pull_request
4
+ #
5
+
6
+ name: Test
7
+
8
+ on:
9
+ workflow_dispatch: {}
10
+ pull_request:
11
+ branches: [main]
12
+ push:
13
+ branches:
14
+ - 'main'
15
+ tags:
16
+ - 'v*'
17
+
18
+ jobs:
19
+ rspec:
20
+ runs-on: ubuntu-latest
21
+ strategy:
22
+ matrix:
23
+ versions:
24
+ # ruby 2.7 is minimum Ruby supported by Rails 7.0
25
+ - ruby: "3.0"
26
+ rails-major: "7"
27
+ rails-minor: "0"
28
+ # ruby 2.7 is minimum Ruby supported by Rails 7.1
29
+ - ruby: "3.0"
30
+ rails-major: "7"
31
+ rails-minor: "1"
32
+ # ruby 3.1 is minimum Ruby supported by Rails 7.2
33
+ - ruby: "3.1"
34
+ rails-major: "7"
35
+ rails-minor: "2"
36
+ # ruby 3.2 is minimum Ruby supported by Rails 8.0
37
+ - ruby: "3.2"
38
+ rails-major: "8"
39
+ rails-minor: "0"
40
+ solargraph-version:
41
+ - "0.48.0"
42
+ - "0.49.0"
43
+ - "0.50.0"
44
+ - "0.51.2"
45
+ - "0.52.0"
46
+ - "0.56.0"
47
+ - "0.56.1"
48
+ - "0.56.2"
49
+ - "0.57.alpha"
50
+ include:
51
+ - versions:
52
+ ruby: "3.2"
53
+ rails-major: "8"
54
+ rails-minor: "0"
55
+ solargraph-version: "0.57.alpha"
56
+ run_coverage: true
57
+ fail-fast: false
58
+ steps:
59
+ - uses: actions/checkout@v2
60
+
61
+ - uses: ruby/setup-ruby@v1
62
+ with:
63
+ ruby-version: ${{ matrix.versions.ruby }}
64
+ bundler: latest
65
+ bundler-cache: true
66
+ cache-version: ${{ matrix.solargraph-version }}-${{ matrix.versions.rails-major }}.${{ matrix.versions.rails-minor }}-2025-06-06
67
+ env:
68
+ # Used in Gemfile/gemspec
69
+ MATRIX_SOLARGRAPH_VERSION: ${{ matrix.solargraph-version }}
70
+ MATRIX_RAILS_MAJOR_VERSION: ${{ matrix.versions.rails-major }}
71
+ MATRIX_RAILS_VERSION: ${{ matrix.versions.rails-major }}.${{ matrix.versions.rails-minor }}
72
+
73
+ - name: Update solargraph from branch if needed
74
+ run: |
75
+ bundle update solargraph
76
+ env:
77
+ # Used in Gemfile/gemspec
78
+ MATRIX_SOLARGRAPH_VERSION: ${{ matrix.solargraph-version }}
79
+ MATRIX_RAILS_MAJOR_VERSION: ${{ matrix.versions.rails-major }}
80
+ MATRIX_RAILS_VERSION: ${{ matrix.versions.rails-major }}.${{ matrix.versions.rails-minor }}
81
+
82
+ - name: Install child bundle
83
+ run: |
84
+ set -x
85
+ # same as used by ruby/setup-ruby
86
+ BUNDLE_PATH="${GITHUB_WORKSPACE:?}/vendor/bundle"
87
+ export BUNDLE_PATH
88
+ RAILS_DIR="${GITHUB_WORKSPACE:?}/spec/rails${{ matrix.versions.rails-major }}"
89
+ export RAILS_DIR
90
+ cd ${RAILS_DIR}
91
+ bundle install
92
+ # these solargraphs use rbs versions that are too old - and
93
+ # don't pay attention to the rbs collection regardless
94
+ if [[ "$MATRIX_SOLARGRAPH_VERSION" != "0.48.0" && "$MATRIX_SOLARGRAPH_VERSION" != "0.49.0" && "$MATRIX_SOLARGRAPH_VERSION" != "0.50.0" ]]
95
+ then
96
+ cd ../..
97
+ bundle update rbs
98
+ cd ${RAILS_DIR}
99
+ bundle exec --gemfile ../../Gemfile rbs --version
100
+ bundle exec --gemfile ../../Gemfile rbs collection update
101
+ fi
102
+ cd ../..
103
+ env:
104
+ # Used in Gemfile/gemspec
105
+ MATRIX_SOLARGRAPH_VERSION: ${{ matrix.solargraph-version }}
106
+ MATRIX_RAILS_VERSION: ${{ matrix.versions.rails-major }}.${{ matrix.versions.rails-minor }}
107
+ MATRIX_RAILS_MAJOR_VERSION: ${{ matrix.versions.rails-major }}
108
+
109
+ - name: Restore cache of gem annotations
110
+ id: dot-cache-restore
111
+ uses: actions/cache/restore@v4
112
+ with:
113
+ key: |
114
+ 2025-06-29-${{ runner.os }}-dot-cache-${{ matrix.solargraph-version }}-${{ matrix.versions.rails-major }}--${{ matrix.versions.rails-minor }}-${{ hashFiles('spec/**/Gemfile.lock') }}-${{ hashFiles('Gemfile.lock') }}
115
+ restore-keys: |
116
+ 2025-06-29-${{ runner.os }}-dot-cache-${{ matrix.solargraph-version }}-${{ matrix.versions.rails-major }}-${{ matrix.versions.rails-minor }}-${{ hashFiles('spec/**/Gemfile.lock') }}-
117
+ 2025-06-29-${{ runner.os }}-dot-cache-${{ matrix.solargraph-version }}-${{ matrix.versions.rails-major }}-${{ matrix.versions.rails-minor }}-
118
+ 2025-06-29-${{ runner.os }}-dot-cache-${{ matrix.solargraph-version }}-${{ matrix.versions.rails-major }}-
119
+ 2025-06-29-${{ runner.os }}-dot-cache-${{ matrix.solargraph-version }}-
120
+ path: |
121
+ /home/runner/.cache/solargraph
122
+
123
+ - name: bundle list
124
+ run: |
125
+ # same as used by ruby/setup-ruby
126
+ BUNDLE_PATH="${GITHUB_WORKSPACE:?}/vendor/bundle"
127
+ export BUNDLE_PATH
128
+ RAILS_DIR="${GITHUB_WORKSPACE:?}/spec/rails${{ matrix.versions.rails-major }}"
129
+ export RAILS_DIR
130
+ bundle list && cat Gemfile.lock && find vendor -name Gemfile
131
+ env:
132
+ # Used in Gemfile/gemspec
133
+ MATRIX_SOLARGRAPH_VERSION: ${{ matrix.solargraph-version }}
134
+ MATRIX_RAILS_VERSION: ${{ matrix.versions.rails-major }}.${{ matrix.versions.rails-minor }}
135
+ MATRIX_RAILS_MAJOR_VERSION: ${{ matrix.versions.rails-major }}
136
+
137
+ #- name: Setup upterm session
138
+ # uses: lhotari/action-upterm@v1
139
+
140
+ - name: RSpec
141
+ run: |
142
+ set -x
143
+ # same as used by ruby/setup-ruby
144
+ BUNDLE_PATH="${GITHUB_WORKSPACE:?}/vendor/bundle"
145
+ export BUNDLE_PATH
146
+ RAILS_DIR="${GITHUB_WORKSPACE:?}/spec/rails${{ matrix.versions.rails-major }}"
147
+ export RAILS_DIR
148
+ ruby --version
149
+ bundle install
150
+ bundle update solargraph
151
+ bundle exec solargraph version
152
+ bundle info solargraph
153
+ set +e
154
+ bundle info rbs
155
+ set -e
156
+ bundle info yard
157
+ bundle exec rake spec # bundle exec rspec spec/solargraph-rails
158
+ env:
159
+ # Used in Gemfile/gemspec
160
+ MATRIX_SOLARGRAPH_VERSION: ${{ matrix.solargraph-version }}
161
+ MATRIX_RAILS_VERSION: ${{ matrix.versions.rails-major }}.${{ matrix.versions.rails-minor }}
162
+ MATRIX_RAILS_MAJOR_VERSION: ${{ matrix.versions.rails-major }}
163
+
164
+ - name: Upload coverage artifacts
165
+ uses: actions/upload-artifact@v4
166
+ with:
167
+ name: coverage-${{ matrix.solargraph-version }}-${{ matrix.versions.rails-major }}.${{ matrix.versions.rails-minor }}
168
+ path: coverage
169
+
170
+ - name: Code coverage check
171
+ uses: apiology/reviewdog-action-code-coverage@add_options
172
+ with:
173
+ lcov_path: ./coverage/lcov/*.lcov
174
+ fail_level: warning
175
+ if: matrix.run_coverage && github.event_name == 'pull_request'
176
+
177
+ - name: Cache gem annotations
178
+ id: dot-cache-save
179
+ if: always() && steps.dot-cache-restore.outputs.cache-hit != 'true'
180
+ uses: actions/cache/save@v4
181
+ with:
182
+ key: |
183
+ 2025-06-29-${{ runner.os }}-dot-cache-${{ matrix.solargraph-version }}-${{ matrix.versions.rails-major }}--${{ matrix.versions.rails-minor }}-${{ hashFiles('spec/**/Gemfile.lock') }}-${{ hashFiles('Gemfile.lock') }}
184
+ path: |
185
+ /home/runner/.cache/solargraph
@@ -0,0 +1,83 @@
1
+ ---
2
+ # To debug locally:
3
+ # npm install -g act
4
+ # act pull_request
5
+ #
6
+
7
+ name: Typecheck
8
+
9
+ on:
10
+ workflow_dispatch: {}
11
+ pull_request:
12
+ branches: [main]
13
+ push:
14
+ branches:
15
+ - 'main'
16
+ tags:
17
+ - 'v*'
18
+
19
+ jobs:
20
+ solargraph:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v2
24
+
25
+ - uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: 3.4
28
+ bundler: latest
29
+ bundler-cache: true
30
+ cache-version: ${{ matrix.versions.rails-major }}.${{ matrix.versions.rails-minor }}-2025-06-06
31
+ env:
32
+ MATRIX_RAILS_MAJOR_VERSION: "8"
33
+ MATRIX_RAILS_VERSION: "8.0"
34
+
35
+ - name: Restore cache of gem annotations
36
+ id: dot-cache-restore
37
+ uses: actions/cache/restore@v4
38
+ with:
39
+ key: |
40
+ ${{ runner.os }}-dot-cache-${{ hashFiles('Gemfile.lock') }}
41
+ restore-keys: |
42
+ ${{ runner.os }}-dot-cache-
43
+ path: |
44
+ /home/runner/.cache/solargraph
45
+
46
+ - name: bundle list
47
+ run: |
48
+ # same as used by ruby/setup-ruby
49
+ BUNDLE_PATH="${GITHUB_WORKSPACE:?}/vendor/bundle"
50
+ export BUNDLE_PATH
51
+ bundle list && cat Gemfile.lock && find vendor -name Gemfile
52
+ env:
53
+ MATRIX_RAILS_MAJOR_VERSION: "8"
54
+ MATRIX_RAILS_VERSION: "8.0"
55
+
56
+ #- name: Setup upterm session
57
+ # uses: lhotari/action-upterm@v1
58
+
59
+ - name: Typecheck
60
+ run: |
61
+ set -x
62
+ # same as used by ruby/setup-ruby
63
+ ruby --version
64
+ bundle install
65
+ # reject known bad versions
66
+ echo 'gem "solargraph", ["!= 0.56.2"]' >> .Gemfile
67
+ bundle update solargraph
68
+ bundle exec solargraph version
69
+ # SOLARGRAPH_ASSERTS=on
70
+ bundle exec solargraph typecheck --level typed
71
+ env:
72
+ MATRIX_RAILS_MAJOR_VERSION: "8"
73
+ MATRIX_RAILS_VERSION: "8.0"
74
+
75
+ - name: Cache gem annotations
76
+ id: dot-cache-save
77
+ if: always() && steps.dot-cache-restore.outputs.cache-hit != 'true'
78
+ uses: actions/cache/save@v4
79
+ with:
80
+ key: |
81
+ ${{ runner.os }}-dot-cache-${{ hashFiles('Gemfile.lock') }}
82
+ path: |
83
+ /home/runner/.cache/solargraph
data/.overcommit.yml ADDED
@@ -0,0 +1,51 @@
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
+ on_warn: fail # Treat all warnings as failures
23
+
24
+ Solargraph:
25
+ enabled: true
26
+ exclude:
27
+ - 'spec/**/*'
28
+ - lib/solargraph/rails/annotations/**/*
29
+ - vendor/**/*
30
+ - ".bundle/**/*"
31
+
32
+ # creates false positives in CI
33
+ AuthorName:
34
+ enabled: false
35
+
36
+ # creates false positives in CI
37
+ AuthorEmail:
38
+ enabled: false
39
+
40
+ #
41
+ # TrailingWhitespace:
42
+ # enabled: true
43
+ # exclude:
44
+ # - '**/db/structure.sql' # Ignore trailing whitespace in generated files
45
+ #
46
+ #PostCheckout:
47
+ # ALL: # Special hook name that customizes all hooks of this type
48
+ # quiet: true # Change all post-checkout hooks to only display output on failure
49
+ #
50
+ # IndexTags:
51
+ # enabled: true # Generate a tags file with `ctags` each time HEAD changes