Skip to main content

Automatic fix for Python linting issues found by Flake8

Project description

Fix8

CircleCI

Automatic fix for Python linting issues found by Flake8.

Fixes

  • F401: Unused imports are removed
  • C812, C813, C814, C815, C816: Trailing commas are added

Install

pip install fix8

Usage

fix8 wraps flake8, so takes the same arguments. The easist way to use it is to pass the files or directories you want fixed directly to it:

fix8 project/ that.py this.py

Wrappers

If you have a large project you may want to wrap it, something like this:

fix8-local() {
    git diff --name-only --diff-filter=d | grep '\.py$' | sort --unique | xargs --no-run-if-empty fix8
}

This can be paired with isort to do both fixes with a single command:

# Put these functions in your `.bashrc` or similar
run-py-local() {
    git diff --name-only --diff-filter=d | grep '\.py$' | sort --unique | xargs --no-run-if-empty "$@"
}

fix8-local() {
    run-py-local fix8 && run-py-local isort
}

# Usage is then just this, but will detect and fix any changes that might need fixing
$ fix8-local

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

fix8-0.0.2.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

fix8-0.0.2-py2.py3-none-any.whl (2.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fix8-0.0.2.tar.gz.

File metadata

  • Download URL: fix8-0.0.2.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.5.10

File hashes

Hashes for fix8-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d04798c67611ba0e781854c13702f6a5affaee0b9cfbc63bce1f186ca7df89b3
MD5 7b6a3ae364f6741fdc7695e123e4f7da
BLAKE2b-256 618e9eddefacd89493f1ec50db7393a15137ccd1e19e42a95665fd8d2464a988

See more details on using hashes here.

File details

Details for the file fix8-0.0.2-py2.py3-none-any.whl.

File metadata

  • Download URL: fix8-0.0.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.5.10

File hashes

Hashes for fix8-0.0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 80ffda40d339544dd7193d3a77c2fc9cf60023dced0ce25eec1ae1c034bfdec6
MD5 06a7c30ffb1aeb7717a70e77d8bd2b46
BLAKE2b-256 bc918d63ea7806e8591817c9f67cc792eacd0e2d864f03f49474b891087ab7fe

See more details on using hashes here.

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