tags:

views:

80

answers:

2

I'm trying to use sloccount from within hudson to gather statistics on our codebase, however by default sloccount collects information on all files, even those which are "hidden" (eg. .hideme). This means the statistics are skewed since they include numbers from files within the .svn directories.

Is there any way I can tell sloccount to correctly ignore any files/directories which start with a .?

+3  A: 

You could edit the source code of sloccount to not search in directories that begin with a period. Otherwise, here is something I cooked up on the command line. Basically, you can specify a list of file paths on the command line as arguments to sloccount and it will analyze only those files. So this will find all files under PWD, excluding hidden files, and then pass them as argument to sloccount.

find . \( ! -regex '.*/\..*' \) -type f | \
tr '\n' ' ' | \
xargs sloccount
Dave
Are you sure you need the `tr` command? How about passing the `-print0` flag to `find` and the `-0` flag to `xargs` to handle paths and filenames with spaces?
Mike DeSimone
A: 

My final approach was to remove the .svn directories from the sed output:

sloccount --wide --details $DIR | sed "/\/\.svn\//d" > sloccount.sc
digitala
Dave's solution doesn't waste time on files in the `.svn` directories in the first place.
Mike DeSimone