spoom 1.2.4 → 1.3.0
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/README.md +54 -55
- data/lib/spoom/cli/deadcode.rb +172 -0
- data/lib/spoom/cli/helper.rb +20 -0
- data/lib/spoom/cli/srb/bump.rb +200 -0
- data/lib/spoom/cli/srb/coverage.rb +224 -0
- data/lib/spoom/cli/srb/lsp.rb +159 -0
- data/lib/spoom/cli/srb/tc.rb +150 -0
- data/lib/spoom/cli/srb.rb +27 -0
- data/lib/spoom/cli.rb +72 -32
- data/lib/spoom/context/git.rb +2 -2
- data/lib/spoom/context/sorbet.rb +2 -2
- data/lib/spoom/deadcode/definition.rb +11 -0
- data/lib/spoom/deadcode/indexer.rb +222 -224
- data/lib/spoom/deadcode/location.rb +2 -2
- data/lib/spoom/deadcode/plugins/action_mailer.rb +2 -2
- data/lib/spoom/deadcode/plugins/action_mailer_preview.rb +19 -0
- data/lib/spoom/deadcode/plugins/actionpack.rb +4 -6
- data/lib/spoom/deadcode/plugins/active_model.rb +8 -8
- data/lib/spoom/deadcode/plugins/active_record.rb +9 -12
- data/lib/spoom/deadcode/plugins/active_support.rb +11 -0
- data/lib/spoom/deadcode/plugins/base.rb +1 -1
- data/lib/spoom/deadcode/plugins/graphql.rb +4 -4
- data/lib/spoom/deadcode/plugins/namespaces.rb +2 -4
- data/lib/spoom/deadcode/plugins/ruby.rb +8 -17
- data/lib/spoom/deadcode/plugins/sorbet.rb +4 -10
- data/lib/spoom/deadcode/plugins.rb +1 -0
- data/lib/spoom/deadcode/remover.rb +209 -174
- data/lib/spoom/deadcode/send.rb +9 -10
- data/lib/spoom/deadcode/visitor.rb +755 -0
- data/lib/spoom/deadcode.rb +40 -10
- data/lib/spoom/file_tree.rb +0 -16
- data/lib/spoom/sorbet/errors.rb +1 -1
- data/lib/spoom/sorbet/lsp/structures.rb +2 -2
- data/lib/spoom/version.rb +1 -1
- metadata +19 -15
- data/lib/spoom/cli/bump.rb +0 -198
- data/lib/spoom/cli/coverage.rb +0 -222
- data/lib/spoom/cli/lsp.rb +0 -168
- data/lib/spoom/cli/run.rb +0 -148
data/lib/spoom/deadcode/send.rb
CHANGED
@@ -3,16 +3,15 @@
|
|
3
3
|
|
4
4
|
module Spoom
|
5
5
|
module Deadcode
|
6
|
-
# An abstraction to simplify handling of
|
7
|
-
# SyntaxTree::VCall nodes.
|
6
|
+
# An abstraction to simplify handling of Prism::CallNode nodes.
|
8
7
|
class Send < T::Struct
|
9
8
|
extend T::Sig
|
10
9
|
|
11
|
-
const :node,
|
10
|
+
const :node, Prism::CallNode
|
12
11
|
const :name, String
|
13
|
-
const :recv, T.nilable(
|
14
|
-
const :args, T::Array[
|
15
|
-
const :block, T.nilable(
|
12
|
+
const :recv, T.nilable(Prism::Node), default: nil
|
13
|
+
const :args, T::Array[Prism::Node], default: []
|
14
|
+
const :block, T.nilable(Prism::Node), default: nil
|
16
15
|
|
17
16
|
sig do
|
18
17
|
type_parameters(:T)
|
@@ -25,13 +24,13 @@ module Spoom
|
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
28
|
-
sig { params(block: T.proc.params(key:
|
27
|
+
sig { params(block: T.proc.params(key: Prism::Node, value: T.nilable(Prism::Node)).void).void }
|
29
28
|
def each_arg_assoc(&block)
|
30
29
|
args.each do |arg|
|
31
|
-
next unless arg.is_a?(
|
30
|
+
next unless arg.is_a?(Prism::KeywordHashNode) || arg.is_a?(Prism::HashNode)
|
32
31
|
|
33
|
-
arg.
|
34
|
-
yield(assoc.key, assoc.value) if assoc.is_a?(
|
32
|
+
arg.elements.each do |assoc|
|
33
|
+
yield(assoc.key, assoc.value) if assoc.is_a?(Prism::AssocNode)
|
35
34
|
end
|
36
35
|
end
|
37
36
|
end
|