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. (If doing so would create a blank line at the start of the file then the next line is also removed).
  • C812, C813, C814, C815, C816: Trailing commas are added
  • FA100: Future annotation imports are added.
  • LBL001: Leading blank lines are removed.

Install

pip install fix8

Configuration

Fix8 will only fix issues that flake8 finds, so your existing flake8 configuration (including which plugins you have installed) will determine what gets fixed.

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.1.8.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

fix8-0.1.8-py2.py3-none-any.whl (7.3 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: fix8-0.1.8.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for fix8-0.1.8.tar.gz
Algorithm Hash digest
SHA256 3e5a7b813be781cc937b2771866217d66efa12521d0405e0dcfdf7c597fb6fea
MD5 0fbe57d61b10003cd846cbe852f941d2
BLAKE2b-256 cdc676b61ab7f5fc84ea5898e7ef4266810b4fc5021e729115ae3abbb9ed516b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fix8-0.1.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for fix8-0.1.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 96aee86f1d8c3c42d8cd3124e3e33d9d1803011d4ccc633e11c8ce5215c2da87
MD5 733873be4dd68c57f6b94c7bd58f3c1a
BLAKE2b-256 3b503383e25dee047b0566fc0fa6d6beb1c91df9889c3cf602b1faa9ba03cf08

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