Open maxpatiiuk opened 9 months ago
Yay someone read my post!
Interesting that lint-staged
can work on Git diffs. Unfortunately it seems that in Rust land, clippy
lints the whole project (probably because it needs global information).
The code under name: Commit linted files (if made any changes)
looks useful for applying the changes. This is cool that it keeps the author
git config --local committer.name "$( git log -1 --pretty=format:'%cn' )"
git config --local committer.email "$( git log -1 --pretty=format:'%ce' )"
I wonder if it is only possible to trigger only on a comment. Or maybe just doing it automatically might be fine...? Will think about it 👍
This is in response to your Cool things in '23 post:
I do not know know about rust-tooling, but in JavaScript-land there exists lint-staged to run pre-configured linters on files that were changed between main and the head of a branch the PR is on.
There is also husky for running lint-staged as a pre-commit hook in Git (so that devs get feedback even before commit is made, even if they don't have rustfmt in their IDEs)
I am not opening a PR for this as I am not sure if you would be open to having npm-based tools added in this repository, but here is how the above could be configured:
Create
lint-staged.config.js
:Install dependencies:
Add this to scripts section in package.json:
Create GitHub Action workflow
lint.yml
:Alternatively, instead of using npm's
lint-staged
, there is a GitHub action dorny/paths-filter Example usage in https://github.com/specify/specify7/blob/production/.github/workflows/test.yml