From patchwork Sat Jan 18 20:00:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne X-Patchwork-Id: 2674 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 743E060455 for ; Sat, 18 Jan 2020 21:02:42 +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 0D8582911C1; Sat, 18 Jan 2020 20:02:40 +0000 (GMT) From: Nicolas Dufresne To: libcamera-devel@lists.libcamera.org Cc: Nicolas Dufresne Date: Sat, 18 Jan 2020 15:00:09 -0500 Message-Id: <20200118200015.16531-1-nicolas@ndufresne.ca> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 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 20:02:42 -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 v4: - Patch 1 and 2 are unchanged - Unused top_level parameter removed from get_info() (patch 3 to 4) - revlist renamed to commits in main (patch 3) - Removed uneeded get_file() override by using empty string commit (patch 4) - Chain to StagedChanges constructor in Amendment class (patch 5) - Use "--no-patch" to reduce overhead of creating Amendment subject (patch 5) - Corrected the documentation in the pre-commit hook (patch 6) - Use tabs and minor style fix in pre-commit hook (patch 6) - Fixed all grammar mistake found by Laurent (all over) 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 | 118 +++++++++++++++++++++++++++++++++-------- utils/hooks/pre-commit | 18 +++++++ 2 files changed, 113 insertions(+), 23 deletions(-) create mode 100755 utils/hooks/pre-commit