From patchwork Mon Jun 12 22:47:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 18729 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 0BF94C3290 for ; Mon, 12 Jun 2023 22:47:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BF4CC628A2; Tue, 13 Jun 2023 00:47:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1686610077; bh=He3f3szaxuhPEncGvV+Xel2qkY3nXK9yIB9c71GbCmE=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=3mprioAKHLJeqzOytGepc34f/H1Npk602sHsfm3Me8byfz3fo1nMSwvKFr46iXNQz GkbBvewOnVWP2rIGCOMLrukp07bMvQ0pMEy9mgb02iqOt1R/lezIQYP4NEZqVWI2/4 YRCk5euwVVud6uMuvJH7Se93jlkI1kCAk/T5PaXI1Rh9KUYts5+j6dv6101NOne1Te l7q8HLQknajOQUbd+erv/+yZz7cR8Chqr/Az++3zUBLG4GZnnGs5u78Vpy7pYYcAoZ C2+Vlwl76HHJadjnetrognuYj2VHa/aNcXrXhXLgXRVgWIQi4cRSEf6QTyDZ7S2x36 ccKBnlpwi5u3g== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 09EBE61E59 for ; Tue, 13 Jun 2023 00:47:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="cE6DN1RS"; dkim-atps=neutral Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3FA34D80 for ; Tue, 13 Jun 2023 00:47:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1686610046; bh=He3f3szaxuhPEncGvV+Xel2qkY3nXK9yIB9c71GbCmE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cE6DN1RS3n4OquHuT5TXPWcFoiuTyjNdLDRd7o7aQwZ35x3QGfHceu6esB8j/l2xn zR6EJn+lycjKNANDKQYTPtdj+Gt5VhOp4d5sDhAj44UGo/1ajlrUIrF8Jn5xpDIYYN FtX373w/ezw8G4NtomzEwl8G7K5jDxUCaRrvYu6c= To: libcamera-devel@lists.libcamera.org Date: Tue, 13 Jun 2023 01:47:50 +0300 Message-Id: <20230612224751.4437-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20230612224751.4437-1-laurent.pinchart@ideasonboard.com> References: <20230612224751.4437-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 3/4] utils: checkstyle: Don't include commit ID in commit title 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-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The commit title and commit ID are two different pieces of information. Don't include the latter in the former, to simplify code that only needs the commit title. Constructing a string from the ID and title is easier than splitting the combined string back into its elements. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- utils/checkstyle.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/utils/checkstyle.py b/utils/checkstyle.py index 3104acfa2065..e68c874609bc 100755 --- a/utils/checkstyle.py +++ b/utils/checkstyle.py @@ -210,12 +210,12 @@ class Commit: def _parse(self): # Get the commit title and list of files. - ret = subprocess.run(['git', 'show', '--pretty=oneline', '--name-status', + ret = subprocess.run(['git', 'show', '--format=%s', '--name-status', self.commit], stdout=subprocess.PIPE).stdout.decode('utf-8') - files = ret.splitlines() - self._files = [CommitFile(f) for f in files[1:]] - self._title = files[0] + lines = ret.splitlines() + self._files = [CommitFile(f) for f in lines[1:] if f] + self._title = lines[0] def files(self, filter='AMR'): return [f.filename for f in self._files if f.status in filter] @@ -358,7 +358,7 @@ class HeaderAddChecker(CommitChecker): class TitleChecker(CommitChecker): - prefix_regex = re.compile(r'[0-9a-f]+ (([a-zA-Z0-9_.-]+: )+)') + prefix_regex = re.compile(r'^([a-zA-Z0-9_.-]+: )+') release_regex = re.compile(r'libcamera v[0-9]+\.[0-9]+\.[0-9]+') @classmethod @@ -388,7 +388,7 @@ class TitleChecker(CommitChecker): if not prefix: continue - prefix = prefix.group(1) + prefix = prefix.group(0) if prefix in prefixes: prefixes[prefix] += 1 else: @@ -846,9 +846,10 @@ def check_file(top_level, commit, filename, checkers): def check_style(top_level, commit, checkers): - separator = '-' * len(commit.title) + title = commit.commit + ' ' + commit.title + separator = '-' * len(title) print(separator) - print(commit.title) + print(title) print(separator) issues = 0