From patchwork Fri Sep 27 08:08:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 1168337 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46fkvp02ymz9sPY for ; Fri, 27 Sep 2019 18:08:54 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="OfuP0liO"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46fkvn66THzDqw8 for ; Fri, 27 Sep 2019 18:08:53 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=160.202.107.126; helo=q2relay126.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="OfuP0liO"; dkim-atps=neutral Received: from q2relay126.mxroute.com (q2relay126.mxroute.com [160.202.107.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46fkvd2yB0zDqvY for ; Fri, 27 Sep 2019 18:08:44 +1000 (AEST) Received: from filter001.mxrelay.co ([64.52.23.203] filter001.mxrelay.co) (Authenticated sender: mN4UYu2MZsgR) by q2relay126.mxroute.com (ZoneMTA) with ESMTPSA id 16d71c3d1ba000c9a9.001 for (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Fri, 27 Sep 2019 08:08:41 +0000 X-Zone-Loop: 1fe77bfd3e539ca451e8c2563c33dac2fdfe300f153d X-Originating-IP: [64.52.23.203] Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter001.mxrelay.co (Postfix) with ESMTPS id B3CDC1008E8 for ; Fri, 27 Sep 2019 08:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Pi8YRzc7UIth5lAF7u8YB9soHA0jo0wMegqOedQUkS0=; b=OfuP0liOgflAGyCR6mwlj4nxbY S6ICrXx/iHuwqhqwLcxpJ41lG4pMkxuzUZlzk8mXGmvjNAxyFAowjFiArkvygnFLKDe9JfmA/5H0m w33iS+HPwmbP9vV2qOdcB3Y9Kc/3H0TUkus8jN/ZOu1zl/BCDhc9XlkeIoETLqx4MJfbYREcVcWeS Jlm0iBkxnLKsVPtzlIorVUi4+HsCnpaRoFivz9hc3G6JO44AS9N6b8i4Xai1Bb8SDRGs5IV86MeGo wCLmLmHbvvl3yekKCUmHfqV1zHSH/dq7/61W97X3+Y9W8RB99ox9tD7Vw0yJdxSTKfr48fqu3n4O2 rWjgLuRg==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH] docs: Add documentation for pre-commit Date: Fri, 27 Sep 2019 09:08:30 +0100 Message-Id: <20190927080830.20030-1-stephen@that.guru> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Explain what it is and why you should use it. Signed-off-by: Stephen Finucane --- docs/development/contributing.rst | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/docs/development/contributing.rst b/docs/development/contributing.rst index 5089bba8..50171608 100644 --- a/docs/development/contributing.rst +++ b/docs/development/contributing.rst @@ -19,11 +19,29 @@ files and may be added for significant changes to existing files. # # SPDX-License-Identifier: GPL-2.0-or-later -Changes that fix semantic issues will be generally be happily received, but -please keep such changes separate from functional changes. +Changes that fix semantic issues will be happily received, but please keep such +changes separate from functional changes. -``pep8`` targets are provided via tox. Refer to the :ref:`testing` section -below for more information on usage of this tool. +Patchwork uses the `pre-commit`_ framework to allow automated style checks when +committing code. This is opt-in but avoids the need to manually run style +checks on commits. Pre-commit can be installed and enabled like so: + +.. code-block:: shell + + $ pip install --user pre-commit + $ pre-commit install --allow-missing-config + +Once installed, the various checks listed in ``.pre-commit-config.yaml`` will +be run on changed files when committing. It is also possible to run the checks +on all files manually: + +.. code-block:: shell + + $ pre-commit run --all-files + +In addition to *pre-commit*, we provide *tox* targets for style checks. These +are used by CI and can be useful if checking all files manually. Refer to the +:ref:`testing` section below for more information on usage of this tool. .. _testing: @@ -163,6 +181,7 @@ Further information about the Patchwork mailing list is available can be found o .. _PEP 8: https://pep8.org/ .. _GPL v2.0 or later: https://spdx.org/licenses/GPL-2.0-or-later.html .. _SPDX License Identifier: https://spdx.org/using-spdx-license-identifier +.. _pre-commit: https://pre-commit.com/ .. _tox: https://tox.readthedocs.io/en/latest/ .. _reno: https://docs.openstack.org/developer/reno/ .. _QEMU guidelines: http://wiki.qemu.org/Contribute/SubmitAPatch