Plugin to lint various issues in code.
Project description
flake8-jungle
A flake8 plugin to detect bad practices in projects. This plugin is based on flake8-django.
Installation
Install from pip with:
$ pip install flake8-jungle
pre-commit
example
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: ['flake8-jungle==VERSION']
args: ['--max-condition-complexity=8']
List of Rules
Rule | Description | Configuration |
---|---|---|
JG01 |
The order of the model's inner classes, methods, and fields does not follow the Django Style Guide. | |
JG02 |
Do not use exclude attribute in ModelForm , list all items explicitly in fields attribute instead. |
|
JG03 |
Avoid using null=True on string-based fields such as CharField and TextField . |
|
JG04 |
Exceptions should never pass silently, add logging or comment at least. | |
JG05 |
Condition is too complex which makes it impossible to understand. | --max-condition-complexity |
JG06 |
Function is too long. | --max-function-length |
JG07 |
Model is too long, split it into services, selectors, or utilities. | --max-model-length |
JG08 |
Function or method contains local imports, which should be mostly avoided. If you are trying to fix curcular dependency issues, the design probably has some flaws, you should consider refactoring instead. | |
JG09 |
Incorrect logging format, please use the following syntax: logging.info("MESSAGE %(arg1)s", {"arg1": "value1"} ) |
|
JG10 |
Too much patching in tests. Consider changing your design to utilize Dependency Injection and fakes. | --max-patches-in-test |
Testing
flake8-jungle uses pytest for tests. To run them use:
$ poetry install
$ poetry run pytest tests
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flake8-jungle-1.0.1.tar.gz
(10.0 kB
view hashes)
Built Distribution
Close
Hashes for flake8_jungle-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a4af0032aa6b46888439004217e238c582d905d8382e895071464fa7958ebe1 |
|
MD5 | 11bafa26e7df8a72cf1e1cbeaf0501e4 |
|
BLAKE2b-256 | 0c2c3bc304e6ffd29f4ef6927307b451b88f6e434ea2e10c6fb0efb5a424b83e |