Welcome to the flake8-diff documentation!¶
Release v0.2.2.
What is this?¶
flake8-diff is a utility that executes flake8 over a set of files changed between two VCS versions, and prints out only the violations introduced by the newer version. We use this at Dealertrack as part of our code review process, to show what flake8 violations would be introduced by merging a branch or pull request.
Installation¶
$ pip install flake8-diff
Or to install the latest development version:
$ pip install git+git://github.com/dealertrack/flake8-diff
Documentation¶
Using flake8-diff¶
The most simple usage of flake8-diff is to run flake8-diff on its own:
$ flake8-diff
Basic usage¶
There are a number of basic parameters you can pass to flake8-diff, and explanation of these options is below:
$ flake8-diff -h
Managing output¶
TODO: Update once decisions on output, formatting and colors is settled.
Controlling comparisons¶
By default flake8-diff will compare your current branch to the equivalent of origin/master (this is different in other version control systems).
If you want to do the comparison against different branches, or even different commits, then you can follow the below options.
Mercurial Support¶
In order to use mercurial, you need to be sure that extdiff extension is enabled. Please check the following page for more details: https://mercurial.selenic.com/wiki/ExtdiffExtension
API documentation¶
API Documentation¶
flake8diff¶
Run flake8 across a set of changed files and filter out violations occurring only on the lines that were changed.
By default it’s configured for “git diff master” which is useful for buildmasters looking at a checked out PR.
To use, dump this in a file somewhere:
$ pip install flake8-diff
$ git checkout pr/NNN
$ git merge origin/master
$ flake8-diff
Members¶
Contributing¶
Contributing¶
flake8-diff is an open source project that encourages community contributions in all aspects:
- Code patches;
- Documentation improvements;
- Bug reports;
- Code reviews for contributed patches.
Code¶
- Propose all code changes via a pull request in the GitHub repository;
- Use our Development Process;
- Ensure code changes have tests and adequate coverage;
- New features should have examples and documentation;
- Add yourself to AUTHORS.
Documentation¶
The header order:
======== Header 1 ======== Header 2 ======== Header 3 -------- Header 4 ~~~~~~~~Perform at least basic spelling checks;
Use gender-neutral language (singular they is great!);
Reviewing¶
All code that is merged into flake8-diff must be reviewed by at least one person other than an author of the change.
While perfection is a noble goal it often leads to an idea that improvement without achieving perfection is not an improvement. Improvements need only be that, improvements.
Development Process¶
We use a number of tools to manage the code and development of flake8-diff:
- git is our version control system
- Github for tracking issues, and handling our code review process
- Travis CI to run our tests, and Coveralls to track test coverage
- Sphinx to handle our documentation
Getting started¶
To get setup for development you can follow the below steps:
Fork the repository from https://github.com/dealertrack/flake8-diff
Clone and install requirements:
$ git clone $ mkvirtualenv flake8-diff $ pip install -r requirements.pipAdd a remote to the upstream project to track changes
$ git remote add -f upstream https://github.com/dealertrack/flake8-diff
Check out develop or create a feature branch off develop
$ git checkout -b develop upstream/develop $ git push -u origin developDo your work, commit and push, then open a pull request to upstream on the develop branch.
Handle any review comments, add more commits and push