Skip to content
Permalink
Browse files

[JENKINS-42383] Removed dependent plugins (#16)

[JENKINS-42383] Removed dependent plugins
  • Loading branch information...
v1v committed Mar 2, 2017
1 parent 0856ba2 commit ccaba773360c7e3c2ab0aa0ac6fe07f922d6390b
@@ -96,6 +96,7 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>javadoc</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>

<dependency>
@@ -109,7 +110,7 @@
<groupId>org.jenkins-ci.main</groupId>
<artifactId>maven-plugin</artifactId>
<version>2.8</version>
<optional>true</optional>
<scope>test</scope>
</dependency>

<dependency>
@@ -1,7 +1,6 @@
package org.jenkins.ci.plugins.jenkinslint.check;

import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;
import hudson.model.Item;
import hudson.model.Project;
import hudson.tasks.Builder;
@@ -25,10 +24,14 @@ public GradleWrapperChecker() {
public boolean executeCheck(Item item) {
boolean found = false;
if (Jenkins.getInstance().pluginManager.getPlugin("gradle") != null) {

if (Jenkins.getInstance().pluginManager.getPlugin("maven-plugin")!=null) {
if (item instanceof MavenModuleSet) {
found = isGradlew(((MavenModuleSet) item).getPrebuilders());
if (item.getClass().getSimpleName().equals("MavenModuleSet")) {
try {
Object getPrebuilders = item.getClass().getMethod("getPrebuilders", null).invoke(item);
if (getPrebuilders instanceof List) {
found = isGradlew((List) getPrebuilders);
}
}catch (Exception e) {
LOG.log(Level.WARNING, "Exception " + e.getMessage(), e.getCause());
}
}
if (item instanceof Project) {
@@ -1,7 +1,6 @@
package org.jenkins.ci.plugins.jenkinslint.check;

import hudson.matrix.MatrixProject;
import hudson.maven.MavenModuleSet;
import hudson.model.Item;
import hudson.model.Project;
import hudson.tasks.Builder;
@@ -26,9 +25,14 @@ public boolean executeCheck(Item item) {
boolean found = false;
if (Jenkins.getInstance().pluginManager.getPlugin("groovy") != null) {

if (Jenkins.getInstance().pluginManager.getPlugin("maven-plugin")!=null) {
if (item instanceof MavenModuleSet) {
found = isSystemExit(((MavenModuleSet) item).getPrebuilders());
if (item.getClass().getSimpleName().equals("MavenModuleSet")) {
try {
Object getPrebuilders = item.getClass().getMethod("getPrebuilders", null).invoke(item);
if (getPrebuilders instanceof List) {
found = isSystemExit((List) getPrebuilders);
}
}catch (Exception e) {
LOG.log(Level.WARNING, "Exception " + e.getMessage(), e.getCause());
}
}
if (item instanceof Project) {
@@ -4,7 +4,6 @@
import hudson.model.Item;
import hudson.model.Project;
import hudson.tasks.Builder;
import hudson.maven.MavenModuleSet;
import hudson.tasks.CommandInterpreter;
import jenkins.model.Jenkins;
import org.jenkins.ci.plugins.jenkinslint.model.AbstractCheck;
@@ -29,9 +28,14 @@ public HardcodedScriptChecker() {
public boolean executeCheck(Item item) {
LOG.log(Level.FINE, "executeCheck " + item);
boolean found = false;
if (Jenkins.getInstance().pluginManager.getPlugin("maven-plugin")!=null) {
if (item instanceof MavenModuleSet) {
found = isBuilderHarcoded(((MavenModuleSet) item).getPrebuilders());
if (item.getClass().getSimpleName().equals("MavenModuleSet")) {
try {
Object getPrebuilders = item.getClass().getMethod("getPrebuilders", null).invoke(item);
if (getPrebuilders instanceof List) {
found = isBuilderHarcoded((List) getPrebuilders);
}
}catch (Exception e) {
LOG.log(Level.WARNING, "Exception " + e.getMessage(), e.getCause());
}
}
if (item instanceof Project) {
@@ -3,11 +3,12 @@
import hudson.model.AbstractProject;
import hudson.model.Descriptor;
import hudson.model.Item;
import hudson.tasks.JavadocArchiver;
import hudson.tasks.Publisher;
import hudson.util.DescribableList;
import org.jenkins.ci.plugins.jenkinslint.model.AbstractCheck;

import java.util.logging.Level;

/**
* @author Victor Martinez
*/
@@ -20,16 +21,26 @@ public JavadocChecker() {
}

public boolean executeCheck(Item item) {
boolean found = false;
if (item instanceof AbstractProject) {
DescribableList<Publisher, Descriptor<Publisher>> publishersList = ((AbstractProject) item).getPublishersList();
for (Publisher publisher : publishersList) {
if (publisher instanceof hudson.tasks.JavadocArchiver) {
return ( ((JavadocArchiver) publisher).getJavadocDir() == null ||
( ((JavadocArchiver) publisher).getJavadocDir() != null &&
((JavadocArchiver) publisher).getJavadocDir().length() == 0 ));
if (publisher.getClass().getSimpleName().equals("JavadocArchiver")) {
try {
Object getJavadocDir = publisher.getClass().getMethod("getJavadocDir", null).invoke(publisher);
if (getJavadocDir instanceof String) {
if (getJavadocDir == null) {
found = true;
} else {
found = ((String) getJavadocDir).isEmpty();
}
}
} catch (Exception e) {
LOG.log(Level.WARNING, "Exception " + e.getMessage(), e.getCause());
}
}
}
}
return false;
return found;
}
}

0 comments on commit ccaba77

Please sign in to comment.
You can’t perform that action at this time.