biglocalnews / warn-scraper

Command-line interface for downloading WARN Act notices of qualified plant closings and mass layoffs from state government websites
https://warn-scraper.readthedocs.io
Apache License 2.0
28 stars 10 forks source link

Check pre-commit in GitHub Actions #626

Closed chriszs closed 3 months ago

chriszs commented 4 months ago

This PR consolidates linting and type checking into a single step in CI which uses pre-commit. The benefit of this is that it enforces the use of pre-commit when submitting a PR, flagging when somebody has forgotten to do so and thus preventing the introduction of formatting issues into the code base (which will subsequently trip up anyone contributing to those files). This also upgrades mypy to 1.9.0 to clear an apparently erroneous pre-commit type checking error (error: Self? has no attribute "post" [attr-defined] when I ran pipenv run pre-commit run --all) and fixes formatting issues that have snuck in throughout the code base.

Closes #625

chriszs commented 3 months ago

This was a relatively simple change when I first filed it, but it has gotten more complicated. Here's what I have had to do:

These last couple of changes were not strictly related, but were effectively required to get CI to pass while installing packages because package versions are allowed to float, causing various package versioning mismatches.

chriszs commented 3 months ago

Also updated the versions in pre-commit to match the versions in Pipfile.lock by using pre-commit autoupdate.

stucka commented 3 months ago

I'm speechless here, @chriszs . You are absolutely amazing.

Everything looks stellar, just stunning.

Just to double-check one thing right at the beginning -- you're replacing the old linting step with a call to run precommit, so there's no repetition?

chriszs commented 3 months ago

@stucka Yes, that's right.