Skip to content

N803, N804 and N805 should also ignore methods marked with @override #229

Open
@ivanlonel

Description

@ivanlonel

As pointed out in #215 and #217, overridden method names are out of the dev's control when subclassing an external library.

But that actually extends to the whole method signature. Renaming a method parameter in a subclass breaks LSP, so I believe ignoring it in these cases would avoid inducing the user to a bad practice.

Example using QGIS Python API:

class MyFeedback(QgsProcessingFeedback):
    @override
    def reportError(self, error: str, fatalError: bool = False) -> None:  # noqa: N803
        if fatalError:
            logger.critical(error)
        else:
            logger.error(error)

fatalError is not positional-only, so renaming it to fatal_error would cause an error if the method was called as feedback.reportError("oh no", fatalError=True) somewhere else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions