local-checks feature fundamentally incompatible with flake8 3.x

Bug #1652409 reported by Adam Williamson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
hacking
New
Undecided
Unassigned

Bug Description

Hi, folks. I've spent a lot of time today trying to get Fedora's hacking package to vaguely work on Fedora Rawhide (with flake8 3.x). I've more or less managed to fix up the test suite to be compatible with flake8 2.x and 3.x, but I did run into one problem which seems to be more or less unsolvable: given the design changes in flake8 3.x, I don't think hacking's 'local-checks' feature can possibly work.

flake8 3.x really isn't a wrapper around pep8/pycodestyle any more, it's more of an entire alternate loader for pep8/pycodestyle-type tests. It doesn't use pycodestyle's check registry or check runner. It just uses its own 'plugins' mechanism to load all the checks from pycodestyle as a group of 'plugins', then runs them like any other plugin to flake8.

This kind of completely breaks the approach hacking tries to use to load 'local checks' (at least, so far as I can see). hacking works by discovering them, importing them, and then running `pep8.register_check()` on them (it could fairly easily be adjusted to load them into whichever of pep8 and pycodestyle are present, I guess, to handle both). All of that code technically still runs and works - you can hack in some calls to inspect pep8's check list to satisfy yourself that, so far as pep8 is concerned the check is loaded - but with flake8 3.x it's useless. Because flake8 3.x doesn't actually use pep8's check registry. It doesn't care what checks pep8 thinks are available, it's only ever going to load the ones on its effectively hardcoded list (the list of entry points in its setup.py).

The only vague possibility I can think of here is if hacking can somehow provide a flake8 plugin (entry point) which itself discovers and executes the local checks, but I'm not sure if that's viable at all. Anyone got any better ideas?

For Fedora Rawhide purposes for now we're just going to have to ship a slightly broken hacking package with the local-checks feature disabled, unless we downgrade flake8 or provide multiple versions of it.

summary: - local-checks feature fundamentally incompatible with flake8
+ local-checks feature fundamentally incompatible with flake8 3.x
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.