dev@glassfish.java.net

Re: Copyrights, ugh

From: Jason Lee <jason.d.lee_at_oracle.com>
Date: Tue, 08 Jun 2010 10:14:55 -0500

My four have been fixed.

On 6/7/10 9:28 PM, Bill Shannon wrote:
> Or, in sh...
>
> for f in `find . -name '.?*' -prune -o -name target -prune -o \
> -type f -a \( -name '*.java' -o -name '*.xml' \) -print`
> do
> if grep -l Copyright "$f" > /dev/null
> then
> :
> else
> echo "$f"
> fi
> done
>
>
> Bobby Bissett wrote on 06/07/2010 06:11 PM:
>>> Any chance of getting a list of those files?
>> [...]
>>
>> Here's a very simple script to check. Unless you're on Windows, you
>> already have Python installed. Just edit the location at the top and
>> run 'python foo.py'. If on Windows, you may need to download it, or
>> you could just install the Python module for NB and it comes with
>> Jython. (In that case, though, I may need to add explicit calls to
>> close the file handles since they aren't garbage collected -- and
>> thus closed -- immediately).
>>
>> --- begin foo.py ---
>> # Very simple, dumb, 'Copyright' text checker.
>>
>> # edit these
>> startingdir = '/Users/bobby/work/ws/v3'
>> dirstoskip = ['.svn', 'target']
>> filetypes = ['.java', '.xml']
>> # end edits
>>
>> import os.path
>>
>> for (dirname, dirs, files) in os.walk(startingdir):
>> for d in dirstoskip:
>> if d in dirs:
>> dirs.remove(d)
>> for file in files:
>> for ft in filetypes:
>> if file.endswith(ft):
>> fullpath = os.path.join(dirname, file)
>> wholefileasstring = open(fullpath).read()
>> if 'Copyright' not in wholefileasstring:
>> print fullpath
>> --- end ---
>>
>> For what it's worth, I catch >400 files without the word 'Copyright'
>> in them. Must be some false negatives, but that's still a lot. 52 of
>> those are pom.xml files.
>>
>> Again, it's an agonizingly simple script. But it's free.
>>
>> Cheers,
>> Bobby
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>


-- 
Jason Lee
Senior Member of Technical Staff
GlassFish Administration Console
Oracle Corporation
Phone +1 405-216-3193
Blog http://blogs.steeplesoft.com