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
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
fix8-0.0.2.tar.gz
(2.5 kB
view hashes)