napari / cookiecutter-napari-plugin

Cookiecutter for napari plugins
BSD 3-Clause "New" or "Revised" License
67 stars 39 forks source link

pre-commit fails on fresh package #109

Closed dstansby closed 2 years ago

dstansby commented 2 years ago

I just created a new package from this recipe, and thought I'd try running pre-commit without changing anything myself. It failed with the following output - it would be good to fix these errors in the cookiecutter 😃

check docstring is first.................................................Passed
fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing docs/index.rst
Fixing .github/workflows/test_and_deploy.yml
Fixing .gitignore
Fixing src/napari_matplotlib/napari.yaml

trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing setup.cfg
Fixing .github/workflows/test_and_deploy.yml
Fixing .napari/DESCRIPTION.md
Fixing src/napari_matplotlib/napari.yaml
Fixing src/napari_matplotlib/_tests/test_widget.py
Fixing tox.ini

setup-cfg-fmt............................................................Failed
- hook id: setup-cfg-fmt
- exit code: 1
- files were modified by this hook

Rewriting setup.cfg

flake8...................................................................Failed
- hook id: flake8
- exit code: 1

src/napari_matplotlib/__init__.py:11:1: F401 '._widget.ExampleQWidget' imported but unused
src/napari_matplotlib/__init__.py:11:1: F401 '._widget.example_magic_widget' imported but unused
src/napari_matplotlib/__init__.py:11:1: E303 too many blank lines (5)
docs/conf.py:15:1: F401 'sys' imported but unused
docs/conf.py:16:1: F401 'os' imported but unused
docs/conf.py:17:1: F401 'shlex' imported but unused
docs/conf.py:22:1: E265 block comment should start with '# '
docs/conf.py:27:1: E265 block comment should start with '# '
docs/conf.py:45:1: E265 block comment should start with '# '
docs/conf.py:74:1: E265 block comment should start with '# '
docs/conf.py:76:1: E265 block comment should start with '# '
docs/conf.py:84:1: E265 block comment should start with '# '
docs/conf.py:87:1: E265 block comment should start with '# '
docs/conf.py:91:1: E265 block comment should start with '# '
docs/conf.py:95:1: E265 block comment should start with '# '
docs/conf.py:101:1: E265 block comment should start with '# '
docs/conf.py:104:1: E265 block comment should start with '# '
docs/conf.py:119:1: E265 block comment should start with '# '
docs/conf.py:122:1: E265 block comment should start with '# '
docs/conf.py:126:1: E265 block comment should start with '# '
docs/conf.py:129:1: E265 block comment should start with '# '
docs/conf.py:133:1: E265 block comment should start with '# '
docs/conf.py:138:1: E265 block comment should start with '# '
docs/conf.py:148:1: E265 block comment should start with '# '
docs/conf.py:152:1: E265 block comment should start with '# '
docs/conf.py:156:1: E265 block comment should start with '# '
docs/conf.py:159:1: E265 block comment should start with '# '
docs/conf.py:163:1: E265 block comment should start with '# '
docs/conf.py:166:1: E265 block comment should start with '# '
docs/conf.py:169:1: E265 block comment should start with '# '
docs/conf.py:172:1: E265 block comment should start with '# '
docs/conf.py:175:1: E265 block comment should start with '# '
docs/conf.py:178:1: E265 block comment should start with '# '
docs/conf.py:181:1: E265 block comment should start with '# '
docs/conf.py:186:1: E265 block comment should start with '# '
docs/conf.py:189:1: E265 block comment should start with '# '
docs/conf.py:195:1: E265 block comment should start with '# '
docs/conf.py:199:1: E265 block comment should start with '# '
docs/conf.py:203:1: E265 block comment should start with '# '
docs/conf.py:211:1: E122 continuation line missing indentation or outdented
docs/conf.py:212:1: E122 continuation line missing indentation or outdented
docs/conf.py:212:1: E265 block comment should start with '# '
docs/conf.py:214:1: E122 continuation line missing indentation or outdented
docs/conf.py:215:1: E122 continuation line missing indentation or outdented
docs/conf.py:215:1: E265 block comment should start with '# '
docs/conf.py:217:1: E122 continuation line missing indentation or outdented
docs/conf.py:218:1: E122 continuation line missing indentation or outdented
docs/conf.py:218:1: E265 block comment should start with '# '
docs/conf.py:220:1: E122 continuation line missing indentation or outdented
docs/conf.py:221:1: E122 continuation line missing indentation or outdented
docs/conf.py:221:1: E265 block comment should start with '# '
docs/conf.py:228:80: E501 line too long (114 > 79 characters)
docs/conf.py:234:1: E265 block comment should start with '# '
docs/conf.py:238:1: E265 block comment should start with '# '
docs/conf.py:241:1: E265 block comment should start with '# '
docs/conf.py:244:1: E265 block comment should start with '# '
docs/conf.py:247:1: E265 block comment should start with '# '
docs/conf.py:250:1: E265 block comment should start with '# '
docs/conf.py:258:80: E501 line too long (84 > 79 characters)
docs/conf.py:263:1: E265 block comment should start with '# '
docs/conf.py:272:80: E501 line too long (82 > 79 characters)
docs/conf.py:273:80: E501 line too long (80 > 79 characters)
docs/conf.py:278:1: E265 block comment should start with '# '
docs/conf.py:281:1: E265 block comment should start with '# '
docs/conf.py:284:1: E265 block comment should start with '# '
docs/conf.py:287:1: E265 block comment should start with '# '
src/napari_matplotlib/_tests/test_widget.py:6:1: E302 expected 2 blank lines, found 1
src/napari_matplotlib/_tests/test_widget.py:21:1: E302 expected 2 blank lines, found 1
src/napari_matplotlib/_widget.py:33:37: F821 undefined name 'napari'
src/napari_matplotlib/_widget.py:40:40: F821 undefined name 'napari'

autoflake................................................................Failed
- hook id: autoflake
- files were modified by this hook
isort....................................................................Failed
- hook id: isort
- files were modified by this hook

Fixing /Users/dstansby/projects/napari/napari-matplotlib/src/napari_matplotlib/_tests/test_widget.py
Fixing /Users/dstansby/projects/napari/napari-matplotlib/src/napari_matplotlib/_widget.py

black....................................................................Failed
- hook id: black
- files were modified by this hook

reformatted src/napari_matplotlib/__init__.py
reformatted src/napari_matplotlib/_tests/test_widget.py
reformatted docs/conf.py

All done! ✨ 🍰 ✨
3 files reformatted, 2 files left unchanged.

pyupgrade................................................................Failed
- hook id: pyupgrade
- exit code: 1
- files were modified by this hook

Rewriting docs/conf.py

napari-plugin-checks.....................................................Passed
tlambert03 commented 2 years ago

when you run it a second time, did it auto fix everything? or were there any remaining changes that it wasn't able to fix automatically? On one hand, this could be a moving target i.e. if any of the pre-commit hooks change their rules, then we'll need to update it here again... We could have a periodic action that does this and makes a PR, but if the first run of pre-commit in the target package fixes it anyway, it's slightly less critical. On the other hand, i agree, that's a bit confusing!! and it looks like the whole package is a mess! :)