-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[11.x] Add Laravel Pint #53835
base: 11.x
Are you sure you want to change the base?
[11.x] Add Laravel Pint #53835
Conversation
- use an empty preset - set 1 explicit rule - ignore `/tests` (for now)
We can for sure make this possible inside of StyleCI. The idea is to have the |
I think this is a much better approach than running both at once., |
my only reason for running both at once, for a short time, would be to sync them up without causing too much turmoil. as stated, my end goal would be to get it fully moved over to Pint rather quickly. |
This is really nice for contributors. I often see myself getting style ci errors when creating new PRs. With this, contributors can run it before submitting their PRs. |
The idea is that it doesn't matter that StyleCI failed. It's fixes just get merged in with the PR, as it's merged. |
Which is also now possible with Github CI. So Pint and StyleCI are on level footing here. While not needed, it is nice to be able to run it locally before submitting a PR, and making sure everything passes. https://laravel.com/docs/11.x/pint#running-tests-on-github-actions |
I get that, but I still think this is a good idea to have locally. Personally, I prefer committing with CS fixes applied beforehand. |
I kinda like the hand-crafted indents to align stuff... |
I still don't think we should move to
Even with |
thanks for the insight @crynobone. couple of clarifying questions:
|
StyleCI doesn't cover it because it was made to follow Taylor preferred style from the start. I'm not talking about now, but mainly in the near future when pint is updated with new
It's still a maintainer nightmare, again I don't see this an issue for 1st party packages as we rarely get PRs but the framework (currently at 43 pending PRs) it a big task. Again, StyleCI handles styling errors for us without thinking about formatting. We never reject PRs if CI only failed due to StyleCI pipeline. |
the problem is not that I disagree with the styling choices made previously. the issue is that there are new scenarios that have arisen from either new PHP language changes or newly used patterns that StyleCI seems to be (currently) unable to address. my understanding is the "empty" preset has 0 rules. therefore any updates to the Pint or PHP-CS-FIXER package would have no effect as we are defining our desired rules explicitly. |
What happens when someone PR adds new rules to
All these will adds additional work to maintainers when it was never been an issue at the moment. |
The only failure recently was the new Even with pint with php:
preset: laravel
version: 8.2
+ enabled:
+ - nullable_type_declarations |
I think it's incredibly important in any discussion to have a clear understanding of the problem so everyone is on the same page, so let me lay some things out that I believe to be true:
|
A lot of my recent PRs have been focused on bringing some styling consistency to this repo. PRs are fine, but automation is better, and that's what this PR adds.
In #53748 I made changes so chained calls on newlines are indented exactly once, and laid out why I think that is the best option. This PR will automate that change. The only non-whitespace changes are the
composer.json
and thepint.json
files.We are currently using StyleCI in our pipeline, and my first attempt was to try and use StyleCI to enforce this standard. Unfortunately, as far as I can tell, it's not possible with StyleCI.
Based on a comment from @crynobone in #53807, it seems like there are currently some logistical annoyances with using a Pint preset, so my proposal is that to start we use both StyleCI and Pint in tandem, and for Pint we do NOT use a preset, but rather explicitly add rules 1 by 1 that StyleCI is currently unable to handle. The end goal would be to get everything moved over to explicit rules via Pint and drop StyleCI. An additional benefit of this would be contributors could run Pint locally prior to submitting PRs as well.
I excluded the
/tests
directory to start just to keep it simple and easier to review, but would also like to add that back in eventually.It looks like you're deferring to some CI stuff maybe stored at the organization level that I don't have access to, so I thought it might be best to leave that part to you guys.