This is an automated email from the ASF dual-hosted git repository.
abhi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/master by this push:
new bee5e20ce RANGER-5020: Fix duplicate ranger-pmd-ruleset and use
central ruleset in dev-support (#423)
bee5e20ce is described below
commit bee5e20ce7c8bdc9b3509759621633ec481857d4
Author: Abhishek Kumar <[email protected]>
AuthorDate: Tue Jan 13 13:53:52 2026 -0800
RANGER-5020: Fix duplicate ranger-pmd-ruleset and use central ruleset in
dev-support (#423)
---
ranger-examples/conditions-enrichers/pom.xml | 14 +++
ranger-examples/dev-support/ranger-pmd-ruleset.xml | 121 ---------------------
ranger-examples/distro/pom.xml | 14 +++
ranger-examples/plugin-sampleapp/pom.xml | 14 +++
ranger-examples/sample-client/pom.xml | 14 +++
ranger-examples/sampleapp/pom.xml | 14 +++
.../ranger/examples/sampleapp/SampleApp.java | 4 +-
7 files changed, 71 insertions(+), 124 deletions(-)
diff --git a/ranger-examples/conditions-enrichers/pom.xml
b/ranger-examples/conditions-enrichers/pom.xml
index b61eb7433..e0109733f 100644
--- a/ranger-examples/conditions-enrichers/pom.xml
+++ b/ranger-examples/conditions-enrichers/pom.xml
@@ -45,4 +45,18 @@
<scope>test</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <rulesets>
+
<ruleset>${project.parent.parent.basedir}/dev-support/ranger-pmd-ruleset.xml</ruleset>
+ </rulesets>
+ <failOnViolation>true</failOnViolation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/ranger-examples/dev-support/ranger-pmd-ruleset.xml
b/ranger-examples/dev-support/ranger-pmd-ruleset.xml
deleted file mode 100644
index 9e5ed7a5d..000000000
--- a/ranger-examples/dev-support/ranger-pmd-ruleset.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<ruleset name="ranger-pmd" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0
http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
- <description>
- Apache Ranger - PMD rule set
- </description>
-
- <rule ref="category/java/bestpractices.xml">
- <!-- TODO: can be Handle -->
- <exclude name="ForLoopCanBeForeach" />
- <exclude name="UseCollectionIsEmpty" />
- <exclude name="UnusedLocalVariable" />
- <exclude name="UnusedPrivateField" />
- <exclude name="WhileLoopWithLiteralBoolean" />
- <exclude name="UnusedFormalParameter" />
- <exclude name="ForLoopVariableCount" />
- <exclude name="DoubleBraceInitialization" />
- <exclude name="AbstractClassWithoutAbstractMethod" />
- <exclude name="UseTryWithResources" />
- <exclude name="GuardLogStatement" /> <!-- TODO: guard only debug log
level-->
- <!-- Nothing -->
- <exclude name="AvoidReassigningParameters" />
- <exclude name="MissingOverride" />
- <exclude name="AvoidPrintStackTrace" />
- <exclude name="SystemPrintln" />
- <exclude name="UseVarargs" />
- <exclude name="PositionLiteralsFirstInComparisons" />
- <exclude name="JUnitAssertionsShouldIncludeMessage" />
- <exclude name="UseAssertEqualsInsteadOfAssertTrue" />
- <exclude name="AvoidUsingHardCodedIP" />
- <exclude name="AccessorMethodGeneration" />
- <exclude name="PositionLiteralsFirstInCaseInsensitiveComparisons" />
- <exclude name="LooseCoupling" />
- <exclude name="SwitchStmtsShouldHaveDefault" />
- <exclude name="AvoidReassigningLoopVariables" />
- <exclude name="JUnitTestContainsTooManyAsserts" />
- <exclude name="JUnitTestsShouldIncludeAssert" />
- <exclude name="UseAssertSameInsteadOfAssertTrue" />
- <exclude name="UseAssertNullInsteadOfAssertTrue" />
- <exclude name="UseAssertTrueInsteadOfAssertEquals" />
- <exclude name="MethodReturnsInternalArray" />
- <exclude name="PreserveStackTrace" />
- <exclude name="OneDeclarationPerLine" />
- <exclude name="ArrayIsStoredDirectly" />
- <exclude name="AccessorClassGeneration" />
- <exclude name="ConstantsInInterface" />
- </rule>
- <rule ref="category/java/codestyle.xml">
- <!-- TODO: can be Handle -->
- <exclude name="UnnecessaryLocalBeforeReturn" />
- <exclude name="UnnecessaryModifier" />
- <exclude name="UnnecessaryConstructor" />
- <exclude name="UnnecessaryFullyQualifiedName" />
- <exclude name="UnnecessaryAnnotationValueElement" />
- <exclude name="LocalVariableNamingConventions" />
- <exclude name="AvoidDollarSigns" />
- <exclude name="ClassNamingConventions" />
- <!-- Nothing -->
- <exclude name="LocalVariableCouldBeFinal" />
- <exclude name="MethodArgumentCouldBeFinal" />
- <exclude name="ShortVariable" />
- <exclude name="LongVariable" />
- <exclude name="IdenticalCatchBranches" />
- <exclude name="ControlStatementBraces" />
- <exclude name="UselessParentheses" />
- <exclude name="FieldNamingConventions" />
- <exclude name="ConfusingTernary" />
- <exclude name="OnlyOneReturn" />
- <exclude name="AtLeastOneConstructor" />
- <exclude name="PrematureDeclaration" />
- <exclude name="CallSuperInConstructor" />
- <exclude name="DefaultPackage" />
- <exclude name="CommentDefaultAccessModifier" />
- <exclude name="UseDiamondOperator" />
- <exclude name="FieldDeclarationsShouldBeAtStartOfClass" />
- <exclude name="BooleanGetMethodName" />
- <exclude name="EmptyMethodInAbstractClassShouldBeAbstract" />
- <exclude name="UseUnderscoresInNumericLiterals" />
- <exclude name="MethodNamingConventions" />
- <exclude name="UseShortArrayInitializer" />
- <exclude name="LinguisticNaming" />
- <exclude name="ShortClassName" />
- <exclude name="FormalParameterNamingConventions" />
- <exclude name="ShortMethodName" />
- <exclude name="PackageCase" />
- <exclude name="GenericsNaming" />
- <exclude name="TooManyStaticImports" />
- </rule>
- <rule ref="category/java/multithreading.xml">
- <!-- TODO: can be Handle -->
- <exclude name="DontCallThreadRun" />
- <exclude name="DoubleCheckedLocking" />
- <exclude name="AvoidSynchronizedAtMethodLevel" />
- <exclude name="UseConcurrentHashMap" />
- <exclude name="AvoidUsingVolatile" />
- <!-- Nothing -->
- <exclude name="DoNotUseThreads" />
- <exclude name="UseNotifyAllInsteadOfNotify" />
- <exclude name="NonThreadSafeSingleton" />
- </rule>
-
-</ruleset>
diff --git a/ranger-examples/distro/pom.xml b/ranger-examples/distro/pom.xml
index eda1f4dae..3da077af9 100644
--- a/ranger-examples/distro/pom.xml
+++ b/ranger-examples/distro/pom.xml
@@ -51,6 +51,20 @@
<version>${project.version}</version>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <rulesets>
+
<ruleset>${project.parent.parent.basedir}/dev-support/ranger-pmd-ruleset.xml</ruleset>
+ </rulesets>
+ <failOnViolation>true</failOnViolation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
<profiles>
<profile>
diff --git a/ranger-examples/plugin-sampleapp/pom.xml
b/ranger-examples/plugin-sampleapp/pom.xml
index 155b3cbb7..49e7a61b9 100644
--- a/ranger-examples/plugin-sampleapp/pom.xml
+++ b/ranger-examples/plugin-sampleapp/pom.xml
@@ -139,4 +139,18 @@
<scope>test</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <rulesets>
+
<ruleset>${project.parent.parent.basedir}/dev-support/ranger-pmd-ruleset.xml</ruleset>
+ </rulesets>
+ <failOnViolation>true</failOnViolation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/ranger-examples/sample-client/pom.xml
b/ranger-examples/sample-client/pom.xml
index 662a03110..26035fd5b 100644
--- a/ranger-examples/sample-client/pom.xml
+++ b/ranger-examples/sample-client/pom.xml
@@ -55,4 +55,18 @@
<version>${slf4j.version}</version>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <rulesets>
+
<ruleset>${project.parent.parent.basedir}/dev-support/ranger-pmd-ruleset.xml</ruleset>
+ </rulesets>
+ <failOnViolation>true</failOnViolation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/ranger-examples/sampleapp/pom.xml
b/ranger-examples/sampleapp/pom.xml
index 6f1f5a722..6e706d39f 100644
--- a/ranger-examples/sampleapp/pom.xml
+++ b/ranger-examples/sampleapp/pom.xml
@@ -38,4 +38,18 @@
<version>${slf4j.version}</version>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <configuration>
+ <rulesets>
+
<ruleset>${project.parent.parent.basedir}/dev-support/ranger-pmd-ruleset.xml</ruleset>
+ </rulesets>
+ <failOnViolation>true</failOnViolation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git
a/ranger-examples/sampleapp/src/main/java/org/apache/ranger/examples/sampleapp/SampleApp.java
b/ranger-examples/sampleapp/src/main/java/org/apache/ranger/examples/sampleapp/SampleApp.java
index 10a7d7ead..7138376e9 100644
---
a/ranger-examples/sampleapp/src/main/java/org/apache/ranger/examples/sampleapp/SampleApp.java
+++
b/ranger-examples/sampleapp/src/main/java/org/apache/ranger/examples/sampleapp/SampleApp.java
@@ -54,7 +54,7 @@ public void init() {
public void run() {
LOG.debug("==> SampleApp.run()");
- do {
+ while (true) {
String input = getInput();
if (input == null) {
@@ -89,8 +89,6 @@ public void run() {
LOG.info("Not authorized!");
}
}
- while (true);
-
LOG.debug("<== SampleApp.run()");
}