flake8-warnings-0.4.0
توضیحات
Linter (flake8, pylint, custom CLI) for finding usage of deprecated functions.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | flake8-warnings-0.4.0 |
| نام | flake8-warnings |
| نسخه کتابخانه | 0.4.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | Gram <gram@orsinium.dev> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/flake8-warnings/ |
| مجوز | - |
# flake8-warnings
Python linter that warns you about using deprecated modules, classes, and functions. It provides a CLI as well as [flake8][flake8] and [pylint][pylint] plugins.
## Usage
Installation:
```bash
python3 -m pip install flake8-warnings
```
Now, you can use it in one of the following ways:
1. Directly from CLI: `python3 -m flake8_warnings ./my_project/`
1. As a [flake8][flake8] plugin. Just run `flake8 ./my_project/`, it will automatically detect the plugin.
1. As a [pylint][pylint] plugin. For pylint, plugins must be explicitly specified: `pylint --load-plugins=flake8_warnings ./my_project/`.
[flake8]: https://flake8.pycqa.org/en/latest/
[pylint]: https://pylint.org/
## How it works
It analyzes all imported modules, classes and functions and detects the following:
1. [warnings.warn](https://docs.python.org/3/library/warnings.html#warnings.warn) function calls.
1. Deprecation decorators like [deprecated](https://github.com/tantale/deprecated) or [deprecation](https://github.com/briancurtin/deprecation).
1. Deprecation messages in docstrings.
1. Stdlib modules deprecated by [PEP 594](https://peps.python.org/pep-0594/).
## Error codes
The tool provides a different error code for each [warning category](https://docs.python.org/3/library/warnings.html#warning-categories):
+ 01: Warning
+ 02: UserWarning
+ 03: DeprecationWarning
+ 04: SyntaxWarning
+ 05: RuntimeWarning
+ 06: FutureWarning
+ 07: PendingDeprecationWarning
+ 08: ImportWarning
+ 09: UnicodeWarning
+ 10: BytesWarning
+ 11: ResourceWarning
This is how they are used in different linters:
+ In flake8, the code prefix is `WS0`, so `DeprecationWarning` will be reported as `WS003`.
+ In pylint, the prefix is `W99`, so `DeprecationWarning` will be reported as `W9903`. The "message-symbol" is the warning category. So, if you want to ignore an error about `DeprecationWarning`, add `# pylint: disable=DeprecationWarning` to this line.
+ If you use CLI, the warning category will be shown you directly, without any obscure codes.
In all cases, the error message is the detected warning message.
## License
1. flake8-wranings is licensed under [MIT License](./LICENSE). On practice, I don't care how you're going to use it. i did the project because it is fun, not because I want to be famous or whatever.
1. [astroid](https://github.com/PyCQA/astroid) is a direct runtime dependency of flake8-warning and it is licensed under [LGPL-2.1 License](https://github.com/PyCQA/astroid/blob/main/LICENSE). It allows commercial and private usage, distribution and whatever, don't confuse it with GPL. However, if your legal department is still nervous, just don't make flake8-warnings a production dependency (why would you?), use it only on dev and test environments.
نیازمندی
| مقدار | نام |
|---|---|
| - | astroid |
| - | flake8-length |
| - | mypy |
| - | isort |
| - | pytest |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl flake8-warnings-0.4.0:
pip install flake8-warnings-0.4.0.whl
نصب پکیج tar.gz flake8-warnings-0.4.0:
pip install flake8-warnings-0.4.0.tar.gz