PyCQA / flake8-import-order

Flake8 plugin that checks import order against various Python Style Guides
GNU Lesser General Public License v3.0
278 stars 72 forks source link

Please add instructions to install & configure with pylama. #157

Closed alvassin closed 5 years ago

alvassin commented 6 years ago

Not clear how to start using this plugin with pylama. Can it be somehow integrated via pylama.ini?

pgjones commented 5 years ago

Does something like this work in the setup.cfg?

[pylama]
application-import-names = quart, tests
ignore = E252, W503, W504
import-order-style = smarkets
max_line_length = 100
alvassin commented 5 years ago

I added this linter to pylama as following:

entry_points = {
    'pylama.linter': [
        'imports_order = flake8_import_order.pylama_linter:Linter'
    ]
},

Also, i configured pylama using pylama.ini:

[pylama]
linters=pycodestyle,pyflakes,mccabe,imports_order

[pylama:imports_order]
application-import-names=myapp
import-order-style = smarkets

The problem is that pylama does not detect imports from myapp as local ones. Moreover, i do not see application_import_names in self.options .

I can see that self.options contains the following:

{
    'code': '...',
    'ignore': set(),
    'select': set(),
    'params': {
        'application-import-names': 'myapp',
        'import-order-style': 'smarkets',
    },
    'import_order_style': Entrypoint('cryptography = flake8_import_order.styles:Cryptography')
}

I can see in your test, that you expect application_import_names named underscored with list. I can see string, even when i pass myapp,tests value

alvassin commented 5 years ago

Can you please advice, what is going wrong?

pgjones commented 5 years ago

Have you tried putting this in the pylama.ini?

[pylama:imports_order]
application_import_names=myapp
import_order_style = smarkets
pgjones commented 5 years ago

I'm going to assumed the above worked, please reopen if not.