aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFabrice Bellingard <fabrice.bellingard@sonarsource.com>2012-09-07 18:39:15 +0200
committerFabrice Bellingard <fabrice.bellingard@sonarsource.com>2012-09-07 18:39:15 +0200
commit3cd42ac0a5e2b24ce579ed86823bcc1c97d16c16 (patch)
treee8e856992f421c0672bce3e7c1f87f8db2a7a143 /src
parent4d7933d93151bc4f99e27fbeef6eb6efb0b9b755 (diff)
downloadsonar-scanner-cli-3cd42ac0a5e2b24ce579ed86823bcc1c97d16c16.tar.gz
sonar-scanner-cli-3cd42ac0a5e2b24ce579ed86823bcc1c97d16c16.zip
Fix violations / improve documentation / refactor some code
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/sonar/runner/Main.java6
-rw-r--r--src/main/java/org/sonar/runner/Runner.java16
-rw-r--r--src/main/java/org/sonar/runner/RunnerException.java11
-rw-r--r--src/main/java/org/sonar/runner/bootstrapper/BootstrapException.java14
-rw-r--r--src/main/java/org/sonar/runner/bootstrapper/Bootstrapper.java6
-rw-r--r--src/main/java/org/sonar/runner/bootstrapper/utils/PrivateIOUtils.java (renamed from src/main/java/org/sonar/runner/internal/PrivateIOUtils.java)2
-rw-r--r--src/main/java/org/sonar/runner/bootstrapper/utils/package-info.java (renamed from src/main/java/org/sonar/runner/internal/package-info.java)2
-rw-r--r--src/main/java/org/sonar/runner/model/Launcher.java3
-rw-r--r--src/main/java/org/sonar/runner/utils/SonarRunnerVersion.java2
-rw-r--r--src/test/java/org/sonar/runner/bootstrapper/BootstrapClassLoaderTest.java1
-rw-r--r--src/test/java/org/sonar/runner/bootstrapper/BootstrapperTest.java1
-rw-r--r--src/test/java/org/sonar/runner/model/LauncherTest.java5
-rw-r--r--src/test/java/org/sonar/runner/utils/SonarRunnerVersionTest.java2
13 files changed, 56 insertions, 15 deletions
diff --git a/src/main/java/org/sonar/runner/Main.java b/src/main/java/org/sonar/runner/Main.java
index 89c8dcf..633401f 100644
--- a/src/main/java/org/sonar/runner/Main.java
+++ b/src/main/java/org/sonar/runner/Main.java
@@ -20,8 +20,9 @@
package org.sonar.runner;
+import org.sonar.runner.bootstrapper.utils.PrivateIOUtils;
+
import org.sonar.runner.bootstrapper.BootstrapException;
-import org.sonar.runner.internal.PrivateIOUtils;
import org.sonar.runner.utils.SonarRunnerVersion;
import java.io.File;
@@ -51,6 +52,9 @@ public final class Main {
private static boolean debugMode = false;
+ /**
+ * Entry point of the program.
+ */
public static void main(String[] args) {
long startTime = System.currentTimeMillis();
try {
diff --git a/src/main/java/org/sonar/runner/Runner.java b/src/main/java/org/sonar/runner/Runner.java
index 85197d6..f2ef6f8 100644
--- a/src/main/java/org/sonar/runner/Runner.java
+++ b/src/main/java/org/sonar/runner/Runner.java
@@ -52,33 +52,49 @@ import java.util.Properties;
public final class Runner {
/**
+ * Old property used to activate debug level for logging.
+ *
* @deprecated Replaced by sonar.verbose since 1.2
*/
@Deprecated
public static final String PROPERTY_OLD_DEBUG_MODE = "runner.debug";
/**
+ * Property used to increase logging information.
+ *
* @since 1.2
*/
public static final String PROPERTY_VERBOSE = "sonar.verbose";
/**
+ * Property used to specify the working directory for the runner. May be a relative or absolute path.
+ *
* @since 1.4
*/
public static final String PROPERTY_WORK_DIRECTORY = "sonar.working.directory";
+
+ /**
+ * Default value of the working directory.
+ */
public static final String DEF_VALUE_WORK_DIRECTORY = ".sonar";
/**
+ * Property used to specify the base directory of the project to analyse.
+ *
* @since 1.5
*/
public static final String PROPERTY_PROJECT_DIR = "sonar.projectDir";
/**
+ * Property used to specify the name of the tool that will run a Sonar analysis.
+ *
* @since 1.5
*/
public static final String PROPERTY_ENVIRONMENT_INFORMATION_KEY = "sonar.environment.information.key";
/**
+ * Property used to specify the version of the tool that will run a Sonar analysis.
+ *
* @since 1.5
*/
public static final String PROPERTY_ENVIRONMENT_INFORMATION_VERSION = "sonar.environment.information.version";
diff --git a/src/main/java/org/sonar/runner/RunnerException.java b/src/main/java/org/sonar/runner/RunnerException.java
index 5d61d06..7892542 100644
--- a/src/main/java/org/sonar/runner/RunnerException.java
+++ b/src/main/java/org/sonar/runner/RunnerException.java
@@ -20,20 +20,31 @@
package org.sonar.runner;
/**
+ * Exception thrown by the Sonar Runner when something bad happens.
+ *
* @since 1.2
*/
public class RunnerException extends RuntimeException {
private static final long serialVersionUID = 4810407777585753030L;
+ /**
+ * See {@link RuntimeException}
+ */
public RunnerException(String message) {
super(message);
}
+ /**
+ * See {@link RuntimeException}
+ */
public RunnerException(Throwable cause) {
super(cause);
}
+ /**
+ * See {@link RuntimeException}
+ */
public RunnerException(String message, Throwable cause) {
super(message, cause);
}
diff --git a/src/main/java/org/sonar/runner/bootstrapper/BootstrapException.java b/src/main/java/org/sonar/runner/bootstrapper/BootstrapException.java
index 7bad396..d780364 100644
--- a/src/main/java/org/sonar/runner/bootstrapper/BootstrapException.java
+++ b/src/main/java/org/sonar/runner/bootstrapper/BootstrapException.java
@@ -19,16 +19,30 @@
*/
package org.sonar.runner.bootstrapper;
+/**
+ * Exception thrown by the bootstrapper when something bad happens.
+ */
public class BootstrapException extends RuntimeException {
+ private static final long serialVersionUID = -4974995497654796971L;
+
+ /**
+ * See {@link RuntimeException}
+ */
public BootstrapException(String message) {
super(message);
}
+ /**
+ * See {@link RuntimeException}
+ */
public BootstrapException(Throwable cause) {
super(cause);
}
+ /**
+ * See {@link RuntimeException}
+ */
public BootstrapException(String message, Throwable cause) {
super(message, cause);
}
diff --git a/src/main/java/org/sonar/runner/bootstrapper/Bootstrapper.java b/src/main/java/org/sonar/runner/bootstrapper/Bootstrapper.java
index 18b5ccc..f13c2dd 100644
--- a/src/main/java/org/sonar/runner/bootstrapper/Bootstrapper.java
+++ b/src/main/java/org/sonar/runner/bootstrapper/Bootstrapper.java
@@ -19,7 +19,8 @@
*/
package org.sonar.runner.bootstrapper;
-import org.sonar.runner.internal.PrivateIOUtils;
+import org.sonar.runner.bootstrapper.utils.PrivateIOUtils;
+
import org.sonar.runner.utils.SonarRunnerVersion;
import java.io.File;
@@ -34,6 +35,9 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.List;
+/**
+ * Bootstrapper used to download everything from the server and create the correct classloader required to execute a Sonar analysis in isolation.
+ */
public class Bootstrapper {
private static final String VERSION_PATH = "/api/server/version";
diff --git a/src/main/java/org/sonar/runner/internal/PrivateIOUtils.java b/src/main/java/org/sonar/runner/bootstrapper/utils/PrivateIOUtils.java
index 7b7f1de..5276571 100644
--- a/src/main/java/org/sonar/runner/internal/PrivateIOUtils.java
+++ b/src/main/java/org/sonar/runner/bootstrapper/utils/PrivateIOUtils.java
@@ -17,7 +17,7 @@
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
*/
-package org.sonar.runner.internal;
+package org.sonar.runner.bootstrapper.utils;
import java.io.Closeable;
import java.io.File;
diff --git a/src/main/java/org/sonar/runner/internal/package-info.java b/src/main/java/org/sonar/runner/bootstrapper/utils/package-info.java
index 64ccad4..3b9f5ed 100644
--- a/src/main/java/org/sonar/runner/internal/package-info.java
+++ b/src/main/java/org/sonar/runner/bootstrapper/utils/package-info.java
@@ -21,4 +21,4 @@
* Internal package that provides utils for internal purposes.
* Should not be used by consumers.
*/
-package org.sonar.runner.internal; \ No newline at end of file
+package org.sonar.runner.bootstrapper.utils; \ No newline at end of file
diff --git a/src/main/java/org/sonar/runner/model/Launcher.java b/src/main/java/org/sonar/runner/model/Launcher.java
index cfa14b3..e18ba1e 100644
--- a/src/main/java/org/sonar/runner/model/Launcher.java
+++ b/src/main/java/org/sonar/runner/model/Launcher.java
@@ -36,7 +36,6 @@ import org.sonar.api.batch.bootstrap.ProjectReactor;
import org.sonar.api.utils.SonarException;
import org.sonar.batch.Batch;
import org.sonar.batch.bootstrapper.EnvironmentInformation;
-import org.sonar.runner.Main;
import org.sonar.runner.Runner;
import java.io.File;
@@ -56,7 +55,7 @@ public class Launcher {
}
/**
- * This method invoked from {@link Main}. Do not rename it.
+ * Main entry point.
*/
public void execute() {
File baseDir = new File(propertiesFromRunner.getProperty(Runner.PROPERTY_PROJECT_DIR));
diff --git a/src/main/java/org/sonar/runner/utils/SonarRunnerVersion.java b/src/main/java/org/sonar/runner/utils/SonarRunnerVersion.java
index 5cc1577..e429fdc 100644
--- a/src/main/java/org/sonar/runner/utils/SonarRunnerVersion.java
+++ b/src/main/java/org/sonar/runner/utils/SonarRunnerVersion.java
@@ -19,7 +19,7 @@
*/
package org.sonar.runner.utils;
-import org.sonar.runner.internal.PrivateIOUtils;
+import org.sonar.runner.bootstrapper.utils.PrivateIOUtils;
import java.io.IOException;
import java.io.InputStream;
diff --git a/src/test/java/org/sonar/runner/bootstrapper/BootstrapClassLoaderTest.java b/src/test/java/org/sonar/runner/bootstrapper/BootstrapClassLoaderTest.java
index 87496ba..17ddce5 100644
--- a/src/test/java/org/sonar/runner/bootstrapper/BootstrapClassLoaderTest.java
+++ b/src/test/java/org/sonar/runner/bootstrapper/BootstrapClassLoaderTest.java
@@ -22,7 +22,6 @@ package org.sonar.runner.bootstrapper;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.sonar.runner.bootstrapper.BootstrapClassLoader;
import static org.fest.assertions.Assertions.assertThat;
diff --git a/src/test/java/org/sonar/runner/bootstrapper/BootstrapperTest.java b/src/test/java/org/sonar/runner/bootstrapper/BootstrapperTest.java
index 0741701..b09afae 100644
--- a/src/test/java/org/sonar/runner/bootstrapper/BootstrapperTest.java
+++ b/src/test/java/org/sonar/runner/bootstrapper/BootstrapperTest.java
@@ -20,7 +20,6 @@
package org.sonar.runner.bootstrapper;
import org.junit.Test;
-import org.sonar.runner.bootstrapper.Bootstrapper;
import java.io.File;
import java.io.IOException;
diff --git a/src/test/java/org/sonar/runner/model/LauncherTest.java b/src/test/java/org/sonar/runner/model/LauncherTest.java
index e3b6f15..33a7ebf 100644
--- a/src/test/java/org/sonar/runner/model/LauncherTest.java
+++ b/src/test/java/org/sonar/runner/model/LauncherTest.java
@@ -19,13 +19,10 @@
*/
package org.sonar.runner.model;
-import org.sonar.runner.Runner;
-
-import org.sonar.runner.model.Launcher;
-
import org.apache.commons.configuration.BaseConfiguration;
import org.apache.commons.configuration.Configuration;
import org.junit.Test;
+import org.sonar.runner.Runner;
import java.util.Properties;
diff --git a/src/test/java/org/sonar/runner/utils/SonarRunnerVersionTest.java b/src/test/java/org/sonar/runner/utils/SonarRunnerVersionTest.java
index bfbf720..5b94ee4 100644
--- a/src/test/java/org/sonar/runner/utils/SonarRunnerVersionTest.java
+++ b/src/test/java/org/sonar/runner/utils/SonarRunnerVersionTest.java
@@ -19,8 +19,6 @@
*/
package org.sonar.runner.utils;
-import org.sonar.runner.utils.SonarRunnerVersion;
-
import org.junit.Test;
import static org.fest.assertions.Assertions.assertThat;