Skip to content

bug: Restructure PER-CS rule sets#6707

Merged
Wirone merged 20 commits intoPHP-CS-Fixer:masterfrom
Crell:percs
Jun 6, 2023
Merged

bug: Restructure PER-CS rule sets#6707
Wirone merged 20 commits intoPHP-CS-Fixer:masterfrom
Crell:percs

Conversation

@Crell
Copy link
Copy Markdown
Contributor

@Crell Crell commented Dec 12, 2022

Resolves #6700.

This PR does a few things:

  1. Sets the plan to have pinned versions of PER-CS as it evolves. Right now there's just PERCS10 (1.0), but as PER-CS 2.0 is now out, that can be added in a follow-up.
  2. Introduces PERCS as a ruleset that just aliases to the latest release. So when PERCS20 is added, PERCS changes to point to that.
  3. Makes PER an alias to PERCS for BC. It can probably be deprecated and removed eventually, but I leave that to the maintainers to decide.

I don't know if there's any defaults elsewhere that should also be updated. Again, I defer to the maintainers.

@Crell Crell changed the title Restructure PER-CS rule sets. Restructure PER-CS rule sets Dec 12, 2022
Comment thread src/RuleSet/Sets/PERCS10Set.php Outdated
Comment thread src/RuleSet/Sets/PERCS10Set.php Outdated
Comment thread src/RuleSet/Sets/PERSet.php Outdated
Comment thread src/RuleSet/Sets/PERCS10Set.php
@Crell
Copy link
Copy Markdown
Contributor Author

Crell commented Dec 13, 2022

I've updated the names. Let me know if I did it right or if there's some other format I should use there. I wasn't clear if spaces were allowed.

I also realized I missed the "risky" sets before, so I added those as well.

@Crell
Copy link
Copy Markdown
Contributor Author

Crell commented Dec 22, 2022

Hm. Did I not use the names correctly? Please advise.

Comment thread src/RuleSet/Sets/PERCSSet.php Outdated
@Crell
Copy link
Copy Markdown
Contributor Author

Crell commented Dec 26, 2022

OK, I don't understand what the tests are objecting to now. Can someone help me out here? I'm confused as to what I'm still screwing up. 😄

@kubawerlos
Copy link
Copy Markdown
Member

Isn't the name of the test - testFixerDocumentationFileIsUpToDate - helping? Have you read https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/CONTRIBUTING.md? My bet would be you haven't run php dev-tools/doc.php.

BTW it is not illegal to run tests locally 😉

Comment thread src/RuleSet/Sets/PERCS10RiskySet.php
Comment thread src/RuleSet/Sets/PERCSRiskySet.php Outdated
Comment thread src/RuleSet/Sets/PERSet.php
@Crell
Copy link
Copy Markdown
Contributor Author

Crell commented Jan 13, 2023

OK, I think I got it this time. Let's see what the bot thinks.

@Crell Crell changed the title Restructure PER-CS rule sets bug: Restructure PER-CS rule sets Jan 13, 2023
@coveralls
Copy link
Copy Markdown

coveralls commented Jan 14, 2023

Pull Request Test Coverage Report for Build 4098266388

  • 25 of 25 (100.0%) changed or added relevant lines in 7 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.006%) to 92.956%

Totals Coverage Status
Change from base Build 4093635880: 0.006%
Covered Lines: 22724
Relevant Lines: 24446

💛 - Coveralls

@Crell
Copy link
Copy Markdown
Contributor Author

Crell commented Jan 28, 2023

Anyone else still interested in this PR, now that it's actually passing? 😄

@keradus
Copy link
Copy Markdown
Member

keradus commented Jan 29, 2023

you put per-cs1.0 in test fixture name, but keep PERCS10Set for Set classname file.
what do you think about using 1x0 in filename to indicate the dot? ref #6707 (comment) [I believe it's last still open comment]

Comment thread src/RuleSet/Sets/PERCS1x0Set.php
@Crell
Copy link
Copy Markdown
Contributor Author

Crell commented Feb 19, 2023

Anything else that needs to be done here?

@viktorprogger
Copy link
Copy Markdown

viktorprogger commented Apr 4, 2023

It's released today! 🎉 But it's 2.0 instead of 1.1.
https://github.com/php-fig/per-coding-style/releases

@Crell
Copy link
Copy Markdown
Contributor Author

Crell commented Apr 4, 2023

All the more reason we should get this code merged soon so work can start on the 2x0 ruleset... 😄

I'm not going to try and fix the conflicts until I hear from someone with merge access that this approach is acceptable. No sense doing (more) work if it's not going to be accepted.

@Wirone
Copy link
Copy Markdown
Member

Wirone commented May 19, 2023

@Crell I really would like to get it merged, but I need some time to get familiar with it. I believe all @keradus' doubts were addressed, @kubawerlos gave approval, for me it looks good at first glance (deprecate too general ruleset + introduce version specific rulesets), I just need to dig deeper into provided changes and previous discussions.

If you don't mind, I can rebase it to get rid of the conflicts and to trigger new CI pipeline. But of course you can do it too 🙂. Let me know, thanks in advance.

@Crell
Copy link
Copy Markdown
Contributor Author

Crell commented May 19, 2023

You'll probably have a chance to rebase it before I will, so feel free. I am happy to answer questions about it, though "why is it done that way?" is mostly answered by "because some other PR reviewer said to and I don't know the tool well enough to disagree." 😄

(Also updated the description to account for there now being a PER-CS 2, not 1.1.)

Copy link
Copy Markdown
Member

@Wirone Wirone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General idea is OK for me, but I have some doubts, 2 most important are:

Comment thread src/RuleSet/Sets/PERRiskySet.php Outdated
Comment thread src/RuleSet/Sets/PERSet.php Outdated
Comment thread src/RuleSet/Sets/PERCS10RiskySet.php
Comment thread src/RuleSet/AbstractRuleSetDescription.php Outdated
Comment thread src/RuleSet/Sets/PERCS1x0RiskySet.php
Comment thread src/RuleSet/Sets/PERCSRiskySet.php Outdated
Comment thread src/RuleSet/Sets/PERCSSet.php Outdated
Comment thread src/RuleSet/Sets/PERCSRiskySet.php Outdated
Comment thread src/RuleSet/Sets/PERCSSet.php Outdated
Co-authored-by: Greg Korba <wirone@gmail.com>
Comment thread src/RuleSet/AbstractRuleSetDescription.php Outdated
@Wirone
Copy link
Copy Markdown
Member

Wirone commented May 31, 2023

@Crell are you able to address last 2 concerns (this and this)? We could finish it 🙂.

@Crell
Copy link
Copy Markdown
Contributor Author

Crell commented May 31, 2023

I thought you had taken over. 😄 Here's a stab at it. Let's see if the bot approves.

Once this is done, we should figure out how to get PER-CS 2 implemented. There are probably going to need to be a few new rules.

@Crell Crell mentioned this pull request Jun 5, 2023
8 tasks
@Crell
Copy link
Copy Markdown
Contributor Author

Crell commented Jun 5, 2023

@Wirone Back at you.

It was added at some point, but is not used since both added PER-CS rule sets have hardcoded `getName()`.
@Wirone
Copy link
Copy Markdown
Member

Wirone commented Jun 6, 2023

I am not 100% sure about current file/class naming (PERCS1x0Set and PERCS1x0RiskySet), because looking at other sets none of them uses NxN notation - both PHP and PHPUnit related sets have only numbers (like PHPUnit100MigrationRiskySet, but I believe we can change those files/classes names when needed, leaving actual set's name as-is. It is something that should be standardise somehow, but it's out of scope of this PR.

So.. I'm going to merge it and if anything looks wrong to @keradus we can change it later, before release.

@Wirone Wirone merged commit 44398f1 into PHP-CS-Fixer:master Jun 6, 2023
@Wirone
Copy link
Copy Markdown
Member

Wirone commented Jun 6, 2023

Thank you very much @Crell 🍻

@Crell
Copy link
Copy Markdown
Contributor Author

Crell commented Jun 6, 2023

Excellent! Now someone can start on the PER-CS 2.0 ruleset. 😄

@Crell Crell deleted the percs branch June 6, 2023 13:58
niklam pushed a commit to niklam/PHP-CS-Fixer that referenced this pull request Jun 19, 2023
Co-authored-by: Julien Falque <julien.falque@gmail.com>
Co-authored-by: Dariusz Rumiński <dariusz.ruminski@gmail.com>
Co-authored-by: Greg Korba <greg@codito.dev>
@Wirone Wirone mentioned this pull request Jul 19, 2023
10 tasks
@Wirone Wirone mentioned this pull request Aug 23, 2023
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PER ruleset is misnamed

7 participants