From patchwork Fri Jan 17 19:17:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne X-Patchwork-Id: 2660 Return-Path: Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D159860456 for ; Fri, 17 Jan 2020 20:17:51 +0100 (CET) Received: from nicolas-tpx395.localdomain (unknown [IPv6:2610:98:8005::127]) (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 274952949D4; Fri, 17 Jan 2020 19:17:51 +0000 (GMT) From: Nicolas Dufresne To: libcamera-devel@lists.libcamera.org Cc: Nicolas Dufresne Date: Fri, 17 Jan 2020 14:17:27 -0500 Message-Id: <20200117191733.198897-1-nicolas@ndufresne.ca> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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: Fri, 17 Jan 2020 19:17:52 -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 index changes (--staged) and the combined changes the index changes and the last commit (--amend). Hopefully I have covered all the review comments, note that I ended up refactoring a lot with hope this is cleaner and less ambiguous. 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 indexed changes checkstyle: Add support for checking style on amendments checkstyle: Add a pre-commit hook script utils/checkstyle.py | 114 +++++++++++++++++++++++++++++++++-------- utils/hooks/pre-commit | 17 ++++++ 2 files changed, 110 insertions(+), 21 deletions(-) create mode 100755 utils/hooks/pre-commit