Skip to main content

lint-diffs

Build Status Code Coverage

lint-diffs is a simple command line tool for running a set of arbitrarty linters on a set of 'unified diffs'.

Errors on diff-lines will always be reported. Errors on non-diff lines can also be reported, depending on severity.

First you need some diffs, then you pipe it to lint-diffs:

git diff -U0 origin/master | lint-diffs

... or in mercurial: hg outgoing -p | lint-diffs

  • default linter configuration is on for pylint (.py), rubocop (.rb), and clang (.cpp, .hpp)

  • flake8, eslint and other linters need to be enabled (see below) explicitly.

Configuration

lint-diffs will read a config files from ~/.config/lint-diffs and/or ./.lint-diffs.

Example:

[pylint]
always_report=E.*

[flake8]
extensions=.py

[rubocop]
extensions=.rb
always_report=(E.*|W.*)

[eslint]
extensions=.js

[shellcheck]
extensions=.sh

In this example, a flake8 and pylint are run on every diff file ending in .py. Additionally, ruby, eslint and shell script linters have been enabled. The ruby linter has been modified to always report warnings, on any changed file, not just changed lines.

To add new linters

  • The linter has to report to stdout

  • The linter has to have a regex that produces a full file path, a line number and an error class

  • The line numbers and file paths have to match diff target file paths

To enable or disable linters change the 'extensions' config.

Goals

  • Runs with good defaults for many people
  • Should be easy to modify the config for any linter
  • Should be easy to use with any vcs

Development

This project uses Flit to build its packages. That might answer your question in case you are wondering why there is no setup.py here.

Release files for lint_diffs 0.1.22

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

Source distribution (sdist)

Source distribution for lint_diffs 0.1.22
File Size Uploaded
lint_diffs-0.1.22.tar.gz 11.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lint_diffs 0.1.22
File Interpreter ABI Platform
lint_diffs-0.1.22-py3-none-any.whl Python 3 none any Details

Total release size: 20.1 kB

Release files / lint_diffs-0.1.22.tar.gz

Download URL lint_diffs-0.1.22.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4760cdc62644760c3f8a4924eb45ae8999b6913363b01129252017ca1dba0c09
BLAKE2b-256 checksum
How to use checksums
88f28952bc87e6b83fe11fe3414836cf2e48371de12704c9a98884cb56dfcc88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.23.0

Release files / lint_diffs-0.1.22-py3-none-any.whl

Download URL lint_diffs-0.1.22-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e716bc634c1dd09e7d010b60382ae5d261d3cfccd8b7b79a70b8b8a816849040
BLAKE2b-256 checksum
How to use checksums
ae9f745d30cb75322caeab7372fad3a53d4b3dfdae885b95b4bab6c105014d53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.23.0

Release history Release notifications | RSS feed

This release

0.1.22 This release

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.17

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

1 release file

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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