Skip to content

Commit 62c0c3d

Browse files
AndreLouisCaronAndre Caron
andauthored
Ignore PMD violations in generated Thrift source (#325)
All but one violation were in code generated by the Thrift compiler. Some of them were excluded specifically using PMD exclusion rules, but the remaining ones refer to inner classes, which don't seem to be affected by exclusion rules. Co-authored-by: Andre Caron <[email protected]>
1 parent 7b31490 commit 62c0c3d

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
com.cloudera.flume.handlers.thrift.EventStatus=UnnecessaryModifier
2+
com.cloudera.flume.handlers.thrift.Priority=UnnecessaryModifier
3+
com.cloudera.flume.handlers.thrift.ThriftFlumeEvent=UnnecessaryFullyQualifiedName,UselessParentheses

flume-ng-legacy-sources/flume-thrift-source/pom.xml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ limitations under the License.
3131
<name>Flume legacy Thrift Source</name>
3232

3333
<properties>
34-
<!-- TODO fix spotbugs/pmd violations -->
35-
<spotbugs.maxAllowedViolations>38</spotbugs.maxAllowedViolations>
36-
<pmd.maxAllowedViolations>119</pmd.maxAllowedViolations>
34+
<!-- TODO fix spotbugs violations -->
35+
<spotbugs.maxAllowedViolations>37</spotbugs.maxAllowedViolations>
36+
<!-- PMD violations come from code generated by the Thrift compiler.
37+
We cannot seem to be able to match inner classes (with a `$` in them)
38+
using the patterns in `exclude-pmd.properties`, so we cannot exclude
39+
the remaining violations and we must live with them. -->
40+
<pmd.maxAllowedViolations>91</pmd.maxAllowedViolations>
41+
<pmd.excludeFromFailureFile>${basedir}/exclude-pmd.properties</pmd.excludeFromFailureFile>
3742
</properties>
3843

3944
<profiles>

flume-ng-legacy-sources/flume-thrift-source/src/main/java/org/apache/flume/source/thriftLegacy/ThriftLegacySource.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ public void append(ThriftFlumeEvent evt ) {
9999
}
100100

101101
counterGroup.incrementAndGet("rpc.successful");
102-
return;
103102
}
104103

105104
public void close() {

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ limitations under the License.
534534
<exclude>**/derby.log</exclude>
535535
<exclude>**/metastore_db/</exclude>
536536
<exclude>.mvn/**</exclude>
537+
<exclude>**/exclude-pmd.properties</exclude>
537538
</excludes>
538539
<consoleOutput>true</consoleOutput>
539540
</configuration>

0 commit comments

Comments
 (0)