django-planet
Jan. 24, 2024

pre-commit: Block files based on name with a custom “fail” hook

published by Adam Johnson
in blog Adam Johnson
original entry pre-commit: Block files based on name with a custom “fail” hook

This post is an adapted extract from my book Boost Your Django DX, as updated last week.

pre-commit’s “fail” virtual language fails all files that it matches. Combine it with pre-commit’s file name and type matching to block unwanted files in your repository.

Let’s try it out …