rubocop-sorbet 0.9.0 → 0.10.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.
- checksums.yaml +4 -4
- data/.devcontainer/devcontainer.json +25 -0
- data/.github/workflows/ci.yml +6 -6
- data/.github/workflows/dependabot_automerge.yml +2 -2
- data/.github/workflows/stale.yml +1 -1
- data/.rubocop.yml +2 -2
- data/.ruby-version +1 -1
- data/CONTRIBUTING.md +29 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +27 -29
- data/README.md +4 -16
- data/Rakefile +43 -5
- data/VERSION +1 -0
- data/bin/{rspec → rake} +5 -9
- data/config/default.yml +89 -64
- data/config/rbi.yml +0 -3
- data/dev.yml +1 -1
- data/lib/rubocop/cop/sorbet/block_method_definition.rb +83 -0
- data/lib/rubocop/cop/sorbet/forbid_mixes_in_class_methods.rb +49 -0
- data/lib/rubocop/cop/sorbet/select_by_is_a.rb +62 -0
- data/lib/rubocop/cop/sorbet/sigils/enforce_single_sigil.rb +1 -1
- data/lib/rubocop/cop/sorbet/sigils/valid_sigil.rb +20 -2
- data/lib/rubocop/cop/sorbet/signatures/empty_line_after_sig.rb +20 -11
- data/lib/rubocop/cop/sorbet_cops.rb +3 -0
- data/lib/rubocop/sorbet/plugin.rb +5 -3
- data/lib/rubocop/sorbet/version.rb +1 -1
- data/lib/rubocop/sorbet.rb +1 -1
- data/lib/rubocop-sorbet.rb +1 -1
- data/manual/cops.md +3 -0
- data/manual/cops_sorbet.md +108 -8
- data/rubocop-sorbet.gemspec +2 -2
- metadata +15 -10
- data/.travis.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 890d05a2b3a1bdbd0b1bc8e406c31563306732664faeb0f22b4ac3437017d0b1
|
4
|
+
data.tar.gz: c82de2c3757ebccb1ddb1955238c9e0005f2211887ef27e0118bc9ebd938d8a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1d3c14c1ef19f582bb01b768ba0e6110cb5c416da71128fb522839dc09798623e7c0e680842191908d62f9ca34c9228d05ee493acb6285e20cbba0738a078a9
|
7
|
+
data.tar.gz: 19c6a4eef2efec75790045a39c7bdd54360d43a700e30068ae0e77a872141e869832df04751a9f1b7db24f3801507c50927c4595cad09a7d42e9dc187097bbd9
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
2
|
+
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
|
3
|
+
{
|
4
|
+
"name": "Ruby",
|
5
|
+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
6
|
+
"image": "ghcr.io/rails/devcontainer/images/ruby:3.4.3",
|
7
|
+
"features": {
|
8
|
+
"ghcr.io/devcontainers/features/github-cli:1": {}
|
9
|
+
}
|
10
|
+
|
11
|
+
// Features to add to the dev container. More info: https://containers.dev/features.
|
12
|
+
// "features": {},
|
13
|
+
|
14
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
15
|
+
// "forwardPorts": [],
|
16
|
+
|
17
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
18
|
+
// "postCreateCommand": "ruby --version",
|
19
|
+
|
20
|
+
// Configure tool-specific properties.
|
21
|
+
// "customizations": {},
|
22
|
+
|
23
|
+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
24
|
+
// "remoteUser": "root"
|
25
|
+
}
|
data/.github/workflows/ci.yml
CHANGED
@@ -14,14 +14,14 @@ jobs:
|
|
14
14
|
ruby: ["3.1", "3.2", "3.3", "3.4"]
|
15
15
|
name: Test Ruby ${{ matrix.ruby }}
|
16
16
|
steps:
|
17
|
-
- uses: actions/checkout@v4
|
17
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
18
18
|
- name: Set up Ruby
|
19
|
-
uses: ruby/setup-ruby@v1
|
19
|
+
uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
|
20
20
|
with:
|
21
21
|
ruby-version: ${{ matrix.ruby }}
|
22
22
|
bundler-cache: true
|
23
23
|
- name: Run tests
|
24
|
-
run: bin/
|
24
|
+
run: bin/rake test
|
25
25
|
|
26
26
|
lint-and-docs:
|
27
27
|
runs-on: ubuntu-latest
|
@@ -29,16 +29,16 @@ jobs:
|
|
29
29
|
fail-fast: false
|
30
30
|
name: Lint & Docs
|
31
31
|
steps:
|
32
|
-
- uses: actions/checkout@v4
|
32
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
33
33
|
- name: Set up Ruby
|
34
|
-
uses: ruby/setup-ruby@v1
|
34
|
+
uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0
|
35
35
|
with:
|
36
36
|
bundler-cache: true
|
37
37
|
# This is just to ensure the default config is valid. The target is intentionally set
|
38
38
|
# to a directory that doesn't contain any .rb or .rbi files.
|
39
39
|
- name: Validate default config
|
40
40
|
run: |
|
41
|
-
bin/rubocop --config config/rbi.yml config
|
41
|
+
bin/rubocop --plugin rubocop-sorbet --config config/rbi.yml config
|
42
42
|
bin/rubocop --config config/default.yml config -r rubocop-sorbet
|
43
43
|
- name: Lint Ruby files
|
44
44
|
run: bin/rubocop
|
@@ -12,12 +12,12 @@ jobs:
|
|
12
12
|
steps:
|
13
13
|
- name: Dependabot metadata
|
14
14
|
id: metadata
|
15
|
-
uses: dependabot/fetch-metadata@v2
|
15
|
+
uses: dependabot/fetch-metadata@08eff52bf64351f401fb50d4972fa95b9f2c2d1b # v2.4.0
|
16
16
|
with:
|
17
17
|
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
18
18
|
- name: Enable auto-merge for Dependabot PRs
|
19
19
|
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
|
20
|
-
uses: actions/github-script@v7
|
20
|
+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
21
21
|
with:
|
22
22
|
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
23
23
|
script: |
|
data/.github/workflows/stale.yml
CHANGED
data/.rubocop.yml
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.4.
|
1
|
+
3.4.3
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/rubocop-sorbet.
|
2
|
+
|
3
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
4
|
+
|
5
|
+
## Creating a new cop
|
6
|
+
|
7
|
+
To contribute a new cop, please use the supplied generator like this:
|
8
|
+
|
9
|
+
```sh
|
10
|
+
bundle exec rake "new_cop[Sorbet/NewCopName]"
|
11
|
+
```
|
12
|
+
|
13
|
+
which will create a skeleton cop, a skeleton spec, an entry in the default config file and will require the new cop so that it is properly exported from the gem.
|
14
|
+
|
15
|
+
Don't forget to update the documentation with:
|
16
|
+
|
17
|
+
```sh
|
18
|
+
bundle exec rake generate_cops_documentation
|
19
|
+
```
|
20
|
+
|
21
|
+
## Releasing a new version
|
22
|
+
|
23
|
+
Update the version in the `VERSION` file.
|
24
|
+
|
25
|
+
Then run the `rake prepare_release` task.
|
26
|
+
|
27
|
+
This will update the version in the `lib/rubocop/sorbet/version.rb` file, the `config/default.yml` file, and the `Gemfile.lock` file.
|
28
|
+
|
29
|
+
It will also commit the changes, tag the release, and push the changes to the remote repository.
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,55 +1,45 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rubocop-sorbet (0.
|
5
|
-
lint_roller
|
4
|
+
rubocop-sorbet (0.10.1)
|
5
|
+
lint_roller
|
6
6
|
rubocop (>= 1)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
ast (2.4.
|
11
|
+
ast (2.4.3)
|
12
12
|
date (3.4.1)
|
13
13
|
debug (1.10.0)
|
14
14
|
irb (~> 1.10)
|
15
15
|
reline (>= 0.3.8)
|
16
|
-
diff-lcs (1.5.1)
|
17
16
|
io-console (0.8.0)
|
18
17
|
irb (1.14.3)
|
19
18
|
rdoc (>= 4.0.0)
|
20
19
|
reline (>= 0.4.2)
|
21
|
-
json (2.
|
22
|
-
language_server-protocol (3.17.0.
|
20
|
+
json (2.12.2)
|
21
|
+
language_server-protocol (3.17.0.5)
|
23
22
|
lint_roller (1.1.0)
|
24
|
-
|
25
|
-
|
23
|
+
minitest (5.25.5)
|
24
|
+
mocha (2.7.1)
|
25
|
+
ruby2_keywords (>= 0.0.5)
|
26
|
+
parallel (1.27.0)
|
27
|
+
parser (3.3.8.0)
|
26
28
|
ast (~> 2.4.1)
|
27
29
|
racc
|
30
|
+
prism (1.4.0)
|
28
31
|
psych (5.2.2)
|
29
32
|
date
|
30
33
|
stringio
|
31
34
|
racc (1.8.1)
|
32
35
|
rainbow (3.1.1)
|
33
|
-
rake (13.
|
36
|
+
rake (13.3.0)
|
34
37
|
rdoc (6.10.0)
|
35
38
|
psych (>= 4.0.0)
|
36
39
|
regexp_parser (2.10.0)
|
37
40
|
reline (0.6.0)
|
38
41
|
io-console (~> 0.5)
|
39
|
-
|
40
|
-
rspec-core (~> 3.13.0)
|
41
|
-
rspec-expectations (~> 3.13.0)
|
42
|
-
rspec-mocks (~> 3.13.0)
|
43
|
-
rspec-core (3.13.0)
|
44
|
-
rspec-support (~> 3.13.0)
|
45
|
-
rspec-expectations (3.13.0)
|
46
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
-
rspec-support (~> 3.13.0)
|
48
|
-
rspec-mocks (3.13.0)
|
49
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
-
rspec-support (~> 3.13.0)
|
51
|
-
rspec-support (3.13.1)
|
52
|
-
rubocop (1.73.2)
|
42
|
+
rubocop (1.75.8)
|
53
43
|
json (~> 2.3)
|
54
44
|
language_server-protocol (~> 3.17.0.2)
|
55
45
|
lint_roller (~> 1.1.0)
|
@@ -57,14 +47,20 @@ GEM
|
|
57
47
|
parser (>= 3.3.0.2)
|
58
48
|
rainbow (>= 2.2.2, < 4.0)
|
59
49
|
regexp_parser (>= 2.9.3, < 3.0)
|
60
|
-
rubocop-ast (>= 1.
|
50
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
61
51
|
ruby-progressbar (~> 1.7)
|
62
52
|
unicode-display_width (>= 2.4.0, < 4.0)
|
63
|
-
rubocop-ast (1.
|
64
|
-
parser (>= 3.3.
|
65
|
-
|
66
|
-
|
53
|
+
rubocop-ast (1.44.1)
|
54
|
+
parser (>= 3.3.7.2)
|
55
|
+
prism (~> 1.4)
|
56
|
+
rubocop-minitest (0.38.1)
|
57
|
+
lint_roller (~> 1.1)
|
58
|
+
rubocop (>= 1.75.0, < 2.0)
|
59
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
60
|
+
rubocop-shopify (2.17.0)
|
61
|
+
rubocop (~> 1.62)
|
67
62
|
ruby-progressbar (1.13.0)
|
63
|
+
ruby2_keywords (0.0.5)
|
68
64
|
stringio (3.1.2)
|
69
65
|
unicode-display_width (3.1.4)
|
70
66
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
@@ -76,8 +72,10 @@ PLATFORMS
|
|
76
72
|
|
77
73
|
DEPENDENCIES
|
78
74
|
debug
|
75
|
+
minitest
|
76
|
+
mocha
|
79
77
|
rake (>= 12.3.3)
|
80
|
-
|
78
|
+
rubocop-minitest (>= 0.38.1)
|
81
79
|
rubocop-shopify
|
82
80
|
rubocop-sorbet!
|
83
81
|
yard (~> 0.9)
|
data/README.md
CHANGED
@@ -62,6 +62,8 @@ To enable the cops related to RBI files under the `sorbet/rbi/` directory, put t
|
|
62
62
|
inherit_gem:
|
63
63
|
rubocop-sorbet: config/rbi.yml
|
64
64
|
```
|
65
|
+
> [!NOTE]
|
66
|
+
> If your top-level `.rubocop.yml` does not load `rubocop-sorbet`, you might need to also add a `require: rubocop-sorbet` or `plugins: rubocop-sorbet` to the `sorbet/rbi/.rubocop.yml` file at the top.
|
65
67
|
|
66
68
|
This will turn off default cops for `**/*.rbi` files and enable the RBI specific cops.
|
67
69
|
|
@@ -93,25 +95,11 @@ You can read about each cop supplied by RuboCop Sorbet in [the manual](manual/co
|
|
93
95
|
Sorbet cops support the following versions:
|
94
96
|
|
95
97
|
- Sorbet >= 0.5
|
96
|
-
- Ruby >=
|
98
|
+
- Ruby >= 3.1
|
97
99
|
|
98
100
|
## Contributing
|
99
101
|
|
100
|
-
|
101
|
-
|
102
|
-
To contribute a new cop, please use the supplied generator like this:
|
103
|
-
|
104
|
-
```sh
|
105
|
-
bundle exec rake "new_cop[Sorbet/NewCopName]"
|
106
|
-
```
|
107
|
-
|
108
|
-
which will create a skeleton cop, a skeleton spec, an entry in the default config file and will require the new cop so that it is properly exported from the gem.
|
109
|
-
|
110
|
-
Don't forget to update the documentation with:
|
111
|
-
|
112
|
-
```sh
|
113
|
-
bundle exec rake generate_cops_documentation
|
114
|
-
```
|
102
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.
|
115
103
|
|
116
104
|
## License
|
117
105
|
|
data/Rakefile
CHANGED
@@ -5,13 +5,15 @@ require("bundler/gem_tasks")
|
|
5
5
|
Dir["tasks/**/*.rake"].each { |t| load t }
|
6
6
|
|
7
7
|
require "rubocop/rake_task"
|
8
|
-
require "
|
8
|
+
require "rubocop/cop/minitest_generator"
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
require "minitest/test_task"
|
11
|
+
|
12
|
+
Minitest::TestTask.create(:test) do |test|
|
13
|
+
test.test_globs = FileList["test/**/*_test.rb"]
|
12
14
|
end
|
13
15
|
|
14
|
-
task(default: [:documentation_syntax_check, :generate_cops_documentation, :
|
16
|
+
task(default: [:documentation_syntax_check, :generate_cops_documentation, :test])
|
15
17
|
|
16
18
|
desc("Generate a new cop with a template")
|
17
19
|
task :new_cop, [:cop] do |_task, args|
|
@@ -25,7 +27,7 @@ task :new_cop, [:cop] do |_task, args|
|
|
25
27
|
generator = RuboCop::Cop::Generator.new(cop_name)
|
26
28
|
|
27
29
|
generator.write_source
|
28
|
-
generator.
|
30
|
+
generator.write_test
|
29
31
|
generator.inject_require(root_file_path: "lib/rubocop/cop/sorbet_cops.rb")
|
30
32
|
generator.inject_config(config_file_path: "config/default.yml")
|
31
33
|
|
@@ -34,3 +36,39 @@ task :new_cop, [:cop] do |_task, args|
|
|
34
36
|
.sub(/$\s+4\. Run.*changelog.*for your new cop\.$/m, "")
|
35
37
|
puts todo_without_changelog_instruction
|
36
38
|
end
|
39
|
+
|
40
|
+
module Releaser
|
41
|
+
extend Rake::DSL
|
42
|
+
extend self
|
43
|
+
|
44
|
+
desc "Prepare a release. The version is read from the VERSION file."
|
45
|
+
task :prepare_release do
|
46
|
+
version = File.read("VERSION").strip
|
47
|
+
puts "Preparing release for version #{version}"
|
48
|
+
|
49
|
+
update_file("lib/rubocop/sorbet/version.rb") do |version_file|
|
50
|
+
version_file.sub(/VERSION = ".*"/, "VERSION = \"#{version}\"")
|
51
|
+
end
|
52
|
+
|
53
|
+
update_file("config/default.yml") do |default|
|
54
|
+
default.gsub(/['"]?<<\s*next\s*>>['"]?/i, "'#{version}'")
|
55
|
+
end
|
56
|
+
|
57
|
+
sh "bundle install"
|
58
|
+
sh "bundle exec rake generate_cops_documentation"
|
59
|
+
|
60
|
+
sh "git add lib/rubocop/sorbet/version.rb config/default.yml Gemfile.lock VERSION manual"
|
61
|
+
|
62
|
+
puts "git commit -m 'Release #{version}'"
|
63
|
+
puts "git push origin main"
|
64
|
+
puts "git tag -a v#{version} -m 'Release #{version}'"
|
65
|
+
puts "git push origin v#{version}"
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def update_file(path)
|
71
|
+
content = File.read(path)
|
72
|
+
File.write(path, yield(content))
|
73
|
+
end
|
74
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.10.1
|
data/bin/{rspec → rake}
RENAMED
@@ -4,20 +4,16 @@
|
|
4
4
|
#
|
5
5
|
# This file was generated by Bundler.
|
6
6
|
#
|
7
|
-
# The application '
|
7
|
+
# The application 'rake' is installed as part of a gem, and
|
8
8
|
# this file is here to facilitate running it.
|
9
9
|
#
|
10
10
|
|
11
|
-
|
12
|
-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(
|
13
|
-
"../../Gemfile",
|
14
|
-
Pathname.new(__FILE__).realpath,
|
15
|
-
)
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
16
12
|
|
17
|
-
bundle_binstub = File.expand_path("
|
13
|
+
bundle_binstub = File.expand_path("bundle", __dir__)
|
18
14
|
|
19
15
|
if File.file?(bundle_binstub)
|
20
|
-
if File.read(bundle_binstub, 300)
|
16
|
+
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
21
17
|
load(bundle_binstub)
|
22
18
|
else
|
23
19
|
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
@@ -28,4 +24,4 @@ end
|
|
28
24
|
require "rubygems"
|
29
25
|
require "bundler/setup"
|
30
26
|
|
31
|
-
load
|
27
|
+
load Gem.bin_path("rake", "rake")
|
data/config/default.yml
CHANGED
@@ -1,11 +1,3 @@
|
|
1
|
-
Sorbet/Refinement:
|
2
|
-
Description: >-
|
3
|
-
Checks for the use of Ruby Refinements library. Refinements add
|
4
|
-
complexity and incur a performance penalty that can be significant
|
5
|
-
for large code bases. They are also not supported by Sorbet.
|
6
|
-
Enabled: pending
|
7
|
-
VersionAdded: '<<next>>'
|
8
|
-
|
9
1
|
inherit_mode:
|
10
2
|
merge:
|
11
3
|
- Exclude
|
@@ -22,6 +14,33 @@ Sorbet/BindingConstantWithoutTypeAlias:
|
|
22
14
|
Enabled: true
|
23
15
|
VersionAdded: 0.2.0
|
24
16
|
|
17
|
+
Sorbet/BlockMethodDefinition:
|
18
|
+
Description: >-
|
19
|
+
Disallows defining methods inside blocks without using `define_method`,
|
20
|
+
unless the block is a named class definition. This is to avoid running
|
21
|
+
into https://github.com/sorbet/sorbet/issues/3609.
|
22
|
+
Enabled: pending
|
23
|
+
Safe: true
|
24
|
+
SafeAutoCorrect: false
|
25
|
+
VersionAdded: '0.10.1'
|
26
|
+
|
27
|
+
Sorbet/BuggyObsoleteStrictMemoization:
|
28
|
+
Description: >-
|
29
|
+
Checks for the a mistaken variant of the "obsolete memoization pattern" that used to be required
|
30
|
+
for older Sorbet versions in `#typed: strict` files. The mistaken variant would overwrite the ivar with `nil`
|
31
|
+
on every call, causing the memoized value to be discarded and recomputed on every call.
|
32
|
+
|
33
|
+
This cop will correct it to read from the ivar instead of `nil`, which will memoize it correctly.
|
34
|
+
|
35
|
+
The result of this correction will be the "obsolete memoization pattern", which can further be corrected by
|
36
|
+
the `Sorbet/ObsoleteStrictMemoization` cop.
|
37
|
+
|
38
|
+
See `Sorbet/ObsoleteStrictMemoization` for more details.
|
39
|
+
Enabled: true
|
40
|
+
VersionAdded: '0.7.3'
|
41
|
+
Safe: true
|
42
|
+
SafeAutoCorrect: false
|
43
|
+
|
25
44
|
Sorbet/CallbackConditionalsBinding:
|
26
45
|
Description: 'Ensures callback conditionals are bound to the right type.'
|
27
46
|
Enabled: false
|
@@ -33,11 +52,6 @@ Sorbet/CheckedTrueInSignature:
|
|
33
52
|
Enabled: true
|
34
53
|
VersionAdded: 0.2.0
|
35
54
|
|
36
|
-
Sorbet/EmptyLineAfterSig:
|
37
|
-
Description: 'Ensures that there are no blank lines after signatures'
|
38
|
-
Enabled: true
|
39
|
-
VersionAdded: 0.7.0
|
40
|
-
|
41
55
|
Sorbet/ConstantsFromStrings:
|
42
56
|
Description: >-
|
43
57
|
Forbids constant access through meta-programming.
|
@@ -47,21 +61,28 @@ Sorbet/ConstantsFromStrings:
|
|
47
61
|
Enabled: true
|
48
62
|
VersionAdded: 0.2.0
|
49
63
|
|
64
|
+
Sorbet/EmptyLineAfterSig:
|
65
|
+
Description: 'Ensures that there are no blank lines after signatures'
|
66
|
+
Enabled: true
|
67
|
+
VersionAdded: 0.7.0
|
68
|
+
VersionChanged: '0.10.1'
|
69
|
+
|
50
70
|
Sorbet/EnforceSigilOrder:
|
51
71
|
Description: 'Ensures that Sorbet sigil comes first in a file.'
|
52
72
|
Enabled: true
|
53
73
|
VersionAdded: 0.3.4
|
54
74
|
|
55
|
-
Sorbet/EnforceSingleSigil:
|
56
|
-
Description: 'Ensures that there is only one Sorbet sigil in a file.'
|
57
|
-
Enabled: true
|
58
|
-
VersionAdded: 0.7.0
|
59
|
-
|
60
75
|
Sorbet/EnforceSignatures:
|
61
76
|
Description: 'Ensures all methods have a valid signature.'
|
62
77
|
Enabled: false
|
78
|
+
AllowRBS: false
|
63
79
|
VersionAdded: 0.3.4
|
64
80
|
|
81
|
+
Sorbet/EnforceSingleSigil:
|
82
|
+
Description: 'Ensures that there is only one Sorbet sigil in a file.'
|
83
|
+
Enabled: true
|
84
|
+
VersionAdded: 0.7.0
|
85
|
+
|
65
86
|
Sorbet/FalseSigil:
|
66
87
|
Description: 'All files must be at least at strictness `false`.'
|
67
88
|
Enabled: true
|
@@ -74,6 +95,11 @@ Sorbet/FalseSigil:
|
|
74
95
|
- db/**/*.rb
|
75
96
|
- script/**/*
|
76
97
|
|
98
|
+
Sorbet/ForbidComparableTEnum:
|
99
|
+
Description: 'Disallows including the `Comparable` module in a `T::Enum`.'
|
100
|
+
Enabled: true
|
101
|
+
VersionAdded: 0.8.2
|
102
|
+
|
77
103
|
Sorbet/ForbidExtendTSigHelpersInShims:
|
78
104
|
Description: 'Forbid the use of `extend T::Sig` and `extend T::Helpers` in RBI shims'
|
79
105
|
Enabled: true
|
@@ -81,6 +107,18 @@ Sorbet/ForbidExtendTSigHelpersInShims:
|
|
81
107
|
Include:
|
82
108
|
- "**/*.rbi"
|
83
109
|
|
110
|
+
Sorbet/ForbidIncludeConstLiteral:
|
111
|
+
Description: 'Forbids include of non-literal constants.'
|
112
|
+
Enabled: false
|
113
|
+
VersionAdded: 0.2.0
|
114
|
+
VersionChanged: 0.5.0
|
115
|
+
|
116
|
+
Sorbet/ForbidMixesInClassMethods:
|
117
|
+
Description: >-
|
118
|
+
Disallows the usage of `mixes_in_class_methods` in favor of `extend ActiveSupport::Concern`.
|
119
|
+
Enabled: false
|
120
|
+
VersionAdded: '0.10.1'
|
121
|
+
|
84
122
|
Sorbet/ForbidRBIOutsideOfAllowedPaths:
|
85
123
|
Description: 'Forbids RBI files outside of the allowed paths'
|
86
124
|
Enabled: true
|
@@ -91,31 +129,20 @@ Sorbet/ForbidRBIOutsideOfAllowedPaths:
|
|
91
129
|
Include:
|
92
130
|
- "**/*.rbi"
|
93
131
|
|
94
|
-
Sorbet/ForbidIncludeConstLiteral:
|
95
|
-
Description: 'Forbids include of non-literal constants.'
|
96
|
-
Enabled: false
|
97
|
-
VersionAdded: 0.2.0
|
98
|
-
VersionChanged: 0.5.0
|
99
|
-
|
100
|
-
Sorbet/ForbidTypeAliasedShapes:
|
101
|
-
Description: 'Forbids defining type aliases that contain shapes'
|
102
|
-
Enabled: false
|
103
|
-
VersionAdded: 0.7.6
|
104
|
-
|
105
132
|
Sorbet/ForbidSig:
|
106
133
|
Description: 'Forbid usage of sig'
|
107
134
|
Enabled: false
|
108
|
-
VersionAdded:
|
135
|
+
VersionAdded: 0.9.0
|
109
136
|
|
110
137
|
Sorbet/ForbidSigWithRuntime:
|
111
138
|
Description: 'Forbid usage of T::Sig.sig'
|
112
139
|
Enabled: false
|
113
|
-
VersionAdded:
|
140
|
+
VersionAdded: 0.9.0
|
114
141
|
|
115
142
|
Sorbet/ForbidSigWithoutRuntime:
|
116
143
|
Description: 'Forbid usage of T::Sig::WithoutRuntime.sig'
|
117
144
|
Enabled: false
|
118
|
-
VersionAdded:
|
145
|
+
VersionAdded: 0.9.0
|
119
146
|
|
120
147
|
Sorbet/ForbidSuperclassConstLiteral:
|
121
148
|
Description: 'Forbid superclasses which are non-literal constants.'
|
@@ -128,15 +155,13 @@ Sorbet/ForbidSuperclassConstLiteral:
|
|
128
155
|
Sorbet/ForbidTEnum:
|
129
156
|
Description: 'Forbid usage of T::Enum.'
|
130
157
|
Enabled: false
|
131
|
-
VersionAdded:
|
132
|
-
VersionChanged: <<next>>
|
158
|
+
VersionAdded: 0.8.9
|
133
159
|
Safe: false
|
134
160
|
|
135
161
|
Sorbet/ForbidTStruct:
|
136
162
|
Description: 'Forbid usage of T::Struct.'
|
137
163
|
Enabled: false
|
138
|
-
VersionAdded:
|
139
|
-
VersionChanged: <<next>>
|
164
|
+
VersionAdded: 0.7.4
|
140
165
|
Safe: false
|
141
166
|
|
142
167
|
Sorbet/ForbidTUnsafe:
|
@@ -151,6 +176,11 @@ Sorbet/ForbidTUntyped:
|
|
151
176
|
VersionAdded: 0.6.9
|
152
177
|
VersionChanged: 0.7.0
|
153
178
|
|
179
|
+
Sorbet/ForbidTypeAliasedShapes:
|
180
|
+
Description: 'Forbids defining type aliases that contain shapes'
|
181
|
+
Enabled: false
|
182
|
+
VersionAdded: 0.7.6
|
183
|
+
|
154
184
|
Sorbet/ForbidUntypedStructProps:
|
155
185
|
Description: >-
|
156
186
|
Disallows use of `T.untyped` or `T.nilable(T.untyped)` as a
|
@@ -189,7 +219,7 @@ Sorbet/ImplicitConversionMethod:
|
|
189
219
|
This cop disallows declaring implicit conversion methods, as sorbet does
|
190
220
|
not support implicit conversion.
|
191
221
|
Enabled: false
|
192
|
-
VersionAdded:
|
222
|
+
VersionAdded: 0.7.1
|
193
223
|
|
194
224
|
Sorbet/KeywordArgumentOrdering:
|
195
225
|
Description: >-
|
@@ -201,6 +231,11 @@ Sorbet/KeywordArgumentOrdering:
|
|
201
231
|
Enabled: true
|
202
232
|
VersionAdded: 0.2.0
|
203
233
|
|
234
|
+
Sorbet/MultipleTEnumValues:
|
235
|
+
Description: 'Ensures that all `T::Enum`s have multiple values.'
|
236
|
+
Enabled: true
|
237
|
+
VersionAdded: 0.8.2
|
238
|
+
|
204
239
|
Sorbet/ObsoleteStrictMemoization:
|
205
240
|
Description: >-
|
206
241
|
This cop checks for the obsolete pattern for initializing instance variables that was required for older Sorbet
|
@@ -213,23 +248,6 @@ Sorbet/ObsoleteStrictMemoization:
|
|
213
248
|
Safe: true
|
214
249
|
SafeAutoCorrect: true
|
215
250
|
|
216
|
-
Sorbet/BuggyObsoleteStrictMemoization:
|
217
|
-
Description: >-
|
218
|
-
Checks for the a mistaken variant of the "obsolete memoization pattern" that used to be required
|
219
|
-
for older Sorbet versions in `#typed: strict` files. The mistaken variant would overwrite the ivar with `nil`
|
220
|
-
on every call, causing the memoized value to be discarded and recomputed on every call.
|
221
|
-
|
222
|
-
This cop will correct it to read from the ivar instead of `nil`, which will memoize it correctly.
|
223
|
-
|
224
|
-
The result of this correction will be the "obsolete memoization pattern", which can further be corrected by
|
225
|
-
the `Sorbet/ObsoleteStrictMemoization` cop.
|
226
|
-
|
227
|
-
See `Sorbet/ObsoleteStrictMemoization` for more details.
|
228
|
-
Enabled: true
|
229
|
-
VersionAdded: '0.7.3'
|
230
|
-
Safe: true
|
231
|
-
SafeAutoCorrect: false
|
232
|
-
|
233
251
|
Sorbet/RedundantExtendTSig:
|
234
252
|
Description: >-
|
235
253
|
Forbid the usage of redundant `extend T::Sig`.
|
@@ -240,6 +258,23 @@ Sorbet/RedundantExtendTSig:
|
|
240
258
|
Safe: false
|
241
259
|
VersionAdded: 0.7.0
|
242
260
|
|
261
|
+
Sorbet/Refinement:
|
262
|
+
Description: >-
|
263
|
+
Checks for the use of Ruby Refinements library. Refinements add
|
264
|
+
complexity and incur a performance penalty that can be significant
|
265
|
+
for large code bases. They are also not supported by Sorbet.
|
266
|
+
Enabled: pending
|
267
|
+
VersionAdded: 0.8.6
|
268
|
+
|
269
|
+
Sorbet/SelectByIsA:
|
270
|
+
Description: >-
|
271
|
+
Suggests using `grep` over `select` when using it only for type narrowing.
|
272
|
+
This is because Sorbet can properly infer types when using `grep` but not with `select`.
|
273
|
+
Enabled: true
|
274
|
+
VersionAdded: '0.10.1'
|
275
|
+
Safe: true
|
276
|
+
SafeAutoCorrect: true
|
277
|
+
|
243
278
|
Sorbet/SignatureBuildOrder:
|
244
279
|
Description: >-
|
245
280
|
Enforces the order of parts in a signature.
|
@@ -338,13 +373,3 @@ Sorbet/VoidCheckedTests:
|
|
338
373
|
Description: 'Forbid `.void.checked(:tests)`'
|
339
374
|
Enabled: true
|
340
375
|
VersionAdded: 0.7.7
|
341
|
-
|
342
|
-
Sorbet/MultipleTEnumValues:
|
343
|
-
Description: 'Ensures that all `T::Enum`s have multiple values.'
|
344
|
-
Enabled: true
|
345
|
-
VersionAdded: 0.8.2
|
346
|
-
|
347
|
-
Sorbet/ForbidComparableTEnum:
|
348
|
-
Description: 'Disallows including the `Comparable` module in a `T::Enum`.'
|
349
|
-
Enabled: true
|
350
|
-
VersionAdded: 0.8.2
|