Metadata-Version: 2.1
Name: flake8-one-class
Version: 0.0.1
Summary: flake8 plugin for check and inheritance of implementations
Home-page: https://github.com/blablatdinov/flake8-one-class
License: MIT
Author: Almaz Ilaletdinov
Author-email: a.ilaletdinov@yandex.ru
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: flake8 (>=7.1,<8.0)
Project-URL: Repository, https://github.com/blablatdinov/flake8-one-class
Description-Content-Type: text/markdown

<!---
The MIT License (MIT)

Copyright (c) 2024 Almaz Ilaletdinov <a.ilaletdniov@yandex.ru>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.
--->

# flake8-one-class

[![test](https://github.com/blablatdinov/flake8-one-class/actions/workflows/test.yml/badge.svg)](https://github.com/blablatdinov/flake8-one-class/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/blablatdinov/flake8-one-class/branch/master/graph/badge.svg)](https://codecov.io/gh/blablatdinov/flake8-one-class)
[![Python Version](https://img.shields.io/pypi/pyversions/flake8-one-class.svg)](https://pypi.org/project/flake8-one-class/)
[![wemake-python-styleguide](https://img.shields.io/badge/style-wemake-000000.svg)](https://github.com/wemake-services/wemake-python-styleguide)

## Background

In Python modules, having multiple classes in a single file can often indicate overly complex code or an unclear separation of concerns. The flake8-one-class plugin enforces a single public class per module to encourage modular and maintainable code design. Private (internal) classes are allowed but are intended for module-level encapsulation only.

## Installation

Install flake8-one-class using pip:

```
pip install flake8-one-class
```

## Usage

After installation, flake8-one-class will automatically run with flake8:

```
flake8 your_project_directory
```

This plugin checks each module for multiple public class definitions. If more than one public class is detected, an error is raised.

## Example

Given the following Python code:

```python
class Animal:
    pass

class Plant:
    pass
```

Running flake8 will produce the following error:

```
your_file.py:1:1: FOC100 found module with more than one public class
```

Using only one public class in the module will resolve the error:

```python
class Animal:
    pass

class _Helper:  # private class is allowed
    pass
```


## License

[MIT](https://github.com/blablatdinov/flake8-one-class/blob/master/LICENSE)


## Credits

This project was generated with [`wemake-python-package`](https://github.com/wemake-services/wemake-python-package). Current template version is: [9899cb192f754a566da703614227e6d63227b933](https://github.com/wemake-services/wemake-python-package/tree/9899cb192f754a566da703614227e6d63227b933). See what is [updated](https://github.com/wemake-services/wemake-python-package/compare/9899cb192f754a566da703614227e6d63227b933...master) since then.

