Skip to content

Commit

Permalink
Qulice reamrks final fix
Browse files Browse the repository at this point in the history
  • Loading branch information
alevohin committed Jan 4, 2015
1 parent 4d44a1e commit 6bb7806
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 54 deletions.
45 changes: 23 additions & 22 deletions qulice-ant/src/main/java/com/qulice/ant/AntEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.LinkedList;
import java.util.List;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
import org.apache.commons.io.filefilter.IOFileFilter;
Expand All @@ -65,30 +65,30 @@ public final class AntEnvironment implements Environment {
/**
* Classes dir (only one dir is supported).
*/
private final transient java.io.File classesdir;
private final transient File classesdir;
/**
* Classpath dirs and files.
*/
@SuppressWarnings("PMD.AvoidFieldNameMatchingMethodName")
private final transient Path classpath;

/**
* Public ctor.
* @param project Ant project
* @param srcdir Sources dirs
* @param classesdir Classes dir
* @param classpath Classpath
* @param prjct Ant project
* @param srcdr Sources dirs
* @param clsssdr Classes dir
* @param clsspth Classpath
* @checkstyle ParameterNumber (5 lines)
*/
//@checkstyle ParameterNumber (5 lines)
//@checkstyle HiddenField (5 lines)
public AntEnvironment(
final Project project,
final Path srcdir,
final java.io.File classesdir,
final Path classpath) {
this.project = project;
this.srcdir = srcdir;
this.classesdir = classesdir;
this.classpath = classpath;
final Project prjct,
final Path srcdr,
final File clsssdr,
final Path clsspth) {
this.project = prjct;
this.srcdir = srcdr;
this.classesdir = clsssdr;
this.classpath = clsspth;
}

@Override
Expand All @@ -108,15 +108,15 @@ public File outdir() {

@Override
public String param(final String name, final String value) {
final String property = this.project.getProperty(name);
if (property == null) {
return value;
} else {
return property;
String propValue = this.project.getProperty(name);
if (propValue == null) {
propValue = value;
}
return propValue;
}

@Override
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
public ClassLoader classloader() {
final List<URL> urls = new LinkedList<URL>();
try {
Expand All @@ -125,7 +125,7 @@ public ClassLoader classloader() {
new File(path).toURI().toURL()
);
}
urls.add(classesdir.toURI().toURL());
urls.add(this.classesdir.toURI().toURL());
} catch (final MalformedURLException ex) {
throw new IllegalStateException("Failed to build URL", ex);
}
Expand All @@ -145,6 +145,7 @@ public Collection<String> classpath() {
}

@Override
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
public Collection<File> files(final String pattern) {
final Collection<File> files = new LinkedList<File>();
final IOFileFilter filter = new WildcardFileFilter(pattern);
Expand Down
63 changes: 31 additions & 32 deletions qulice-ant/src/main/java/com/qulice/ant/QuliceTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,32 @@ public final class QuliceTask extends Task {
*/
private transient Path classpath;

/**
* Set source dirs.
* @param srcdr Source dirs
*/
public void setSrcdir(final Path srcdr) {
this.srcdir = srcdr;
}

/**
* Set classes dir.
* @param clssedr Classes dir
*/
public void setClassesdir(final File clssedr) {
this.classesdir = clssedr;
}

/**
* Set classpath.
* @param clsspth Classpath
*/
public void setClasspath(final Path clsspth) {
this.classpath = clsspth;
}

@Override
public void execute() throws BuildException {
public void execute() {
super.execute();
final Environment env = this.environment();
try {
Expand All @@ -76,7 +100,7 @@ public void execute() throws BuildException {
"Qulice quality check completed in %[nano]s",
System.nanoTime() - start
);
} catch (ValidationException ex) {
} catch (final ValidationException ex) {
Logger.info(
this,
"Read our quality policy: http://www.qulice.com/quality.html"
Expand All @@ -87,13 +111,11 @@ public void execute() throws BuildException {

/**
* Create Environment.
* @checkstyle RedundantThrows (5 lines)
* @return Environment.
* @throws BuildException If ant task doesn't have mandatory params.
*/
private Environment environment() throws BuildException {
private Environment environment() {
if (this.srcdir == null) {
throw new BuildException("sourcepath not defined for QuliceTask");
throw new BuildException("srcdir not defined for QuliceTask");
}
if (this.classesdir == null) {
throw new BuildException("classesdir not defined for QuliceTask");
Expand All @@ -105,15 +127,16 @@ private Environment environment() throws BuildException {
this.getProject(),
this.srcdir,
this.classesdir,
this.classpath);
this.classpath
);
}

/**
* Validate and throws exception if there are any problems.
* @param env Environment
* @throws ValidationException If there are any problems.
*/
private void validate(Environment env) throws ValidationException {
private void validate(final Environment env) throws ValidationException {
for (final Validator validator : this.validators()) {
validator.validate(env);
}
Expand All @@ -132,28 +155,4 @@ private Set<Validator> validators() {
validators.add(new com.qulice.findbugs.FindBugsValidator());
return validators;
}

/**
* Set source dirs
* @param srcdr Source dirs
*/
public void setSrcdir(Path srcdr) {
this.srcdir = srcdir;
}

/**
* Set classes dir
* @param clssedr Classes dir
*/
public void setClassesdir(File clssedr) {
this.classesdir = clssedr;
}

/**
* Set classpath
* @param clsspth classpath
*/
public void setClasspath(Path clsspth) {
this.classpath = clsspth;
}
}

0 comments on commit 6bb7806

Please sign in to comment.