Skip to main content

Git Lint: README

A git command that automatically runs identifiable linters against changed files in your current git repository or staging area.

  • Free software: MIT license

Git Lint runs a configurable set of syntax, style, and complexity checkers against changed files in your current working directory or staging area. It can be configured to work with any lint-like command. Some commands may require shell wrappers.

While it may be possible to create a custom lint command in your npm, grunt, Make, CMake, or whatever, the fact is we all use a VCS, and most of us use git. Having a centralized repository for what we want checked and how we want it checked, associated with git (and by extension, as a pre-commit hook), that can be run at any time for any reason.

Usage

To lint only what’s changed recently in your current working directory:

git lint

To lint everything, changed or otherwise, from the current directory down:

git lint -a

To lint what’s changed from the repo’s base:

git lint -b

To lint what’s in your staging directory:

git lint -s

Documentation

Complete documentation for the project is available in the docs directory, or at Git Linter Docs.

Install

This ought to work:

pip install git-linter

You will need to copy the .git-lint configuration file to either your home directory or the repo`s base directory. Edit the configuration file as needed. You will also need any linters that you plan on running.

As git-linter is still mostly alpha code, it might be better to install from source:

`` git clone https://github.com/elfsternberg/git-linter python setup.py install ``

Features

  • Highly configurable - configuration files, both for git-lint and individual linters, can be global or per-project.

  • Only checks files that have been changed, but this can be overriden from the command line.

  • Can be used directly as a pre-commit hook, to ensure you personally don’t check in anything broken.

    • Used this way, it checks the staging area, not your workspace.

    • When using the staging area, it stashes your current work. Upon restoration of your workspace, it ensures the timestamps are the same, so as not to confuse your build system or IDE.

Acknowledgements

Git lint started life as a simple pre-commit hook. Most of the changes since were inspired by Steve Pulec’s Why You Need a Git Pre-Commit Hook and Why Most Are Wrong, as well as just my own needs as a software developer.

Disclaimer

This software, including provided configuration and documentation materials, is provided “as is” without any warranties, including any implied warranties of merchantability, fitness, performance, or quality. In no event shall the author or sponsor be liable for any special, direct, indirect, or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of this software. Each user of the program will agree and understand, and be deemed to have agreed and understood, that there is no warranty whatsoever for the program and, accordingly, the entire risk arising from or otherwise connected with the program is assumed by the user.

History

0.0.2 (2015-05-22)

Pre-commit version

0.0.04 (2016-09-26)

Moved to “git lint” and optioned the hell out of it.

Release files for git_linter 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for git_linter 0.0.7
File Size Uploaded
git_linter-0.0.7.tar.gz 34.4 kB Details

Release files / git_linter-0.0.7.tar.gz

Download URL git_linter-0.0.7.tar.gz
Size 34.4 kB
Tags Source
SHA-256 checksum
How to use checksums
358892ec4636e926998686e44151c8b87212456576b1b885697cadd3c7fc9bfd
BLAKE2b-256 checksum
How to use checksums
5bc4d2d0ec84bcc3c77a20f7739d0b30fb857f52cc87754794f414792776e0e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.7 This release

1 release file

0.0.6

1 release file

0.0.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page