realm / realm/SwiftLint

False positive on `attributes` rule

Open
#4,596 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

New Issue Checklist
Describe the bug

When we add a comment between the attribute and the variable, it triggers the attributes rule.

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
Environment
  • SwiftLint version (run swiftlint version to be sure)?
    0.50.1
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    Homebrew
  • Paste your configuration file:
opt_in_rules:
  - attributes
  • Are you using nested configurations?
    No
  • Which Xcode version are you using (check xcodebuild -version)?
    Build version 14B47b
  • 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.
extension Property {
    @available(*, unavailable, renamed: "isOptional")
    // Hello world
    public var optional: Bool { fatalError() }
}

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

Reproduce the report with swiftlint lint --no-cache --use-stdin --enable-all-rules using the provided Swift extension, attribute, comment, and variable. Start by locating the attributes rule and its handling of comments; done means the comment no longer causes a violation for this example, with the behavior verified through the relevant rule checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.