Skip to content

Commit

Permalink
Allow more unused methods to be covered by fixmes
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Apr 22, 2024
1 parent 23587c2 commit 393aec3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/file_scanner_analyzer/unused_symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,14 +287,6 @@ pub(crate) fn find_unused_definitions(

let method_storage = functionlike_storage.method_info.as_ref().unwrap();

if functionlike_storage
.suppressed_issues
.iter()
.any(|(i, _)| i == &IssueKind::UnusedPrivateMethod)
{
continue;
}

// allow one-liner private construct statements that prevent instantiation
if *method_name_ptr == StrId::CONSTRUCT
&& matches!(method_storage.visibility, MemberVisibility::Private)
Expand Down Expand Up @@ -358,6 +350,14 @@ pub(crate) fn find_unused_definitions(
)
};

if functionlike_storage
.suppressed_issues
.iter()
.any(|(i, _)| i == &issue.kind)
{
continue;
}

let file_path = interner.lookup(&pos.file_path.0);

if !config.allow_issue_kind_in_file(&issue.kind, file_path) {
Expand Down
10 changes: 10 additions & 0 deletions tests/unused/UnusedCode/coverByFixme/input.hack
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class A {
/* HAKANA_FIXME[UnusedPublicOrProtectedMethod] */
public function foo(): void {
}
}

<<__EntryPoint>>
function main(): void {
new A();
}

0 comments on commit 393aec3

Please sign in to comment.