-
-
Notifications
You must be signed in to change notification settings - Fork 413
Description
Is your feature request related to a problem? Please describe.
It is obvious that not everyone/everything(!) is using pre-commit, which is OK as it was never a requirement. We have been aware of the discrepancies between the checks of pre-commit (as per the config file) and the checks we use in CI (in particular the super-linter). Unsurprisingly, this have now lead to issues to update some files without making unrelated changes (because pre-commit will not allow it). I recently experienced it first-hand making changes to a yaml file with modifications made by Renovate bot update.
Describe the solution you'd like
This situation can be mitigated by using pre-commit.ci for this repository.
For this to work the following pull requests need to be merged:
- CI: fix pre-commit warnings/errors in linting #3246 addressing the pre-commit errors/warnings from running a check on the whole source.
- checks: set min-space to 1 for in-line comments in pre-commit yaml files #3254 updating the config file to allow the specific deviation the Renovate commits usually causes, it is also preparing the config file to the use of pre-commit.ci.
To then enable pre-commit.ci on this repo, an admin with enough access rights, need to sign into GitHub via https://pre-commit.ci and give it repository access. That's all there is to do. The config file .pre-commit-config.yaml does the rest.
Now, how does this work in real life?
Every commit is checked by pre-commit.ci as if pre-commit were executed locally: the hooks that are formatters, e.g. 'trailing-whitespace', 'black', clang-format' actually do the format and the changed files are added with a new commit to the PR. The other hooks only fails the workflow.
As we always squash the PRs, the automatically added commit do not matter much for the commit history of main. But the commit need to be pulled before adding any additional commits by the PR submitter. This is the main "drawback" with this, but as long as we are aware of this it may be acceptable.
You can see how it works/look like in my test-field at nilason#5.
Describe alternatives you've considered
There are no good alternatives that come to my mind.