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 <mgo...@gentoo.org> 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