Skip to content

False positive in unneeded_override #5355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
dalemyers opened this issue Nov 16, 2023 · 0 comments · Fixed by #5356
Closed
2 tasks done

False positive in unneeded_override #5355

dalemyers opened this issue Nov 16, 2023 · 0 comments · Fixed by #5356
Assignees
Labels
bug Unexpected and reproducible misbehavior.

Comments

@dalemyers
Copy link

dalemyers commented Nov 16, 2023

New Issue Checklist

Describe the bug

In the following code, the override is deemed redundant, even though it provides an default parameter:

class Foo {
    func bar(value: String) {
        print(value)
    }
}

class Baz: Foo {
    override func bar(value: String = "Hello") {
        super.bar(value: value)
    }
}
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint test.swift
Linting Swift files at paths test.swift
Linting 'test.swift' (1/1)
[snipped]/test.swift:8:5: warning: Unneeded Overridden Functions Violation: Remove overridden functions that don't do anything except call their super (unneeded_override)
Done linting! Found 1 violation, 0 serious in 1 file.

Environment

  • SwiftLint version: 0.54.0
  • Installation method used: CocoaPods
  • Paste your configuration file: N/A
  • Are you using nested configurations: No
  • Which Xcode version are you using (check xcodebuild -version): Xcode 15.0.1 Build version 15A507
  • Do you have a sample that shows the issue? See above
@SimplyDanny SimplyDanny added the bug Unexpected and reproducible misbehavior. label Nov 16, 2023
@SimplyDanny SimplyDanny self-assigned this Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants