-
-
Notifications
You must be signed in to change notification settings - Fork 73
QA: "normalize" the code style rules used by this code base a little #155
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
Comments
Yes, they bother me a bit. Especially items number 1, 4, and 5. I'm ok with changing items number 2 and 3 as well.
I'm not a fan of Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned as it causes changes on unrelated lines and causes larger diffs. Example: https://github.com/PHPCSStandards/PHP_CodeSniffer/pull/179/files#diff-b9f974c9e5e2ca608e335ac55aa95730811bcaef7590ad41b4d59d5444f296c9R47 (only the highlighted line actually changed).
I think so. Especially for rules that can be changed automatically using |
The protip for reviewing code like this is to turn on the hide whitespace option (props to Juliette for mentioning this to me 😄 ) ![]() |
Another one to add to the "catches me out/contrary to industry standard" list:
One for a later point in time once there is a sniff available which can enforce this:
|
I've just opened PR #225 for yet another annoyance, but one which is serious enough that it decreases productivity. See the PR description for the reasoning. |
Suggested by @fredden :
|
@jrfnl in #924 you mentioned some coding standard rules that you intend to change as part of the 4.0.0 release. That sounds related to this issue. Do you have a proposed I think the idea is to eventually switch over to using PHPCSDevCS, but that we are looking for an incremental change on that journey for now. |
@fredden For now I have bits and pieces in a few different branches - largely those things outlined above. It's one of the last changes I will apply to the branch as those commits would need updating every time something changes in the 3.x branch (and I rebase on top of it). |
The coding standard of this code base was historically/organically grown and is likely influenced by some internal rules which were being used in Squiz projects at one time or another.
Changing the code style to PSR12 with some extra rules (i.e. PHPCSDevCS) would cause lots and lots of code churn, so is not on the table at this time.
However, I do think there are some rules which can (and should) be changed in the near future.
On the one hand, these rules cause code churn on lines unrelated to the actual code change being made.
On the other hand, these rules catch contributors out a lot as they are contrary to what most code bases nowadays expect, making contributing to this code base more painful for new contributors than necessary.
My personal top 5 of "annoying" rules which are being enforced is:
else if
instead ofelseif
case
/default
statements inswitch
statements not being indented by four spaces - changing this would cause lots of code churn in the test files though.I'm opening this issue to allow for people to voice their opinion on this.
I'm going to leave this ticket open for a few weeks and will decide on a course of action and timeline after that.
/cc @fredden
The text was updated successfully, but these errors were encountered: