Skip to content

False positive triggers for async_without_await, unneeded_throws_rethrows with override functions #6416

Closed

Description

@akuzminskyi

New Issue Checklist

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 lint

Environment

  • 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_rethrows

Are you using nested configurations? If so, paste their
relative paths and respective contents.

Activity

  1. SimplyDanny commented on Jan 6, 2026

    @SimplyDanny
    Collaborator

    For throws that's not a problem. Overriding function can omit the throws if the function doesn't actually throw. But you're right for async. It cannot be left out.

  2. added
    bug
    good first issue
    on Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

buggood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions