ZF-407: Provide a degree of automated coding standards compliance

Issue Type: Coding Standards Violation Created: 2006-09-29T11:40:38.000+0000 Last Updated: 2008-09-02T10:39:34.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)

Reporter: Darby Felton (darby) Assignee: Thomas Weidner (thomas) Tags: Related issues: - ZF-3065



It would be nice to have some level of automated coding standards compliance assistance, and below are a couple of options:

Most likely this is too old and doesn't work with PHP 5.1.4:" rel="nofollow">phpCodeBeautifier (Thanks, [~gavin])](

To evaluate: [PHP_CodeSniffer (Thanks, [~nicklo])

Help Wanted - We would like help with evaluating such a system for Zend Framework code, as we would possibly integrate a good solution as a pre-commit hook to the Subversion repository.


Posted by Matthew Ratzloff (mratzloff) on 2006-12-06T10:37:52.000+0000

Not evaluated yet for quality yet, but:

Most recent release was in June, built in PHP 5. Works on the command line, and you write custom rules.

Posted by Matthew Ratzloff (mratzloff) on 2006-12-06T10:42:36.000+0000

That should read, "you can write custom rules if you like."

Here's a command line usage guide:…

Posted by Gavin (gavin) on 2006-12-06T12:15:58.000+0000

These tools require a non-trivial effort to configure and setup "profiles". If someone takes the initiative of codifying the ZF coding standards into configurations for these tools, then the chance for adoption would increase.

Posted by Bill Karwin (bkarwin) on 2006-12-06T13:19:19.000+0000

I've had bad luck with automated code beautifiers. The risk is that there's some obscure corner case that the code beautifier doesn't handle well, and it inadvertently changes the functionality of the code and introduces bugs.

This actually happened on a Java project I was on in 2005. We upgraded from Java 1.4 to Java 5 and the code beautifier tools didn't know about the new syntax in that release, so they totally ruined the code in the process of trying to beautify it.

It would be one thing to have a tool check and report mismatches between the code and the coding standard, but I wouldn't want it committing changes without a human reviewing them first. Code beautifiers should be run manually and then the results checked visually and with unit tests.

We also have some points in our draft coding standards document that are not simply syntactic issues. So enforcement by a code beautifier is not a complete solution. Still, some automation is better than none.

Matthew, if you want to write a profile that does best-effort checks with respect to the Zend Framework coding standard, that would be much appreciated.

Posted by Gavin (gavin) on 2006-12-06T13:26:32.000+0000

The pre-commit SVN hook we previously discussed for code analysis/beautifier tools might simply result in an email under certain conditions instead of doing something drastic.

Posted by Bill Karwin (bkarwin) on 2007-10-17T15:28:41.000+0000

Changing to 'Unassigned'

Posted by Wil Sinclair (wil) on 2008-03-21T17:05:26.000+0000

This issue should have been fixed for the 1.5 release.

Posted by Wil Sinclair (wil) on 2008-04-18T13:12:03.000+0000

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Posted by Wil Sinclair (wil) on 2008-06-08T06:12:27.000+0000

Thomas, I believe you are currently working on this. Please update the issue with any changes to the original idea.

Posted by Thomas Weidner (thomas) on 2008-06-08T09:02:06.000+0000

We have decide to use PHP_CodeSniffer. Actually a testbed can already be found within incubator under tools.

This issue itself is seems to be duplicated by ZF-3027 and ZF-3065.

Posted by Wil Sinclair (wil) on 2008-06-15T14:00:00.000+0000

Changing to comply with new IT coventions for components.

Posted by Thomas Weidner (thomas) on 2008-06-16T07:52:34.000+0000

Closing due to duplication of existing issue ZF-3065

Posted by Wil Sinclair (wil) on 2008-09-02T10:39:34.000+0000

Updating for the 1.6.0 release.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.