diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 736ca4e..2dee3f1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,7 +28,7 @@ jobs: strategy: matrix: - java-version: [ 11 ] + java-version: [ 17 ] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/test-instalation.yml b/.github/workflows/test-instalation.yml index 5f24bd0..2722081 100644 --- a/.github/workflows/test-instalation.yml +++ b/.github/workflows/test-instalation.yml @@ -29,7 +29,7 @@ jobs: strategy: matrix: sonarqube-image: - - 'sonarqube:9.9-community' + - 'sonarqube:10.7-community' - 'sonarqube:lts-community' - 'sonarqube:latest' fail-fast: false @@ -40,7 +40,7 @@ jobs: uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: - java-version: 11 + java-version: 17 distribution: 'adopt' cache: maven - run: mvn clean package diff --git a/local-docker-image/docker-compose.yml b/local-docker-image/docker-compose.yml index c7b55ba..d6bd000 100644 --- a/local-docker-image/docker-compose.yml +++ b/local-docker-image/docker-compose.yml @@ -22,7 +22,7 @@ name: sonar-local services: sonar-local: - image: sonarqube:9.9-community + image: sonarqube:10.7-community build: context: . ports: diff --git a/pom.xml b/pom.xml index 73519ac..6689607 100644 --- a/pom.xml +++ b/pom.xml @@ -104,14 +104,14 @@ 1.1.2-1.4.0 - 3.15.0.5107 - 7.30.1.34514 + 3.16.0.5274 + 8.5.0.37199 UTF-8 10.11.0.2468 - 10.3.0.82913 + 10.7.0.96327 10.7.0.96327 - 7.30.1.34514 - 11 + 8.5.0.37199 + 17 src/main/java 4rVf3NGV0jyQ3EGrc8L86oEDoHWm6MgDD v${project.version} @@ -138,50 +138,16 @@ sonar-html-plugin - - - guava - com.google.guava - - org.sonarsource.html ${sonar.html.version} - sslr-squid-bridge - - - sslr-core - org.codehaus.sonar.sslr - - - sonar-plugin-api - org.codehaus.sonar - - - sslr-xpath - org.codehaus.sonar.sslr - - - jcl-over-slf4j - org.slf4j - - - slf4j-api - org.slf4j - - - org.sonarsource.sslr-squid-bridge - 2.6.1 + sonar-analyzer-commons + org.sonarsource.analyzer-commons + 2.14.0.3087 sonar-java-plugin - - - guava - com.google.guava - - org.sonarsource.java sonar-plugin ${sonar.java.plugin} @@ -256,12 +222,6 @@ test ${sonar.javaCheksTestkitVersion} - - sonar-analyzer-commons - org.sonarsource.analyzer-commons - test - 2.14.0.3087 - logback-classic ch.qos.logback @@ -350,19 +310,18 @@ aemrules com.vml.aemrules.AemRulesSonarPlugin 9.9 - https://github.com/wttech/AEM-Rules-for-SonarQube/issues - - https://github.com/wttech/AEM-Rules-for-SonarQube/tree/${tagName} - + https://github.com/wttech/AEM-Rules-for-SonarQube/issues + https://github.com/wttech/AEM-Rules-for-SonarQube/tree/${tagName} https://github.com/wttech/AEM-Rules-for-SonarQube true true + java org.apache.maven.plugins maven-shade-plugin - 3.2.4 + 3.6.0 false true @@ -382,7 +341,7 @@ maven-compiler-plugin 3.13.0 - 11 + 17 diff --git a/src/main/java/com/vml/aemrules/htl/AnalysisException.java b/src/main/java/com/vml/aemrules/htl/AnalysisException.java new file mode 100644 index 0000000..374a244 --- /dev/null +++ b/src/main/java/com/vml/aemrules/htl/AnalysisException.java @@ -0,0 +1,32 @@ +/*- + * #%L + * AEM Rules for SonarQube + * %% + * Copyright (C) 2015-2024 VML + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +package com.vml.aemrules.htl; + +public class AnalysisException extends RuntimeException { + + public AnalysisException(String message) { + super(message); + } + + public AnalysisException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/src/main/java/com/vml/aemrules/htl/HtlFilesAnalyzer.java b/src/main/java/com/vml/aemrules/htl/HtlFilesAnalyzer.java index dccea25..2ca8c56 100644 --- a/src/main/java/com/vml/aemrules/htl/HtlFilesAnalyzer.java +++ b/src/main/java/com/vml/aemrules/htl/HtlFilesAnalyzer.java @@ -31,8 +31,7 @@ import org.sonar.api.batch.sensor.issue.NewIssue; import org.sonar.api.batch.sensor.issue.NewIssueLocation; import org.sonar.api.rule.RuleKey; -import org.sonar.squidbridge.ProgressReport; -import org.sonar.squidbridge.api.AnalysisException; +import org.sonarsource.analyzer.commons.ProgressReport; import java.io.IOException; import java.io.InterruptedIOException; diff --git a/src/main/java/com/vml/aemrules/htl/HtlSensor.java b/src/main/java/com/vml/aemrules/htl/HtlSensor.java index e6739fc..edb39e5 100644 --- a/src/main/java/com/vml/aemrules/htl/HtlSensor.java +++ b/src/main/java/com/vml/aemrules/htl/HtlSensor.java @@ -36,9 +36,8 @@ import org.sonar.api.rule.RuleKey; import org.sonar.plugins.html.node.Node; import org.sonar.plugins.html.visitor.HtmlSourceCode; -import org.sonar.squidbridge.ProgressReport; +import org.sonarsource.analyzer.commons.ProgressReport; -import java.io.File; import java.io.IOException; import java.io.Reader; import java.io.StringReader; @@ -75,9 +74,8 @@ public void execute(SensorContext context) { FilePredicate htlFilePredicate = HtlFilePredicateProvider.createFilePredicate(configuration, context); Iterable inputFiles = context.fileSystem().inputFiles(htlFilePredicate); - Collection files = StreamSupport.stream(inputFiles.spliterator(), false) - .map(InputFile::uri) - .map(File::new) + Collection files = StreamSupport.stream(inputFiles.spliterator(), false) + .map(InputFile::filename) .collect(Collectors.toList()); ProgressReport progressReport = new ProgressReport("Report about progress of HTL analyzer", @@ -109,8 +107,7 @@ private HtlScanner setupScanner() { for (HtlCheck check : checks.getAll()) { RuleKey ruleKey = checks.ruleKeyFor(check); check.setRuleKey(ruleKey); - if (check instanceof DefaultHtlVisitor) { - DefaultHtlVisitor nodeVisitor = (DefaultHtlVisitor) check; + if (check instanceof DefaultHtlVisitor nodeVisitor) { scanner.addVisitor(nodeVisitor); } } diff --git a/src/main/java/com/vml/aemrules/java/rules/JavaCheckRegistrar.java b/src/main/java/com/vml/aemrules/java/rules/JavaCheckRegistrar.java index cebd054..e47beee 100644 --- a/src/main/java/com/vml/aemrules/java/rules/JavaCheckRegistrar.java +++ b/src/main/java/com/vml/aemrules/java/rules/JavaCheckRegistrar.java @@ -50,13 +50,13 @@ public void register(RegistrarContext registrarContext) { private List> checkClasses() { return JavaRulesList.getJavaChecks().stream() .filter(checkClass -> shouldRegister(aemVersion, checkClass)) - .collect(Collectors.toList()); + .toList(); } private List> testCheckClasses() { return JavaRulesList.getJavaTestChecks().stream() .filter(checkClass -> shouldRegister(aemVersion, checkClass)) - .collect(Collectors.toList()); + .toList(); } private boolean shouldRegister(String aemVersion, Class checkClass) { diff --git a/src/test/java/com/vml/aemrules/matcher/MethodMatcherTest.java b/src/test/java/com/vml/aemrules/matcher/MethodMatcherTest.java index e625007..2f0c105 100644 --- a/src/test/java/com/vml/aemrules/matcher/MethodMatcherTest.java +++ b/src/test/java/com/vml/aemrules/matcher/MethodMatcherTest.java @@ -154,7 +154,7 @@ private void givenMethodInvocationTree(String codeToParse) { private CompilationUnitTree parse(String source) { List classpath = Arrays.asList(new File(TEST_CLASSES_FILEPATH), new File(CLASSES_FILEPATH)); - return JParser.parse(JParserConfig.Mode.FILE_BY_FILE.create(new JavaVersionImpl(11), classpath).astParser(), JAVA_VERSION, UNIT_NAME, source); + return JParser.parse(JParserConfig.Mode.FILE_BY_FILE.create(new JavaVersionImpl(17), classpath).astParser(), JAVA_VERSION, UNIT_NAME, source); } }