mattlqx / pre-commit-search-and-replace

Plugin for pre-commit for arbitrary search and replace on committed files.
MIT License
12 stars 7 forks source link

Add a file argument to run searches only on specific files #7

Closed mildblimp closed 3 years ago

mildblimp commented 3 years ago

This can be helpful if the string is common but should be disallowed in a particular file.

mattlqx commented 3 years ago

This is actually native to pre-commit itself. In the .pre-commit-hooks.yaml config where you're activating the hook, you can use exclude: to exclude a list of files. There's a good example of this w/ regex here.

mildblimp commented 3 years ago

Ah of course! You are totally right, my apologies.