Automatic fix for Python linting issues found by Flake8
Project description
Fix8
Automatic fix for Python linting issues found by Flake8.
Fixes
F401
: Unused imports are removedC812
,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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fix8-0.1.3.tar.gz
.
File metadata
- Download URL: fix8-0.1.3.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39822cf31e00b48ceaad8798d9bfb749b4dcd51b186b0768cfc0ef4c550e5d4c |
|
MD5 | 5d453165eb372c3ae6abdaa23dc8507a |
|
BLAKE2b-256 | 432fdbd140fdc5f455c22e4fa5a0fb98f9c74591a109c8843dc1e2e7f081525b |
File details
Details for the file fix8-0.1.3-py2.py3-none-any.whl
.
File metadata
- Download URL: fix8-0.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d222c00e7730f7c5da3c965ceedb7c45459bbd09e0f7f1cc23163d72c007ba0 |
|
MD5 | 97ab4dd4f67538f414bb5aa12e1d6f74 |
|
BLAKE2b-256 | e9917df9859476ba9241dd2189a3770f53523aec2b27f4d8540e86a48216b65b |