realm / realm/SwiftLint

Support superfluous_disable_command rule with analyzer rules

Open
#3,765 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

New Issue Checklist
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.