A lint framework that writes better Python code for you.
Project description
A lint framework that writes better Python code for you.
Fixit is a lint framework that complements Flake8. It’s based on LibCST which makes it possible to provide auto-fixes. Lint rules are made easy to build through pattern matching, a test toolkit, and utility helpers (e.g. scope analysis) for non-trivial boilerplate. It is optimized for efficiency, easy to customize and comes with many builtin lint rules.
Getting Started
To install Fixit:
pip install fixit
Fixit provides CLI commands. To run built-in Fixit rules on existing code to get code quality suggestions:
python -m fixit.cli.run_rules
To apply autofix on existing code:
python -m fixit.cli.apply_fix
You can learn more about how to configure Fixit, build a lint rule, test a lint rule from our tutorials. Try it out with our notebook examples.
Further Reading
Development
Start by setting up and activating a virtualenv:
git clone git@github.com:Instagram/Fixit.git fixit
cd fixit
python3 -m venv ../fixit-env/ # just an example, put this wherever you want
source ../fixit-env/bin/activate
pip install --upgrade pip # optional, if you have an old system version of pip
pip install -r requirements.txt -r requirements-dev.txt
# If you're done with the virtualenv, you can leave it by running:
deactivate
We use isort and black to format code. To format changes to be conformant, run the following in the root:
tox -e autofix
To run all tests, you’ll need to install tox and do the following in the root: (use py37, py38 to choose from Python version 3.7 or 3.8):
tox -e py38
You can also run individual unit tests by specifying a module like this:
tox -e py38 -- fixit.common.tests.test_report
To run all test cases of a specific rule (e.g. NoInheritFromObjectRule):
tox -e py38 -- fixit.tests.NoInheritFromObjectRule
See the unittest documentation for more examples of how to run tests.
We use Pyre for type-checking. To verify types for the library, do the following in the root:
pyre --preserve-pythonpath check
To generate documentation, do the following in the root:
tox -e docs
License
Fixit is MIT licensed, as found in the LICENSE file.
Privacy Policy and Terms of Use
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 fixit-0.1.4.tar.gz
.
File metadata
- Download URL: fixit-0.1.4.tar.gz
- Upload date:
- Size: 94.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 450281387eebb36fdc6027cdbd14d48a4d4b84134034bd0e50415aaeff272ced |
|
MD5 | c083770c52e3aeef48f2dcab4b49fc1e |
|
BLAKE2b-256 | d53bcc7cb2cc52a16a6e4bbc27b77aaa1d4e99a0613fb9f4bbdbc6892b42b26a |
Provenance
File details
Details for the file fixit-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: fixit-0.1.4-py3-none-any.whl
- Upload date:
- Size: 144.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d4db17b91e562637f78ffcb017e82b02b299863addf9907b57f05fafd45f8c4 |
|
MD5 | 1ebb99827c725e6fbf6ad475f143345e |
|
BLAKE2b-256 | b43745c4f6db02f57b3f6aaabd0719bfe94e624b94806f57aab048b67c2a70c2 |