[dojo-contributors] A new build tool for style guide violation checking

Kris Zyp kzyp at dojotoolkit.org
Sat May 16 23:41:49 EDT 2009


Maybe I missed discussion around this, but is there any chance we could
somehow use this to auto-correct style issues (with opt-in of course)?
It seems like going throughing fixing all the current style errors could
be very time consuming for humans, and most of the style issues could
easily corrected mechanically. Given the tool/option I would certainly
use it on my modules.
Kris

Shane O'Sullivan wrote:
> OK, I've added a new patch for the checkstyle tool.  It now:
>
>  - is in it's own folder, util/checkstyle
>  - supports generating a report of all folders
>  - supports generating a report of a single folder
>  - supports specifying a list of files, and printing the results to the console
>  - can optionally throw an exception if errors are found, so an svn
> hook would fail (I think)
>
> I can't figure out the SVN hook part, but do ppl have any other
> ideas/issues before I check this in?
>
> Thanks
>
> Shane
>
> 2009/5/14 Dustin Machi <dmachi at dojotoolkit.org>:
>   
>> ewps hit enter too early.  To work with hooks, when you create a
>> repository there is already a hooks directory with the default hooks
>> renamed to disable them, so you can just rename one and do a commit to
>> the repo to see it in action.
>>
>> Dustin
>>
>> On May 14, 2009, at 6:02 PM, Shane O'Sullivan wrote:
>>
>>     
>>> Hi All,
>>>
>>> I'm working on hooking up the checkstyle tool to an SVN hook, and need
>>> a little help.
>>>
>>> 1. How to I make a script fail a check?  If the .sh file calls a .js
>>> file using Rhino, how do I fail the svn hook check?  Print "Error" or
>>> something?
>>> 2. How/where to I work with SVN hooks? :-)
>>>
>>> Maybe someone else could handle #2 :-)  Any ideas?  Are there any
>>> other svn hooks in Dojo that I can copy as an example?
>>>
>>> Thanks
>>>
>>> Shane
>>>
>>> 2009/5/11 Shane O'Sullivan <shaneosullivan1 at gmail.com>:
>>>       
>>>> I think keeping it simple for developers to use is quite worthwhile.
>>>> Also, while the errors being checked for can conceptually be grouped
>>>> into separate "types" of validation,  they all fall under the Dojo
>>>> style guide, and are all simple little things that developers can fix
>>>> quickly.  Having them all checked for, and listed, in the same place
>>>> makes sense to me.
>>>>
>>>> Pete, with regards to your suggestions for || and && surrounded by
>>>> spaces, that's been added and the patch updated.  The page at
>>>> http://skynet.ie/~sos/misc/dojoCheckstyle/util/buildscripts/checkstyleReport.html
>>>> has also been updated with the new errors, now at a grand total of
>>>> 6011.
>>>>
>>>> Thanks
>>>>
>>>> Shane
>>>>
>>>> 2009/5/11 Mike Wilcox <mwilcox at sitepen.com>:
>>>>         
>>>>>> Mike Wilcox wrote:
>>>>>>             
>>>>>>> It sounds like you are mixing two different validations - code
>>>>>>> integrity (braces in if statements)  and formating integrity
>>>>>>> (proper
>>>>>>> tabbing and minimum whitespace).
>>>>>>>
>>>>>>>               
>>>>>> Maybe I'm confused, but I'm talking about our "style guidelines".
>>>>>>
>>>>>> if (foo) { return; }
>>>>>>
>>>>>> should be:
>>>>>>
>>>>>> if(foo){ return; }
>>>>>>
>>>>>> and explicitly NOT:
>>>>>>
>>>>>> if(foo) return;
>>>>>>             
>>>>> Yes, but let me clarify what I saw as a problem - having the parser
>>>>> handle code validation and format validation. If hypothetically, we
>>>>> wanted to use JSLint, and remove our custom engine we would lose the
>>>>> validation of tabs and spaces, since JSLint doesn't do that.
>>>>>
>>>>> Basically, there is code style which applies to JavaScript, and
>>>>> format
>>>>> style which applies to the docs and build/compression.
>>>>>
>>>>> I only suggest they be two different validation engines. Otherwise
>>>>> its
>>>>> all good stuff.
>>>>>
>>>>>
>>>>> Mike
>>>>>
>>>>> _______________________________________________
>>>>> dojo-contributors mailing list
>>>>> dojo-contributors at mail.dojotoolkit.org
>>>>> http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
>>>>>
>>>>>           
>>> _______________________________________________
>>> dojo-contributors mailing list
>>> dojo-contributors at mail.dojotoolkit.org
>>> http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
>>>       
>> _______________________________________________
>> dojo-contributors mailing list
>> dojo-contributors at mail.dojotoolkit.org
>> http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
>>
>>     
> _______________________________________________
> dojo-contributors mailing list
> dojo-contributors at mail.dojotoolkit.org
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-contributors
>
>   


More information about the dojo-contributors mailing list