Support superfluous_disable_command rule with analyzer rules
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Describe the bug
I would like to detect when an analyze rule is wrongly disabled. For example, with below code:
// swiftlint:disable:next unused_import
struct SomeStruct {
}
And below configuration:
analyzer_rules:
- unused_import
only_rules:
- superfluous_disable_command
I would expect swiftlint to raise an error/warning SwiftLint rule 'unused_import' did not trigger a violation in the disabled region. Please remove the disable command. on the line where the disable comment is.
But currently no error/warning is raised. Is there a way to do this? Thanks! 🙏
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the superfluous_disable_command rule handles disabled rules and how analyzer_rules are processed. Use the Swift example and configuration in the issue as the first reproduction. Done means the unused_import disable comment produces the expected warning when analyzer_rules includes unused_import.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100