Update the autoflake pre-commit hook #43
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The mirrors-autoflake pre-commit was giving the following error:
due to the fact that the
mirrors-autoflake
repository that our "autoflake" pre-commit hook uses has been deprecated since the officialautoflake
released functionality that supports its use with pre-commit, and therefore was stopped from being maintained more than 2 years ago.In that time, python has deprecated its
distutils
module from version 3.10 onwards (can read up on that here), whichmirrors-autoflake
still relies on, meaning it will always give the same error within our pre-commit setup (that seems to be using 3.12 as default as can be seen from the python ref in the error traceback).To solve this, I have opted to point our "autoflake" pre-commit hook in the direction of the latest version of the official
autoflake
repo which doesn't have this dependency. Rather than override pre-commit's default_language_version to 3.8 (or any version < 3.10).