Skip to content

blablatdinov/flake8-final

Repository files navigation

flake8-final

test codecov Python Version wemake-python-styleguide

Background

Implementation inheritance can lead to brittle and hard-to-maintain code. By enforcing the use of the @final decorator, this plugin aims to encourage composition over inheritance, promoting better software design principles.

yegor256 blog post

Installation

To install flake8-final, you can use pip:

pip install flake8-final

Usage

After installing the plugin, flake8 will automatically use it when you run the following command:

flake8 your_project_directory

The plugin will check each class definition to ensure it has a @final decorator. If a class is missing the @final decorator, an error will be reported.

Example

Given the following Python code:

class MyClass:
    pass

Running flake8 will produce the following error:

your_file.py:1:1: FIN100 class must be final

Adding the @final decorator will resolve the error:

from typing import final

@final
class MyClass:
    pass

License

MIT

Credits

This project was generated with wemake-python-package. Current template version is: 9899cb192f754a566da703614227e6d63227b933. See what is updated since then.

About

Implementation inheritance can lead to brittle and hard-to-maintain code. By enforcing the use of the "typing.final" decorator, this plugin aims to encourage composition over inheritance, promoting better software design principles.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors