Skip to content

Commit

Permalink
chore(lint): Switch to name.remal.sonarlint plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLion committed Sep 17, 2023
1 parent be2d38a commit 5ff6bc9
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 28 deletions.
28 changes: 17 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
id('com.gradle.plugin-publish') version '1.2.1'
id('io.github.joselion.pretty-jupiter') version '3.0.1'
id('io.github.joselion.strict-null-check') version '3.0.1'
id('se.solrike.sonarlint') version '1.0.0-beta.15'
id('name.remal.sonarlint') version '3.3.9'
}

group = 'io.github.joselion'
Expand Down Expand Up @@ -41,15 +41,21 @@ checkstyle {
setToolVersion(libs.versions.checkstyle.get())
}

sonarlint {
excludeRules = [
'java:S107', // Allow constructors with more than 7 parameters
'java:S3776', // Allow methods with more than 15 lines
'java:S4032', // Allow packages only containing `package-info.java`
]
includeRules = [
'java:S4266', // "Stream.collect()" calls should not be redundant
]
sonarLint {
setToolVersion(libs.versions.sonarlint.core.get())
languages {
include('java')
}
rules {
enable(
'java:S4266', // "Stream.collect()" calls should not be redundant
)
disable(
'java:S107', // Allow constructors with more than 7 parameters
'java:S3776', // Allow methods with more than 15 lines
'java:S4032', // Allow packages only containing `package-info.java`
)
}
}

strictNullCheck {
Expand All @@ -64,7 +70,7 @@ repositories {
dependencies {
annotationProcessor(libs.lombok)
compileOnly(libs.lombok)
sonarlintPlugins(libs.sonarlint.java)
sonarlintCorePlugins(libs.sonarlint.java)

implementation(localGroovy())
}
Expand Down
9 changes: 2 additions & 7 deletions buildscript-gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@
# This file is expected to be part of source control.
com.gradle.plugin-publish:com.gradle.plugin-publish.gradle.plugin:1.2.1=classpath
com.gradle.publish:plugin-publish-plugin:1.2.1=classpath
io.github.furstenheim:copy_down:1.1=classpath
io.github.joselion.pretty-jupiter:io.github.joselion.pretty-jupiter.gradle.plugin:3.0.1=classpath
io.github.joselion.strict-null-check:io.github.joselion.strict-null-check.gradle.plugin:3.0.1=classpath
io.github.joselion:maybe:3.2.0=classpath
io.github.joselion:pretty-jupiter:3.0.1=classpath
io.github.joselion:strict-null-check:3.0.1=classpath
org.apache.commons:commons-lang3:3.11=classpath
org.apache.commons:commons-text:1.9=classpath
name.remal.gradle-plugins.sonarlint:sonarlint:3.3.9=classpath
name.remal.sonarlint:name.remal.sonarlint.gradle.plugin:3.3.9=classpath
org.apache.maven:maven-model:3.6.3=classpath
org.jsoup:jsoup:1.15.2=classpath
org.sonarsource.sonarlint.core:sonarlint-core:8.0.2.42487=classpath
se.solrike.sonarlint:se.solrike.sonarlint.gradle.plugin:1.0.0-beta.15=classpath
se.solrike.sonarlint:sonarlint-gradle-plugin:1.0.0-beta.15=classpath
empty=
54 changes: 51 additions & 3 deletions gradle.lockfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.google.code.findbugs:jsr305:3.0.2=checkstyle
com.fasterxml.staxmate:staxmate:2.4.0=sonarlintCoreClasspath
com.fasterxml.woodstox:woodstox-core:6.4.0=sonarlintCoreClasspath
com.google.code.findbugs:jsr305:3.0.2=checkstyle,sonarlintCoreClasspath
com.google.code.gson:gson:2.8.9=sonarlintCoreClasspath
com.google.collections:google-collections:1.0=checkstyle
com.google.errorprone:error_prone_annotations:2.18.0=checkstyle
com.google.guava:failureaccess:1.0.1=checkstyle
Expand All @@ -12,11 +15,14 @@ com.puppycrawl.tools:checkstyle:10.12.3=checkstyle
commons-beanutils:commons-beanutils:1.9.4=checkstyle
commons-codec:commons-codec:1.15=checkstyle
commons-collections:commons-collections:3.2.2=checkstyle
commons-io:commons-io:2.11.0=sonarlintCoreClasspath
info.picocli:picocli:4.7.4=checkstyle
net.bytebuddy:byte-buddy-agent:1.14.6=testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath
net.bytebuddy:byte-buddy:1.14.6=testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath
net.sf.saxon:Saxon-HE:12.3=checkstyle
org.antlr:antlr4-runtime:4.11.1=checkstyle
org.apache.commons:commons-compress:1.21=sonarlintCoreClasspath
org.apache.commons:commons-lang3:3.12.0=sonarlintCoreClasspath
org.apache.commons:commons-lang3:3.8.1=checkstyle
org.apache.commons:commons-text:1.3=checkstyle
org.apache.httpcomponents.client5:httpclient5:5.1.3=checkstyle
Expand All @@ -28,6 +34,10 @@ org.apache.maven.doxia:doxia-core:1.12.0=checkstyle
org.apache.maven.doxia:doxia-logging-api:1.12.0=checkstyle
org.apache.maven.doxia:doxia-module-xdoc:1.12.0=checkstyle
org.apache.maven.doxia:doxia-sink-api:1.12.0=checkstyle
org.apache.tomcat.embed:tomcat-embed-core:9.0.75=sonarlintCoreClasspath
org.apache.tomcat.embed:tomcat-embed-el:9.0.75=sonarlintCoreClasspath
org.apache.tomcat.embed:tomcat-embed-jasper:9.0.75=sonarlintCoreClasspath
org.apache.tomcat:tomcat-annotations-api:9.0.75=sonarlintCoreClasspath
org.apache.xbean:xbean-reflect:3.7=checkstyle
org.apiguardian:apiguardian-api:1.1.2=testCompileClasspath,testkitCompileClasspath
org.assertj:assertj-core:3.24.2=testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath
Expand All @@ -36,7 +46,19 @@ org.codehaus.plexus:plexus-classworlds:2.6.0=checkstyle
org.codehaus.plexus:plexus-component-annotations:2.1.0=checkstyle
org.codehaus.plexus:plexus-container-default:2.1.0=checkstyle
org.codehaus.plexus:plexus-utils:3.3.0=checkstyle
org.codehaus.woodstox:stax2-api:4.2.1=sonarlintCoreClasspath
org.eclipse.jdt:ecj:3.33.0=sonarlintCoreClasspath
org.eclipse.jdt:org.eclipse.jdt.annotation:2.2.700=compileClasspath,testCompileClasspath,testkitCompileClasspath
org.eclipse.jdt:org.eclipse.jdt.core:3.33.0=sonarlintCoreClasspath
org.eclipse.platform:org.eclipse.core.commands:3.10.300=sonarlintCoreClasspath
org.eclipse.platform:org.eclipse.core.contenttype:3.8.100=sonarlintCoreClasspath
org.eclipse.platform:org.eclipse.core.jobs:3.13.200=sonarlintCoreClasspath
org.eclipse.platform:org.eclipse.core.resources:3.18.200=sonarlintCoreClasspath
org.eclipse.platform:org.eclipse.core.runtime:3.26.100=sonarlintCoreClasspath
org.eclipse.platform:org.eclipse.equinox.common:3.17.100=sonarlintCoreClasspath
org.eclipse.platform:org.eclipse.equinox.preferences:3.10.200=sonarlintCoreClasspath
org.eclipse.platform:org.eclipse.osgi:3.18.300=sonarlintCoreClasspath
org.eclipse.platform:org.eclipse.text:3.12.300=sonarlintCoreClasspath
org.jacoco:org.jacoco.agent:0.8.10=jacocoAgent,jacocoAnt
org.jacoco:org.jacoco.ant:0.8.10=jacocoAnt
org.jacoco:org.jacoco.core:0.8.10=jacocoAnt
Expand All @@ -53,11 +75,37 @@ org.junit:junit-bom:5.10.0=testCompileClasspath,testRuntimeClasspath,testkitComp
org.mockito:mockito-core:5.5.0=testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath
org.objenesis:objenesis:3.3=testRuntimeClasspath,testkitRuntimeClasspath
org.opentest4j:opentest4j:1.3.0=testCompileClasspath,testRuntimeClasspath,testkitCompileClasspath,testkitRuntimeClasspath
org.osgi:org.osgi.service.prefs:1.1.2=sonarlintCoreClasspath
org.osgi:osgi.annotation:8.0.1=sonarlintCoreClasspath
org.ow2.asm:asm-commons:9.5=jacocoAnt
org.ow2.asm:asm-tree:9.5=jacocoAnt
org.ow2.asm:asm:9.0=sonarlintCoreClasspath
org.ow2.asm:asm:9.5=jacocoAnt
org.projectlombok:lombok:1.18.28=annotationProcessor,compileClasspath,testAnnotationProcessor,testCompileClasspath,testkitAnnotationProcessor,testkitCompileClasspath
org.reflections:reflections:0.10.2=checkstyle
org.sonarsource.java:sonar-java-plugin:7.20.0.31692=sonarlintPlugins
org.sonarsource.analyzer-commons:sonar-analyzer-commons:2.7.0.1482=sonarlintCoreClasspath
org.sonarsource.analyzer-commons:sonar-analyzer-recognizers:2.7.0.1482=sonarlintCoreClasspath
org.sonarsource.analyzer-commons:sonar-performance-measure:2.7.0.1482=sonarlintCoreClasspath
org.sonarsource.analyzer-commons:sonar-regex-parsing:2.7.0.1482=sonarlintCoreClasspath
org.sonarsource.analyzer-commons:sonar-xml-parsing:2.7.0.1482=sonarlintCoreClasspath
org.sonarsource.java:external-reports:7.24.0.32100=sonarlintCoreClasspath
org.sonarsource.java:java-checks:7.24.0.32100=sonarlintCoreClasspath
org.sonarsource.java:java-frontend:7.24.0.32100=sonarlintCoreClasspath
org.sonarsource.java:java-jsp:7.24.0.32100=sonarlintCoreClasspath
org.sonarsource.java:java-surefire:7.24.0.32100=sonarlintCoreClasspath
org.sonarsource.java:java-symbolic-execution:7.24.0.32100=sonarlintCoreClasspath
org.sonarsource.java:jdt:7.24.0.32100=sonarlintCoreClasspath
org.sonarsource.java:sonar-java-plugin:7.24.0.32100=sonarlintCoreClasspath
org.sonarsource.javascript:css:10.6.0.22520=sonarlintCoreClasspath
org.sonarsource.javascript:javascript-checks:10.6.0.22520=sonarlintCoreClasspath
org.sonarsource.javascript:sonar-javascript-plugin:10.6.0.22520=sonarlintCoreClasspath
org.sonarsource.kotlin:sonar-kotlin-plugin:2.18.0.2938=sonarlintCoreClasspath
org.sonarsource.slang:sonar-ruby-plugin:1.14.0.4481=sonarlintCoreClasspath
org.sonarsource.slang:sonar-scala-plugin:1.14.0.4481=sonarlintCoreClasspath
org.sonarsource.sonarlint.core:sonarlint-core:9.2.0.74516=sonarlintCore,sonarlintCoreClasspath
org.sonarsource.sslr:sslr-core:1.24.0.633=sonarlintCoreClasspath
org.sonarsource.xml:sonar-xml-plugin:2.10.0.4108=sonarlintCoreClasspath
org.xmlresolver:xmlresolver:5.2.0=checkstyle
empty=runtimeClasspath,sonarlint
xerces:xercesImpl:2.12.2=sonarlintCoreClasspath
xml-apis:xml-apis:1.4.01=sonarlintCoreClasspath
empty=runtimeClasspath
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ dependencyResolutionManagement {
version('checkstyle', '10.12.3')
version('jacoco', '0.8.10')
version('junit', '5.10.0')
version('sonarlint-core', '9.2.0.74516')

library('assertj', 'org.assertj', 'assertj-core').version('3.24.2')
library('lombok', 'org.projectlombok', 'lombok').version('1.18.28')
library('mockito', 'org.mockito', 'mockito-core').version('5.5.0')
library('sonarlint-java', 'org.sonarsource.java', 'sonar-java-plugin').version('7.20.0.31692')
library('sonarlint-java', 'org.sonarsource.java', 'sonar-java-plugin').version('7.24.0.32100')
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public PrettyJupiterExtension(final ObjectFactory objects) {
this.failure = objects.newInstance(Failure.class);
}

public void duration(final Action<Duration> durationAction) {
durationAction.execute(duration);
public void duration(final Action<Duration> action) {
action.execute(this.duration);
}

public void failure(final Action<Failure> failureAction) {
failureAction.execute(failure);
public void failure(final Action<Failure> action) {
action.execute(this.failure);
}

@Getter
Expand Down Expand Up @@ -65,7 +65,7 @@ public Duration(final ObjectFactory objects) {
public Integer getThreshold(final Test testTask) {
return Optional.of(testTask)
.flatMap(this::findCustomThreshold)
.orElseGet(threshold::get);
.orElseGet(this.threshold::get);
}

private Optional<Integer> findCustomThreshold(final Test testTask) {
Expand All @@ -75,7 +75,7 @@ private Optional<Integer> findCustomThreshold(final Test testTask) {
return Optional.empty();
}

return Optional.of(customThreshold)
return Optional.of(this.customThreshold)
.map(MapProperty<String, Integer>::get)
.map(thresholdMap -> thresholdMap.get(matcher.group(1)));
}
Expand Down

0 comments on commit 5ff6bc9

Please sign in to comment.