`prefer_self_in_static_references` doesn't report violations in extensions
Open
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
- I've Updated SwiftLint to the latest version.
- I've searched for existing GitHub issues.
Bug Description
prefer_self_in_static_references doesn't report violations in extensions
struct Example {
var value = 1
}
extension Example {
static func example() -> Example { // no violation reported here
.init()
}
}
$ swiftlint lint --quiet --only-rule prefer_self_in_static_references Sources
Environment
- SwiftLint version: 0.65.0
- Xcode version: Xcode 26.6 / Build version 17F113
- Installation method: Homebrew
- Configuration file: occurs even if no config file
Are you using nested configurations? No
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 running the provided swiftlint lint command against the Swift extension example with only prefer_self_in_static_references enabled. Trace how that rule handles static references in extensions, then verify that the .init() call is reported as a violation while the existing behavior remains intact.
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
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100