spoom 1.6.1 → 1.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c9b64402b943d03196b4ac55fc9f9582c635e20b50639ea631b345149e02fa3
4
- data.tar.gz: 9e1720b82a26ac68cd91125bf05605f7964926829a06d9b9a7b2ac3bb4881e26
3
+ metadata.gz: e2f7a10c996ca4d114ec5d34f9c0a08aa1e3ab5ed8ac1853997ff5725635d61c
4
+ data.tar.gz: c2cb5939f9fa17f7737dc9ca65f0a232bfc04241a0eeb21ec4770616f0990da9
5
5
  SHA512:
6
- metadata.gz: d8138e2c64f4615b21f3b83b6c42013f6559a51ea173bc1086d8aae44c300a0596338826e3f03653c9ed39ead2fc799bec901b8cfac684cafb341981aeeea3e6
7
- data.tar.gz: 38140e0e9cda06b563595a1616622f81f4860a8f3f9fbf2bafd2111879f56349b65c2865769b25035902dedc5574ef1267ae1b14cd05517867d20ef3296f52e1
6
+ metadata.gz: f4127b9180f965024a9e8afd64789bd21a2174e63933440e6c01085d54263b4f7edbc94a3e9869432c511f65dcc0c2ea8e2d1035e6e22a5f5b809a415ec49c24
7
+ data.tar.gz: 0b70e5d289ac509cbd45c8a69a5f27aeefe580d934acca250ac2feaa4d6b0a4f3cb73972e27c1524f05749b8d17f03c67fd0fe89b14a8e0528e9983576683ceb
data/README.md CHANGED
@@ -221,6 +221,20 @@ Count the number of type-checking errors if all files were bumped to true:
221
221
  $ spoom srb bump --count-errors --dry
222
222
  ```
223
223
 
224
+ #### Translate sigs between RBI and RBS
225
+
226
+ Translate all file sigs from RBI to RBS:
227
+
228
+ ```
229
+ $ spoom srb sigs translate
230
+ ```
231
+
232
+ Translate one file's sigs from RBS to RBI:
233
+
234
+ ```
235
+ $ spoom srb sigs translate --from rbs --to rbi /path/to/file.rb
236
+ ```
237
+
224
238
  #### Interact with Sorbet LSP mode
225
239
 
226
240
  **Experimental**
@@ -6,7 +6,7 @@ require "minitest"
6
6
  module Spoom
7
7
  module BacktraceFilter
8
8
  class Minitest < ::Minitest::BacktraceFilter
9
- SORBET_PATHS = T.let(Gem.loaded_specs["sorbet-runtime"].full_require_paths.freeze, T::Array[String])
9
+ SORBET_PATHS = Gem.loaded_specs["sorbet-runtime"].full_require_paths.freeze #: Array[String]
10
10
 
11
11
  # @override
12
12
  #: (Array[String]? bt) -> Array[String]
@@ -56,7 +56,7 @@ module Spoom
56
56
  # Returns the context at `--path` (by default the current working directory)
57
57
  #: -> Context
58
58
  def context
59
- @context ||= T.let(Context.new(exec_path), T.nilable(Context))
59
+ @context ||= Context.new(exec_path) #: Context?
60
60
  end
61
61
 
62
62
  # Raise if `spoom` is not ran inside a context with a `sorbet/config` file
@@ -81,15 +81,17 @@ module Spoom
81
81
  end
82
82
 
83
83
  # Collect files from `paths`, defaulting to `exec_path`
84
- #: (Array[String] paths) -> Array[String]
85
- def collect_files(paths)
84
+ #: (Array[String] paths, ?include_rbi_files: bool) -> Array[String]
85
+ def collect_files(paths, include_rbi_files: false)
86
86
  paths << exec_path if paths.empty?
87
87
 
88
88
  files = paths.flat_map do |path|
89
89
  if File.file?(path)
90
90
  path
91
91
  else
92
- Dir.glob("#{path}/**/*.rb")
92
+ exts = ["rb"]
93
+ exts << "rbi" if include_rbi_files
94
+ Dir.glob("#{path}/**/*.{#{exts.join(",")}}")
93
95
  end
94
96
  end
95
97
 
@@ -104,7 +106,7 @@ module Spoom
104
106
  # Colors
105
107
 
106
108
  # Color used to highlight expressions in backticks
107
- HIGHLIGHT_COLOR = T.let(Spoom::Color::BLUE, Spoom::Color)
109
+ HIGHLIGHT_COLOR = Spoom::Color::BLUE #: Spoom::Color
108
110
 
109
111
  # Is the `--color` option true?
110
112
  #: -> bool
@@ -118,7 +120,7 @@ module Spoom
118
120
 
119
121
  res = StringIO.new
120
122
  word = StringIO.new
121
- in_ticks = T.let(false, T::Boolean)
123
+ in_ticks = false #: bool
122
124
  string.chars.each do |c|
123
125
  if c == "`" && !in_ticks
124
126
  in_ticks = true
@@ -89,7 +89,7 @@ module Spoom
89
89
 
90
90
  context.git_checkout!(ref: commit.sha)
91
91
 
92
- snapshot = T.let(nil, T.nilable(Spoom::Coverage::Snapshot))
92
+ snapshot = nil #: Spoom::Coverage::Snapshot?
93
93
  if options[:bundle_install]
94
94
  Bundler.with_unbundled_env do
95
95
  next unless bundle_install(path, commit.sha)
@@ -17,6 +17,7 @@ module Spoom
17
17
  aliases: :p,
18
18
  desc: "Use positional names when translating from RBI to RBS",
19
19
  default: true
20
+ option :include_rbi_files, type: :boolean, desc: "Include RBI files", default: false
20
21
  def translate(*paths)
21
22
  from = options[:from]
22
23
  to = options[:to]
@@ -26,7 +27,7 @@ module Spoom
26
27
  exit(1)
27
28
  end
28
29
 
29
- files = collect_files(paths)
30
+ files = collect_files(paths, include_rbi_files: options[:include_rbi_files])
30
31
 
31
32
  say("Translating signatures from `#{from}` to `#{to}` " \
32
33
  "in `#{files.size}` file#{files.size == 1 ? "" : "s"}...\n\n")
@@ -124,7 +125,7 @@ module Spoom
124
125
  gem "#{spec.name}", path: "#{copy_context.absolute_path}"
125
126
  RB
126
127
  exec(tapioca_context, "bundle install")
127
- exec(tapioca_context, "bundle exec tapioca gem #{spec.name} --no-loc --no-file-header")
128
+ exec(tapioca_context, "bundle exec tapioca gem #{spec.name} --no-doc --no-loc --no-file-header")
128
129
 
129
130
  rbi_path = tapioca_context.glob("sorbet/rbi/gems/#{spec.name}@*.rbi").first
130
131
  unless rbi_path && tapioca_context.file?(rbi_path)
@@ -22,6 +22,7 @@ module Spoom
22
22
  option :format, type: :string, aliases: :f, desc: "Format line output"
23
23
  option :uniq, type: :boolean, aliases: :u, desc: "Remove duplicated lines"
24
24
  option :count, type: :boolean, default: true, desc: "Show errors count"
25
+ option :junit_output_path, type: :string, desc: "Output failures to XML file formatted for JUnit"
25
26
  option :sorbet, type: :string, desc: "Path to custom Sorbet bin"
26
27
  option :sorbet_options, type: :string, default: "", desc: "Pass options to Sorbet"
27
28
  def tc(*paths_to_select)
@@ -32,6 +33,7 @@ module Spoom
32
33
  uniq = options[:uniq]
33
34
  format = options[:format]
34
35
  count = options[:count]
36
+ junit_output_path = options[:junit_output_path]
35
37
  sorbet = options[:sorbet]
36
38
 
37
39
  unless limit || code || sort
@@ -55,6 +57,12 @@ module Spoom
55
57
 
56
58
  if result.status
57
59
  say_error(result.err, status: nil, nl: false)
60
+ if junit_output_path
61
+ doc = Spoom::Sorbet::Errors.to_junit_xml([])
62
+ file = File.open(junit_output_path, "w")
63
+ doc.write(output: file, indent: 2)
64
+ file.close
65
+ end
58
66
  exit(0)
59
67
  end
60
68
 
@@ -94,6 +102,13 @@ module Spoom
94
102
  say_error(line, status: nil)
95
103
  end
96
104
 
105
+ if junit_output_path
106
+ doc = Spoom::Sorbet::Errors.to_junit_xml(errors)
107
+ file = File.open(junit_output_path, "w")
108
+ doc.write(output: file, indent: 2)
109
+ file.close
110
+ end
111
+
97
112
  if count
98
113
  if errors_count == errors.size
99
114
  say_error("Errors: #{errors_count}", status: nil)
@@ -132,7 +147,7 @@ module Spoom
132
147
  def colorize_message(message)
133
148
  return message unless color?
134
149
 
135
- cyan = T.let(false, T::Boolean)
150
+ cyan = false #: bool
136
151
  word = StringIO.new
137
152
  message.chars.each do |c|
138
153
  if c == "`"
@@ -31,7 +31,7 @@ module Spoom
31
31
  #: (String command, ?capture_err: bool) -> ExecResult
32
32
  def exec(command, capture_err: true)
33
33
  Bundler.with_unbundled_env do
34
- opts = T.let({ chdir: absolute_path }, T::Hash[Symbol, T.untyped])
34
+ opts = { chdir: absolute_path } #: Hash[Symbol, untyped]
35
35
 
36
36
  if capture_err
37
37
  out, err, status = Open3.capture3(command, opts)
data/lib/spoom/context.rb CHANGED
@@ -45,7 +45,7 @@ module Spoom
45
45
  # Call `#make!` to create it.
46
46
  #: (String absolute_path) -> void
47
47
  def initialize(absolute_path)
48
- @absolute_path = T.let(::File.expand_path(absolute_path), String)
48
+ @absolute_path = ::File.expand_path(absolute_path) #: String
49
49
  end
50
50
  end
51
51
  end
@@ -40,7 +40,7 @@ module Spoom
40
40
 
41
41
  abstract!
42
42
 
43
- TEMPLATE = T.let("#{Spoom::SPOOM_PATH}/templates/page.erb", String)
43
+ TEMPLATE = "#{Spoom::SPOOM_PATH}/templates/page.erb" #: String
44
44
 
45
45
  #: String
46
46
  attr_reader :title
@@ -88,7 +88,7 @@ module Spoom
88
88
  class Card < Template
89
89
  extend T::Sig
90
90
 
91
- TEMPLATE = T.let("#{Spoom::SPOOM_PATH}/templates/card.erb", String)
91
+ TEMPLATE = "#{Spoom::SPOOM_PATH}/templates/card.erb" #: String
92
92
 
93
93
  #: String?
94
94
  attr_reader :title, :body
@@ -120,7 +120,7 @@ module Spoom
120
120
  end
121
121
 
122
122
  class Snapshot < Card
123
- TEMPLATE = T.let("#{Spoom::SPOOM_PATH}/templates/card_snapshot.erb", String)
123
+ TEMPLATE = "#{Spoom::SPOOM_PATH}/templates/card_snapshot.erb" #: String
124
124
 
125
125
  #: Coverage::Snapshot
126
126
  attr_reader :snapshot
@@ -25,7 +25,7 @@ module Spoom
25
25
  prop :sigils_excluding_rbis, T::Hash[String, Integer], default: Hash.new(0)
26
26
 
27
27
  # The strictness name as found in the Sorbet metrics file
28
- STRICTNESSES = T.let(["ignore", "false", "true", "strict", "strong", "stdlib"].freeze, T::Array[String])
28
+ STRICTNESSES = ["ignore", "false", "true", "strict", "strong", "stdlib"].freeze #: Array[String]
29
29
 
30
30
  #: (?out: (IO | StringIO), ?colors: bool, ?indent_level: Integer) -> void
31
31
  def print(out: $stdout, colors: true, indent_level: 0)
@@ -24,9 +24,9 @@ module Spoom
24
24
  #: (Model model) -> void
25
25
  def initialize(model)
26
26
  @model = model
27
- @definitions = T.let({}, T::Hash[String, T::Array[Definition]])
28
- @references = T.let({}, T::Hash[String, T::Array[Model::Reference]])
29
- @ignored = T.let(Set.new, T::Set[Model::SymbolDef])
27
+ @definitions = {} #: Hash[String, Array[Definition]]
28
+ @references = {} #: Hash[String, Array[Model::Reference]]
29
+ @ignored = Set.new #: Set[Model::SymbolDef]
30
30
  end
31
31
 
32
32
  # Indexing
@@ -7,23 +7,20 @@ module Spoom
7
7
  class ActionPack < Base
8
8
  ignore_classes_inheriting_from("ApplicationController")
9
9
 
10
- CALLBACKS = T.let(
11
- [
12
- "after_action",
13
- "append_after_action",
14
- "append_around_action",
15
- "append_before_action",
16
- "around_action",
17
- "before_action",
18
- "prepend_after_action",
19
- "prepend_around_action",
20
- "prepend_before_action",
21
- "skip_after_action",
22
- "skip_around_action",
23
- "skip_before_action",
24
- ].freeze,
25
- T::Array[String],
26
- )
10
+ CALLBACKS = [
11
+ "after_action",
12
+ "append_after_action",
13
+ "append_around_action",
14
+ "append_before_action",
15
+ "around_action",
16
+ "before_action",
17
+ "prepend_after_action",
18
+ "prepend_around_action",
19
+ "prepend_before_action",
20
+ "skip_after_action",
21
+ "skip_around_action",
22
+ "skip_before_action",
23
+ ].freeze #: Array[String]
27
24
 
28
25
  # @override
29
26
  #: (Model::Method definition) -> void
@@ -15,58 +15,49 @@ module Spoom
15
15
  "to_param",
16
16
  )
17
17
 
18
- CALLBACKS = T.let(
19
- [
20
- "after_commit",
21
- "after_create_commit",
22
- "after_create",
23
- "after_destroy_commit",
24
- "after_destroy",
25
- "after_find",
26
- "after_initialize",
27
- "after_rollback",
28
- "after_save_commit",
29
- "after_save",
30
- "after_touch",
31
- "after_update_commit",
32
- "after_update",
33
- "after_validation",
34
- "around_create",
35
- "around_destroy",
36
- "around_save",
37
- "around_update",
38
- "before_create",
39
- "before_destroy",
40
- "before_save",
41
- "before_update",
42
- "before_validation",
43
- ].freeze,
44
- T::Array[String],
45
- )
18
+ CALLBACKS = [
19
+ "after_commit",
20
+ "after_create_commit",
21
+ "after_create",
22
+ "after_destroy_commit",
23
+ "after_destroy",
24
+ "after_find",
25
+ "after_initialize",
26
+ "after_rollback",
27
+ "after_save_commit",
28
+ "after_save",
29
+ "after_touch",
30
+ "after_update_commit",
31
+ "after_update",
32
+ "after_validation",
33
+ "around_create",
34
+ "around_destroy",
35
+ "around_save",
36
+ "around_update",
37
+ "before_create",
38
+ "before_destroy",
39
+ "before_save",
40
+ "before_update",
41
+ "before_validation",
42
+ ].freeze #: Array[String]
46
43
 
47
- CRUD_METHODS = T.let(
48
- [
49
- "assign_attributes",
50
- "create",
51
- "create!",
52
- "insert",
53
- "insert!",
54
- "new",
55
- "update",
56
- "update!",
57
- "upsert",
58
- ].freeze,
59
- T::Array[String],
60
- )
44
+ CRUD_METHODS = [
45
+ "assign_attributes",
46
+ "create",
47
+ "create!",
48
+ "insert",
49
+ "insert!",
50
+ "new",
51
+ "update",
52
+ "update!",
53
+ "upsert",
54
+ ].freeze #: Array[String]
61
55
 
62
- ARRAY_METHODS = T.let(
63
- [
64
- "insert_all",
65
- "insert_all!",
66
- "upsert_all",
67
- ].freeze,
68
- T::Array[String],
69
- )
56
+ ARRAY_METHODS = [
57
+ "insert_all",
58
+ "insert_all!",
59
+ "upsert_all",
60
+ ].freeze #: Array[String]
70
61
 
71
62
  # @override
72
63
  #: (Send send) -> void
@@ -16,7 +16,7 @@ module Spoom
16
16
  "before_teardown",
17
17
  )
18
18
 
19
- SETUP_AND_TEARDOWN_METHODS = T.let(["setup", "teardown"], T::Array[String])
19
+ SETUP_AND_TEARDOWN_METHODS = ["setup", "teardown"] #: Array[String]
20
20
 
21
21
  # @override
22
22
  #: (Send send) -> void
@@ -5,7 +5,7 @@ module Spoom
5
5
  module Deadcode
6
6
  module Plugins
7
7
  class Rubocop < Base
8
- RUBOCOP_CONSTANTS = T.let(["MSG", "RESTRICT_ON_SEND"].to_set.freeze, T::Set[String])
8
+ RUBOCOP_CONSTANTS = ["MSG", "RESTRICT_ON_SEND"].to_set.freeze #: Set[String]
9
9
 
10
10
  ignore_classes_inheriting_from(
11
11
  "RuboCop::Cop::Cop",
@@ -25,34 +25,28 @@ module Spoom
25
25
  module Deadcode
26
26
  DEFAULT_CUSTOM_PLUGINS_PATH = ".spoom/deadcode/plugins"
27
27
 
28
- DEFAULT_PLUGINS = T.let(
29
- Set.new([
30
- Spoom::Deadcode::Plugins::Namespaces,
31
- Spoom::Deadcode::Plugins::Ruby,
32
- ]).freeze,
33
- T::Set[T.class_of(Plugins::Base)],
34
- )
28
+ DEFAULT_PLUGINS = Set.new([
29
+ Spoom::Deadcode::Plugins::Namespaces,
30
+ Spoom::Deadcode::Plugins::Ruby,
31
+ ]).freeze #: Set[singleton(Plugins::Base)]
35
32
 
36
- PLUGINS_FOR_GEM = T.let(
37
- {
38
- "actionmailer" => Spoom::Deadcode::Plugins::ActionMailer,
39
- "actionpack" => Spoom::Deadcode::Plugins::ActionPack,
40
- "activejob" => Spoom::Deadcode::Plugins::ActiveJob,
41
- "activemodel" => Spoom::Deadcode::Plugins::ActiveModel,
42
- "activerecord" => Spoom::Deadcode::Plugins::ActiveRecord,
43
- "activesupport" => Spoom::Deadcode::Plugins::ActiveSupport,
44
- "graphql" => Spoom::Deadcode::Plugins::GraphQL,
45
- "minitest" => Spoom::Deadcode::Plugins::Minitest,
46
- "rails" => Spoom::Deadcode::Plugins::Rails,
47
- "rake" => Spoom::Deadcode::Plugins::Rake,
48
- "rspec" => Spoom::Deadcode::Plugins::RSpec,
49
- "rubocop" => Spoom::Deadcode::Plugins::Rubocop,
50
- "sorbet-runtime" => Spoom::Deadcode::Plugins::Sorbet,
51
- "sorbet-static" => Spoom::Deadcode::Plugins::Sorbet,
52
- "thor" => Spoom::Deadcode::Plugins::Thor,
53
- }.freeze,
54
- T::Hash[String, T.class_of(Plugins::Base)],
55
- )
33
+ PLUGINS_FOR_GEM = {
34
+ "actionmailer" => Spoom::Deadcode::Plugins::ActionMailer,
35
+ "actionpack" => Spoom::Deadcode::Plugins::ActionPack,
36
+ "activejob" => Spoom::Deadcode::Plugins::ActiveJob,
37
+ "activemodel" => Spoom::Deadcode::Plugins::ActiveModel,
38
+ "activerecord" => Spoom::Deadcode::Plugins::ActiveRecord,
39
+ "activesupport" => Spoom::Deadcode::Plugins::ActiveSupport,
40
+ "graphql" => Spoom::Deadcode::Plugins::GraphQL,
41
+ "minitest" => Spoom::Deadcode::Plugins::Minitest,
42
+ "rails" => Spoom::Deadcode::Plugins::Rails,
43
+ "rake" => Spoom::Deadcode::Plugins::Rake,
44
+ "rspec" => Spoom::Deadcode::Plugins::RSpec,
45
+ "rubocop" => Spoom::Deadcode::Plugins::Rubocop,
46
+ "sorbet-runtime" => Spoom::Deadcode::Plugins::Sorbet,
47
+ "sorbet-static" => Spoom::Deadcode::Plugins::Sorbet,
48
+ "thor" => Spoom::Deadcode::Plugins::Thor,
49
+ }.freeze #: Hash[String, singleton(Plugins::Base)]
56
50
 
57
51
  class << self
58
52
  #: (Context context) -> Set[singleton(Plugins::Base)]
@@ -31,11 +31,11 @@ module Spoom
31
31
  #: (String source, Definition::Kind? kind, Location location) -> void
32
32
  def initialize(source, kind, location)
33
33
  @old_source = source
34
- @new_source = T.let(source.dup, String)
34
+ @new_source = source.dup #: String
35
35
  @kind = kind
36
36
  @location = location
37
37
 
38
- @node_context = T.let(NodeFinder.find(source, location, kind), NodeContext)
38
+ @node_context = NodeFinder.find(source, location, kind) #: NodeContext
39
39
  end
40
40
 
41
41
  #: -> void
@@ -99,8 +99,10 @@ module Spoom
99
99
  prev_node = context.previous_node
100
100
  next_node = context.next_node
101
101
 
102
- if (prev_node && prev_node.location.end_line != node.location.start_line) &&
103
- (next_node && next_node.location.start_line != node.location.end_line)
102
+ has_prev_node_on_different_line = prev_node && prev_node.location.end_line != node.location.start_line
103
+ has_next_node_on_different_line = next_node && next_node.location.start_line != node.location.end_line
104
+
105
+ if has_prev_node_on_different_line && has_next_node_on_different_line
104
106
  # We have a node before and after, but on different lines, we need to remove the whole line
105
107
  #
106
108
  # ~~~
@@ -164,8 +166,10 @@ module Spoom
164
166
  prev_node = context.previous_node
165
167
  next_node = context.next_node
166
168
 
167
- if (prev_node && prev_node.location.end_line != context.node.location.start_line) &&
168
- (next_node && next_node.location.start_line != context.node.location.end_line)
169
+ has_prev_node_on_different_line = prev_node && prev_node.location.end_line != context.node.location.start_line
170
+ has_next_node_on_different_line = next_node && next_node.location.start_line != context.node.location.end_line
171
+
172
+ if has_prev_node_on_different_line && has_next_node_on_different_line
169
173
  # We have a node before and after, but on different lines, we need to remove the whole line
170
174
  #
171
175
  # ~~~
@@ -275,7 +279,7 @@ module Spoom
275
279
 
276
280
  # Adjust the lines to remove to include previous blank lines
277
281
  prev_context = NodeContext.new(@old_source, @node_context.comments, first_node, context.nesting)
278
- before = T.let(prev_context.previous_node, T.nilable(T.any(Prism::Node, Prism::Comment)))
282
+ before = prev_context.previous_node #: (Prism::Node | Prism::Comment)?
279
283
 
280
284
  # There may be an unrelated comment between the current node and the one before
281
285
  # if there is, we only want to delete lines up to the last comment found
@@ -329,7 +333,7 @@ module Spoom
329
333
 
330
334
  #: (Prism::CallNode node, name: String, kind: Definition::Kind?) -> String
331
335
  def transform_sig(node, name:, kind:)
332
- type = T.let(nil, T.nilable(String))
336
+ type = nil #: String?
333
337
 
334
338
  block = T.cast(node.block, Prism::BlockNode)
335
339
  statements = T.cast(block.body, Prism::StatementsNode)
@@ -428,7 +432,7 @@ module Spoom
428
432
 
429
433
  #: -> NodeContext?
430
434
  def sclass_context
431
- sclass = T.let(nil, T.nilable(Prism::SingletonClassNode))
435
+ sclass = nil #: Prism::SingletonClassNode?
432
436
 
433
437
  nesting = @nesting.dup
434
438
  until nesting.empty? || sclass
@@ -473,7 +477,7 @@ module Spoom
473
477
 
474
478
  #: (Integer start_line, Integer end_line) -> Array[Prism::Comment]
475
479
  def comments_between_lines(start_line, end_line)
476
- comments = T.let([], T::Array[Prism::Comment])
480
+ comments = [] #: Array[Prism::Comment]
477
481
 
478
482
  (start_line + 1).upto(end_line - 1) do |line|
479
483
  comment = @comments[line]
@@ -485,7 +489,7 @@ module Spoom
485
489
 
486
490
  #: (Prism::Node node) -> Array[Prism::Comment]
487
491
  def attached_comments(node)
488
- comments = T.let([], T::Array[Prism::Comment])
492
+ comments = [] #: Array[Prism::Comment]
489
493
 
490
494
  start_line = node.location.start_line - 1
491
495
  start_line.downto(1) do |line|
@@ -500,7 +504,7 @@ module Spoom
500
504
 
501
505
  #: -> Array[Prism::Node]
502
506
  def attached_sigs
503
- nodes = T.let([], T::Array[Prism::Node])
507
+ nodes = [] #: Array[Prism::Node]
504
508
 
505
509
  previous_nodes.reverse_each do |prev_node|
506
510
  break unless sorbet_signature?(prev_node)
@@ -553,12 +557,9 @@ module Spoom
553
557
  raise Error, "Can't find node at #{location}, expected #{kind} but got #{node.class}"
554
558
  end
555
559
 
556
- comments_by_line = T.let(
557
- result.comments.to_h do |comment|
558
- [comment.location.start_line, comment]
559
- end,
560
- T::Hash[Integer, Prism::Comment],
561
- )
560
+ comments_by_line = result.comments.to_h do |comment|
561
+ [comment.location.start_line, comment]
562
+ end #: Hash[Integer, Prism::Comment]
562
563
 
563
564
  NodeContext.new(source, comments_by_line, node, visitor.nodes_nesting)
564
565
  end
@@ -599,8 +600,8 @@ module Spoom
599
600
  super()
600
601
  @location = location
601
602
  @kind = kind
602
- @node = T.let(nil, T.nilable(Prism::Node))
603
- @nodes_nesting = T.let([], T::Array[Prism::Node])
603
+ @node = nil #: Prism::Node?
604
+ @nodes_nesting = [] #: Array[Prism::Node]
604
605
  end
605
606
 
606
607
  # @override
@@ -16,7 +16,7 @@ module Spoom
16
16
  # the list.
17
17
  #: (?allow_extensions: Array[String], ?allow_mime_types: Array[String], ?exclude_patterns: Array[String]) -> void
18
18
  def initialize(allow_extensions: [], allow_mime_types: [], exclude_patterns: [])
19
- @files = T.let([], T::Array[String])
19
+ @files = [] #: Array[String]
20
20
  @allow_extensions = allow_extensions
21
21
  @allow_mime_types = allow_mime_types
22
22
  @exclude_patterns = exclude_patterns
@@ -6,7 +6,7 @@ module Spoom
6
6
  class FileTree
7
7
  #: (?T::Enumerable[String] paths) -> void
8
8
  def initialize(paths = [])
9
- @roots = T.let({}, T::Hash[String, Node])
9
+ @roots = {} #: Hash[String, Node]
10
10
  add_paths(paths)
11
11
  end
12
12
 
@@ -123,7 +123,7 @@ module Spoom
123
123
  #: -> void
124
124
  def initialize
125
125
  super()
126
- @nodes = T.let([], T::Array[FileTree::Node])
126
+ @nodes = [] #: Array[FileTree::Node]
127
127
  end
128
128
 
129
129
  # @override
@@ -143,7 +143,7 @@ module Spoom
143
143
  def initialize(context)
144
144
  super()
145
145
  @context = context
146
- @strictnesses = T.let({}, T::Hash[Node, T.nilable(String)])
146
+ @strictnesses = {} #: Hash[Node, String?]
147
147
  end
148
148
 
149
149
  # @override
@@ -165,7 +165,7 @@ module Spoom
165
165
  def initialize(context)
166
166
  super
167
167
  @context = context
168
- @scores = T.let({}, T::Hash[Node, Float])
168
+ @scores = {} #: Hash[Node, Float]
169
169
  end
170
170
 
171
171
  # @override
@@ -207,7 +207,7 @@ module Spoom
207
207
  super()
208
208
  @strictnesses = strictnesses
209
209
  @colors = colors
210
- @printer = T.let(Spoom::Printer.new(out: out, colors: colors), Spoom::Printer)
210
+ @printer = Spoom::Printer.new(out: out, colors: colors) #: Spoom::Printer
211
211
  end
212
212
 
213
213
  # @override