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

Custom styles should be able to use the application-package-names setting #109

Closed RevolutionTech closed 7 years ago

RevolutionTech commented 7 years ago

Currently, checker.py uses the application-package-names option only if the name of the style matches a whitelist: ['appnexus', 'edited']: https://github.com/PyCQA/flake8-import-order/blob/35434d29ddc9c1a580ae0c9ff14b8f00a288fd99/flake8_import_order/checker.py#L44

That means that it is not possible to create a custom style that extends the behaviour of the AppNexus or Edited styles (ie. that uses application-package-names option) unless that style also uses the same name.

I would suggest that instead of comparing the name, a property be added the base Style class like accepts_application_package_names which is set to False in the Style class but set to True in the AppNexus and Edited classes. Then the logic in checker.py should be changed to check for this flag in the style class.

RevolutionTech commented 7 years ago

Wow, thanks for the quick turnaround!