endlessm/difflint

Name: difflint

Owner: endlessm

Description: Linter that will examine only new changes as you commit them

Created: 2015-08-24 19:41:51.0

Updated: 2018-01-19 13:51:15.0

Pushed: 2017-11-26 20:25:36.0

Homepage:

Size: 55

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Difflint

Suppose you have a codebase with inconsistent code style, and you want to start checking your commits with a linter. You could fix the entire thing in one gargantuan code style commit, but you might not want to do that if you rely on your commit history for tracking down bugs with tools like git blame and git bisect.

Difflint will check only the changes that you make in each commit. It's suitable for using as a Git pre-commit hook.

Linters Supported
Requirements
Installation
Usage

Use difflint -c to make sure that Difflint can find all the linting tools it needs.

Whenever you make a commit in a Git repository where you've installed Difflint as a pre-commit hook, Difflint will check the lines you're about to commit and warn you if you've added any new errors that weren't already there.

You can check without committing by staging the files you wish to check (with git add) and running difflint without any arguments.

Enable/Disable Linters (optional)

Difflint allows you to specify which linters to use for particular file extensions. Any linters included in the section “Linters Supported” can be enabled or disabled. You can configure this by renaming the example.difflintrc file to .difflintrc and placing it in your repository's root level. Then you can change which file extensions belong to which groups of linters, disable some of the default linters, or add other linters that are not enabled by default.

If you do not supply a .difflintrc file, default values for extensions and linters will be used. They can be found in the default difflintrc file.

The format of the .difflintrc file is JSON and looks like the following:


"<language_name>": {
    "extensions": ["<file_extension_without_a_leading_dot_1>",
                   "<file_extension_without_a_leading_dot_2>"],
    "linters": ["<linter_executable_name_1>",
                "<linter_executable_name_2>"]
}

Here the <language_name> could be something like “python” or “javascript”. It is not used in the linting process but will help generate useful error messages if you forgot to install one of the linters you associated with it.

The <file_extension_without_a_leading_dot> could be “py” or “pyw”. Example linter executable names are “pep8” and “jscs”. You are free to mix and match groupings/extensions/linters as best fits your workflow.

Linter Specific Configuration (optional)

If you don't want JSCS and JSHint's default settings, create .jscsrc and .jshintrc files where JSCS and JSHint can find them. We've created example ones in this repository, named example.jscsrc and example.jshintrc that you can rename and customize. See JSCS documentation and JSHint documentation for more information.

Bug Reporting

Report bugs using Difflint's issue tracking on Github.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.