Skip to main content

No project description provided

Project description

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

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-drf-0.1.0.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page