False positive on `attributes` rule
Open
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
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
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 versionto 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 useswiftlint lint --path [file here] --no-cache --enable-all-rules.
extension Property {
@available(*, unavailable, renamed: "isOptional")
// Hello world
public var optional: Bool { fatalError() }
}
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
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