Skip to content

Commit

Permalink
update readme and fix checkstyle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas3oo committed Aug 16, 2024
1 parent 1ab06f4 commit aa31502
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
15 changes: 7 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,14 @@ Kotlin DSL:

```Gradle Kotlin DSL
tasks.sonarlintMain {
reports {
reports.create("html") {
enabled = true
outputLocation = layout.buildDirectory.file("reports/sonarlint/sonarlint.html")
}
reports {
reports.create("html") {
enabled.set(true)
}
}
}
tasks.sonarlintTest {
ignoreFailures = true
ignoreFailures.set(true)
}
```

Expand Down Expand Up @@ -690,16 +689,16 @@ This plugin picks the node executable from that but since the node path contains

### future
Improvements that might be implemented are:
* Support config of reports in the `sonarlint` extension and not only per task. Need to investigate more on how to lazy load NamedDomainObjectContainer.
* Support for windows when using node.
* Support to specify sonarlint properties. For instance the node exec can be configured that way using 'sonar.nodejs.executable'.
* Support to find node on the $PATH using org.sonarsource.sonarlint.core.NodeJsHelper
* Support for a list of suppressed issues like Checkstyle and Spotbug have.
* specify stylesheet for the html reports
* Be able to specify the source sets in the sonarlint DSL
* specify the sonarlint-core version via a toolsversion property and invoke it via WorkerAPI
* make sure up-to-date checks are resonable
* link to rules description in the report
* it might exists more issue types: "SECURITY_HOTSPOT" but they are not in sonarlint
* it might exists more issue types: "SECURITY_HOTSPOT" but they are not in sonarlint. They are only in SonarCloud.


SARIF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public List<IssueEx> run(Sonarlint task, SetProperty<File> plugins, ProjectLayou

@SuppressWarnings({ "java:S1874", "deprecation" })
protected List<IssueEx> analyze(Sonarlint task, Logger logger, SetProperty<File> plugins, ProjectLayout layout) {
Map<String, String> sonarProperties = new HashMap<>();
Map<String, String> sonarProperties = new HashMap<>();

Project project = task.getProject();
// Java sourceCompatibility needs to be read so project is actually configured
Expand Down
18 changes: 7 additions & 11 deletions src/test/java/se/solrike/sonarlint/IntegrationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,26 +118,22 @@ void testSonarlintListRules() throws IOException {

@Test
void testJavaVersion() throws IOException {
// given the project has source comparability set to 1.8 the sonarlist component shall be invokded with that.
// and given that default java runtime is java11
// given the project has source comparability set to 1.8 the sonarlist component shall be invokded with that.
// and given that default java runtime is java11

createJavaFile(Files.createFile(mProjectDir.resolve("src/main/java/Hello.java")));
createJavaFile(Files.createFile(mProjectDir.resolve("src/main/java/Hello.java")));

// when sonarlintMain is run with debug printouts
BuildResult buildResult = runGradle(false, List.of("--debug", "sonarlintMain"));
// when sonarlintMain is run with debug printouts
BuildResult buildResult = runGradle(false, List.of("--debug", "sonarlintMain"));

// then java source shall be 1.8
assertThat(buildResult.getOutput()).contains("extraProperties: {sonar.java.source=1.8");
// then java source shall be 1.8
assertThat(buildResult.getOutput()).contains("extraProperties: {sonar.java.source=1.8");

// CHECKSTYLE:OFF
System.err.println(buildResult.getOutput());
// CHECKSTYLE:ON
}





BuildResult runGradle(List<String> args) {
return runGradle(true, args);
}
Expand Down

0 comments on commit aa31502

Please sign in to comment.