Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flake8-django

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flake8-django

Plugin to catch bad style specific to Django Projects.

  • 1.4
  • PyPI
  • Socket score

Maintainers
1

flake8-django

pypi CICodecov Downloads

A flake8 plugin to detect bad practices on Django projects.

Installation

Install from pip with:

$ pip install flake8-django

Testing

flake8-django uses pytest for tests. To run them use:

$ pytest

Run coverage report using:

$ pytest --cov=.

List of Rules

RuleDescription
DJ01Avoid using null=True on string-based fields such as CharField and TextField
DJ03Avoid passing locals() as context to a render function
DJ06Do not use exclude with ModelForm, use fields instead
DJ07Do not use __all__ with ModelForm, use fields instead
DJ08Model does not define __str__ method
DJ12Order of Model's inner classes, methods, and fields does not follow the Django Style Guide
DJ13@receiver decorator must be on top of all the other decorators

More details about each of the Rules can be found on the wiki page.

Optional Rules - Disabled by Default

RuleDescription
DJ10Model should define verbose_name on its Meta inner class
DJ11Model should define verbose_name_plural on its Meta inner class

To enable optional rules you can use the --select parameter. It's default values are: E,F,W,C90.

For example, if you wanted to enable DJ10, you could call flake8 in the following way:

flake8 --select=E,F,W,C90,DJ,DJ10

You could also add it to your configuration file:

[flake8]
max-line-length = 120
...
select = C,E,F,W,DJ,DJ10

Licence

GPL

Thanks

@stummjr for teaching me AST, and what I could do with it. His blog is cool.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc