ssec / sift

A visualization application for satellite imagery
http://sift.ssec.wisc.edu/
GNU General Public License v3.0
46 stars 14 forks source link

Fix all code style issues identified by flake8 #320

Closed djhoese closed 2 years ago

djhoese commented 2 years ago

While working on CI stuff I added automatic linting of the code. This found a lot of issues. You can run it locally with:

pip install flake8 flake8-debugger flake8-bugbear
flake8 uwsift

This PR fixes all the issues that were found. It also adds a pre-commit config which you can use by doing:

pip install pre-commit
pre-commit install

With this, linting is automatically done when you make a commit and if it finds anything you won't be able to commit until you fix the issues.

The config is relatively limited right now for a couple reasons:

  1. I usually use the "black" autoformatter but didn't want to for SIFT until we've combined the EUMETSAT code more thoroughly since it is going to cause unnecessarily difficult merge conflicts.
  2. I usually have "isort" for sorting imports automatically. Didn't do it for the same reason as not using black.
  3. I disabled checking docstrings with flake8-docstrings since it would take years to update all the docstrings in SIFT. I've disabled checking them by including ignore = D, in the setup.cfg under the flake8 section.