[OpenLayers-Dev] coding style best practices

Paul Spencer pspencer at dmsolutions.ca
Mon Oct 1 20:46:43 EDT 2007

Somewhat unrelated to coding standards, what do you think about using  
jslint, perhaps as a pre-commit hook?  There are a couple of places  
that jslint gives warnings about in OpenLayers that are probably not  
necessary to fix (regular expressions I think), but I did find a  
number of missing semi-colons just working on the transition stuff.

I have jslint embedded in my text editor so it lint's every file I  
save.  I find this very handy to avoid certain problems.


On 1-Oct-07, at 8:31 PM, Erik Uzureau wrote:

> fyi:
> http://trac.openlayers.org/wiki/CodingStandards
> ;-)
> erik
> On 10/1/07, Christopher Schmidt <crschmidt at metacarta.com> wrote:
>> On Mon, Oct 01, 2007 at 04:28:15PM -0400, Paul Spencer wrote:
>>> I am not a particularly fastidious coder but I do strongly believe
>>> that folks should be making their code readable and, as much as
>>> possible, avoid common sources of bugs.  Also, for those folks
>>> looking to make contributions, it is going to be much easier for the
>>> core maintainers to bring your code into trunk if it already fits  
>>> the
>>> coding style of OpenLayers.
>>> I am sure Chris will have more to say on this, but my particular pet
>>> peeves are:
>> Erik will much more so than me :)
>> Both of Paul's points are dead on, and some others:
>>  * Wrap lines at 80 characters. I'm less picky about this than
>>    Erik, but he'll go through and clean up the code later if you  
>> don't
>>    do it, and his commit statistics are inflated enough without  
>> giving
>>    him more material ;)
>>  * Comments when you're doing something confusing are helpful.
>>    Don't write a novel, but also don't leave the next guy  
>> wondering what
>>    was going on. (And as always, a key when commenting is "Not  
>> how, but
>>    *why*.") I screwed this up with one change I made around r1400,  
>> and
>>    we've been paying for it for 3000 commits.
>> Regards,
>> --
>> Christopher Schmidt
>> MetaCarta
>> _______________________________________________
>> Dev mailing list
>> Dev at openlayers.org
>> http://openlayers.org/mailman/listinfo/dev

|Paul Spencer                          pspencer at dmsolutions.ca    |
|Chief Technology Officer                                         |
|DM Solutions Group Inc                http://www.dmsolutions.ca/ |

More information about the Dev mailing list