From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id A299015800F for ; Sun, 1 Jan 2023 18:38:44 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DAA13E07EE; Sun, 1 Jan 2023 18:38:43 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BD64EE07EE for ; Sun, 1 Jan 2023 18:38:43 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B7E94335C47 for ; Sun, 1 Jan 2023 18:38:42 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 16F4062F for ; Sun, 1 Jan 2023 18:38:41 +0000 (UTC) From: "John Helmert III" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "John Helmert III" Message-ID: <1672598008.9fd0f840f7d3ab9b4b91ea90ea3bd8255bc3b891.ajak@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: / X-VCS-Repository: proj/portage X-VCS-Files: .pre-commit-config.yaml README.md X-VCS-Directories: / X-VCS-Committer: ajak X-VCS-Committer-Name: John Helmert III X-VCS-Revision: 9fd0f840f7d3ab9b4b91ea90ea3bd8255bc3b891 X-VCS-Branch: master Date: Sun, 1 Jan 2023 18:38:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 4dc5195b-aeef-4d3f-baf7-96f60633d02f X-Archives-Hash: 5d68533dad39a2e11cf618a3af44d451 commit: 9fd0f840f7d3ab9b4b91ea90ea3bd8255bc3b891 Author: John Helmert III gentoo org> AuthorDate: Thu Dec 1 18:33:59 2022 +0000 Commit: John Helmert III gentoo org> CommitDate: Sun Jan 1 18:33:28 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9fd0f840 Add a pre-commit config Using pre-commit instead of a manually written pre-commit hook will run the linter only over files that have changes, resulting in a much faster linting hook. Closes: https://github.com/gentoo/portage/pull/954 Signed-off-by: John Helmert III gentoo.org> .pre-commit-config.yaml | 10 ++++++++++ README.md | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..e150bc80a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,10 @@ +--- +repos: + - repo: https://github.com/psf/black + rev: 22.12.0 + hooks: + - id: black + - repo: https://github.com/PyCQA/pylint + rev: v2.15.9 + hooks: + - id: pylint diff --git a/README.md b/README.md index 188503b81..08b06c10f 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,17 @@ editor integration. Something like this: black --check --diff . ``` +One can also use pre-commit to run the configured pre-commit +hooks. Utilizing pre-commit has the advantage of running the linter +over only the changed files, resulting in a much faster pre-commit +hook. To use, install pre-commit and then install the hook to your +.git: + +```sh +emerge dev-vcs/pre-commit +pre-commit install +``` + To ignore commit 1bb64ff452 (and other reformatting commits) which is a massive commit that simply formatted the code base using black - you can do the following: