A flake8 extension to validate django models ForeignKey fields on on_delete CASCADE comment
Project description
flake8-django-on-delete-comment
A flake8 extension to validate django models ForeignKey fields on on_delete CASCADE comment.
test_field = models.ForeignKey( # allowed_cascade
'TestModel',
on_delete=models.CASCADE,
)
CASCADE can be not safe to choose, so such fields should be marked by comment.
Installation
pip install flake8-django-on-delete-comment
Example
Sample file:
# test.py
first_field = models.ForeignKey( # allowed_cascade
'FirstModel',
on_delete=models.CASCADE,
)
second_field = models.ForeignKey(
'SecondModel',
on_delete=models.CASCADE,
)
third_field = models.ForeignKey(
'ThirdModel',
on_delete=models.PROTECT,
)
Usage:
$ flake8 test.py
test.py:6:1: CD001 field needs a valid comment for on_delete
Contributing
We would love you to contribute to our project. It's simple:
- Create an issue with bug you found or proposal you have. Wait for approve from maintainer.
- Create a pull request. Make sure all checks are green.
- Fix review comments if any.
- Be awesome.
Here are useful tips:
- You can run all checks and tests with
make check. Please do it before CI does. - We use BestDoctor python styleguide.
- We respect Django CoC. Make soft, not bullshit.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flake8_django_on_delete_comment-0.0.3.tar.gz.
File metadata
- Download URL: flake8_django_on_delete_comment-0.0.3.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a47c667f9189421023ac873ec0b3cba12b06a4a28f6979615ab334f12e356a05
|
|
| MD5 |
b8e5fca5a693d57951665ec48f7cfdfc
|
|
| BLAKE2b-256 |
f6e1ff11d749c738e70e97f834f5cd05cd9f244471269808d29994520782f01d
|
File details
Details for the file flake8_django_on_delete_comment-0.0.3-py3-none-any.whl.
File metadata
- Download URL: flake8_django_on_delete_comment-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2643086ef01320bb3e6a37f25e2b93eb31d910db73ae9c3808a64cfa3016b190
|
|
| MD5 |
9ad1b60e32cffd30b870d0bb13bc0de0
|
|
| BLAKE2b-256 |
42482e4d36d83cd47f81e8ee8d3e468c540bd5b55b5fdaf5c9703838a904a8ad
|