Skip to content

new rule - useless @final decorator on private method #24221

@DetachHead

Description

@DetachHead

Summary

Originally raised at astral-sh/ty#3140

Playground

main.py

from typing import final, override


class Foo:
    @final # no error. should say something like "@final decorator is useless on private methods"
    def __foo(self):
        ...

class Bar(Foo):
    @override
    def __foo(self): # correct error: Method `__foo` is decorated with `@override` but does not override anything
        ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-decisionAwaiting a decision from a maintainerruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions