# Fixing Flake8 Errors for plugin contribution

**URL:** <https://discourse.beets.io/t/fixing-flake8-errors-for-plugin-contribution/1454>\
**Category:** Development\
**Created:** [August 4, 2020, 4:06pm UTC](https://discourse.beets.io/t/fixing-flake8-errors-for-plugin-contribution/1454 "2020-08-04T16:06:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidswarbrick](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/davidswarbrick/32/458_2.png) [@davidswarbrick](https://discourse.beets.io/u/davidswarbrick)\
**Post date:** [August 4, 2020, 4:06pm UTC](https://discourse.beets.io/t/fixing-flake8-errors-for-plugin-contribution/1454/1 "2020-08-04T16:06:38Z")

</div>

I previously started work on PR [#3560](https://github.com/beetbox/beets/pull/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:

```auto
beetsplug/tweet.py:53:1: D107 Missing docstring in __init__
beetsplug/tweet.py:74:1: 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 `setup.py` 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 `setup.py`:

```auto
setup.py:82:61: E231 missing whitespace after ','
setup.py:82:63: E231 missing whitespace after ','
setup.py:137:70: 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!

---

<div class="post-metadata">

**Author:** ![jtpavlock](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/jtpavlock/32/443_2.png) [@jtpavlock](https://discourse.beets.io/u/jtpavlock)\
**Post date:** [August 4, 2020, 6:39pm UTC](https://discourse.beets.io/t/fixing-flake8-errors-for-plugin-contribution/1454/2 "2020-08-04T18:39:19Z")

</div>

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 [https://github.com/beetbox/beets/pull/3694](https://github.com/beetbox/beets/pull/3694)

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