[Insight-developers] Followup: using uncrustify

Matthew McCormick (thewtex) matt at mmmccormick.com
Wed Dec 15 12:42:48 EST 2010


Hi Michael,

Great to here you got it working.  Here is a script I use to remove
trailing whitespace:

#!/bin/bash

# strip trailing whitespaces from filenames sent to stdin or as args
# Matt McCormick (thewtex) <matt at mmmccormick.com>
# created 2008 May 01

MYTEMP=`tempfile`
trap 'rm -f $MYTEMP' SIGINT SIGTERM

stripit() {
  echo "stripping $1"
  sed 's/[ \t]*$//' "$1" > $MYTEMP
  cp $MYTEMP "$1"
}

if [ $# -gt 0 ]; then
  while [ "$1" != "" ]; do
    stripit $1
    shift
  done
else
  while read; do
    stripit $REPLY
  done
fi

rm $MYTEMP

Regards,
Matt

On Wed, Dec 15, 2010 at 11:24 AM, Michael Stauffer (Circular Logic)
<mstauff at verizon.net> wrote:
> Hi again,
>
> I've got it working now, sorry. So the "trailing whitespaces" errors
> must be coming from git itself. Once I fixed those manually, uncrustify
> ran and launched the mergetool. Very cool!
>
> Is there a way to get uncrustify or something else to fix trailing
> whitespaces? If not, I'll try to write a simple script myself.
>
> Cheers,
> Michael
>
>>-----Original Message-----
>>From: Michael Stauffer (Circular Logic) [mailto:mstauff at verizon.net]
>>Sent: Wednesday, December 15, 2010 11:47 AM
>>To: 'ITK-dev-list'
>>Subject: using uncrustify
>>
>>Hi,
>>
>>I'm trying to run uncrustify via the commit hooks to remove a
>>whole bunch of kwstyle errors with trailing whitespace. I've
>>enabled it via 'git config hooks.uncrustify true', but it
>>doesn't seem to be doing anything I can see. Is there an
>>intermediate output file I should see that has my changed
>>source? Am I wrong to think that uncrustify should remove
>>trailing whitespaces?
>>
>>I've installed uncrustify 0.56 and set the env var
>>UNCRUSTIFYBIN to point to the exe.
>>
>>Sorry if this is explained somewhere that I've missed, I can't
>>seem to find it in any documentation.
>>
>>Thanks.
>>
>>Cheers,
>>Michael ``
>
> _______________________________________________
> 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
>


More information about the Insight-developers mailing list