spoom 1.7.11 → 1.7.13
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/Gemfile +1 -0
- data/README.md +18 -0
- data/lib/spoom/bundler_helper.rb +0 -2
- data/lib/spoom/cli/srb/metrics.rb +1 -1
- data/lib/spoom/cli/srb/sigs.rb +1 -0
- data/lib/spoom/coverage.rb +1 -1
- data/lib/spoom/deadcode/plugins/ruby.rb +6 -0
- data/lib/spoom/file_tree.rb +2 -2
- data/lib/spoom/sorbet/config.rb +19 -10
- data/lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb +9 -0
- data/lib/spoom/version.rb +1 -1
- data/rbi/spoom.rbi +8 -4
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 02432e9390507a5cc9072d83c3eaf7952d430fdb4329cf5e33e969513d21f58b
|
|
4
|
+
data.tar.gz: 693d74660c7aa1faad796f5a948bb06302c1b8d62dc3855665ea1125cb0ee1fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f34e8b9207ed4b538ef2ca5450041aa62baede9429d295e4348b68008cfe3df43e7e0f626b6e41e872e808afebeabe34bcd33536c6e6520e053b5b9be43a76d
|
|
7
|
+
data.tar.gz: b4e28008f5529e134664d250bd17f2934ed978045861031d9f4b9e5d13a4e7fbde24b86d07fbeca9e0e4e114a1e6bc07bf599efa4c0e1a5ee7ccfa322c57ab3b
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -377,6 +377,24 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
|
377
377
|
|
|
378
378
|
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
379
379
|
|
|
380
|
+
## Releasing
|
|
381
|
+
|
|
382
|
+
### Bump the gem version
|
|
383
|
+
|
|
384
|
+
- [ ] Locally, update the version number in [`version.rb`](https://github.com/Shopify/spoom/blob/main/lib/spoom/version.rb)
|
|
385
|
+
- [ ] Run `bundle install` to update the version number in `Gemfile.lock`
|
|
386
|
+
- [ ] Commit this change with the message `Bump version to vx.y.z`
|
|
387
|
+
- [ ] Push this change directly to main or open a PR
|
|
388
|
+
|
|
389
|
+
### Create a new tag
|
|
390
|
+
|
|
391
|
+
- [ ] Locally, create a new tag with the new version number: `git tag vx.y.z`
|
|
392
|
+
- [ ] Push this tag up to the remote `git push origin vx.y.z`
|
|
393
|
+
|
|
394
|
+
### Release workflow will run automatically
|
|
395
|
+
|
|
396
|
+
We have a [release workflow](https://github.com/Shopify/spoom/actions/workflows/release.yml) that will publish your new gem version to rubygems.org via [Trusted Publishing](https://guides.rubygems.org/trusted-publishing/). This workflow must be approved by a member of the Ruby and Rails Infrastructure team at Shopify before it will run. Once it is approved, it will automatically publish a new gem version to rubygems.org and create a new GitHub release.
|
|
397
|
+
|
|
380
398
|
## Contributing
|
|
381
399
|
|
|
382
400
|
Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/spoom. 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.
|
data/lib/spoom/bundler_helper.rb
CHANGED
data/lib/spoom/cli/srb/sigs.rb
CHANGED
|
@@ -149,6 +149,7 @@ module Spoom
|
|
|
149
149
|
|
|
150
150
|
#{Spoom::BundlerHelper.gem_requirement_from_real_bundle("rbs")}
|
|
151
151
|
#{Spoom::BundlerHelper.gem_requirement_from_real_bundle("tapioca")}
|
|
152
|
+
#{Spoom::BundlerHelper.gem_requirement_from_real_bundle("sorbet-static-and-runtime")}
|
|
152
153
|
|
|
153
154
|
gem "#{spec.name}", path: "#{copy_context.absolute_path}"
|
|
154
155
|
GEMFILE
|
data/lib/spoom/coverage.rb
CHANGED
|
@@ -15,7 +15,7 @@ module Spoom
|
|
|
15
15
|
config = context.sorbet_config
|
|
16
16
|
config.allowed_extensions.push(".rb", ".rbi") if config.allowed_extensions.empty?
|
|
17
17
|
|
|
18
|
-
new_config = config.
|
|
18
|
+
new_config = config.dup
|
|
19
19
|
new_config.allowed_extensions.reject! { |ext| !rbi && ext == ".rbi" }
|
|
20
20
|
flags = [
|
|
21
21
|
"--no-config",
|
|
@@ -33,6 +33,12 @@ module Spoom
|
|
|
33
33
|
if last_arg.is_a?(Prism::SymbolNode) || last_arg.is_a?(Prism::StringNode)
|
|
34
34
|
@index.reference_method(last_arg.unescaped, send.location)
|
|
35
35
|
end
|
|
36
|
+
when "dup"
|
|
37
|
+
@index.reference_method("initialize_dup", send.location)
|
|
38
|
+
@index.reference_method("initialize_copy", send.location)
|
|
39
|
+
when "clone"
|
|
40
|
+
@index.reference_method("initialize_clone", send.location)
|
|
41
|
+
@index.reference_method("initialize_copy", send.location)
|
|
36
42
|
when "method"
|
|
37
43
|
arg = send.args.first
|
|
38
44
|
@index.reference_method(arg.unescaped, send.location) if arg.is_a?(Prism::SymbolNode)
|
data/lib/spoom/file_tree.rb
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
module Spoom
|
|
5
5
|
# Build a file hierarchy from a set of file paths.
|
|
6
6
|
class FileTree
|
|
7
|
-
#: (?
|
|
7
|
+
#: (?Enumerable[String] paths) -> void
|
|
8
8
|
def initialize(paths = [])
|
|
9
9
|
@roots = {} #: Hash[String, Node]
|
|
10
10
|
add_paths(paths)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
# Add all `paths` to the tree
|
|
14
|
-
#: (
|
|
14
|
+
#: (Enumerable[String] paths) -> void
|
|
15
15
|
def add_paths(paths)
|
|
16
16
|
paths.each { |path| add_path(path) }
|
|
17
17
|
end
|
data/lib/spoom/sorbet/config.rb
CHANGED
|
@@ -40,14 +40,12 @@ module Spoom
|
|
|
40
40
|
@no_stdlib = false #: bool
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
#: ->
|
|
44
|
-
def
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
new_config.no_stdlib = @no_stdlib
|
|
50
|
-
new_config
|
|
43
|
+
#: (Config source) -> void
|
|
44
|
+
def initialize_copy(source)
|
|
45
|
+
super
|
|
46
|
+
@paths = @paths.dup
|
|
47
|
+
@ignore = @ignore.dup
|
|
48
|
+
@allowed_extensions = @allowed_extensions.dup
|
|
51
49
|
end
|
|
52
50
|
|
|
53
51
|
# Returns self as a string of options that can be passed to Sorbet
|
|
@@ -107,8 +105,8 @@ module Spoom
|
|
|
107
105
|
when /^--dir=/
|
|
108
106
|
config.paths << parse_option(line)
|
|
109
107
|
next
|
|
110
|
-
when /^--no-stdlib
|
|
111
|
-
config.no_stdlib =
|
|
108
|
+
when /^--no-stdlib(=|$)/
|
|
109
|
+
config.no_stdlib = parse_bool_option(line)
|
|
112
110
|
next
|
|
113
111
|
when /^--.*=/
|
|
114
112
|
next
|
|
@@ -143,6 +141,17 @@ module Spoom
|
|
|
143
141
|
def parse_option(line)
|
|
144
142
|
T.must(line.split("=").last).strip
|
|
145
143
|
end
|
|
144
|
+
|
|
145
|
+
#: (String line) -> bool
|
|
146
|
+
def parse_bool_option(line)
|
|
147
|
+
return true unless line.include?("=") # `--foo` is equivalent to `--foo=true`
|
|
148
|
+
|
|
149
|
+
case parse_option(line)
|
|
150
|
+
when "true", "True", "t", "T", "1" then true
|
|
151
|
+
when "false", "False", "f", "F", "0" then false
|
|
152
|
+
else raise ArgumentError, "invalid boolean value: #{parse_option(line).inspect}"
|
|
153
|
+
end
|
|
154
|
+
end
|
|
146
155
|
end
|
|
147
156
|
end
|
|
148
157
|
end
|
|
@@ -139,6 +139,12 @@ module Spoom
|
|
|
139
139
|
|
|
140
140
|
apply_member_annotations(comments.method_annotations, sig)
|
|
141
141
|
|
|
142
|
+
# Sorbet runtime doesn't support `sig` on `method_added` or
|
|
143
|
+
# `singleton_method_added`, so we always use `without_runtime` for them.
|
|
144
|
+
if def_node.name == :method_added || def_node.name == :singleton_method_added
|
|
145
|
+
sig.without_runtime = true
|
|
146
|
+
end
|
|
147
|
+
|
|
142
148
|
@rewriter << Source::Replace.new(
|
|
143
149
|
signature.location.start_offset,
|
|
144
150
|
signature.location.end_offset,
|
|
@@ -202,6 +208,9 @@ module Spoom
|
|
|
202
208
|
signatures = comments.signatures
|
|
203
209
|
if signatures.any?
|
|
204
210
|
signatures.each do |signature|
|
|
211
|
+
# Only type param signatures (e.g. `#: [A, B]`) are valid on class/module nodes
|
|
212
|
+
next unless signature.string.start_with?("[")
|
|
213
|
+
|
|
205
214
|
type_params = ::RBS::Parser.parse_type_params(signature.string)
|
|
206
215
|
next if type_params.empty?
|
|
207
216
|
|
data/lib/spoom/version.rb
CHANGED
data/rbi/spoom.rbi
CHANGED
|
@@ -2603,10 +2603,6 @@ class Spoom::Sorbet::Config
|
|
|
2603
2603
|
|
|
2604
2604
|
def allowed_extensions; end
|
|
2605
2605
|
def allowed_extensions=(_arg0); end
|
|
2606
|
-
|
|
2607
|
-
sig { returns(::Spoom::Sorbet::Config) }
|
|
2608
|
-
def copy; end
|
|
2609
|
-
|
|
2610
2606
|
def ignore; end
|
|
2611
2607
|
def ignore=(_arg0); end
|
|
2612
2608
|
|
|
@@ -2623,6 +2619,11 @@ class Spoom::Sorbet::Config
|
|
|
2623
2619
|
|
|
2624
2620
|
def paths=(_arg0); end
|
|
2625
2621
|
|
|
2622
|
+
private
|
|
2623
|
+
|
|
2624
|
+
sig { params(source: ::Spoom::Sorbet::Config).void }
|
|
2625
|
+
def initialize_copy(source); end
|
|
2626
|
+
|
|
2626
2627
|
class << self
|
|
2627
2628
|
sig { params(sorbet_config_path: ::String).returns(::Spoom::Sorbet::Config) }
|
|
2628
2629
|
def parse_file(sorbet_config_path); end
|
|
@@ -2632,6 +2633,9 @@ class Spoom::Sorbet::Config
|
|
|
2632
2633
|
|
|
2633
2634
|
private
|
|
2634
2635
|
|
|
2636
|
+
sig { params(line: ::String).returns(T::Boolean) }
|
|
2637
|
+
def parse_bool_option(line); end
|
|
2638
|
+
|
|
2635
2639
|
sig { params(line: ::String).returns(::String) }
|
|
2636
2640
|
def parse_option(line); end
|
|
2637
2641
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spoom
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.7.
|
|
4
|
+
version: 1.7.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexandre Terrasa
|
|
@@ -43,14 +43,14 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - "~>"
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 13.
|
|
46
|
+
version: 13.4.2
|
|
47
47
|
type: :development
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 13.
|
|
53
|
+
version: 13.4.2
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: erubi
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -99,14 +99,14 @@ dependencies:
|
|
|
99
99
|
requirements:
|
|
100
100
|
- - ">="
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: 4.0.0.dev.
|
|
102
|
+
version: 4.0.0.dev.5
|
|
103
103
|
type: :runtime
|
|
104
104
|
prerelease: false
|
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
106
|
requirements:
|
|
107
107
|
- - ">="
|
|
108
108
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: 4.0.0.dev.
|
|
109
|
+
version: 4.0.0.dev.5
|
|
110
110
|
- !ruby/object:Gem::Dependency
|
|
111
111
|
name: rexml
|
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -275,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
275
275
|
- !ruby/object:Gem::Version
|
|
276
276
|
version: '0'
|
|
277
277
|
requirements: []
|
|
278
|
-
rubygems_version:
|
|
278
|
+
rubygems_version: 4.0.3
|
|
279
279
|
specification_version: 4
|
|
280
280
|
summary: Useful tools for Sorbet enthusiasts.
|
|
281
281
|
test_files: []
|