Giter VIP home page Giter VIP logo

django-pylint's Introduction

pylint-django

Build Status Coverage Status

About

django-pylint is a Pylint plugin for improving code analysis for when analysing code using Django. This package is a currently maintained fork of pylint-django!

Usage

Pylint

Ensure django-pylint is installed and on your path (pip install django-pylint), and then run pylint:

pylint --load-plugins pylint_django [..other options..]

Features

  • Prevents warnings about Django-generated attributes such as Model.objects or Views.request.
  • Prevents warnings when using ForeignKey attributes ("Instance of ForeignKey has no member").
  • Fixes pylint's knowledge of the types of Model and Form field attributes
  • Validates Model.__unicode__ methods.
  • Meta informational classes on forms and models do not generate errors.

Contributing

Please feel free to add your name to the CONTRIBUTORS.md file if you want to be credited when pull requests get merged. You can also add to the CHANGELOG.md file.

Tests

The structure of the test package follows that from pylint itself.

It is fairly simple: create a module starting with func_ followed by a test name, and insert into it some code. The tests will run pylint against these modules. If the idea is that no messages now occur, then that is fine, just check to see if it works by running scripts/test.sh.

Ideally, add some pylint error suppression messages to the file to prevent spurious warnings, since these are all tiny little modules not designed to do anything so there's no need to be perfect.

It is possible to make tests with expected error output, for example, if adding a new message or simply accepting that pylint is supposed to warn. Add a .txt file which should match the name of the test and contains error type, line number, class and expected text. The test code itself should also be annotated with comments on lines which are supposed to trigger pylint messages! See func_model_does_not_use_unicode_py33 for example!

License

django-pylint is available under the GPLv2 license.

django-pylint's People

Contributors

atodorov avatar canarduck avatar carlio avatar coldwings avatar danni avatar dnozay avatar federicobond avatar frost-nzcr4 avatar goldan avatar ixce avatar jakirkham avatar jmaroeder avatar kouk avatar lfrodrigues avatar lhupfeldt avatar mbarrien avatar mbertolacci avatar mikebryant avatar nijel avatar shawnjk avatar smirolo avatar ustun avatar vinaypai avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.