Skip to content

Add RemoveUnusedLabels recipe (RSPEC-S1065)#835

Open
timtebeek wants to merge 3 commits intomainfrom
tim/remove-unused-labels
Open

Add RemoveUnusedLabels recipe (RSPEC-S1065)#835
timtebeek wants to merge 3 commits intomainfrom
tim/remove-unused-labels

Conversation

@timtebeek
Copy link
Copy Markdown
Member

Summary

Implements OpenRewrite recipe for SonarQube rule S1065 — removes unused labels that are not referenced by any break or continue statement. Preserves the labeled statement with the label removed.

Changes

  • New recipe class RemoveUnusedLabels with visitor that scans label subtrees for references
  • Comprehensive test suite with 6 test cases covering loops, blocks, used/unused labels, and nested scenarios
  • Registered in CodeCleanup recipe collection

All tests pass.

Remove labels that are not referenced by any break or continue statement. The labeled statement is preserved, with the label removed.

Includes 6 test cases covering unused labels on loops and blocks, labels referenced by break/continue, and partial removal in nested label scenarios.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant