Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use pre-commit.ci lite bot for applying code fixes like linting #265

Closed
philipp-baumann opened this issue Jul 18, 2024 · 3 comments
Closed

Comments

@philipp-baumann
Copy link
Collaborator

philipp-baumann commented Jul 18, 2024

I'd propose to use the pre-commit.ci lite bot to apply styling/linting. The main advantage it does auto-fixing when needed. https://pre-commit.ci/lite

So this would apply styling automatically. It could deal with cases like this as well: #257
Here is an example setup I implemented for one of my packages a while ago, here is action for applying to a PR branch.

spectral-cockpit/opusreader2@abe3edc

What we would need to do is 1) authorize the bot on the repo, 2) define something like here but with newer version tags maybe: https://github.com/spectral-cockpit/opusreader2/blob/main/.github/workflows/code-check.yml 3) add a minimal pre-commit config and add style-files hook (https://cran.r-project.org/web/packages/precommit/vignettes/available-hooks.html) i have used a bit a more extensive setup but to illustrate https://github.com/spectral-cockpit/opusreader2/blob/main/.pre-commit-config.yaml

@b-rodrigues
Copy link
Contributor

b-rodrigues commented Jul 18, 2024

So we could replace the current styler action? Styler does the fixing as well, and as it's currently configured, it opens a PR. I don't mind changing, but what would be the advantage over what we have now? Fixing for PRs as well?

@philipp-baumann
Copy link
Collaborator Author

So we could replace the current styler action? Styler does the fixing as well, and as it's currently configured, it opens a PR. I don't mind changing, but what would be the advantage over what we have now? Fixing for PRs as well?

like discussed on matrix. The advantage i see is auto-fixing directly in the PR and a green lint CI in PRs. Priority is not super high. I could do a minimal setup if i find a little bit of time.

@philipp-baumann
Copy link
Collaborator Author

closing, as lessons learnt, see in PR comments #295

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants