PatternSyntaxException when trying rat -E

2013-04-04 Thread Peter Hartmann

Hello

I'm contributing to Apache Allura incubating project, where my efforts 
are mostly focused on getting a release out. I've attempted a RAT 
testing, but it gives me an error when I try to use -E option:


~ $: java -jar ../apache-rat-0.8/apache-rat-0.8.jar -E ./.rat-ignore -d ./
Exception in thread "main" java.util.regex.PatternSyntaxException: 
Dangling meta character '*' near index 0

**/setup.cfg
^
at java.util.regex.Pattern.error(Pattern.java:1924)
at java.util.regex.Pattern.sequence(Pattern.java:2090)
at java.util.regex.Pattern.expr(Pattern.java:1964)
at java.util.regex.Pattern.compile(Pattern.java:1665)
at java.util.regex.Pattern.(Pattern.java:1337)
at java.util.regex.Pattern.compile(Pattern.java:1022)
at 
org.apache.commons.io.filefilter.RegexFileFilter.(RegexFileFilter.java:62)

at org.apache.rat.Report.main(Report.java:109)

.rat-ignore file's content is:

.rat-ignore
**/setup.cfg
**/*.json
Makefile.def.buildbot
requirements*
**/MANIFEST.in
Allura/allura/controllers/controller.template
Allura/allura/etc/mime.types
Allura/allura/tests/data/genshi_hello_tmpl
Allura/allura/tests/data/test_mime/text_file.txt
ForgeGit/forgegit/data/post-receive_tmpl
ForgeGit/forgegit/tests/data/
ForgeSVN/forgesvn/tests/data/

Do I miss something? I've modelled the file after examples given at 
http://ci.apache.org/projects/rat-master-summary.html


Re: PatternSyntaxException when trying rat -E

2013-04-04 Thread sebb
On 4 April 2013 20:42, Peter Hartmann  wrote:

> Hello
>
> I'm contributing to Apache Allura incubating project, where my efforts are
> mostly focused on getting a release out. I've attempted a RAT testing, but
> it gives me an error when I try to use -E option:
>
> ~ $: java -jar ../apache-rat-0.8/apache-rat-**0.8.jar -E ./.rat-ignore -d
> ./
> Exception in thread "main" java.util.regex.**PatternSyntaxException:
> Dangling meta character '*' near index 0
> **/setup.cfg
> ^
> at java.util.regex.Pattern.error(**Pattern.java:1924)
> at java.util.regex.Pattern.**sequence(Pattern.java:2090)
> at java.util.regex.Pattern.expr(**Pattern.java:1964)
> at java.util.regex.Pattern.**compile(Pattern.java:1665)
> at java.util.regex.Pattern.**(Pattern.java:1337)
> at java.util.regex.Pattern.**compile(Pattern.java:1022)
> at org.apache.commons.io.**filefilter.RegexFileFilter.<**
> init>(RegexFileFilter.java:62)
> at org.apache.rat.Report.main(**Report.java:109)
>
> .rat-ignore file's content is:
>
> .rat-ignore
> **/setup.cfg
> **/*.json
> Makefile.def.buildbot
> requirements*
> **/MANIFEST.in
> Allura/allura/controllers/**controller.template
> Allura/allura/etc/mime.types
> Allura/allura/tests/data/**genshi_hello_tmpl
> Allura/allura/tests/data/test_**mime/text_file.txt
> ForgeGit/forgegit/data/post-**receive_tmpl
> ForgeGit/forgegit/tests/data/
> ForgeSVN/forgesvn/tests/data/
>
> Do I miss something? I've modelled the file after examples given at
> http://ci.apache.org/projects/**rat-master-summary.html
>

It looks like Apache RAT 0.8 uses standard Java wildcard regex file
matching, whereas the original RAT used a different set of wildcard
meta-characters - more like the syntax used by Maven and Ant.

The intended wildcard support does not appear to be documented anywhere, so
it's not clear whether the change is intentional or not.

If you are running RAT from Ant or Maven I think they interpret the
patterns using their own wildcard scheme.


Re: PatternSyntaxException when trying rat -E

2013-04-07 Thread Robert Burrell Donkin

On 04/05/13 04:09, sebb wrote:

On 4 April 2013 20:42, Peter Hartmann  wrote:





It looks like Apache RAT 0.8 uses standard Java wildcard regex file
matching, whereas the original RAT used a different set of wildcard
meta-characters - more like the syntax used by Maven and Ant.

The intended wildcard support does not appear to be documented anywhere, so
it's not clear whether the change is intentional or not.


I'm not sure this is intentional either :-/


I've always found the Maven and Ant syntax styles more intuitive than 
the Java standard.


I'd be happy to support more than one wildcard syntax (provided we 
document them :-)


Robert



Re: PatternSyntaxException when trying rat -E

2013-04-07 Thread Jochen Wiedmann
> It looks like Apache RAT 0.8 uses standard Java wildcard regex file
> matching, whereas the original RAT used a different set of wildcard
> meta-characters - more like the syntax used by Maven and Ant.

Unfortunately, in this particular case, there is no such thing like "Rat",
but there are

a) the Rat Maven Plugin (uses Plexus Utils internally, hence Maven style)
b) the Rat Ant Tasks (uses Ant pattern matcher internally, hence Ant style)
c) the Rat CLI, which probably uses native Java patterns (dunno)

My suggestion would be to switch to either Ant, or Maven anyways. (At
least, I assume that Allura has got a build script.)


Jochen



On Fri, Apr 5, 2013 at 5:09 AM, sebb  wrote:

> On 4 April 2013 20:42, Peter Hartmann  wrote:
>
> > Hello
> >
> > I'm contributing to Apache Allura incubating project, where my efforts
> are
> > mostly focused on getting a release out. I've attempted a RAT testing,
> but
> > it gives me an error when I try to use -E option:
> >
> > ~ $: java -jar ../apache-rat-0.8/apache-rat-**0.8.jar -E ./.rat-ignore -d
> > ./
> > Exception in thread "main" java.util.regex.**PatternSyntaxException:
> > Dangling meta character '*' near index 0
> > **/setup.cfg
> > ^
> > at java.util.regex.Pattern.error(**Pattern.java:1924)
> > at java.util.regex.Pattern.**sequence(Pattern.java:2090)
> > at java.util.regex.Pattern.expr(**Pattern.java:1964)
> > at java.util.regex.Pattern.**compile(Pattern.java:1665)
> > at java.util.regex.Pattern.**(Pattern.java:1337)
> > at java.util.regex.Pattern.**compile(Pattern.java:1022)
> > at org.apache.commons.io.**filefilter.RegexFileFilter.<**
> > init>(RegexFileFilter.java:62)
> > at org.apache.rat.Report.main(**Report.java:109)
> >
> > .rat-ignore file's content is:
> >
> > .rat-ignore
> > **/setup.cfg
> > **/*.json
> > Makefile.def.buildbot
> > requirements*
> > **/MANIFEST.in
> > Allura/allura/controllers/**controller.template
> > Allura/allura/etc/mime.types
> > Allura/allura/tests/data/**genshi_hello_tmpl
> > Allura/allura/tests/data/test_**mime/text_file.txt
> > ForgeGit/forgegit/data/post-**receive_tmpl
> > ForgeGit/forgegit/tests/data/
> > ForgeSVN/forgesvn/tests/data/
> >
> > Do I miss something? I've modelled the file after examples given at
> > http://ci.apache.org/projects/**rat-master-summary.html<
> http://ci.apache.org/projects/rat-master-summary.html>
> >
>
> It looks like Apache RAT 0.8 uses standard Java wildcard regex file
> matching, whereas the original RAT used a different set of wildcard
> meta-characters - more like the syntax used by Maven and Ant.
>
> The intended wildcard support does not appear to be documented anywhere, so
> it's not clear whether the change is intentional or not.
>
> If you are running RAT from Ant or Maven I think they interpret the
> patterns using their own wildcard scheme.
>



-- 
"That's what prayers are ... it's frightened people trying to make friends
with the bully!"

Terry Pratchett. The Last Hero


Re: PatternSyntaxException when trying rat -E

2013-04-07 Thread sebb
On 7 April 2013 20:09, Jochen Wiedmann  wrote:

> > It looks like Apache RAT 0.8 uses standard Java wildcard regex file
> > matching, whereas the original RAT used a different set of wildcard
> > meta-characters - more like the syntax used by Maven and Ant.
>
> Unfortunately, in this particular case, there is no such thing like "Rat",
> but there are
>
> a) the Rat Maven Plugin (uses Plexus Utils internally, hence Maven style)
> b) the Rat Ant Tasks (uses Ant pattern matcher internally, hence Ant style)
> c) the Rat CLI, which probably uses native Java patterns (dunno)
>
>
It uses Commons IO.

For the -E option (expressions read from a file), it uses RegexFileFilter
which uses java.util.regex.Pattern syntax.

For the -e option (expression provided on command-line), it uses
WildcardFileFilter, whose Javadoc says:
"The wildcard matcher uses the characters '?' and '*' to represent a single
or multiple wildcard characters. This is the same as often found on
Dos/Unix command lines."

I cannot see any valid reason for that discrepancy.

Ant is the same as WildcardFileFilter, except that:
+ When ** is used as the name of a directory in the pattern, it matches
zero or more directories.
+ There is one "shorthand": if a pattern ends with / or \, then ** is
appended.

I think the Maven syntax is much the same as Ant (but there could be
differences in edge cases)

I agree that RAT CLI should use Ant/Maven style.


> My suggestion would be to switch to either Ant, or Maven anyways. (At
> least, I assume that Allura has got a build script.)
>
>
> Jochen
>
>
>
> On Fri, Apr 5, 2013 at 5:09 AM, sebb  wrote:
>
> > On 4 April 2013 20:42, Peter Hartmann  wrote:
> >
> > > Hello
> > >
> > > I'm contributing to Apache Allura incubating project, where my efforts
> > are
> > > mostly focused on getting a release out. I've attempted a RAT testing,
> > but
> > > it gives me an error when I try to use -E option:
> > >
> > > ~ $: java -jar ../apache-rat-0.8/apache-rat-**0.8.jar -E ./.rat-ignore
> -d
> > > ./
> > > Exception in thread "main" java.util.regex.**PatternSyntaxException:
> > > Dangling meta character '*' near index 0
> > > **/setup.cfg
> > > ^
> > > at java.util.regex.Pattern.error(**Pattern.java:1924)
> > > at java.util.regex.Pattern.**sequence(Pattern.java:2090)
> > > at java.util.regex.Pattern.expr(**Pattern.java:1964)
> > > at java.util.regex.Pattern.**compile(Pattern.java:1665)
> > > at java.util.regex.Pattern.**(Pattern.java:1337)
> > > at java.util.regex.Pattern.**compile(Pattern.java:1022)
> > > at org.apache.commons.io.**filefilter.RegexFileFilter.<**
> > > init>(RegexFileFilter.java:62)
> > > at org.apache.rat.Report.main(**Report.java:109)
> > >
> > > .rat-ignore file's content is:
> > >
> > > .rat-ignore
> > > **/setup.cfg
> > > **/*.json
> > > Makefile.def.buildbot
> > > requirements*
> > > **/MANIFEST.in
> > > Allura/allura/controllers/**controller.template
> > > Allura/allura/etc/mime.types
> > > Allura/allura/tests/data/**genshi_hello_tmpl
> > > Allura/allura/tests/data/test_**mime/text_file.txt
> > > ForgeGit/forgegit/data/post-**receive_tmpl
> > > ForgeGit/forgegit/tests/data/
> > > ForgeSVN/forgesvn/tests/data/
> > >
> > > Do I miss something? I've modelled the file after examples given at
> > > http://ci.apache.org/projects/**rat-master-summary.html<
> > http://ci.apache.org/projects/rat-master-summary.html>
> > >
> >
> > It looks like Apache RAT 0.8 uses standard Java wildcard regex file
> > matching, whereas the original RAT used a different set of wildcard
> > meta-characters - more like the syntax used by Maven and Ant.
> >
> > The intended wildcard support does not appear to be documented anywhere,
> so
> > it's not clear whether the change is intentional or not.
> >
> > If you are running RAT from Ant or Maven I think they interpret the
> > patterns using their own wildcard scheme.
> >
>
>
>
> --
> "That's what prayers are ... it's frightened people trying to make friends
> with the bully!"
>
> Terry Pratchett. The Last Hero
>


Re: PatternSyntaxException when trying rat -E

2013-04-07 Thread sebb
Created RAT-134


On 7 April 2013 22:48, sebb  wrote:

> On 7 April 2013 20:09, Jochen Wiedmann  wrote:
>
>> > It looks like Apache RAT 0.8 uses standard Java wildcard regex file
>> > matching, whereas the original RAT used a different set of wildcard
>> > meta-characters - more like the syntax used by Maven and Ant.
>>
>> Unfortunately, in this particular case, there is no such thing like "Rat",
>> but there are
>>
>> a) the Rat Maven Plugin (uses Plexus Utils internally, hence Maven style)
>> b) the Rat Ant Tasks (uses Ant pattern matcher internally, hence Ant
>> style)
>> c) the Rat CLI, which probably uses native Java patterns (dunno)
>>
>>
> It uses Commons IO.
>
> For the -E option (expressions read from a file), it uses RegexFileFilter
> which uses java.util.regex.Pattern syntax.
>
> For the -e option (expression provided on command-line), it uses
> WildcardFileFilter, whose Javadoc says:
> "The wildcard matcher uses the characters '?' and '*' to represent a
> single or multiple wildcard characters. This is the same as often found on
> Dos/Unix command lines."
>
> I cannot see any valid reason for that discrepancy.
>
> Ant is the same as WildcardFileFilter, except that:
> + When ** is used as the name of a directory in the pattern, it matches
> zero or more directories.
> + There is one "shorthand": if a pattern ends with / or \, then ** is
> appended.
>
> I think the Maven syntax is much the same as Ant (but there could be
> differences in edge cases)
>
> I agree that RAT CLI should use Ant/Maven style.
>
>
>> My suggestion would be to switch to either Ant, or Maven anyways. (At
>> least, I assume that Allura has got a build script.)
>>
>>
>> Jochen
>>
>>
>>
>> On Fri, Apr 5, 2013 at 5:09 AM, sebb  wrote:
>>
>> > On 4 April 2013 20:42, Peter Hartmann  wrote:
>> >
>> > > Hello
>> > >
>> > > I'm contributing to Apache Allura incubating project, where my efforts
>> > are
>> > > mostly focused on getting a release out. I've attempted a RAT testing,
>> > but
>> > > it gives me an error when I try to use -E option:
>> > >
>> > > ~ $: java -jar ../apache-rat-0.8/apache-rat-**0.8.jar -E
>> ./.rat-ignore -d
>> > > ./
>> > > Exception in thread "main" java.util.regex.**PatternSyntaxException:
>> > > Dangling meta character '*' near index 0
>> > > **/setup.cfg
>> > > ^
>> > > at java.util.regex.Pattern.error(**Pattern.java:1924)
>> > > at java.util.regex.Pattern.**sequence(Pattern.java:2090)
>> > > at java.util.regex.Pattern.expr(**Pattern.java:1964)
>> > > at java.util.regex.Pattern.**compile(Pattern.java:1665)
>> > > at java.util.regex.Pattern.**(Pattern.java:1337)
>> > > at java.util.regex.Pattern.**compile(Pattern.java:1022)
>> > > at org.apache.commons.io.**filefilter.RegexFileFilter.<**
>> > > init>(RegexFileFilter.java:62)
>> > > at org.apache.rat.Report.main(**Report.java:109)
>> > >
>> > > .rat-ignore file's content is:
>> > >
>> > > .rat-ignore
>> > > **/setup.cfg
>> > > **/*.json
>> > > Makefile.def.buildbot
>> > > requirements*
>> > > **/MANIFEST.in
>> > > Allura/allura/controllers/**controller.template
>> > > Allura/allura/etc/mime.types
>> > > Allura/allura/tests/data/**genshi_hello_tmpl
>> > > Allura/allura/tests/data/test_**mime/text_file.txt
>> > > ForgeGit/forgegit/data/post-**receive_tmpl
>> > > ForgeGit/forgegit/tests/data/
>> > > ForgeSVN/forgesvn/tests/data/
>> > >
>> > > Do I miss something? I've modelled the file after examples given at
>> > > http://ci.apache.org/projects/**rat-master-summary.html<
>> > http://ci.apache.org/projects/rat-master-summary.html>
>> > >
>> >
>> > It looks like Apache RAT 0.8 uses standard Java wildcard regex file
>> > matching, whereas the original RAT used a different set of wildcard
>> > meta-characters - more like the syntax used by Maven and Ant.
>> >
>> > The intended wildcard support does not appear to be documented
>> anywhere, so
>> > it's not clear whether the change is intentional or not.
>> >
>> > If you are running RAT from Ant or Maven I think they interpret the
>> > patterns using their own wildcard scheme.
>> >
>>
>>
>>
>> --
>> "That's what prayers are ... it's frightened people trying to make friends
>> with the bully!"
>>
>> Terry Pratchett. The Last Hero
>>
>
>


Re: PatternSyntaxException when trying rat -E

2013-04-08 Thread Peter Hartmann

On 07.04.2013 21:09, Jochen Wiedmann wrote:

Unfortunately, in this particular case, there is no such thing like "Rat",
but there are

a) the Rat Maven Plugin (uses Plexus Utils internally, hence Maven style)
b) the Rat Ant Tasks (uses Ant pattern matcher internally, hence Ant style)
c) the Rat CLI, which probably uses native Java patterns (dunno)

My suggestion would be to switch to either Ant, or Maven anyways. (At
least, I assume that Allura has got a build script.)
We do, but actually it's only there for convenience use with test 
server. Had it not been the case, we probably wouldn't bother as Allura 
is written in a dynamic language and the notion of "building" is kinda 
alien in this world. So I wouldn't count on every project to have build 
script :)


I'll probably resort to writing some simple build script in Ant for the 
moment, but from a user standpoint I would definetly expect for 
commandline to be compatible with pattern files for other "Rat's", as 
you outlined. It is only reasonable to be able to test these patterns 
with Rat c), without having to use an entirely new build system or to 
switch from existing one, which ASF projects are probably accustomed to 
and which may arguably suit their needs better.


Regards, Peter