Skip to content

checks: missing-nonce / missing-event-for-admin-change / unprotected-* unit tests never assert function_name or line #532

Description

@unrealtim-tech

Labels: bug, checks-crate
Crate: checks

Description
Several checks' unit tests assert only findings.len() and never the finding's function_name or line, so a regression in which method is flagged (or where the finding is anchored — see the method.span() vs fn_token.span() issue) passes silently:

  • crates/checks/src/missing_nonce.rsflags_missing_nonce / ignores_with_nonce
  • crates/checks/src/missing_event_for_admin_change.rsflags_missing_event
  • crates/checks/src/unprotected_token_mint.rsflags_unprotected_mint
  • crates/checks/src/unprotected_contract_deployment.rsflags_unprotected_deployer
  • crates/checks/src/large_loop.rsflags_loop / flags_while

By contrast auth.rs, admin.rs, transfer.rs assert hits[0].function_name / severity.

Acceptance Criteria

  • Add assert_eq!(hits[0].function_name, "<expected>") (and a line assertion where the fixture makes it meaningful) to the listed tests.

Difficulty: beginner

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions