Skip to main content

flake8-drf

Flake8 plugin that detects some issues with your drf code. Work in progress. Currently detects places where you should use drf status constants.

Installation

pip install flake8-drf

Usage

Let's say we have the following code below:

from rest_framework import views
from rest_framework.views import Response, APIView


class AuthView(APIView):

    def get(self, request):
        return Response(status=200)


class PostsView(views.APIView, APIView):

    def post(self, request):
        return Response(status=201)

Running flake8 with the plugin will tell the following:

main.py:8:25: DRF0 Status code can be changed to constant: HTTP_200_OK
main.py:14:25: DRF0 Status code can be changed to constant: HTTP_201_CREATED

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8-drf-0.1.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flake8_drf-0.1.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file flake8-drf-0.1.0.tar.gz.

File metadata

  • Download URL: flake8-drf-0.1.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.7.6 Darwin/21.3.0

File hashes

Hashes for flake8-drf-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4ee75f80bb654e12a4510d652acdca0fc8b2399e1ea7c81bd0bd7b1629519098
MD5 5cc849528efd579697632b66b1455a28
BLAKE2b-256 5daa108de5537bdea79542d9dc4f6c8f3473b603d7d00d5fc3f850883b5e41d1

See more details on using hashes here.

File details

Details for the file flake8_drf-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: flake8_drf-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0 CPython/3.7.6 Darwin/21.3.0

File hashes

Hashes for flake8_drf-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cea18c898b5aad470b56685f78a4e5eb3b476086600179e7ed5ab8f8bd1f8952
MD5 97b83f7ccb2233de62e5e7be3859eb22
BLAKE2b-256 ae2aaefa5d579f75ef0724489b641d9b1437507346257d622e29ebb6e8029bc3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page