-
Notifications
You must be signed in to change notification settings - Fork 148
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
[1.x] Adds --diff
option
#327
Conversation
@ProjektGopher Thanks! Could you send a documentation PR for this? 👍 |
What happen when Or if one is used, the other should no longer be used? |
@parallels999 I haven't tested that, but from what I remember of the logic, one would just override the other (I don't remember the order in which they show up). I suspect the |
Thanks for answer, that's what I imagine |
This PR is how I've always wished the
--dirty
flag worked.pint --dirty
will lint staged and unstaged files (and possibly untracked?). But once a file is committed, it will not be touched again bypint --dirty
, whether or not it passes. The only time it will be linted is when we run pint on the whole project again.This also means that running
pint --dirty
in CI is pointless, since all the files have already been committed, meaning we'll lint nothing. But running Pint without any flags can take upto five minutes in a large project, and that feedback cycle sucks.pint --diff=main
will collect all committed, staged, unstaged, and untracked files that differ from the provided branch. Meaning that if we've got a PR that only touches 5 files, we can now runpint --diff=main
in CI, and we're only going to look at those 5 files, saving a ton of time.We can also use this effectively locally. If your regular workflow is to create a branch from within a new issue, then check that branch out locally, your
main
branch might not be up to date withorigin
. Runningpint --diff=main
might not give you the results you'd expect then. However usingpint --diff=origin/main
can help speed up your feedback cycle dramatically.Note
I added a new method to the
PathsRepository
contract, which could be considered a breaking change.Here's the commit to revert if you need to:
git revert e295403a66c145e9b5530d3e5f9614875fc90162