Fixing Flake8 Errors for plugin contribution

I previously started work on PR #3560, a plugin to allow the contents of a query to be tweeted - an admittedly niche use-case, but (I hoped) a useful introduction to contribution to the project.

I’ve returned to the code to provide tests & documentation so it may be included (assuming there is sufficient interest for me to do so). Using the flake8 linter (tox -e lint) I’ve managed to correct most errors, however I am struggling to understand the need to address:

beetsplug/ D107 Missing docstring in __init__
beetsplug/ D102 Missing docstring in public method

All of the other plugin implementations I have checked do not provide a docstring for __init__ on the plugin class or the commands(...) function as these are standard & common, thus I don’t understand why my plugin file is raising these errors when others are not.

I’ve added "tweet": ["twitter"], to under extras_require in case that would signify the file’s status as a plugin. Relatedly, for best practice I use black to format all edited python files before saving which has raised another conflict with flake8 on E231 missing whitespace after ',' E231 missing whitespace after ',' E231 missing whitespace after ','

I cannot see a reference to this error on discourse so I thought it may be worth bringing to general attention, as I understand there’s a PR to introduce black as standard. My question from this would be do you recommend continuing to use black for my code contribution, given its impending inclusion, or should I manually address these flake8 errors (and disable black) instead?

Thanks for all of your help in advance!

Welcome to beets!

The docstring errors are new. The reason you aren’t seeing them for existing files is because we just implemented the checks recently and current modules are excluded from the checks until we transition them to have proper documentation.

For black, it is a good idea, however as you’ve seen, there are a couple minor conflicts with flake8. I would avoid applying black to existing files as it would potentially alter other code outside the scope of your contribution. We hope to eventually transition to dealing with this in

For now, it is best to use the current flake8 checks as they are.