super-linter icon indicating copy to clipboard operation
super-linter copied to clipboard

Add pre-commit to run as a standalone linter

Open ferrarimarco opened this issue 2 years ago • 4 comments

Is your feature request related to a problem? Please describe.

Pre-commit has quite a few useful (Python-based) hooks: https://github.com/pre-commit/pre-commit-hooks

We could (relatively) easily integrate it because it supports a standalone mode. Example:

pre-commit run --all-files

Describe the solution you'd like

Run pre-commit as part of super-linter

Additional context

We could also deprecate bash-exec and git-merge-conflict-markers, and rely on those pre-commit hooks instead.

@lindluni What do you think?

ferrarimarco avatar Dec 22 '22 10:12 ferrarimarco

I love this idea! Especially to replace bash-exec, but it would be great to pick up at least some of their out of the box hooks.

lindluni avatar Jan 05 '23 03:01 lindluni

Using pre-commit would also open a way of eventually offloading some tasks. For example, instead of maintaining linter installation, we might leverage pre-commit hooks because pre-commit already knows how to install (some) things.

ferrarimarco avatar Jan 05 '23 13:01 ferrarimarco

This might be a bit off topic, so happy to create another PR if you want to tackle it separately...

Would you also consider adding a pre-commit-hook for super-linter? This way we wouldn't have to define various linters for each repo but we could only use super-linter in the pre-commit-config.yaml file.

tunayokumus avatar Feb 17 '23 16:02 tunayokumus