Skip to content

Commit 3fc6397

Browse files
committedDec 5, 2018
Merge branch '__rultor'
2 parents f9ba694 + 386912e commit 3fc6397

File tree

7 files changed

+339
-0
lines changed

7 files changed

+339
-0
lines changed
 

‎pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<module>qulice-maven-plugin</module>
5050
<module>qulice-pmd</module>
5151
<module>qulice-spi</module>
52+
<module>qulice-spotbugs</module>
5253
<module>qulice-gradle-plugin</module>
5354
</modules>
5455
<description><![CDATA[

‎qulice-spotbugs/LICENSE.txt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2011-2018, Qulice.com
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions
6+
are met: 1) Redistributions of source code must retain the above
7+
copyright notice, this list of conditions and the following
8+
disclaimer. 2) Redistributions in binary form must reproduce the above
9+
copyright notice, this list of conditions and the following
10+
disclaimer in the documentation and/or other materials provided
11+
with the distribution. 3) Neither the name of the Qulice.com nor
12+
the names of its contributors may be used to endorse or promote
13+
products derived from this software without specific prior written
14+
permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
18+
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
19+
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20+
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
25+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27+
OF THE POSSIBILITY OF SUCH DAMAGE.

‎qulice-spotbugs/pom.xml

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
*
4+
* Copyright (c) 2011-2018, Qulice.com
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions
9+
* are met: 1) Redistributions of source code must retain the above
10+
* copyright notice, this list of conditions and the following
11+
* disclaimer. 2) Redistributions in binary form must reproduce the above
12+
* copyright notice, this list of conditions and the following
13+
* disclaimer in the documentation and/or other materials provided
14+
* with the distribution. 3) Neither the name of the Qulice.com nor
15+
* the names of its contributors may be used to endorse or promote
16+
* products derived from this software without specific prior written
17+
* permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
21+
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22+
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23+
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
30+
* OF THE POSSIBILITY OF SUCH DAMAGE.
31+
*
32+
-->
33+
<project xmlns="http://maven.apache.org/POM/4.0.0"
34+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
35+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
36+
<modelVersion>4.0.0</modelVersion>
37+
<parent>
38+
<groupId>com.qulice</groupId>
39+
<artifactId>qulice</artifactId>
40+
<version>1.0-SNAPSHOT</version>
41+
</parent>
42+
<artifactId>qulice-spotbugs</artifactId>
43+
<packaging>jar</packaging>
44+
<name>qulice-spotbugs</name>
45+
<dependencies>
46+
<dependency>
47+
<groupId>com.qulice</groupId>
48+
<artifactId>qulice-spi</artifactId>
49+
<version>${project.version}</version>
50+
</dependency>
51+
<dependency>
52+
<groupId>junit</groupId>
53+
<artifactId>junit</artifactId>
54+
</dependency>
55+
</dependencies>
56+
<build>
57+
<plugins>
58+
<plugin>
59+
<artifactId>maven-jar-plugin</artifactId>
60+
<configuration>
61+
<archive>
62+
<manifestEntries>
63+
<Main-Class>com.qulice.findbugs.Wrap</Main-Class>
64+
</manifestEntries>
65+
</archive>
66+
</configuration>
67+
</plugin>
68+
<plugin>
69+
<groupId>com.github.github</groupId>
70+
<artifactId>site-maven-plugin</artifactId>
71+
<configuration>
72+
<path>${project.artifactId}</path>
73+
</configuration>
74+
</plugin>
75+
</plugins>
76+
</build>
77+
<profiles>
78+
<profile>
79+
<id>qulice</id>
80+
<build>
81+
<plugins>
82+
<plugin>
83+
<groupId>com.qulice</groupId>
84+
<artifactId>qulice-maven-plugin</artifactId>
85+
<configuration>
86+
<excludes combine.children="append">
87+
<exclude>duplicatefinder:.*</exclude>
88+
</excludes>
89+
</configuration>
90+
</plugin>
91+
</plugins>
92+
</build>
93+
</profile>
94+
</profiles>
95+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2011-2018, Qulice.com
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met: 1) Redistributions of source code must retain the above
8+
* copyright notice, this list of conditions and the following
9+
* disclaimer. 2) Redistributions in binary form must reproduce the above
10+
* copyright notice, this list of conditions and the following
11+
* disclaimer in the documentation and/or other materials provided
12+
* with the distribution. 3) Neither the name of the Qulice.com nor
13+
* the names of its contributors may be used to endorse or promote
14+
* products derived from this software without specific prior written
15+
* permission.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
19+
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20+
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21+
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28+
* OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
package com.qulice.spotbugs;
31+
32+
import com.qulice.spi.Environment;
33+
import com.qulice.spi.ValidationException;
34+
import com.qulice.spi.Validator;
35+
36+
/**
37+
* Validates source code and compiled binaries with SpotBugs.
38+
*
39+
* @since 0.19
40+
*/
41+
public final class SpotBugsValidator implements Validator {
42+
43+
@Override
44+
public void validate(final Environment env) throws ValidationException {
45+
throw new UnsupportedOperationException("validate not implemented");
46+
}
47+
48+
@Override
49+
public String name() {
50+
return "SpotBugs";
51+
}
52+
53+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2011-2018, Qulice.com
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met: 1) Redistributions of source code must retain the above
8+
* copyright notice, this list of conditions and the following
9+
* disclaimer. 2) Redistributions in binary form must reproduce the above
10+
* copyright notice, this list of conditions and the following
11+
* disclaimer in the documentation and/or other materials provided
12+
* with the distribution. 3) Neither the name of the Qulice.com nor
13+
* the names of its contributors may be used to endorse or promote
14+
* products derived from this software without specific prior written
15+
* permission.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
19+
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20+
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21+
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28+
* OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
/**
32+
* SpotBugs validator.
33+
*
34+
* @since 0.19
35+
*/
36+
package com.qulice.spotbugs;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/*
2+
* Copyright (c) 2011-2018, Qulice.com
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met: 1) Redistributions of source code must retain the above
8+
* copyright notice, this list of conditions and the following
9+
* disclaimer. 2) Redistributions in binary form must reproduce the above
10+
* copyright notice, this list of conditions and the following
11+
* disclaimer in the documentation and/or other materials provided
12+
* with the distribution. 3) Neither the name of the Qulice.com nor
13+
* the names of its contributors may be used to endorse or promote
14+
* products derived from this software without specific prior written
15+
* permission.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
19+
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20+
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21+
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28+
* OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
package com.qulice.spotbugs;
31+
32+
import com.qulice.spi.Environment;
33+
import org.junit.Ignore;
34+
import org.junit.Test;
35+
36+
/**
37+
* Test case for {@link SpotBugsValidator}.
38+
* @since 0.19
39+
* @todo #884:30min Continue migration from FindBugs to SpotBugs. Implement
40+
* SpotBugsValidator for this and then uncomment SpotBugsValidatorTest class
41+
* so the minimal tests on this class can be run. Then, after all is set,
42+
* remove FindBugs references from pom and from qulice executions.
43+
*/
44+
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
45+
@Ignore
46+
public final class SpotBugsValidatorTest {
47+
48+
/**
49+
* SpotBugsValidatorTest can pass correct files with no exceptions.
50+
* @throws Exception If something wrong happens inside
51+
*/
52+
@Test
53+
public void passesCorrectFilesWithNoExceptions() throws Exception {
54+
final Environment env = new Environment.Mock()
55+
.withFile("src/main/java/Main.java", "class Main { int x = 0; }")
56+
.withDefaultClasspath();
57+
new SpotBugsValidator().validate(env);
58+
}
59+
60+
/**
61+
* SpotBugs can exclude classes from check.
62+
* @throws Exception If something wrong happens inside
63+
*/
64+
@Test
65+
public void excludesIncorrectClassFormCheck() throws Exception {
66+
final Environment env = new Environment.Mock()
67+
.withFile(
68+
"target/classes/Foo.class",
69+
"class Foo { public Foo clone() { return this; } }"
70+
).withExcludes("Foo").withDefaultClasspath();
71+
new SpotBugsValidator().validate(env);
72+
}
73+
74+
/**
75+
* FindbugsValidator can exclude several classes from check.
76+
* @throws Exception If something wrong happens inside
77+
*/
78+
@Test
79+
public void excludesSeveralIncorrectClassFromCheck() throws Exception {
80+
final Environment env = new Environment.Mock()
81+
.withFile(
82+
"target/classes/Foo.java",
83+
"class Foo { public Foo clone() { return this; } }"
84+
).withFile(
85+
"target/classes/Bar.java",
86+
"class Bar { public Bar clone() { return this; } }"
87+
).withExcludes("Foo,Bar")
88+
.withDefaultClasspath();
89+
new SpotBugsValidator().validate(env);
90+
}
91+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2011-2018, Qulice.com
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met: 1) Redistributions of source code must retain the above
8+
* copyright notice, this list of conditions and the following
9+
* disclaimer. 2) Redistributions in binary form must reproduce the above
10+
* copyright notice, this list of conditions and the following
11+
* disclaimer in the documentation and/or other materials provided
12+
* with the distribution. 3) Neither the name of the Qulice.com nor
13+
* the names of its contributors may be used to endorse or promote
14+
* products derived from this software without specific prior written
15+
* permission.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
19+
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20+
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21+
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28+
* OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
/**
32+
* Tests of SpotBugs validator.
33+
*
34+
* @since 0.19
35+
*/
36+
package com.qulice.spotbugs;

1 commit comments

Comments
 (1)

0pdd commented on Dec 5, 2018

@0pdd
Collaborator

Puzzle 884-ab2ca2fa discovered in qulice-spotbugs/src/test/java/com.qulice.spotbugs/SpotBugsValidatorTest.java and submitted as #959. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.