Browse Source

Improve quality (#34)

tags/3.1.0.1141
Janos Gyerik 6 years ago
parent
commit
88e2e5ad2b

+ 3
- 3
src/main/java/org/sonarsource/scanner/cli/Conf.java View File

@@ -55,7 +55,7 @@ class Conf {
this.env = env;
}

Properties properties() throws IOException {
Properties properties() {
Properties result = new Properties();
result.putAll(loadGlobalProperties());
result.putAll(loadProjectProperties());
@@ -79,7 +79,7 @@ class Conf {
return Utils.loadEnvironmentProperties(env);
}

private Properties loadGlobalProperties() throws IOException {
private Properties loadGlobalProperties() {
Path settingsFile = locatePropertiesFile(cli.properties(), SCANNER_HOME, "conf/sonar-scanner.properties",
SCANNER_SETTINGS);
if (settingsFile != null && Files.isRegularFile(settingsFile)) {
@@ -90,7 +90,7 @@ class Conf {
return new Properties();
}

private Properties loadProjectProperties() throws IOException {
private Properties loadProjectProperties() {
Properties rootProps = new Properties();
Properties knownProps = new Properties();


+ 2
- 3
src/main/java/org/sonarsource/scanner/cli/Main.java View File

@@ -19,7 +19,6 @@
*/
package org.sonarsource.scanner.cli;

import java.io.IOException;
import java.util.Properties;
import org.sonarsource.scanner.api.EmbeddedScanner;
import org.sonarsource.scanner.api.ScanProperties;
@@ -102,7 +101,7 @@ public class Main {
}
}

private void init(Properties p) throws IOException {
private void init(Properties p) {
SystemInfo.print(logger);
if (cli.isDisplayVersionOnly()) {
exit.exit(Exit.SUCCESS);
@@ -111,7 +110,7 @@ public class Main {
runner = runnerFactory.create(p);
}

private void configureLogging(Properties props) throws IOException {
private void configureLogging(Properties props) {
if ("true".equals(props.getProperty("sonar.verbose"))
|| "DEBUG".equalsIgnoreCase(props.getProperty("sonar.log.level"))
|| "TRACE".equalsIgnoreCase(props.getProperty("sonar.log.level"))) {

+ 2
- 5
src/main/java/org/sonarsource/scanner/cli/ScannerVersion.java View File

@@ -27,12 +27,9 @@ public enum ScannerVersion {

private String version;

private ScannerVersion() {
Scanner scanner = new Scanner(getClass().getResourceAsStream("/version.txt"), "UTF-8");
try {
ScannerVersion() {
try (Scanner scanner = new Scanner(getClass().getResourceAsStream("/version.txt"), "UTF-8")) {
this.version = scanner.next();
} finally {
scanner.close();
}
}


Loading…
Cancel
Save