Coding Standards.

Permalink 3 users found helpful
Hello. I was just wondering about the coding standards and how flexible they are because I've been using Zend and PEAR as the basis for all of my coding standards for a few years now as they are the standard. Even my IDE is equipped with tools such as codesniffer which is setup to find badly formatted code much like the standards described here.. If I were to submit an add-on with PHP-standard formatted code would it be denied?

 
jbx replied on at Permalink Best Answer Reply
jbx
Well - going on some of the code in some of the add-ons I've seen, I don't think you'll have any problems...

Seriously though, coding standards are difficult to stick to 100% when you're using different systems. What I mean by that is, Zend have one set and C5 has another set. In many places they complement each other, but in some places they conflict. Personally, I try and stick to Zend standards as much as possible, as that is a much more widely recognized standard and only switch to C5 standards where there would be a conflict.

Quite honestly, I reckon if you are thinking this hard about coding standards, then that puts you above 90% of the programmers out there! :)

Jon
mmmshuddup replied on at Permalink Reply
Gotcha. Well that's good! And thanks haha :). I definitely feel your flow and will do the same then.

Thanks for the rapid response!
jordanlev replied on at Permalink Reply
jordanlev
FWIW, I completely agree with everything jbx said.
claarman replied on at Permalink Reply
I also try to stick on the Zend standards for the same reason. Creating clean code helps you and your fellow programmers to read your code. Handy trick in netBeans: CTRL + ALT + F = Instant neatly formatted code
JohntheFish replied on at Permalink Reply
JohntheFish
You should be ok for an addon (Its you that has to maintain it). For C5 core mods, you need to follow C5's quirks.
synlag replied on at Permalink Reply
synlag
Hi,

are there any tips for pull requests to the core of how the code should be formatted?
E.g. Herehttp://www.concrete5.org/documentation/developers/system/coding-sty... it says "intend your code with tabs", but as you can see in the core files, a tab might be 4 or 8 spaces long.

Greets
Ron