I'm having trouble getting flake8 v3's --enable-extensions feature to work the
way I want it.  It's possible that I'm misunderstanding how it's supposed to

I have a checker plugin that starts out like:

class ImportOrder:
    name = 'flufl-import-order'
    version = '0.2'
    off_by_default = True

    def __init__(self, tree, filename):
        # ...

    def run(self):
        # ...

and it registers itself via an entry point like so:

    # ...
        'flake8.extensions': ['U4 = flufl.testhelpers.imports:ImportOrder'],
    # ...

All of the plugin's errors are U40X and U41X codes.

What I'd like to be able to do is to tell users to add this to say their
tox.ini file:

enable-extensions = U4

and that would enable my extension.  This doesn't seem to work though.

I know that the extension runs just fine if I don't include the
off_by_default=True class attribute, but as soon as I add that, there doesn't
seem to be a way to re-enable it.  I don't want to have to tell users that the
plugin always runs and that they have to suppress the U4 errors if they don't
want it.

What am I doing wrong?  Or can I not do what I think I want to do? ;)


Attachment: pgpxUilA_c0_3.pgp
Description: OpenPGP digital signature

code-quality mailing list

Reply via email to