[oslo] fix flake8-hacking inconsistences on xena/wallaby
hberaud at redhat.com
Wed Mar 24 14:31:50 UTC 2021
Thanks for your feedback, they are much appreciated.
Le mer. 24 mars 2021 à 13:45, Sorin Sbarnea <ssbarnea at redhat.com> a écrit :
> As one of the early adopters and supporters of pre-commit *tool* I should
> mention few things I observed.
> pre-commit tool by design does pin all the hooks/linters/checks, so it is
> mainly making use of 'hacking' package irrelevant. On many tripleo
> repositories we ended up removing hacking and I do not remember getting
> into any problems due to flake8 or its plugins so far..
Here our problem was that we recently started to define the version of
flake8 to use and that version wasn't compatible with the one supported by
hacking. The solution is simply to let hacking manage these own
requirements. We don't want to drop hacking.
> My personal recommendation is to avoid the use of "repo: local", especial
> for calling an external tools (flake8). This makes you loose the ability to
> upgrade the linter using `pre-commit auto-update`. Local hooks are designed
> for running custom checks hosted in-repo.
We don't want to use auto-update. We want to control the flow of supported
hacking versions and its supported rules. We don't want to suffer each new
version of hacking.
> Sidenote: when using additional dependencies with pre-commit, there is no
> pinning, so there is still a chance you may want to use hacking or at least
> manually control the version of the extra packages you want to inject
> inside the "hook".
Please can you share docs or links that refer to this point? I didn't find
that point in the official documentation.
> 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. If doing
> this it will be possible to make use of pre-commit pin to tag and fully
> control the bumping of flake8 with all the deps involved.
Indeed, it's a good idea.
> On 23 Mar 2021 at 11:00:42, Herve Beraud <hberaud at redhat.com> wrote:
>> Hello Osloers,
>> As you surely recently observed patches proposed by the openstack bot to
>> configure wallaby fail with a flake8/hacking issue.
>> Here are some guideline to fix the problem the inconsistency:
>> - Patch pre-commit on master (now xena) (here is the patch:
>> - Once Xena is patched cherry-pick and backport these changes on Wallaby
>> - Rebase the openstack bot patches on the top of this cherry-pick (or
>> wait for the merge of the previous one patch)
>> You can copy the patch on oslo.db with the related commit message .
>> The root cause of the issue was that with the introduction of pre-commit
>> we started to define the version of flake8 to use. Previously this version
>> was defined by hacking's requirements.
>> Indeed a few months ago we added pre-commit to allow us to run checks
>> with git hooks and reduce the usage of our gates. These changes were
>> standardized and spread on all the scope of oslo .
>> However, during the design of these changes  and after some discussion
>> we decided to pin the version of flake8 to use, hence by doing this we
>> short circuited hacking on its management of flake8.
>> The solution to solve this issue is simply to trust hacking on its flake8
>> management. Hacking will pull the right version of flake8 and the
>> inconsistency will disappear. flake8 provides a pre-commit hook so it could
>> be seen and called as a local target.
>>  https://review.opendev.org/c/openstack/oslo.db/+/781470
>>  https://review.opendev.org/q/topic:%22oslo-pre-commit%22
>> Hervé Beraud
>> Senior Software Engineer at Red Hat
>> irc: hberaud
>> -----BEGIN PGP SIGNATURE-----
>> -----END PGP SIGNATURE-----
Senior Software Engineer at Red Hat
-----BEGIN PGP SIGNATURE-----
-----END PGP SIGNATURE-----
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the openstack-discuss