<html><body><div dir="ltr">This is all is needed to make hacking being directly consumable by pre-commit (tool, not git hook): <font color="#258dff" style=""><a href="https://review.opendev.org/c/openstack/hacking/+/783820">https://review.opendev.org/c/openstack/hacking/+/783820</a></font><div><br></div><div dir="ltr">I already did some tests and it worked fine, that is how I made bashate and doc8 long time ago:</div><div dir="ltr"><br></div><div dir="ltr"><a href="https://github.com/openstack/bashate/blob/master/.pre-commit-hooks.yaml" style="">https://github.com/openstack/bashate/blob/master/.pre-commit-hooks.yaml</a></div><div dir="ltr"><a href="https://github.com/PyCQA/doc8/blob/master/.pre-commit-hooks.yaml" style="">https://github.com/PyCQA/doc8/blob/master/.pre-commit-hooks.yaml</a></div><div dir="ltr"><div><br></div><div dir="ltr">Once that is merged and released, you could replace the normal flake8 usage inside your repo .pre-commit-config.yaml file:</div><div dir="ltr"><br></div><div dir="ltr"><div dir="ltr">- repo: <a href="https://review.opendev.org/openstack/hacking">https://review.opendev.org/openstack/hacking</a></div><div dir="ltr"> rev: 4.1.0 # or whatever release number we will pick</div><div dir="ltr"> hooks:</div><div dir="ltr"> - id: hacking</div></div><div><br></div><div dir="ltr">If you want to add your own extra plugins you can still do it using the additional_dependencies key.</div><div dir="ltr"><br></div><div><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">--<div>/zbr</div></div></div></div><div dir="ltr">
<br><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr" style="">On 24 Mar 2021 at 16:34:09, Herve Beraud <<a href="mailto:hberaud@redhat.com">hberaud@redhat.com</a>> wrote:<br></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr" style="">Le mer. 24 mars 2021 à 17:13, Jeremy Stanley <<a href="mailto:fungi@yuggoth.org" style="">fungi@yuggoth.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On 2021-03-24 05:44:59 -0700 (-0700), Sorin Sbarnea wrote:<br>
[...]<br>
> If we still have a strong case for using hacking, I think it<br>
> should be converted to be usable as a hook itself, one that calls<br>
> flake8.<br>
[...]<br>
<br>
Can you expand on how you would expect that to work? Quoting from<br>
hacking's README:<br>
<br>
"hacking is a set of flake8 plugins that test and enforce the<br>
OpenStack StyleGuide"<br>
<br>
How would you turn a set of flake8 plugins into a pre-commit hook<br>
which calls flake8? That seems rather circular.<br></blockquote><div><br></div><div>Excellent point! <br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
-- <br>
Jeremy Stanley<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Hervé Beraud</div><div>Senior Software Engineer at Red Hat</div><div>irc: hberaud</div><div><a href="https://github.com/4383/" target="_blank" style="">https://github.com/4383/</a></div><div><a href="https://twitter.com/4383hberaud" target="_blank" style="">https://twitter.com/4383hberaud</a><br></div><div>-----BEGIN PGP SIGNATURE-----<br><br>wsFcBAABCAAQBQJb4AwCCRAHwXRBNkGNegAALSkQAHrotwCiL3VMwDR0vcja10Q+<br>Kf31yCutl5bAlS7tOKpPQ9XN4oC0ZSThyNNFVrg8ail0SczHXsC4rOrsPblgGRN+<br>RQLoCm2eO1AkB0ubCYLaq0XqSaO+Uk81QxAPkyPCEGT6SRxXr2lhADK0T86kBnMP<br>F8RvGolu3EFjlqCVgeOZaR51PqwUlEhZXZuuNKrWZXg/oRiY4811GmnvzmUhgK5G<br>5+f8mUg74hfjDbR2VhjTeaLKp0PhskjOIKY3vqHXofLuaqFDD+WrAy/NgDGvN22g<br>glGfj472T3xyHnUzM8ILgAGSghfzZF5Skj2qEeci9cB6K3Hm3osj+PbvfsXE/7Kw<br>m/xtm+FjnaywZEv54uCmVIzQsRIm1qJscu20Qw6Q0UiPpDFqD7O6tWSRKdX11UTZ<br>hwVQTMh9AKQDBEh2W9nnFi9kzSSNu4OQ1dRMcYHWfd9BEkccezxHwUM4Xyov5Fe0<br>qnbfzTB1tYkjU78loMWFaLa00ftSxP/DtQ//iYVyfVNfcCwfDszXLOqlkvGmY1/Y<br>F1ON0ONekDZkGJsDoS6QdiUSn8RZ2mHArGEWMV00EV5DCIbCXRvywXV43ckx8Z+3<br>B8qUJhBqJ8RS2F+vTs3DTaXqcktgJ4UkhYC2c1gImcPRyGrK9VY0sCT+1iA+wp/O<br>v6rDpkeNksZ9fFSyoY2o<br>=ECSj<br>-----END PGP SIGNATURE-----<br><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
</blockquote>
</div>
</div>
</div></div></div></body></html>