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