Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Commit

Permalink
[FIXED JENKINS-10027] Added new tokens for new and fixed warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Jul 6, 2011
1 parent 6cdbc30 commit c78ff2c
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -36,7 +36,7 @@
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>analysis-core</artifactId>
<version>1.23</version>
<version>1.24-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
Expand Down
@@ -0,0 +1,23 @@
package hudson.plugins.pmd.tokens;

import hudson.Extension;
import hudson.plugins.analysis.tokens.AbstractFixedAnnotationsTokenMacro;
import hudson.plugins.pmd.PmdMavenResultAction;
import hudson.plugins.pmd.PmdResultAction;

/**
* Provides a token that evaluates to the number of fixed PMD warnings.
*
* @author Ulli Hafner
*/
@Extension(optional = true)
public class FixedPmdWarningsTokenMacro extends AbstractFixedAnnotationsTokenMacro {
/**
* Creates a new instance of {@link FixedPmdWarningsTokenMacro}.
*/
@SuppressWarnings("unchecked")
public FixedPmdWarningsTokenMacro() {
super("PMD_FIXED", PmdResultAction.class, PmdMavenResultAction.class);
}
}

@@ -0,0 +1,23 @@
package hudson.plugins.pmd.tokens;

import hudson.Extension;
import hudson.plugins.analysis.tokens.AbstractNewAnnotationsTokenMacro;
import hudson.plugins.pmd.PmdMavenResultAction;
import hudson.plugins.pmd.PmdResultAction;

/**
* Provides a token that evaluates to the number of new PMD warnings.
*
* @author Ulli Hafner
*/
@Extension(optional = true)
public class NewPmdWarningsTokenMacro extends AbstractNewAnnotationsTokenMacro {
/**
* Creates a new instance of {@link NewPmdWarningsTokenMacro}.
*/
@SuppressWarnings("unchecked")
public NewPmdWarningsTokenMacro() {
super("PMD_NEW", PmdResultAction.class, PmdMavenResultAction.class);
}
}

Expand Up @@ -2,6 +2,7 @@

import hudson.Extension;
import hudson.plugins.analysis.tokens.AbstractResultTokenMacro;
import hudson.plugins.pmd.PmdMavenResultAction;
import hudson.plugins.pmd.PmdResultAction;

/**
Expand All @@ -14,8 +15,9 @@ public class PmdResultTokenMacro extends AbstractResultTokenMacro {
/**
* Creates a new instance of {@link PmdResultTokenMacro}.
*/
@SuppressWarnings("unchecked")
public PmdResultTokenMacro() {
super(PmdResultAction.class, "PMD_RESULT");
super("PMD_RESULT", PmdResultAction.class, PmdMavenResultAction.class);
}
}

@@ -1,7 +1,8 @@
package hudson.plugins.pmd.tokens;

import hudson.Extension;
import hudson.plugins.analysis.tokens.AbstractResultTokenMacro;
import hudson.plugins.analysis.tokens.AbstractAnnotationsCountTokenMacro;
import hudson.plugins.pmd.PmdMavenResultAction;
import hudson.plugins.pmd.PmdResultAction;

/**
Expand All @@ -10,12 +11,13 @@
* @author Ulli Hafner
*/
@Extension(optional = true)
public class PmdWarningCountTokenMacro extends AbstractResultTokenMacro {
public class PmdWarningCountTokenMacro extends AbstractAnnotationsCountTokenMacro {
/**
* Creates a new instance of {@link PmdWarningCountTokenMacro}.
*/
@SuppressWarnings("unchecked")
public PmdWarningCountTokenMacro() {
super(PmdResultAction.class, "PMD_COUNT");
super("PMD_COUNT", PmdResultAction.class, PmdMavenResultAction.class);
}
}

@@ -0,0 +1,8 @@
<j:jelly xmlns:j="jelly:core">

<dt>$${PMD_FIXED}</dt>
<dd>
Expands to the total number of fixed PMD warnings in a build.
</dd>

</j:jelly>
@@ -0,0 +1,8 @@
<j:jelly xmlns:j="jelly:core">

<dt>$${PMD_NEW}</dt>
<dd>
Expands to the total number of new PMD warnings in a build.
</dd>

</j:jelly>

0 comments on commit c78ff2c

Please sign in to comment.