Skip to content
This repository has been archived by the owner on Jul 8, 2019. It is now read-only.

Commit

Permalink
Merge pull request #14 from alexkrauss/ws
Browse files Browse the repository at this point in the history
Consolidated whitespace.
  • Loading branch information
Pablissimo committed Sep 29, 2015
2 parents 09a880a + bf402ba commit 12c5c39
Show file tree
Hide file tree
Showing 25 changed files with 1,681 additions and 1,670 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
<version>${sonar.buildVersion}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3</version>
</dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3</version>
</dependency>

<!-- unit tests -->
<dependency>
<groupId>org.codehaus.sonar</groupId>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/pablissimo/sonar/LCOVParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
import org.sonar.api.measures.CoverageMeasuresBuilder;

public interface LCOVParser {
Map<String, CoverageMeasuresBuilder> parseFile(File file);
Map<String, CoverageMeasuresBuilder> parse(List<String> lines);
Map<String, CoverageMeasuresBuilder> parseFile(File file);
Map<String, CoverageMeasuresBuilder> parse(List<String> lines);
}
14 changes: 7 additions & 7 deletions src/main/java/com/pablissimo/sonar/TsCoverageSensor.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,18 @@ protected void saveMeasureFromLCOVFile(Project project, SensorContext context) {
}
}
}

protected org.sonar.api.resources.File fileFromIoFile(java.io.File file, Project project) {
return org.sonar.api.resources.File.fromIOFile(file, project);
return org.sonar.api.resources.File.fromIOFile(file, project);
}

protected LCOVParser getParser(File baseDirectory) {
return new LCOVParserImpl(baseDirectory);
return new LCOVParserImpl(baseDirectory);
}

private void saveZeroValueForResource(org.sonar.api.resources.File resource, SensorContext context) {
PropertiesBuilder<Integer, Integer> lineHitsData = new PropertiesBuilder<Integer, Integer>(CoreMetrics.COVERAGE_LINE_HITS_DATA);

for (int x = 1; x < context.getMeasure(resource, CoreMetrics.LINES).getIntValue(); x++) {
lineHitsData.add(x, 0);
}
Expand All @@ -132,11 +132,11 @@ public String toString() {
}

private boolean isForceZeroCoverageActivated() {
return settings.getBoolean(TypeScriptPlugin.SETTING_FORCE_ZERO_COVERAGE);
return settings.getBoolean(TypeScriptPlugin.SETTING_FORCE_ZERO_COVERAGE);
}

private boolean isLCOVReportProvided() {
return StringUtils.isNotBlank(settings.getString(TypeScriptPlugin.SETTING_LCOV_REPORT_PATH));
return StringUtils.isNotBlank(settings.getString(TypeScriptPlugin.SETTING_LCOV_REPORT_PATH));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/pablissimo/sonar/TsLintExecutor.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.pablissimo.sonar;

public interface TsLintExecutor {
String execute(String pathToTsLint, String configFile, String file);
String execute(String pathToTsLint, String configFile, String file);
}
74 changes: 37 additions & 37 deletions src/main/java/com/pablissimo/sonar/TsLintExecutorImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,41 @@
import org.sonar.api.utils.command.CommandExecutor;
import org.sonar.api.utils.command.StreamConsumer;

public class TsLintExecutorImpl implements TsLintExecutor {
private static final Logger LOG = LoggerFactory.getLogger(TsLintExecutorImpl.class);
private StringBuilder stdOut;
private StringBuilder stdErr;
public String execute(String pathToTsLint, String configFile, String file) {
LOG.info("TsLint executing for " + file);
Command command = Command.create("node");
command
.addArgument("\"" + pathToTsLint + "\" --config \"" + configFile + "\" --format json \"" + file.trim() + "\"");
command.setNewShell(true);
this.stdOut = new StringBuilder();
this.stdErr = new StringBuilder();
StreamConsumer stdOutConsumer = new StreamConsumer() {
public void consumeLine(String line) {
LOG.trace("TsLint Out: " + line);
stdOut.append(line + "\n");
}
};
StreamConsumer stdErrConsumer = new StreamConsumer() {
public void consumeLine(String line) {
LOG.error("TsLint Err: " + line);
stdErr.append(line + "\n");
}
};
CommandExecutor executor = CommandExecutor.create();
int exitCode = executor.execute(command, stdOutConsumer, stdErrConsumer, 5000);
return stdOut.toString();
}
public class TsLintExecutorImpl implements TsLintExecutor {
private static final Logger LOG = LoggerFactory.getLogger(TsLintExecutorImpl.class);

private StringBuilder stdOut;
private StringBuilder stdErr;

public String execute(String pathToTsLint, String configFile, String file) {
LOG.info("TsLint executing for " + file);
Command command = Command.create("node");

command
.addArgument("\"" + pathToTsLint + "\" --config \"" + configFile + "\" --format json \"" + file.trim() + "\"");

command.setNewShell(true);

this.stdOut = new StringBuilder();
this.stdErr = new StringBuilder();

StreamConsumer stdOutConsumer = new StreamConsumer() {
public void consumeLine(String line) {
LOG.trace("TsLint Out: " + line);
stdOut.append(line + "\n");
}
};

StreamConsumer stdErrConsumer = new StreamConsumer() {
public void consumeLine(String line) {
LOG.error("TsLint Err: " + line);
stdErr.append(line + "\n");
}
};

CommandExecutor executor = CommandExecutor.create();
int exitCode = executor.execute(command, stdOutConsumer, stdErrConsumer, 5000);

return stdOut.toString();
}
}
2 changes: 1 addition & 1 deletion src/main/java/com/pablissimo/sonar/TsLintParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import com.pablissimo.sonar.model.TsLintIssue;

public interface TsLintParser {
TsLintIssue[] parse(String toParse);
TsLintIssue[] parse(String toParse);
}
12 changes: 6 additions & 6 deletions src/main/java/com/pablissimo/sonar/TsLintParserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import com.pablissimo.sonar.model.TsLintIssue;

public class TsLintParserImpl implements TsLintParser {
public TsLintIssue[] parse(String toParse) {
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
return gson.fromJson(toParse, TsLintIssue[].class);
}
public TsLintIssue[] parse(String toParse) {
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();

return gson.fromJson(toParse, TsLintIssue[].class);
}
}
Loading

0 comments on commit 12c5c39

Please sign in to comment.