JBKahn / flake8-print

flake8
MIT License
119 stars 22 forks source link

Rename entry point to enable plugin codes #17

Closed mihaic closed 7 years ago

mihaic commented 8 years ago

In flake8 v3, plugin codes are enabled automatically based on the plugin entry point name. https://github.com/PyCQA/flake8/blob/master/src/flake8/plugins/manager.py#L188 https://github.com/PyCQA/flake8/commit/ec2e601cbf9a56c9bee2ee3cc22999c795c1c824

JBKahn commented 8 years ago

I have no issue with the change but I didn't see anything about it in the docs and am not super knowledgeable on flake8. What exactly does this do?

mihaic commented 8 years ago

My PR changes the name for the flake8-print entry point such that flake8 automatically enables the flake8-print codes. Without this PR, flake8-print runs, but its results are not included in the report by default.

The example in the docs does name the entry point in a similar way to my proposal: http://flake8.pycqa.org/en/latest/plugin-development/registering-plugins.html

The X in checking plugins define what error codes it is going to report. So if the plugin reports only the error code X101 your entry-point would look like:

X101 = flake8_example.ExamplePlugin

jayvdb commented 8 years ago

Nod there are other flake8 plugins which use the T prefix. I assume this change would create confusion and possibly bugs.

Is there another way to register only the exact codes that this plugin uses?

mihaic commented 8 years ago

I am not sure about that. I asked in the flake8 issue tracker: https://gitlab.com/pycqa/flake8/issues/149#note_15020371

gforcada commented 7 years ago

Another option, to not block the compatibility with flake8 > 3.0.0, would be to rename the codes to be all in, say T90X where X is the specific code (so far only 3 different error codes are returned by flake8-print)

This way, other plugins that also use T in their codes will probably not clash, if that's actually a problem at all. My gut feeling is that it shouldn't be because then only as many characters as the alphabet would be allowed. And that's quite limiting...

JBKahn commented 7 years ago

Not a bad idea, just in the middle of my vacation, I'm back next week then I'll be active again.

JBKahn commented 7 years ago

likely fixed by https://gitlab.com/pycqa/flake8/issues/257

and is fixed in 3.2.1 of flake8

mihaic commented 7 years ago

Thanks for the follow-up. Indeed, it is fixed.