Skip to content

QA: "normalize" the code style rules used by this code base a little #155

Open
@jrfnl

Description

@jrfnl

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:

  1. End comments at the end of "long" control structures/functions/classes.
  2. else if instead of elseif
  3. No spaces around a concatenation operator.
  4. The case/default statements in switch statements not being indented by four spaces - changing this would cause lots of code churn in the test files though.
  5. Unnecessary blank lines at the end of each function/class.

I'm opening this issue to allow for people to voice their opinion on this.

  • Do the above five rules bother you or not ?
  • Are there other rules, not mentioned above, which catch you out often when contributing ?
  • Do you think the code churn caused by changing these rules and updating the code base to comply is worth it ?

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions