Skip to content

Commit

Permalink
TMP: ignore thor commands
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Terrasa <[email protected]>
  • Loading branch information
Morriar committed Jun 13, 2024
1 parent 7a4da36 commit 13b12b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 0 additions & 3 deletions lib/spoom/deadcode/plugins/thor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ class Thor < Base

sig { override.params(symbol_def: Model::Method, definition: Definition).void }
def on_define_method(symbol_def, definition)
# TODO?
# return if indexer.nesting_block # method defined in `no_commands do ... end`, we don't want to ignore it

owner = symbol_def.owner
return unless owner.is_a?(Model::Class)

Expand Down
8 changes: 4 additions & 4 deletions test/spoom/deadcode/plugins/thor_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ class ThorTest < TestWithProject
def test_ignore_thor_commands
@project.write!("foo.rb", <<~RB)
class Foo < Thor
def ignored; end
def ignored1; end
no_commands do
def dead; end
def ignored2; end
end
end
Expand All @@ -26,8 +26,8 @@ class Bar; end
index = index_with_plugins
refute_ignored(index, "Foo")
refute_ignored(index, "Bar")
assert_ignored(index, "ignored")
refute_ignored(index, "dead")
assert_ignored(index, "ignored1")
assert_ignored(index, "ignored2")
end

def test_ignore_thor_methods
Expand Down

0 comments on commit 13b12b6

Please sign in to comment.