Coder Social home page Coder Social logo

amyreese / fixit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from instagram/fixit

1.0 1.0 0.0 799 KB

Fixit is a Python Lint Framework based on LibCST. It comes with useful default lint rules for coding convention, performance and security issues. It makes custom lint rule easy to build, test and configure. It empowers lint rule to provide autofix to fix the issues for developers. It also provide tools to run autofix across codebase to fix existing issues and automatically insert lint-fixme comments to silent existing violation. Fixit integrates with Flake8 and it adds the above mentioned enhancements to it.

License: Other

Python 100.00%

fixit's Introduction

Fixit

Documentation codecov-badge PYPI PYPI Download

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 [email protected]: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 ufmt 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

fixit's People

Contributors

jimmylai avatar josieesh avatar thatch avatar amyreese avatar lisroach avatar lpetre avatar acharles7 avatar zsol avatar isidentical avatar luciawlli avatar nt591 avatar mvismonte avatar ulgens avatar pwoolvett avatar haroldopsf avatar tsx avatar hauntsaninja avatar yoonphillip avatar liangming168 avatar michel-slm avatar 7imbrook avatar mkniewallner avatar lionellloh avatar lukuang avatar kronuz avatar oopdaniel avatar dkteo avatar alambert avatar kappa avatar aehernandez avatar

Stargazers

Sid Mitra avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.