Skip to content

Conversation

@ep0chzer0
Copy link

Summary

  • Implements issue warn when slither-disable comment is no longer necessary #1680: Warn when slither-disable comment is no longer necessary
  • Adds --warn-unused-ignores CLI flag to detect and report slither-disable comments that do not suppress any findings
  • Helps maintain clean codebases by identifying stale or unnecessary ignore comments

Implementation Details

  • Added tracking infrastructure in SlitherCore for all ignore comments found during parsing
  • Track which ignore comments are actually used when suppressing detector findings
  • Report unused ignore comments via logger.warning() when the flag is enabled

The implementation handles:

  • slither-disable-next-line comments
  • slither-disable-start/end block comments
  • Multiple detectors on the same comment (comma-separated)
  • The all keyword
  • Empty detector lists (filtered out)
  • Whitespace in detector lists (properly stripped)

Test plan

  • Added unit tests for unused ignore detection
  • Tests for empty detector list handling
  • Tests for whitespace handling
  • Tests for the all keyword

Closes #1680

…r-disable comments

Implements issue crytic#1680 - Warn when slither-disable comment is no longer necessary.

This feature adds the ability to detect and report slither-disable comments that
do not actually suppress any findings, helping maintain clean codebases.

Changes:
- Add tracking infrastructure in SlitherCore for all ignore comments
- Track which ignore comments are actually used when suppressing findings
- Add --warn-unused-ignores CLI flag to enable warning output
- Report unused ignore comments via logger.warning()
- Add unit tests for the feature

The implementation handles:
- slither-disable-next-line comments
- slither-disable-start/end block comments
- Multiple detectors on the same comment
- The "all" keyword
- Empty detector lists (filtered out)
- Whitespace in detector lists (stripped)

Closes crytic#1680
@ep0chzer0 ep0chzer0 requested a review from smonicas as a code owner January 17, 2026 00:14
@ep0chzer0
Copy link
Author

Implements #1680. Adds --warn-unused-ignores flag that reports slither-disable comments not suppressing any findings. Let me know if you'd like any changes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

warn when slither-disable comment is no longer necessary

1 participant