realm / realm/SwiftLint

The superfluous_disable_command rule should report disabled rules too

Open
#5,715 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

New Issue Checklist
Describe the bug

If you disable a <rule> using the disabled_rules configuration key, but still have // swiftlint:disable <rule> in the code, the superfluous_disable_command rule should still report a warning for them.

I didn't complete the rest of the template, because I think it's more of a logic issue than a rule issue, and it's pretty self explanatory, but let me know if you want me to do that.

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
Environment
  • SwiftLint version (run swiftlint version to be sure)?
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
  • Paste your configuration file:
# insert yaml contents here
  • Are you using nested configurations?
    If so, paste their relative paths and respective contents.
  • Which Xcode version are you using (check xcodebuild -version)?
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
    to quickly test if your example is really demonstrating the issue. If your example is more
    complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.
// This triggers a violation:
let foo = try! bar()

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 at the swiftlint lint entry point and reproduce the superfluous_disable_command behavior with a configuration using disabled_rules and a matching // swiftlint:disable directive. Done means the command reports a warning for the disabled rule; the issue does not name a source file or test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.