[Insight-developers] Uncrustify tools and configuration file

Daniel Blezek Blezek.Daniel at mayo.edu
Fri Aug 20 14:43:35 EDT 2010


I can confirm that the local git hooks do prevent checkins with extra
whitespace and lines at the end of the file.  I fought this for ~2 hours on
Monday.  uncrustify to the rescue!

-dan


On 8/20/10 12:46 PM, "Bill Lorensen" <bill.lorensen at gmail.com> wrote:

> The vtk hooks do check for it. I don't know about the itk hooks. I
> assume they do since Brad K. did both hooks.
> 
> Bill
> On Fri, Aug 20, 2010 at 1:33 PM, Bradley Lowekamp
> <blowekamp at mail.nih.gov> wrote:
>> Hello Hans,
>> I only recently added the option to my emacs to make visible white space at
>> the EOL. It now shows up red, and it makes me want to delete it, so this is
>> great!
>> My one question is: Do we have anything in place to prevent this end of line
>> white space from returning? Local git check-in script, or just KWStyle tests
>> (parameter is currently 3-ish could just be changed to 0)?
>> I was adding a lot of this before, and I didn't know I was doing it.
>> Brad.
>> On Aug 20, 2010, at 12:54 PM, Hans Johnson wrote:
>> 
>> Hello All,
>> 
>> I wanted to alert everyone that I will be removing blank lines at the end of
>> files, and making the indenting of code blocks consistent this weekend.
>>    These changes are compatible with the work that Brad Davis is working on,
>> and will ensure that once KWStyle is corrected that the rules for
>> indentation will be more uniform regardless of nesting level  of function
>> declarations.
>> 
>> By necessity, this will involve touching a large number of files.  I will be
>> doing this as a branch on git-hub, and then I¹ll give it a few days for
>> review before pushing the patch to the main branch early next week
>> (immediately after the Tuesday T-Con if no objections are posed).
>> 
>> =============
>> I¹ve executed trial runs of this in the past, and they occurred without
>> errors (i.e. Compilation succeeded, and all test pass).
>> 
>> Regards,
>> Hans
>> 
>> On 8/3/10 7:02 AM, "Brad Davis" <brad.davis at kitware.com> wrote:
>> 
>> Hans,
>> 
>> Here is an update: the fix has required some refactoring of code
>> (e.g., simplification of the code, improved robustness wrt strings and
>> comments, and removal of n^2 operations that were choking on large
>> files).  I am getting close but have more work to do before I feel
>> comfortable checking in code.  At this rate it may be next week before
>> it is done.
>> 
>> Best,
>> Brad
>> 
>> On Wed, Jul 28, 2010 at 10:20 PM, Hans Johnson <hans-johnson at uiowa.edu>
>> wrote:
>>> Thanks Brad,
>>> 
>>> Let me know when the change is implemented, and I'll give it another test.
>>> I'll also be expanding the test_code.cxx file to include some more
>>> difficult
>>> test cases.
>>> 
>>> Hans
>>> 
>>> 
>>> 
>>> On 7/28/10 9:10 PM, "Brad Davis" <brad.davis at kitware.com> wrote:
>>> 
>>>> Hi Hans,
>>>> 
>>>> I'm glad you got the new code.  The coding change needed to support
>>>> the new policy has not been made yet.  I hope to have something
>>>> implemented by the next itk tcon.
>>>> 
>>>> Best,
>>>> Brad
>>>> 
>>>> 
>>>> On Wednesday, July 28, 2010, Hans Johnson <hans-johnson at uiowa.edu> wrote:
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Brad,
>>>>> 
>>>>> I¹ve downloaded the latest git version of KWStyle, but I still can not
>>>>> get
>>>>> the new formatting to pass:
>>>>> 
>>>>> I¹m running:
>>>>> 
>>>>> /Users/hjohnson/src/KWStyle-build/bin/KWStyle -v -o
>>>>> /Users/hjohnson/Desktop/AutoFormat/KWStyle/ITKOverwrite.txt -xml
>>>>> /Users/hjohnson/Desktop/AutoFormat/KWStyle/ITK.cvs.kws.xml
>>>>> ./test_code.cxx
>>>>> Processing ./test_code.cxx
>>>>> Error #12 (19) Indent is wrong 2 (should be 4)
>>>>> Error #12 (23) Indent is wrong 2 (should be 4)
>>>>> Error #12 (36) Indent is wrong 2 (should be 4)
>>>>> Error #12 (37) Special Indent is wrong 0 (should be 2)
>>>>> Error #12 (40) Indent is wrong 4 (should be 6)
>>>>> Error #12 (51) Indent is wrong 4 (should be 6)
>>>>> Error #12 (55) Indent is wrong 4 (should be 6)
>>>>> Error #12 (58) Indent is wrong 2 (should be 4)
>>>>> 
>>>>> I believe that the file is actually correct with respect to the desired
>>>>> formatting, but KWStyle is reporting it incorrectly.
>>>>> 
>>>>> Hans
>>>>> 
>>>>> 
>>>>> 
>>>>> On 7/27/10 8:42 AM, "Brad Davis" <brad.davis at kitware.com> wrote:
>>>>> 
>>>>> Hans, all,
>>>>> 
>>>>> I am looking at KWStyle today to see how to best make this change
>>>>> (probably as a new option to the indent checker).  In any case I will
>>>>> make the change in the git repository and not the old CVS repository
>>>>> so we should think about how to best transition ITK folks to that
>>>>> repository (including adding appropriate documentation to the KWStyle
>>>>> web page and ITK wiki pages).
>>>>> 
>>>>> You can get read access to the repository like this:
>>>>> % git clone http://public.kitware.com/KWStyle.git
>>>>> 
>>>>> Best,
>>>>> Brad
>>>>> 
>>>>> On Tue, Jul 20, 2010 at 3:07 PM, Daniel Blezek <Blezek.Daniel at mayo.edu>
>>>>> wrote:
>>>>>> +1 for this idea.
>>>>>> 
>>>>>> I used uncrustify to, well, uncrustify some code from an opensource
>>>>>> project
>>>>>> that I wanted to look through and understand.  It was extremely
>>>>>> helpful.
>>>>>> 
>>>>>> Another tool that I would suggest we set up and use is OpenGrok.
>>>>>>  OpenGrok
>>>>>> indexes the code so you can click your way around the source to see
>>>>>> definitions, calls, etc.  Sort of like emacs and ctags, but on the web
>>>>>> and
>>>>>> steroids.
>>>>>> 
>>>>>> http://hub.opensolaris.org/bin/view/Project+opengrok/WebHome
>>>>>> 
>>>>>> It's slightly crufty to setup, but extremely useful in the long run.
>>>>>> 
>>>>>> OpenGrok Example:
>>>>>> 
>>>>>> http://svn.services.openoffice.org/opengrok/xref/DEV300_m80/mysqlc/source
>>>>>> /my
>>>>>> sqlc_general.cxx
>>>>>> 
>>>>>> Cheers,
>>>>>> -dan
>>>>>> 
>>>>>> On 7/20/10 1:32 PM, "Hans Johnson" <hans-johnson at uiowa.edu> wrote:
>>>>>> 
>>>>>>> Brad
>>>>>>> 
>>>>>>> The goal of this script is to develop a consistent system of
>>>>>>> auto-formating
>>>>>>> and format testing such that if uncrustify is run, then the code will
>>>>>>> pass
>>>>>>> the KWStyle format checker.
>>>>>>> 
>>>>>>> After you install uncrustify and KWStyle ( and modify the script to
>>>>>>> point
>>>>>>> to
>>>>>>> them):
>>>>>>> 
>>>>>>> bash ~/Desktop/AutoFormat/ReformatAllOfITK.sh
>>>>>>> ~/src/SA-Darwin-build/Insight
>>>>>>> 
>>>>>>> =============
>>>>>>> Let me know if you need any other information regarding changes to
>>>>>>> KWStyle.
>>>>>>> I'll be happy to test KWStyle once code changes are made (either to
>>>>>>> the
>>>>>>> program, or to the configuration file).
>>>>>>> 
>>>>>>> Regards,
>>>>>> 
>>>>>> --
>>>>>> Daniel Blezek, PhD
>>>>>> Medical Imaging Informatics Innovation Center
>>>>>> 
>>>>>> P 127 or (77) 8 8886
>>>>>> T 507 538 8886
>>>>>> E blezek.daniel at mayo.edu
>>>>>> 
>>>>>> Mayo Clinic
>>>>>> 200 First St. S.W.
>>>>>> Harwick SL-44
>>>>>> Rochester, MN 55905
>>>>>> mayoclinic.org
>>>>>> " It is more complicated than you think." -- RCF 1925
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Brad Davis, Ph.D.
>>>>> Technical Lead
>>>>> Kitware, Inc.
>>>>> 
>>>>> Office: 919-969-6990x302
>>>>> Mobile: 919-265-3301
>>>>> Fax: 518-371-4573
>>>>> 
>>>>> 
>>>>> --
>>>>> Hans J. Johnson, Ph.D.
>>>>> Assistant Professor
>>>>> 200 Hawkins Drive
>>>>> T205 BT, The University of Iowa
>>>>> Iowa City, IA 52242
>>>>> 
>>>>> hans-johnson at uiowa.edu
>>>>> PHONE: 319 353 8587
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>> 
>>> --
>>> Hans J. Johnson, Ph.D.
>>> Assistant Professor
>>> 200 Hawkins Drive
>>> T205 BT, The University of Iowa
>>> Iowa City, IA 52242
>>> 
>>> hans-johnson at uiowa.edu
>>> PHONE: 319 353 8587
>>> 
>>> 
>> 
>> 
>> 
>> --
>> Brad Davis, Ph.D.
>> Technical Lead
>> Kitware, Inc.
>> 
>> Office: 919-969-6990x302
>> Mobile: 919-265-3301
>> Fax: 518-371-4573
>> 
>> <ATT00001..txt>
>> 
>> ========================================================
>> 
>> Bradley Lowekamp
>> 
>> Lockheed Martin Contractor for
>> 
>> Office of High Performance Computing and Communications
>> 
>> National Library of Medicine
>> 
>> blowekamp at mail.nih.gov
>> 
>> 
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.html
>> 
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>> 
>> 

-- 
Daniel Blezek, PhD
Medical Imaging Informatics Innovation Center

P 127 or (77) 8 8886
T 507 538 8886
E blezek.daniel at mayo.edu

Mayo Clinic
200 First St. S.W.
Harwick SL-44
Rochester, MN 55905
mayoclinic.org
"It is more complicated than you think." -- RFC 1925



More information about the Insight-developers mailing list