-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
bugUnexpected and reproducible misbehavior.Unexpected and reproducible misbehavior.good first issueIssue to be taken up by new contributors yet unfamiliar with the project.Issue to be taken up by new contributors yet unfamiliar with the project.
Description
New Issue Checklist
- I've Updated SwiftLint to the latest version.
- I've searched for existing GitHub issues.
Bug Description
async_without_await, unneeded_throws_rethrows "false positive" triggers when function has override.
class A {
func test() async {
try? await Task.sleep(for: .seconds(0.5))
print("A")
}
}
class B: A {
override func test() async {
print("B")
}
}
Task {
let b = B()
await b.test()
}The following code produces B as output, but when the rule is enabled, it suggests to replace to:
class B: A {
func test() {
print("B")
}
}
as a result, the output will be A, because it doesn't override the original function. So the rule breaks the logic.
The same happens for throws in unneeded_throws_rethrows rule.
I would suggest excluding the warning for functions that have override
$ swiftlint lintEnvironment
- SwiftLint version: 0.63.0
- Xcode version: 26.0.1
- Installation method used: Universal macOS Binary
- Configuration file:
only_rules:
- async_without_await
- unneeded_throws_rethrowsAre you using nested configurations? If so, paste their
relative paths and respective contents.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugUnexpected and reproducible misbehavior.Unexpected and reproducible misbehavior.good first issueIssue to be taken up by new contributors yet unfamiliar with the project.Issue to be taken up by new contributors yet unfamiliar with the project.