Yii Framework Forum: Introduce Code convention - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Introduce Code convention

#1 User is offline   Bergtroll 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 40
  • Joined: 20-August 09

Posted 13 April 2012 - 05:04 AM

I know that this topic has been discussed in this forum and led to religious wars :-D. I would like to sum my minds and add some facts that really matter for our work and why I would strongly suggest code conventions because it makes a big difference for the workload in the end. We make extensive use of PHP checkstyle over here. The reason is, that every team member shall be able to change every line of code, we do not have code ownership, the team owns the code.

Unfortunately, with diverging style habitats, not only formatting, but naming and so on every change by a different developer usually not only changes the lines where the new functionality is implemented but also every other line because of reformatting. This is a big problem, since we are doing a lot of branches and merges using git and it es quite simple to do the merge, when the differences shown are only, where there is a difference in functionality. It becomes pure horror, when the whole file is shown as different caused only by different formatting.

This leads us to the next point. I really like the idea of sharing extensions for Yii. But the big problem for us is, that we usually have to do minor to major adaptions to the extensions and we therefore put it under version control as well. If the coding style used in an extensions is quite different from ours, it makes Checkstyle go crazy and makes the CI server sending a hellish red to the xtreme feedback device, melting our smartphones in agony. So we usually do not use most of the extensions, because adapting it to our style needs often takes longer than desirable. So please consider developing a code convention and provide a checkstyle configuration file for it.

Kind regards,

Bergtroll
0

#2 User is offline   Ivica 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 317
  • Joined: 25-May 11

Posted 15 April 2012 - 11:26 PM

I agree with you, we would like if there would be some style/code conventions.

But for your issue, can you exclude some extension folders from checkstyle? On Zurmo, we also have our own style checker, and we excluded extension folders from style checking. It doesn't worth modifying them, and what if authors publish improved version of their extension, you will have nightmare to update them.
Zurmo: Yii Powered Open Source CRM
zurmo.org
0

#3 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,778
  • Joined: 17-January 09
  • Location:Russia

Posted 16 April 2012 - 07:57 AM

I'm working on the style itself. Probably will add config for phpcs when style guide itself will be finished.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
2

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users