From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id DC7DE1382C5 for ; Sun, 18 Feb 2018 18:47:11 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 16294E0D18; Sun, 18 Feb 2018 18:47:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D2253E0D17 for ; Sun, 18 Feb 2018 18:47:10 +0000 (UTC) Received: from pomiot (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id A493A335C39; Sun, 18 Feb 2018 18:47:07 +0000 (UTC) Message-ID: <1518979624.1570.2.camel@gentoo.org> Subject: Re: [gentoo-portage-dev] [PATCH v2 1/3] repoman: Add commit message verification From: =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?= To: gentoo-portage-dev@lists.gentoo.org Date: Sun, 18 Feb 2018 19:47:04 +0100 In-Reply-To: <20180218091101.7fbc2886@professor-x> References: <20180217125648.1697-1-mgorny@gentoo.org> <20180218091101.7fbc2886@professor-x> Organization: Gentoo Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.6 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 94f307b5-ea85-4c31-a550-ad0cdd0461b0 X-Archives-Hash: a7306db7ab31fc4b0d3e8e543091f0dd W dniu nie, 18.02.2018 o godzinie 09∶11 -0800, użytkownik Brian Dolbec napisał: > On Sat, 17 Feb 2018 13:56:46 +0100 > Michał Górny wrote: > > > + > > + footer_re = re.compile(r'^[\w-]+:') > > + > > + @classmethod > > + def verify_commit_message(cls, msg): > > ... > > + if all(cls.footer_re.match(l) for l in lines if l.strip()): > > > Why declare the footer_re in the class space? It is only used in this > new function. Then the function could be @staticmethod instead. I > don't see the advantage of it this way. > > If it is for re-use in other possible check functions, then perhaps it > would be best to split this out to it's own class/file that can be > added to easily. And just run it from the Actions class as M.J. > Everitt suggested. I've declared it outside the function to not have to re-compile it every time the function is run (well, yes, now that I think of it, it won't happen more than once most of the time...). Used class space to avoid moving it too far from code. -- Best regards, Michał Górny