Skip to content

Commit

Permalink
RANGER-5020: Fix duplicate ranger-pmd-ruleset and use central ruleset…
Browse files Browse the repository at this point in the history
… in dev-support
  • Loading branch information
kumaab authored and Abhishek Kumar committed Dec 6, 2024
1 parent 5c8d4d0 commit 95dfffe
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 126 deletions.
14 changes: 14 additions & 0 deletions ranger-examples/conditions-enrichers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
121 changes: 0 additions & 121 deletions ranger-examples/dev-support/ranger-pmd-ruleset.xml

This file was deleted.

14 changes: 14 additions & 0 deletions ranger-examples/distro/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
14 changes: 14 additions & 0 deletions ranger-examples/plugin-sampleapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,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>
14 changes: 14 additions & 0 deletions ranger-examples/sample-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
14 changes: 14 additions & 0 deletions ranger-examples/sampleapp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.apache.ranger.examples.sampleapp;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
Expand Down Expand Up @@ -52,7 +53,7 @@ public void init() {
public void run() {
LOG.debug("==> SampleApp.run()");

do {
while(true) {
String input = getInput();

if(input == null) {
Expand All @@ -69,9 +70,7 @@ public void run() {
String userName = getStringArg(args, 2);
Set<String> userGroups = new HashSet<String>();

for(int i = 3; i < args.length; i++) {
userGroups.add(args[i]);
}
userGroups.addAll(Arrays.asList(args).subList(3, args.length));

if(fileName == null || accessType == null || userName == null) {
LOG.info("Insufficient arguments. Usage: <accessType> <fileName> <userName> [userGroup1 userGroup2 userGroup3 ..]");
Expand All @@ -90,7 +89,7 @@ public void run() {
} else {
LOG.info("Not authorized!");
}
} while(true);
}

LOG.debug("<== SampleApp.run()");
}
Expand Down

0 comments on commit 95dfffe

Please sign in to comment.