From patchwork Sat Jan 18 03:54:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne X-Patchwork-Id: 2667 Return-Path: Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 975A260452 for ; Sat, 18 Jan 2020 04:59:40 +0100 (CET) Received: from nicolas-tpx395.localdomain (unknown [IPv6:2002:c0de:c115:0:66fc:8b:2a38:8313]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: nicolas) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 8029729257E; Sat, 18 Jan 2020 03:59:39 +0000 (GMT) From: Nicolas Dufresne To: libcamera-devel@lists.libcamera.org Cc: Nicolas Dufresne Date: Fri, 17 Jan 2020 22:54:42 -0500 Message-Id: <20200118035448.230530-1-nicolas@ndufresne.ca> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 0/6] Add the ability to do pre-commit style check X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jan 2020 03:59:40 -0000 From: Nicolas Dufresne This series adds the ability to do pre-commit style check. Internally, this adds the ability to use checkstyle.py to check staged changes (--staged) and the combined changes of the index and the last commit (--amend). Changes in v3: - Patch 1 is unchanged - Remove yet another mode change (patch 2) - The return statement has been improved (patch 2) - Static member 'commit' has been removed from Commit class (patch 3) - A comment clarifies the return value of Commit.get_info() (patch 3) - extract_revlist() has been renamed extract_commits() (patch 3) - Index class is now named StagedChanges (patch 4) - If statement to set the default revision_range has been improve (patch 4) - Typo Amandment.det_info() is fixed to get_info() (patch 5) - Description of --amend has been fixed (patch 5) - Fixed commit->args variable name (patch 6) Changes in v2: - Fixed the checkstyle.py mode - Split into smaller patches - Only pass 0 or 1 to exit() - Replace boolean "staged" parameter with a Commit object - Subclass Commit to introduce special cases for Index and Amendment - Introduce a argument "--amend" to disambeguate the CLI Nicolas Dufresne (6): checkstyle: Move from pep8 to pycodestyle checkstyle: Exit with 1 status if issues are found checkstyle: Introduce a Commit class checkstyle: Add support for checking style on staged changes checkstyle: Add support for checking style on amendments checkstyle: Add a pre-commit hook script utils/checkstyle.py | 120 +++++++++++++++++++++++++++++++++-------- utils/hooks/pre-commit | 17 ++++++ 2 files changed, 115 insertions(+), 22 deletions(-) create mode 100755 utils/hooks/pre-commit