`unused_setter_value` incorrectly gets triggered for an empty setter
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
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Describe the bug
The following code gets reported as a vioation of the unused_setter_value rule, even though it was one of the examples explicitly cited as being non-offending.
override var aValue: String {
get {
return Persister.shared.aValue
}
set() { }
There might be a meta-issue here, about why the example didn't cause a test failure.
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
Environment
-
SwiftLint version:
0.46.3 -
Installation method used: Homebrew
-
Which Xcode version are you using (check
xcodebuild -version)?Xcode 13.2.1 Build version 13C100 -
Do you have a sample that shows the issue? Yes:
echo 'private var abc: Int { get { 123 } set() { } }' | swiftlint lint --no-cache --use-stdin --enable-all-rules`
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 reproducing the unused_setter_value report with swiftlint lint --no-cache --use-stdin --enable-all-rules and the empty-setter sample. Trace the unused_setter_value rule and its existing examples or tests, then confirm that the empty setter no longer produces a violation while other offending cases still do.
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
- Clearly specified
- Newbie friendliness
- 38/100