ConaireD / TolimanWIP

WIP Toliman codes go here before being added to the main TOLIMAN github
Other
0 stars 0 forks source link

Use `Black`. #14

Closed Jordan-Dennis closed 1 year ago

Jordan-Dennis commented 1 year ago

Hi all, Black is a code linter that automatically reformats incorrect code. I want to use it for consistency in this project and will probably use it with the pytest-black plugin. Black does not cover all the common PEPs so I will also use flake8 and pytest-flake8 for even better reporting on formatting. Regards Jordan.

Jordan-Dennis commented 1 year ago

Because pytest has so many plugins there is the alternative option to pytest-flake8 of using pytest-pep8. I will need to research/compare the pair.

Jordan-Dennis commented 1 year ago

A useful feature of black is the --diff option which shows you what it would change.

Jordan-Dennis commented 1 year ago

I think that we also use black on the tests. This will be nice in the sense that we will be guaranteed to have nice tests.

Jordan-Dennis commented 1 year ago

I am impressed with black although I have not yet tried it with flake8. I am closing this issue in the meantime.

Jordan-Dennis commented 1 year ago

pytest-black does not do a huge amount not going to lie but I think it will be useful in the long run. Basically, it adds an extra test per file that fails if black finds changes.

Jordan-Dennis commented 1 year ago

Based on the discussion in #22 I will be removing pytest-black as a dependency.