Skip to main content

flake8-django-on-delete-comment

Build Status Maintainability Test Coverage

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:

  1. Create an issue with bug you found or proposal you have. Wait for approve from maintainer.
  2. Create a pull request. Make sure all checks are green.
  3. Fix review comments if any.
  4. Be awesome.

Here are useful tips:

Metadata

Release files for flake8-django-on-delete-comment 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-django-on-delete-comment 0.0.3
File Size Uploaded Provenance Actions
flake8_django_on_delete_comment-0.0.3.tar.gz 4.5 kB Without provenance Details for flake8_django_on_delete_comment-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flake8-django-on-delete-comment 0.0.3
File Interpreter ABI Platform Actions
flake8_django_on_delete_comment-0.0.3-py3-none-any.whl Python 3 none any Details for flake8_django_on_delete_comment-0.0.3-py3-none-any.whl

Total release size: 9.6 kB

Release files / flake8_django_on_delete_comment-0.0.3.tar.gz

Download URL flake8_django_on_delete_comment-0.0.3.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a47c667f9189421023ac873ec0b3cba12b06a4a28f6979615ab334f12e356a05
BLAKE2b-256 checksum
How to use checksums
f6e1ff11d749c738e70e97f834f5cd05cd9f244471269808d29994520782f01d
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / flake8_django_on_delete_comment-0.0.3-py3-none-any.whl

Download URL flake8_django_on_delete_comment-0.0.3-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2643086ef01320bb3e6a37f25e2b93eb31d910db73ae9c3808a64cfa3016b190
BLAKE2b-256 checksum
How to use checksums
42482e4d36d83cd47f81e8ee8d3e468c540bd5b55b5fdaf5c9703838a904a8ad
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for flake8-django-on-delete-comment 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page