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

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

Uploaded Source

Built Distribution

fix8-0.1.2-py2.py3-none-any.whl (6.4 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: fix8-0.1.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for fix8-0.1.2.tar.gz
Algorithm Hash digest
SHA256 49ec411d80404e570d2d2bf3105fa609cd4a8ccdb0de1a8be3a0d6fb7de9312f
MD5 399e5aeff4b595f0783fa774af580a77
BLAKE2b-256 e0432925bfb45b6e8326b6ab012e9e86154d47a0992e45ff9d009bd59f78e63b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fix8-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for fix8-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2500c40b6b5a7b314fecad3d21bd4b1b2df224a76ca37fa4f415d847adc19c30
MD5 ad97dab37016d24343c4de39a18e169c
BLAKE2b-256 892398c755efc4d67572160747c189127e78c64c5ad5f3b7a82bb9958c72ceee

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