forked from phoedos/pmd
Ignore javacc code in coverage report (#5241)
Merge pull request #5241 from Monits:ignore-javacc-code
This commit is contained in:
commit
b7c4a5e492
@ -37,6 +37,7 @@ The old rule names still work but are deprecated.
|
|||||||
|
|
||||||
### ✨ Merged pull requests
|
### ✨ Merged pull requests
|
||||||
* [#4965](https://github.com/pmd/pmd/pull/4965): \[java] Rename JUnit rules with overly restrictive names - [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod)
|
* [#4965](https://github.com/pmd/pmd/pull/4965): \[java] Rename JUnit rules with overly restrictive names - [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod)
|
||||||
|
* [#5241](https://github.com/pmd/pmd/pull/5241): \Ignore javacc code in coverage report - [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod)
|
||||||
|
|
||||||
{% endtocmaker %}
|
{% endtocmaker %}
|
||||||
|
|
||||||
|
@ -224,6 +224,9 @@
|
|||||||
|
|
||||||
<target name="cleanup-parser" unless="jjtreeBuildNotRequired">
|
<target name="cleanup-parser" unless="jjtreeBuildNotRequired">
|
||||||
|
|
||||||
|
<replace token="class ${parser-name}" value='@net.sourceforge.pmd.annotation.Generated("org.javacc.javacc")${line.separator}class ${parser-name}'>
|
||||||
|
<file name="${parser-file}" />
|
||||||
|
</replace>
|
||||||
|
|
||||||
<replace token="new Token()" value="token_source.input_stream.getTokenDocument().open()">
|
<replace token="new Token()" value="token_source.input_stream.getTokenDocument().open()">
|
||||||
<file name="${parser-file}" />
|
<file name="${parser-file}" />
|
||||||
@ -262,7 +265,8 @@
|
|||||||
|
|
||||||
<replaceregexp>
|
<replaceregexp>
|
||||||
<regexp pattern="public interface"/>
|
<regexp pattern="public interface"/>
|
||||||
<substitution expression="interface"/>
|
<substitution expression='@net.sourceforge.pmd.annotation.Generated("org.javacc.javacc")${line.separator}
|
||||||
|
interface'/>
|
||||||
<file name="${target-package-dir}/${parser-name}TreeConstants.java" />
|
<file name="${target-package-dir}/${parser-name}TreeConstants.java" />
|
||||||
</replaceregexp>
|
</replaceregexp>
|
||||||
|
|
||||||
@ -272,7 +276,8 @@
|
|||||||
|
|
||||||
<replaceregexp>
|
<replaceregexp>
|
||||||
<regexp pattern='(public )?class ${tokenmgr-name}' />
|
<regexp pattern='(public )?class ${tokenmgr-name}' />
|
||||||
<substitution expression='class ${tokenmgr-name} extends ${base-tokenmgr}' />
|
<substitution expression='@net.sourceforge.pmd.annotation.Generated("org.javacc.javacc")${line.separator}
|
||||||
|
class ${tokenmgr-name} extends ${base-tokenmgr}' />
|
||||||
<file name="${tokenmgr-file}" />
|
<file name="${tokenmgr-file}" />
|
||||||
</replaceregexp>
|
</replaceregexp>
|
||||||
|
|
||||||
@ -385,11 +390,12 @@
|
|||||||
|
|
||||||
<replaceregexp>
|
<replaceregexp>
|
||||||
<regexp pattern="(public )?interface ${constants-itf-name} \{" />
|
<regexp pattern="(public )?interface ${constants-itf-name} \{" />
|
||||||
<substitution expression="/** Token kinds ({@link ${ast-impl-package}.JavaccToken#kind}) for this language. */${line.separator}
|
<substitution expression='/** Token kinds ({@link ${ast-impl-package}.JavaccToken#kind}) for this language. */${line.separator}
|
||||||
@net.sourceforge.pmd.annotation.InternalApi${line.separator}
|
@net.sourceforge.pmd.annotation.InternalApi${line.separator}
|
||||||
|
@net.sourceforge.pmd.annotation.Generated("org.javacc.javacc")${line.separator}
|
||||||
public final class ${token-constants-name} \{${line.separator}
|
public final class ${token-constants-name} \{${line.separator}
|
||||||
private ${token-constants-name}() { /* Utility class */ }${line.separator}
|
private ${token-constants-name}() { /* Utility class */ }${line.separator}
|
||||||
"/>
|
'/>
|
||||||
<file name="${token-constants-file}" />
|
<file name="${token-constants-file}" />
|
||||||
</replaceregexp>
|
</replaceregexp>
|
||||||
|
|
||||||
@ -534,8 +540,9 @@ public final class ${token-constants-name} \{${line.separator}
|
|||||||
<target name="default-visitor" depends="jjtree" unless="jjtreeBuildNotRequired">
|
<target name="default-visitor" depends="jjtree" unless="jjtreeBuildNotRequired">
|
||||||
<move file="${target-package-dir}/${gen-visitor-name}.java" tofile="${generic-visitor-interface-file}" />
|
<move file="${target-package-dir}/${gen-visitor-name}.java" tofile="${generic-visitor-interface-file}" />
|
||||||
<replace file="${generic-visitor-interface-file}">
|
<replace file="${generic-visitor-interface-file}">
|
||||||
<replacefilter token="${gen-visitor-name}"
|
<replacefilter token="public interface ${gen-visitor-name}"
|
||||||
value="${generic-visitor-interface-name}<P, R> extends ${ast-api-package}.AstVisitor<P, R>" />
|
value='@net.sourceforge.pmd.annotation.Generated("org.javacc.javacc")${line.separator}
|
||||||
|
public interface ${generic-visitor-interface-name}<P, R> extends ${ast-api-package}.AstVisitor<P, R>' />
|
||||||
|
|
||||||
<replacefilter token="SimpleNode" value="${node-name}" />
|
<replacefilter token="SimpleNode" value="${node-name}" />
|
||||||
<!-- Root method, eg visitJavaNode -->
|
<!-- Root method, eg visitJavaNode -->
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.sourceforge.pmd.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.Documented;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Marks a class as generated code, and therefore to be ignored for code coverage purposes.
|
||||||
|
*
|
||||||
|
* @since 7.6.0
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.CLASS)
|
||||||
|
@Documented
|
||||||
|
public @interface Generated {
|
||||||
|
|
||||||
|
/** The generator that produced this code */
|
||||||
|
String value() default "";
|
||||||
|
|
||||||
|
}
|
2
pom.xml
2
pom.xml
@ -611,7 +611,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
<version>0.8.11</version>
|
<version>0.8.12</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.cyclonedx</groupId>
|
<groupId>org.cyclonedx</groupId>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user