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

[1.x] Adds --diff option #327

Merged
merged 11 commits into from
Jan 6, 2025
Merged

Conversation

ProjektGopher
Copy link
Contributor

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 by pint --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 run pint --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 with origin. Running pint --diff=main might not give you the results you'd expect then. However using pint --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

@taylorotwell taylorotwell merged commit cc904c0 into laravel:main Jan 6, 2025
6 checks passed
@taylorotwell
Copy link
Member

@ProjektGopher Thanks! Could you send a documentation PR for this? 👍

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

Successfully merging this pull request may close these issues.

2 participants