Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MartinThoma/flake8-scream
❄️🙀 Flake8 plugin that contains rules which do have known false-positives - it might still be useful for a one-time run
https://github.com/MartinThoma/flake8-scream
flake8 flake8-plugin python
Last synced: 2 months ago
JSON representation
❄️🙀 Flake8 plugin that contains rules which do have known false-positives - it might still be useful for a one-time run
- Host: GitHub
- URL: https://github.com/MartinThoma/flake8-scream
- Owner: MartinThoma
- License: mit
- Created: 2022-03-26T10:40:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-19T14:50:40.000Z (about 2 years ago)
- Last Synced: 2024-11-08T23:25:01.006Z (2 months ago)
- Topics: flake8, flake8-plugin, python
- Language: Python
- Homepage:
- Size: 28.3 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-flake8-extensions - flake8-scream - Rules which do have known false-positives but might still be useful for a one-time run. (Clean code)
README
[![PyPI version](https://badge.fury.io/py/flake8-scream.svg)](https://badge.fury.io/py/flake8-scream)
[![Code on Github](https://img.shields.io/badge/Code-GitHub-brightgreen)](https://github.com/MartinThoma/flake8-scream)
[![Actions Status](https://github.com/MartinThoma/flake8-scream/workflows/Unit%20Tests/badge.svg)](https://github.com/MartinThoma/flake8-scream/actions)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)# flake8-scream
A [flake8](https://flake8.pycqa.org/en/latest/index.html) plugin that helps you scream your code.
## Rules
* [`SCR119`](https://github.com/MartinThoma/flake8-simplify/issues/37) ![](https://shields.io/badge/-legacyfix-inactive): Use dataclasses for data containers ([example](#SCR119))
* [`SCR902`](https://github.com/MartinThoma/flake8-simplify/issues/125): Use keyword-argument instead of magic boolean ([example](#SCR902))
* `SCR903`: Use keyword-argument instead of magic number ([example](#SCR903))## Disabling Rules
You might have good reasons to
[ignore some flake8 rules](https://flake8.pycqa.org/en/3.1.1/user/ignoring-errors.html).
To do that, use the standard Flake8 configuration. For example, within the `setup.cfg` file:```python
[flake8]
ignore = SCR106, SCR113, SCR119, SCR9
```## Examples
### SCR119
Dataclasses were introduced with [PEP 557](https://www.python.org/dev/peps/pep-0557/)
in Python 3.7. The main reason not to use dataclasses is to support legacy Python versions.Dataclasses create a lot of the boilerplate code for you:
* `__init__`
* `__eq__`
* `__hash__`
* `__str__`
* `__repr__`A lot of projects use them:
* [black](https://github.com/psf/black/blob/master/src/black/__init__.py#L1472)
### SCR902
```python
# Bad
foo(False)
bar(True)# Good
foo(verbose=False)
bar(enable_magic=True)
```The false-positives that are currentl not possible to fix are in positional-only
arguments. There is no way to determine in the AST given by Flake8 if a function
has positional-only arguments.### SCR903
```python
# Bad
foo(42, 1.234)# Good
foo(the_answer=42, flux_compensation=1.234)
```The false-positives that are currentl not possible to fix are in positional-only
arguments. There is no way to determine in the AST given by Flake8 if a function
has positional-only arguments.