Gentoo Archives: gentoo-commits

From: John Helmert III <ajak@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: /
Date: Sun, 01 Jan 2023 18:38:44
Message-Id: 1672598008.9fd0f840f7d3ab9b4b91ea90ea3bd8255bc3b891.ajak@gentoo
1 commit: 9fd0f840f7d3ab9b4b91ea90ea3bd8255bc3b891
2 Author: John Helmert III <ajak <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 1 18:33:59 2022 +0000
4 Commit: John Helmert III <ajak <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 1 18:33:28 2023 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9fd0f840
7
8 Add a pre-commit config
9
10 Using pre-commit instead of a manually written pre-commit hook will
11 run the linter only over files that have changes, resulting in a much
12 faster linting hook.
13
14 Closes: https://github.com/gentoo/portage/pull/954
15 Signed-off-by: John Helmert III <ajak <AT> gentoo.org>
16
17 .pre-commit-config.yaml | 10 ++++++++++
18 README.md | 11 +++++++++++
19 2 files changed, 21 insertions(+)
20
21 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
22 new file mode 100644
23 index 000000000..e150bc80a
24 --- /dev/null
25 +++ b/.pre-commit-config.yaml
26 @@ -0,0 +1,10 @@
27 +---
28 +repos:
29 + - repo: https://github.com/psf/black
30 + rev: 22.12.0
31 + hooks:
32 + - id: black
33 + - repo: https://github.com/PyCQA/pylint
34 + rev: v2.15.9
35 + hooks:
36 + - id: pylint
37
38 diff --git a/README.md b/README.md
39 index 188503b81..08b06c10f 100644
40 --- a/README.md
41 +++ b/README.md
42 @@ -30,6 +30,17 @@ editor integration. Something like this:
43 black --check --diff .
44 ```
45
46 +One can also use pre-commit to run the configured pre-commit
47 +hooks. Utilizing pre-commit has the advantage of running the linter
48 +over only the changed files, resulting in a much faster pre-commit
49 +hook. To use, install pre-commit and then install the hook to your
50 +.git:
51 +
52 +```sh
53 +emerge dev-vcs/pre-commit
54 +pre-commit install
55 +```
56 +
57 To ignore commit 1bb64ff452 (and other reformatting commits) which is a
58 massive commit that simply formatted the code base using black - you can do
59 the following: