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
work.

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:

setup(
    # ...
    entry_points={
        '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:

[flake8]
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? ;)

Cheers,
-Barry

Attachment: pgpxUilA_c0_3.pgp
Description: OpenPGP digital signature

_______________________________________________
code-quality mailing list
code-quality@python.org
https://mail.python.org/mailman/listinfo/code-quality

Reply via email to