Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
.. -- coding: utf-8 --
.. image:: https://github.com/gforcada/flake8-isort/actions/workflows/tests.yml/badge.svg?branch=master :target: https://github.com/gforcada/flake8-isort/actions/workflows/tests.yml
.. image:: https://coveralls.io/repos/gforcada/flake8-isort/badge.svg?branch=master :target: https://coveralls.io/github/gforcada/flake8-isort?branch=master
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 with pip::
$ pip install flake8-isort
Install with conda::
$ conda install -c conda-forge flake8-isort
If using the select
option from flake8
_ be sure to enable the I
category as well, see below for the specific error codes reported by flake8-isort
.
See flake8 --help
for available flake8-isort options.
+------------+-----------------------------------------------------------+ | 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 | +------------+-----------------------------------------------------------+
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.
GPL 2.0
.. _isort
: https://pypi.python.org/pypi/isort
.. _isort documentation
: https://pycqa.github.io/isort/docs/configuration/options.html
.. _flake8-import-order
: https://pypi.python.org/pypi/flake8-import-order
.. _option from flake8
: http://flake8.pycqa.org/en/latest/user/options.html#cmdoption-flake8-select
FAQs
flake8 plugin that integrates isort
We found that flake8-isort demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.