Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Commit

Permalink
[FIXED JENKINS-38557] Don' use an empty category or type anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Jan 4, 2017
1 parent 5e3f481 commit ec25a5f
Show file tree
Hide file tree
Showing 24 changed files with 177 additions and 114 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -44,7 +44,7 @@
<dependency>
<groupId>org.jvnet.hudson.plugins</groupId>
<artifactId>analysis-core</artifactId>
<version>1.80</version>
<version>1.82-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down
@@ -1,13 +1,13 @@
package hudson.plugins.warnings.parser;

import static org.junit.Assert.*;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

import org.junit.Test;

import static org.junit.Assert.*;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;

Expand Down Expand Up @@ -58,6 +58,6 @@ public void parseDeprecation() throws IOException {
3,
"The serializable class AttributeException does not declare a static final serialVersionUID field of type long",
"C:/Desenvolvimento/Java/jfg/src/jfg/AttributeException.java",
getType(), "", Priority.NORMAL);
getType(), DEFAULT_CATEGORY, Priority.NORMAL);
}
}
@@ -1,14 +1,13 @@
package hudson.plugins.warnings.parser;

import static org.junit.Assert.*;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

import org.apache.commons.lang.StringUtils;
import org.junit.Test;

import static org.junit.Assert.*;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;

Expand Down Expand Up @@ -36,25 +35,25 @@ public void parseFile() throws IOException {
39,
"Imperative statement required",
"COPY/zzz.CPY",
TYPE, StringUtils.EMPTY, Priority.NORMAL);
TYPE, DEFAULT_CATEGORY, Priority.NORMAL);
annotation = iterator.next();
checkWarning(annotation,
111,
"Don't run with knives",
"C:/Documents and Settings/xxxx/COB/bbb.COB",
TYPE, StringUtils.EMPTY, Priority.NORMAL);
TYPE, DEFAULT_CATEGORY, Priority.NORMAL);
annotation = iterator.next();
checkWarning(annotation,
115,
"Don't run with knives",
"C:/Documents and Settings/xxxx/COB/bbb.COB",
TYPE, StringUtils.EMPTY, Priority.NORMAL);
TYPE, DEFAULT_CATEGORY, Priority.NORMAL);
annotation = iterator.next();
checkWarning(annotation,
123,
"I'm a green banana",
"C:/Documents and Settings/xxxx/COB/ccc.COB",
TYPE, StringUtils.EMPTY, Priority.NORMAL);
TYPE, DEFAULT_CATEGORY, Priority.NORMAL);
}

@Override
Expand Down
14 changes: 7 additions & 7 deletions src/test/java/hudson/plugins/warnings/parser/AjcParserTest.java
@@ -1,16 +1,16 @@
package hudson.plugins.warnings.parser;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;
import org.junit.Test;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.Locale;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import org.junit.Test;

import static org.junit.Assert.*;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;

/**
* Tests the class {@link hudson.plugins.warnings.parser.AjcParser}.
Expand Down Expand Up @@ -41,7 +41,7 @@ public void parseDeprecation() throws IOException {
0,
"incorrect classpath: /home/hudson/.m2/repository/org/apache/cxf/cxf/2.6.1/cxf-2.6.1.pom",
"<unknown source file>",
WARNING_TYPE, "", Priority.NORMAL);
WARNING_TYPE, DEFAULT_CATEGORY, Priority.NORMAL);

annotation = iterator.next();
checkWarning(annotation,
Expand Down
Expand Up @@ -95,7 +95,7 @@ public void issue2133() throws IOException {
86,
"non-varargs call of varargs method with inexact argument type for last parameter;",
"/home/hudson/hudson/data/jobs/Mockito/workspace/trunk/test/org/mockitousage/misuse/DescriptiveMessagesOnMisuseTest.java",
WARNING_TYPE, "", Priority.NORMAL);
WARNING_TYPE, DEFAULT_CATEGORY, Priority.NORMAL);
checkWarning(iterator.next(),
51,
"<T>stubVoid(T) in org.mockito.Mockito has been deprecated",
Expand Down
@@ -1,22 +1,21 @@
package hudson.plugins.warnings.parser;

import static org.junit.Assert.*;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

import org.apache.commons.lang.StringUtils;
import org.junit.Test;

import static org.junit.Assert.*;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;

/**
* Tests the class {@link Armcc5CompilerParser}.
*/
public class Armcc5CompilerParserTest extends ParserTester {
private static final String WARNING_CATEGORY = StringUtils.EMPTY;
private static final String WARNING_CATEGORY = DEFAULT_CATEGORY;
private static final String WARNING_TYPE = new Armcc5CompilerParser().getGroup();

/**
Expand Down
@@ -1,22 +1,21 @@
package hudson.plugins.warnings.parser;

import static org.junit.Assert.*;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

import org.apache.commons.lang.StringUtils;
import org.junit.Test;

import static org.junit.Assert.*;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;

/**
* Tests the class {@link ArmccCompilerParser}.
*/
public class ArmccCompilerParserTest extends ParserTester {
private static final String WARNING_CATEGORY = StringUtils.EMPTY;
private static final String WARNING_CATEGORY = DEFAULT_CATEGORY;
private static final String WARNING_TYPE = new ArmccCompilerParser().getGroup();

/**
Expand Down
@@ -1,13 +1,13 @@
package hudson.plugins.warnings.parser;

import static org.junit.Assert.*;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

import org.junit.Test;

import static org.junit.Assert.*;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;

Expand All @@ -16,6 +16,7 @@
*/
public class BuckminsterParserTest extends ParserTester {
private static final String TYPE = new BuckminsterParser().getGroup();
private static final String CATEGORY = DEFAULT_CATEGORY;

/**
* Parses a file with three Buckminster warnings.
Expand All @@ -35,19 +36,19 @@ public void testWarningsParser() throws IOException {
43,
"ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized",
"/var/lib/hudson/jobs/MailApp/workspace/plugins/org.eclipse.buckminster.tutorial.mailapp/src/org/eclipse/buckminster/tutorial/mailapp/NavigationView.java",
TYPE, "", Priority.NORMAL);
TYPE, CATEGORY, Priority.NORMAL);
annotation = iterator.next();
checkWarning(annotation,
57,
"Type safety: The method toArray(Object[]) belongs to the raw type ArrayList. References to generic type ArrayList<E> should be parameterized",
"/var/lib/hudson/jobs/MailApp/workspace/plugins/org.eclipse.buckminster.tutorial.mailapp/src/org/eclipse/buckminster/tutorial/mailapp/NavigationView.java",
TYPE, "", Priority.HIGH);
TYPE, CATEGORY, Priority.HIGH);
annotation = iterator.next();
checkWarning(annotation,
0,
"Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.",
"/var/lib/hudson/jobs/MailApp/workspace/plugins/org.eclipse.buckminster.tutorial.mailapp",
TYPE, "", Priority.NORMAL);
TYPE, CATEGORY, Priority.NORMAL);
}

@Override
Expand Down
Expand Up @@ -4,7 +4,6 @@
import java.util.Collection;
import java.util.Iterator;

import org.apache.commons.lang.StringUtils;
import org.junit.Test;

import static org.junit.Assert.*;
Expand Down Expand Up @@ -52,7 +51,7 @@ public void issue18084() throws IOException {
assertEquals(WRONG_NUMBER_OF_WARNINGS_DETECTED, 1, warnings.size());
FileAnnotation annotation = warnings.iterator().next();
checkWarning(annotation, 10, 10, "'test.h' file not found",
"./test.h", StringUtils.EMPTY, Priority.HIGH);
"./test.h", DEFAULT_CATEGORY, Priority.HIGH);
}

/**
Expand All @@ -69,7 +68,7 @@ public void issue14333() throws IOException {
assertEquals(WRONG_NUMBER_OF_WARNINGS_DETECTED, 1, warnings.size());
FileAnnotation annotation = warnings.iterator().next();
checkWarning(annotation, 1518, 28, "Array access (via field 'yy_buffer_stack') results in a null pointer dereference",
"scanner.cpp", StringUtils.EMPTY, Priority.NORMAL);
"scanner.cpp", DEFAULT_CATEGORY, Priority.NORMAL);
}

/**
Expand Down Expand Up @@ -108,7 +107,7 @@ public void testWarningsParser() throws IOException {
28,
"extra tokens at end of #endif directive",
"test.c",
TYPE, "", Priority.NORMAL);
TYPE, DEFAULT_CATEGORY, Priority.NORMAL);
annotation = iterator.next();
checkWarning(annotation,
3, 11,
Expand All @@ -133,7 +132,7 @@ public void testWarningsParser() throws IOException {
47, 15,
"invalid operands to binary expression ('int *' and '_Complex float')",
"exprs.c",
TYPE, "", Priority.NORMAL);
TYPE, DEFAULT_CATEGORY, Priority.NORMAL);
}

@Override
Expand Down
@@ -1,13 +1,13 @@
package hudson.plugins.warnings.parser;

import static org.junit.Assert.*;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

import org.junit.Test;

import static org.junit.Assert.*;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;

Expand All @@ -33,7 +33,7 @@ public void testWarningsParser() throws IOException {
150,
"function `unsigned configureRealCh(unsigned)' was declared static, but was not defined",
"/nfs/autofs/nett/nessie6/dailies/Monday/src/n6/heidrun/dsp/Modules/LocalChAdmin.c",
new CoolfluxChessccParser().getGroup(), "", Priority.HIGH);
new CoolfluxChessccParser().getGroup(), DEFAULT_CATEGORY, Priority.HIGH);

}

Expand Down
@@ -1,15 +1,14 @@
package hudson.plugins.warnings.parser;

import static org.junit.Assert.*;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

import org.apache.commons.lang.StringUtils;
import org.junit.Ignore;
import org.junit.Test;

import static org.junit.Assert.*;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;

Expand All @@ -18,7 +17,7 @@
*/
public class DoxygenParserTest extends ParserTester {
private static final String WARNING_TYPE = new DoxygenParser().getGroup();
private static final String WARNING_CATEGORY = StringUtils.EMPTY;
private static final String WARNING_CATEGORY = DEFAULT_CATEGORY;

/**
* Parses a file with Doxygen warnings.
Expand Down
@@ -1,7 +1,5 @@
package hudson.plugins.warnings.parser;

import static org.junit.Assert.*;

import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
Expand All @@ -12,6 +10,8 @@

import com.google.common.collect.Lists;

import static org.junit.Assert.*;

import hudson.plugins.analysis.core.ParserResult;
import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;
Expand All @@ -20,6 +20,8 @@
* Tests the class {@link EclipseParser}.
*/
public class EclipseParserTest extends AbstractEclipseParserTest {
private static final String CATEGORY = DEFAULT_CATEGORY;

/**
* Parses a warning log with previously undetected warnings.
*
Expand All @@ -41,7 +43,7 @@ public void issue21377() throws IOException {
13,
"The method getOldValue() from the type SomeType is deprecated",
"/path/to/job/job-name/module/src/main/java/com/example/Example.java",
getType(), "", Priority.NORMAL);
getType(), CATEGORY, Priority.NORMAL);
}

/**
Expand All @@ -65,17 +67,17 @@ public void issue13969() throws IOException {
369,
"The method compare(List<String>, List<String>) from the type PmModelImporter is never used locally",
"/media/ssd/multi-x-processor/workspace/msgPM_Access/com.faktorzehn.pa2msgpm.core/src/com/faktorzehn/pa2msgpm/core/loader/PmModelImporter.java",
getType(), "", Priority.NORMAL);
getType(), CATEGORY, Priority.NORMAL);
checkWarning(iterator.next(),
391,
"The method getTableValues(PropertyRestrictionType) from the type PmModelImporter is never used locally",
"/media/ssd/multi-x-processor/workspace/msgPM_Access/com.faktorzehn.pa2msgpm.core/src/com/faktorzehn/pa2msgpm/core/loader/PmModelImporter.java",
getType(), "", Priority.NORMAL);
getType(), CATEGORY, Priority.NORMAL);
checkWarning(iterator.next(),
56,
"The value of the field PropertyImporterTest.ERROR_RESPONSE is not used",
"/media/ssd/multi-x-processor/workspace/msgPM_Access/com.faktorzehn.pa2msgpm.core.test/src/com/faktorzehn/pa2msgpm/core/importer/PropertyImporterTest.java",
getType(), "", Priority.NORMAL);
getType(), CATEGORY, Priority.NORMAL);
}

/**
Expand Down Expand Up @@ -136,7 +138,7 @@ public void issue6427() throws IOException {
10,
"The import com.bombardier.oldinfra.export.dataAccess.InfrastructureDiagramAPI is never used",
"/srv/hudson/workspace/Ebitool Trunk/build/plugins/com.bombardier.oldInfra.export.jet/jet2java/org/eclipse/jet/compiled/_jet_infraSoe.java",
getType(), "", Priority.NORMAL);
getType(), CATEGORY, Priority.NORMAL);
}

/**
Expand All @@ -158,12 +160,12 @@ public void issue7077() throws IOException {
90,
"Type safety: The method setBoHandler(BoHandler) belongs to the raw type BoQuickSearchControl.Builder. References to generic type BoQuickSearchControl<S>.Builder<T> should be parameterized",
"/ige/hudson/work/jobs/esvclient__development/workspace/target/rcp-build/plugins/ch.ipi.esv.client.customer/src/main/java/ch/ipi/esv/client/customer/search/CustomerQuickSearch.java",
getType(), "", Priority.NORMAL);
getType(), CATEGORY, Priority.NORMAL);
checkWarning(sorted.get(1),
90,
"Type safety: The expression of type BoQuickSearchControl needs unchecked conversion to conform to BoQuickSearchControl<CustomerBO>",
"/ige/hudson/work/jobs/esvclient__development/workspace/target/rcp-build/plugins/ch.ipi.esv.client.customer/src/main/java/ch/ipi/esv/client/customer/search/CustomerQuickSearch.java",
getType(), "", Priority.NORMAL);
getType(), CATEGORY, Priority.NORMAL);
}

/**
Expand Down

0 comments on commit ec25a5f

Please sign in to comment.