Skip to content
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

Consider switching coding standards to use Zend Framework Coding Standard #617

Closed
mattab opened this issue Mar 20, 2009 · 6 comments
Closed
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.

Comments

@mattab
Copy link
Member

mattab commented Mar 20, 2009

Currently Piwik Coding Standard are documented here: [Piwik Coding Standard](http://dev.piwik.org/trac/wiki/CodingStandard).

But they have a number of slight differences with the Zend Framework Coding Standards, that are not justified. It would be ideal if Piwik used the same (very standard and widely used) [Zend Framework Coding Standard](http://framework.zend.com/manual/en/coding-standard.html).

Main differences:
- if else bracket indentation. The one used in Piwik makes the code a bit harder to read as it takes more lines.
- using four spaces for for indentation rather than tabs

Is there a script (or eclipse plugin for example) we can use to run all Piwik .php against, to automatically modify all files against this standard?

After quick research there seem to be [some solution](http://cogo.wordpress.com/2008/07/13/enforcing-a-php-coding-standard-using-php_codesniffer-part-2/)

Note that we’re not looking into adding a post commit hook to enforce that the guide is respected, it’s more about fixing the existing code in an automated manner in a “one shot” run of some script.

If anybody wants to tackle this, please comment! thanks.

@anonymous-matomo-user
Copy link

keep tabs please. not everybody prefers an indentation of 4 spaces

@mattab
Copy link
Member Author

mattab commented Mar 29, 2010

The Zend coding standards state 4 spaces, so if we follow them directly (which is what the idea is for now), it would be 4 spaces.

The next step is to find an automated solution to convert all existing code to new standards.

@robocoder
Copy link
Contributor

vote wontfix. Inflating the files to conform to a whitespace "standard is silly.

We also deviate from ZF's class naming standards, i.e.,

  • 'core/' & 'plugins/' instead of 'Piwik/'
  • one class per file

@mattab
Copy link
Member Author

mattab commented Mar 29, 2010

My main motivation was the change in curly brackets, put at the end of the line rather that on its own line. I came to like this presentation more after programming in Java.. now it might not be a good enough reason ;)

@mattab
Copy link
Member Author

mattab commented Mar 31, 2010

OK I think This is not as important as other things. If someone finds an automated way of converting the existing source code to ZF standards (we can keep our indentation = tab preference), please write a comment

@mattab
Copy link
Member Author

mattab commented Jul 29, 2010

works as it is for now!

@mattab mattab added this to the Future releases milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. wontfix If you can reproduce this issue, please reopen the issue or create a new one describing it.
Projects
None yet
Development

No branches or pull requests

3 participants