Giter Site home page Giter Site logo

pedrofreire / flake8-isort Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gforcada/flake8-isort

0.0 0.0 0.0 156 KB

flake8 plugin that integrates isort

Home Page: https://pypi.python.org/pypi/flake8-isort

License: GNU General Public License v2.0

Python 100.00%

flake8-isort's Introduction

https://travis-ci.org/gforcada/flake8-isort.svg?branch=master https://coveralls.io/repos/gforcada/flake8-isort/badge.svg?branch=master&service=github

Flake8 meet isort

Use isort to check if the imports on your python files are sorted the way you expect.

Add an .isort.cfg to define how you want your imports sorted and run flake8 as you usually do.

See isort documentation for .isort.cfg available options.

Install

Install with pip:

$ pip install flake8-isort

Install with conda:

$ conda install -c conda-forge flake8-isort

Options

Config options can be set in several different locations:

  • .isort.cfg
  • .editorconfig
  • an [isort] section in setup.cfg, tox.ini, or .flake8

This potentially avoids to lint a project that has no formal definition of how import should be sorted.

With either --no-isort-config command line switch, or no-isort-config flake8 configuration option it can be disabled.

Since version 2.6 we introduce new --isort-show-traceback option. It is used to show verbose multi-line output from isort. By default it is turned off.

Configuration

If using the select [option from flake8](http://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-select) be sure to enable the I category as well, see below for the specific error codes reported by flake8-isort.

Error codes

Error code Description
I001 isort found an import in the wrong position
I002 no configuration found (.isort.cfg or [isort] in configs)
I003 isort expected 1 blank line in imports, found 0
I004 isort found an unexpected blank line in imports
I005 isort found an unexpected missing import

Requirements

  • Python 2.7, 3.5, 3.6, pypy or pypy3
  • flake8
  • isort

Relation to flake8-import-order

As an alternative to this flake8 plugin, there's flake8-import-order that could be worth checking out. In contrast to this plugin that defers all logic to isort, the flake8-import-order comes bundled with it's own logic.

flake8-import-order comes with a few predefined set of styles meanwhile this plugin can be customized a bit more. But the biggest difference could lie in that flake8-isort actually has the corresponding sorting engine isort that can sort the import orders of your existing python files. Meanwhile flake8-import-order has no such corresponding tool, hence big existing projects who want to adopt either would get a more automized experience choosing flake8-isort.

License

GPL 2.0

flake8-isort's People

Contributors

gforcada avatar cas-- avatar danpalmer avatar jleclanche avatar sobolevn avatar johnhbrock avatar jdufresne avatar plumdog avatar tarrasch avatar carljm avatar blueyed avatar sanjioh avatar sigmavirus24 avatar jaysonsantos avatar mjacksonw avatar marcelotrevisani avatar mattbriancon avatar paltman avatar do3cc avatar sergio-alonso avatar charettes 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.