Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.5k
-
Hi, I tried to write a ruleset that match only java files that are in ...<exclude-pattern>.*</exclude-pattern><include-pattern>.*/src/main/java/com/laroueverte/.*(?!Foo).*.java</include-pattern>... But the |
BetaWas this translation helpful?Give feedback.
All reactions
But the (?!Foo) exclusion regex does not seems to work.
Yes, that seems to be the case. But it has something to do with regex, rather than PMD:
https://regex101.com/r/F4JBok/1
An easier way to achieve what you want: Just use exclusion without inclusion:
<exclude-pattern>.*Foo.java|.*/src/test/java/.*</exclude-pattern>
You could remove the "src/test/java"-part, if you set the maven-pmd-plugin parameter<includeTests>false</includeTests>
.
Replies: 2 comments 3 replies
-
I've just tested it and it works as expected… how are you running PMD? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Here's the Java project showing the issue :https://github.com/cinlloc/pmd-pattern-issue-demo I run PMD two ways: with Maven plugin I expect only one validation warning on The regex seems to be syntactically correct for the parser (no error at execution), but the |
BetaWas this translation helpful?Give feedback.
All reactions
-
Yes, that seems to be the case. But it has something to do with regex, rather than PMD: An easier way to achieve what you want: Just use exclusion without inclusion:
You could remove the "src/test/java"-part, if you set the maven-pmd-plugin parameter |
BetaWas this translation helpful?Give feedback.
All reactions
-
Alternatively, a proper include regexp would be:
Which will not include any file with For instance, given |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1
-
Ok. Thanks for the answer! |
BetaWas this translation helpful?Give feedback.