Skip to content

Stop redundant_final from reporting final class members - #6992

Open
nu11waredev wants to merge 1 commit into
realm:mainfrom
nu11waredev:fix-redundant-final-class-members
Open

nu11waredev wants to merge 1 commit into
realm:mainfrom
nu11waredev:fix-redundant-final-class-members

Conversation

@nu11waredev

Copy link
Copy Markdown
Contributor

Fixes #6936.

In a final class, non_overridable_class_declaration reports a class member and corrects it to final class by default. redundant_final then reports that final and removes it, so the two rules undo each other and --fix never settles:

public final class HogeView: UIView {
    override public final class var layerClass: AnyClass { AVCaptureVideoPreviewLayer.self }
}

redundant_final now leaves members with the class modifier alone. For them final class means the same as static, and removing final leaves a declaration the other rule reports.

In a final class, `non_overridable_class_declaration` asks for `final class`
on type members, and `redundant_final` then reported that `final` and removed
it again. Members with the `class` modifier are no longer reported.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@SwiftLintBot

Copy link
Copy Markdown
21 Messages
📖 Building this branch resulted in the same binary size as when built on main.
📖 Linting Aerial with this PR took 0.1 s vs 0.1 s on main (0% slower).
📖 Linting Alamofire with this PR took 0.11 s vs 0.11 s on main (0% slower).
📖 Linting Brave with this PR took 0.37 s vs 0.36 s on main (2% slower).
📖 Linting Brigade with this PR took 18.66 s vs 18.55 s on main (0% slower).
📖 Linting DuckDuckGo with this PR took 2.27 s vs 2.25 s on main (0% slower).
📖 Linting Firefox with this PR took 0.76 s vs 0.75 s on main (1% slower).
📖 Linting Kickstarter with this PR took 0.42 s vs 0.43 s on main (2% faster).
📖 Linting Moya with this PR took 0.09 s vs 0.09 s on main (0% slower).
📖 Linting NetNewsWire with this PR took 0.2 s vs 0.19 s on main (5% slower).
📖 Linting Nimble with this PR took 0.09 s vs 0.09 s on main (0% slower).
📖 Linting PocketCasts with this PR took 0.48 s vs 0.5 s on main (4% faster).
📖 Linting Quick with this PR took 0.09 s vs 0.09 s on main (0% slower).
📖 Linting Realm with this PR took 0.2 s vs 0.19 s on main (5% slower).
📖 Linting Sourcery with this PR took 0.14 s vs 0.14 s on main (0% slower).
📖 Linting Swift with this PR took 0.22 s vs 0.21 s on main (4% slower).
📖 Linting SwiftLintPerformanceTests with this PR took 3.78 s vs 3.78 s on main (0% slower).
📖 Linting VLC with this PR took 0.18 s vs 0.18 s on main (0% slower).
📖 Linting Wire with this PR took 0.77 s vs 0.77 s on main (0% slower).
📖 Linting WordPress with this PR took 0.58 s vs 0.58 s on main (0% slower).
📖 This PR fixed a violation in Swift: /stdlib/public/core/KeyPath.swift:1437:12: Warning: final is redundant (redundant_final)

Generated by 🚫 Danger

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conflicts on non_overridable_class_declaration and redundant_final

2 participants