Daniel Kulp wrote:
On Tuesday October 10 2006 12:15 am, Sakala, Adinarayana wrote:
As an alternative to arat, Checkstyle has a header check. It
currently targets only java files, though. I could fix that quite
easily in the checkstyle core, so that all files can be checked.
Honestly, I'm not sure how well this would work. Couple of reasons:
1) The "format" of the header is different for .properties
files, .xml/.wsdl/.xsd files, etc... Basically, you'd have to abstract
out the "how is a comment constructed" thing. (not too bad)
Currently, the "header check" thing is a pretty strick "does the header
exactly match what I'm expecting" thing.
You aren't restricted to exact matches. We already have a RegexpHeader
check implemented in Checkstyle:
http://checkstyle.sourceforge.net/config_header.html#RegexpHeader
However for historical reasons this check is tied to Java files only,
and I'm making the same functionality available for all text files.
I think that all relevant languages use some non word characters to
indicate a comment, so my idea is to use something like this as the
header definition:
===
^\W*$
^\W*Copyright 2006 ... as applicable\W*$
^\W*$
^\W*$
^\W*Licensed under ... 2.0 \(the License\);\W*$
...
===
2) Some of the files (at least in CXF) aren't supposed to have the apache
header. For the schema that we download from W3C, it's not supposed to
be there. There are others. Thus, it needs some exclusion rules or
something.
Good point. If Ant filesets aren't available then maybe Checkstyle
filters will do the trick:
http://checkstyle.sourceforge.net/config.html#Filters
That said, if it works, great. I like the idea. It just may be hard
to do and may take a couple iterations to figure out all the little
things to get it to work correctly.
Then there is also the issue of getting the maven checkstyle plugin
updated to use it............
The maven people only have to create a new plugin version that depends
on a different version of the checkstyle core. The new version has to
pass all src files into checkstyle, not only the java files. Doesn't
sound like a lot of work, but yes, it might take a bit of time.
Cheers,
Lars