Hi Albert,

On Oct 3, 2014, at 1:40 PM, Albert Coder wrote:

> Recently I had restarted working on Materials Database and had cleaned
> the code according to the guidelines in the Hacking file. But Hacking
> file is C / C++ centred and so for some PHP reference I saw the
> CIAnotify extension as it is on BRL-CAD official GitHub.

The notify extension wasn't developed with really any bearing to BRL-CAD's 
conventions.  It was based on other Mediawiki extensions.

> a) The code of CIAnotify[1] is indented by using a tab-key(8
> characters) whereas Hacking file says to indent using 4 whitespaces
> and use tab for 8 characters.

For web code, use of either convention is fine.  We've had discussions here 
about changing the indentation style of the main codebase sometime to tabs, but 
currently any C/C++ should strictly adhere until we do change.

> b) There is also a space after the parenthesis starts and before it
> ends(line no.29).
> example: if ( $cnTo == '' )

I'm not aware that there is, but if there's a dominant convention in php code 
then that can be used.  It's more important that all the materials db code be 
self-consistent.  It shouldn't be a mix of this and a mix of that.  The most 
byte-efficient-while-still-readable is to eliminate the spaces immediately 
within parentheses.

> c) Then in line number 50 of [1], the curly brackets of a function
> start from the same line whereas Hacking file says it should begin in
> a new line in case of functions.

Again, CIAnotify is merely being consistent with Mediawiki plugin convention.

> d) Then "/" operator for comments is also used in [1] which is
> discouraged in Hacking file.

Not allowed in our C sources, but fine for C++ and (by extension) other 
languages.

> e) Lastly how to indent HTML which is embedded in PHP, 4 characters or 8?

Short answer: doesn't matter.  Longer answer is usually to prefer sending fewer 
bytes back to the browser (so 1 tab or even no indentation).

> Please help me with this confusion so that I can push perfect code on
> BRL-CAD GitHub according to the coding standards.

The requirements for the web-based efforts on Github are not nearly as strict 
as they are for the main C/C++ sources.  It's more important and useful to make 
sure your code is 100% self-consistent at a minimum, and ideally consistent 
with our other sources where possible.

Cheers!
Sean


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Developer mailing list
brlcad-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to