spoom 1.7.10 → 1.7.12
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 +19 -1
- data/lib/spoom/bundler_helper.rb +0 -2
- data/lib/spoom/cli/srb/metrics.rb +1 -1
- data/lib/spoom/context/exec.rb +14 -2
- data/lib/spoom/file_tree.rb +2 -2
- data/lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb +9 -0
- data/lib/spoom/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e5cf816e6ecd86209b75a94d71474288762d94b97da6e6637f2b67bb80c5fcf0
|
|
4
|
+
data.tar.gz: fafeb36ec7993a9632dfa0e7c1b47b7e671122e2e0a89358b1c1ab86dd611aca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a28c07c9f9ddbd22a754d6f4619696d6a82caa6f8b355dd99fc90b27c42c14b8bbb4377e433ad593b7133fffe8397fa929c75e9d309dd9499a7aa105b2126fcb
|
|
7
|
+
data.tar.gz: a098d8d9fba5cef4988d5e3e5fdc01493beec8c3ddd3a75e1b78353570872d447ab82f47a83d2cc3192b6f3699a7409f45b848e29d373eee03d273647e0afacf
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -375,7 +375,25 @@ $ spoom deadcode remove path/to/file.rb:42:18-47:23
|
|
|
375
375
|
|
|
376
376
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Don't forget to run `bin/sanity` before pushing your changes.
|
|
377
377
|
|
|
378
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
378
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
|
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.
|
|
379
397
|
|
|
380
398
|
## Contributing
|
|
381
399
|
|
data/lib/spoom/bundler_helper.rb
CHANGED
data/lib/spoom/context/exec.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require "shellwords"
|
|
5
|
+
|
|
4
6
|
module Spoom
|
|
5
7
|
class ExecResult < T::Struct
|
|
6
8
|
const :out, String
|
|
@@ -30,11 +32,21 @@ module Spoom
|
|
|
30
32
|
Bundler.with_unbundled_env do
|
|
31
33
|
opts = { chdir: absolute_path } #: Hash[Symbol, untyped]
|
|
32
34
|
|
|
35
|
+
# When Ruby is wrapped in another dev environment (e.g. Nix), that environment might set
|
|
36
|
+
# env variables that cause Sorbet (or other tools) to link to incorrect versions of
|
|
37
|
+
# dependencies.
|
|
38
|
+
#
|
|
39
|
+
# In the case of Sorbet, this can lead to corrupted JSON output.
|
|
40
|
+
#
|
|
41
|
+
# Executing the command directly through the shell bypasses any Ruby wrappers and
|
|
42
|
+
# ensures that we are using the versions of tools that are default on the system.
|
|
43
|
+
command_with_shell = "/bin/sh -c #{command.shellescape}"
|
|
44
|
+
|
|
33
45
|
if capture_err
|
|
34
|
-
out, err, status = Open3.capture3(
|
|
46
|
+
out, err, status = Open3.capture3(command_with_shell, opts)
|
|
35
47
|
ExecResult.new(out: out, err: err, status: T.must(status.success?), exit_code: T.must(status.exitstatus))
|
|
36
48
|
else
|
|
37
|
-
out, status = Open3.capture2(
|
|
49
|
+
out, status = Open3.capture2(command_with_shell, opts)
|
|
38
50
|
ExecResult.new(out: out, err: nil, status: T.must(status.success?), exit_code: T.must(status.exitstatus))
|
|
39
51
|
end
|
|
40
52
|
end
|
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
|
|
@@ -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
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.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexandre Terrasa
|
|
@@ -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: []
|