Skip to content

Commit

Permalink
Merge pull request #2629 from guwirth/SQ-10
Browse files Browse the repository at this point in the history
First SQ 10 version
  • Loading branch information
guwirth authored Feb 7, 2024
2 parents 11b5374 + d4c6a5f commit 21dee86
Show file tree
Hide file tree
Showing 20 changed files with 122 additions and 72 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [ SQ-10 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [ SQ-10 ]
schedule:
- cron: '34 6 * * 4'

Expand All @@ -32,15 +32,26 @@ jobs:
strategy:
fail-fast: false
matrix:
java: [ '17' ]
distribution: [ 'temurin' ]
language: [ 'java', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
# Checkout repository
- name: Checkout repository
uses: actions/checkout@v3

# setup Java
- name: Set up JDK Java ${{ matrix.java }} | ${{ matrix.distribution }} | ${{ matrix.os }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: ${{ matrix.distribution }}
cache: maven

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
38 changes: 14 additions & 24 deletions .github/workflows/cxx-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ name: cxx plugin CI

on:
push:
branches: [ master ]
branches: [ SQ-10 ]
pull_request:
branches: [ master ]
branches: [ SQ-10 ]

defaults:
run:
Expand Down Expand Up @@ -64,14 +64,14 @@ jobs:

# -----------------------------------------------------------------------------------------------------------
# Going through the Maven cycles 'validate', 'compile', 'test', 'package' in all combinations to be supported
# The result of 'package' is uploaded as artifact for Ubuntu Linux Java 11 Temurin
# The result of 'package' is uploaded as artifact for Ubuntu Linux Java 17 Temurin
# -----------------------------------------------------------------------------------------------------------
build-linux:

strategy:
matrix:
os: [ubuntu-latest]
java: [ '11' ]
java: [ '17' ]
distribution: [ 'temurin' ]

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -134,10 +134,10 @@ jobs:
- name: Build and test with Maven
run: mvn -B -e -V verify --file pom.xml

# create artifacts from Linux, Java 11 Temurin
# create artifacts from Linux, Java 17 Temurin
#
- name: Collect JAR files
if: matrix.os == 'ubuntu-latest' && matrix.java == '11' && matrix.distribution == 'temurin'
if: matrix.os == 'ubuntu-latest' && matrix.java == '17' && matrix.distribution == 'temurin'
run: |
mkdir staging
cp sonar-cxx-plugin/target/*.jar staging
Expand All @@ -157,14 +157,14 @@ jobs:

# -----------------------------------------------------------------------------------------------------------
# Going through the Maven cycles 'validate', 'compile', 'test', 'package' in all combinations to be supported
# The result of 'package' is uploaded as artifact for Ubuntu Linux Java 11 Temurin
# The result of 'package' is uploaded as artifact for Ubuntu Linux Java 17 Temurin
# -----------------------------------------------------------------------------------------------------------
build-windows:

strategy:
matrix:
os: [windows-latest]
java: [ '11' ]
java: [ '17' ]
distribution: [ 'temurin' ]

runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -306,15 +306,10 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
java: [ '11', '17' ]
java: [ '17' ]
distribution: [ 'temurin' ]
sonarqube: [ '8.9.10.61524', '9.9.1.69595' ]
sonarscanner: [ '4.8.0.2856' ]
exclude:
- sonarqube: '8.9.10.61524'
java: '17'
- sonarqube: '9.9.1.69595'
java: '11'
sonarqube: [ '9.9.1.69595', '10.3.0.82913' ]
sonarscanner: [ '5.0.1.3006' ]

runs-on: ${{ matrix.os }}
needs: [build-linux, verify-rules]
Expand Down Expand Up @@ -452,15 +447,10 @@ jobs:
strategy:
matrix:
os: [windows-latest]
java: [ '11', '17' ]
java: [ '17' ]
distribution: [ 'temurin' ]
sonarqube: [ '8.9.10.61524', '9.9.1.69595' ]
sonarscanner: [ '4.8.0.2856' ]
exclude:
- sonarqube: '8.9.10.61524'
java: '17'
- sonarqube: '9.9.1.69595'
java: '11'
sonarqube: [ '9.9.1.69595', '10.3.0.82913' ]
sonarscanner: [ '5.0.1.3006' ]

runs-on: ${{ matrix.os }}
# needs build-linux because of JAR artifacts
Expand Down
10 changes: 10 additions & 0 deletions cxx-sensors/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,21 @@
<artifactId>sonar-plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.api.plugin</groupId>
<artifactId>sonar-plugin-api-test-fixtures</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-plugin-api-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.batch.postjob.PostJobContext;
import org.sonar.api.batch.sensor.internal.SensorContextTester;
import org.sonar.api.utils.log.LogTesterJUnit5;
import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.api.testfixtures.log.LogTesterJUnit5;
import org.slf4j.event.Level;
import org.sonar.cxx.CxxAstScanner;
import org.sonar.cxx.preprocessor.CxxPreprocessor;
import org.sonar.cxx.visitors.CxxParseErrorLoggerVisitor;
Expand Down Expand Up @@ -68,7 +68,7 @@ void finalReportTest() throws IOException {
var postjob = new FinalReport();
postjob.execute(postJobContext);

var log = logTester.logs(LoggerLevel.WARN);
var log = logTester.logs(Level.WARN);
assertThat(log).hasSize(2);
assertThat(log.get(0)).contains("include directive error(s)");
assertThat(log.get(1)).contains("syntax error(s) detected");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.sensor.internal.SensorContextTester;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.log.LogTesterJUnit5;
import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.api.testfixtures.log.LogTesterJUnit5;
import org.slf4j.event.Level;
import org.sonar.cxx.sensors.utils.CxxReportSensor;
import org.sonar.cxx.sensors.utils.TestUtils;

Expand Down Expand Up @@ -60,9 +60,9 @@ void noLoggingIfNotUsed() {
logTester.clear();
sensor.execute(context);

assertThat(logTester.logs(LoggerLevel.ERROR)).isEmpty();
assertThat(logTester.logs(LoggerLevel.WARN)).isEmpty();
assertThat(logTester.logs(LoggerLevel.INFO)).isEmpty();
assertThat(logTester.logs(Level.ERROR)).isEmpty();
assertThat(logTester.logs(Level.WARN)).isEmpty();
assertThat(logTester.logs(Level.INFO)).isEmpty();
}

@Test
Expand Down Expand Up @@ -108,7 +108,7 @@ void shouldCreateMissingStylesheetMessage() {
logTester.clear();
sensor.execute(context);

List<String> log = logTester.logs(LoggerLevel.ERROR);
List<String> log = logTester.logs(Level.ERROR);
assertThat(log).contains("XLST: 'sonar.cxx.xslt.1.stylesheet' value is not defined.");
}

Expand All @@ -124,7 +124,7 @@ void shouldCreateEmptyInputsMessage() {
logTester.clear();
sensor.execute(context);

List<String> log = logTester.logs(LoggerLevel.ERROR);
List<String> log = logTester.logs(Level.ERROR);
assertThat(log).contains("XLST: 'sonar.cxx.xslt.1.inputs' value is not defined.");
}

Expand All @@ -141,7 +141,7 @@ void shouldCreateEmptyOutputsMessage() {
logTester.clear();
sensor.execute(context);

List<String> log = logTester.logs(LoggerLevel.ERROR);
List<String> log = logTester.logs(Level.ERROR);
assertThat(log).contains("XLST: 'sonar.cxx.xslt.1.outputs' value is not defined.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.sonar.api.batch.sensor.SensorDescriptor;
import org.sonar.api.batch.sensor.internal.SensorContextTester;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.log.LogTesterJUnit5;
import org.sonar.api.testfixtures.log.LogTesterJUnit5;
import org.sonar.cxx.sensors.utils.CxxReportSensor;
import org.sonar.cxx.sensors.utils.TestUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.sonar.api.batch.sensor.internal.SensorContextTester;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.PathUtils;
import org.sonar.api.utils.log.LogTesterJUnit5;
import org.sonar.api.testfixtures.log.LogTesterJUnit5;
import org.sonar.cxx.sensors.coverage.cobertura.CoberturaParser;
import org.sonar.cxx.sensors.coverage.cobertura.CxxCoverageCoberturaSensor;
import org.sonar.cxx.sensors.utils.CxxReportSensor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.sonar.api.batch.sensor.internal.DefaultSensorDescriptor;
import org.sonar.api.batch.sensor.internal.SensorContextTester;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.log.LogTesterJUnit5;
import org.sonar.api.testfixtures.log.LogTesterJUnit5;
import org.sonar.cxx.sensors.utils.CxxReportSensor;
import org.sonar.cxx.sensors.utils.TestUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import static org.mockito.Mockito.mock;
import org.sonar.api.utils.log.LogTesterJUnit5;
import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.api.testfixtures.log.LogTesterJUnit5;
import org.slf4j.event.Level;

class NUnitTestResultsFileParserTest {

Expand Down Expand Up @@ -96,7 +96,7 @@ void empty() {
var results = new UnitTestResults();
new NUnitTestResultsFileParser().accept(new File(REPORT_PATH + "empty.xml"), results);

assertThat(logTester.logs(LoggerLevel.WARN))
assertThat(logTester.logs(Level.WARN))
.contains("One of the assemblies contains no test result, please make sure this is expected.");
assertThat(results.tests()).isZero();
assertThat(results.passedPercentage()).isZero();
Expand Down
10 changes: 10 additions & 0 deletions cxx-squid/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,21 @@
<artifactId>sonar-plugin-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.api.plugin</groupId>
<artifactId>sonar-plugin-api-test-fixtures</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarqube</groupId>
<artifactId>sonar-plugin-api-impl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import org.junit.jupiter.api.Test;
import org.sonar.api.ce.measure.Component;
import org.sonar.api.ce.measure.Component.Type;
import org.sonar.api.ce.measure.test.TestComponent;
import org.sonar.api.ce.measure.test.TestComponent.FileAttributesImpl;
import org.sonar.api.ce.measure.test.TestMeasureComputerContext;
import org.sonar.api.ce.measure.test.TestMeasureComputerDefinition.MeasureComputerDefinitionBuilderImpl;
import org.sonar.api.ce.measure.test.TestSettings;
import org.sonar.api.testfixtures.measure.TestComponent;
import org.sonar.api.testfixtures.measure.TestComponent.FileAttributesImpl;
import org.sonar.api.testfixtures.measure.TestMeasureComputerContext;
import org.sonar.api.testfixtures.measure.TestMeasureComputerDefinition.MeasureComputerDefinitionBuilderImpl;
import org.sonar.api.testfixtures.measure.TestSettings;

class AggregateMeasureComputerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.sonar.api.ce.measure.Component.Type;
import org.sonar.api.ce.measure.test.TestComponent;
import org.sonar.api.ce.measure.test.TestComponent.FileAttributesImpl;
import org.sonar.api.ce.measure.test.TestMeasureComputerContext;
import org.sonar.api.ce.measure.test.TestMeasureComputerDefinition.MeasureComputerDefinitionBuilderImpl;
import org.sonar.api.ce.measure.test.TestSettings;
import org.sonar.api.testfixtures.measure.TestComponent;
import org.sonar.api.testfixtures.measure.TestComponent.FileAttributesImpl;
import org.sonar.api.testfixtures.measure.TestMeasureComputerContext;
import org.sonar.api.testfixtures.measure.TestMeasureComputerDefinition.MeasureComputerDefinitionBuilderImpl;
import org.sonar.api.testfixtures.measure.TestSettings;

class DensityMeasureComputerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.sonar.api.utils.log.LogTesterJUnit5;
import org.sonar.api.utils.log.LoggerLevel;
import org.sonar.api.testfixtures.log.LogTesterJUnit5;
import org.slf4j.event.Level;
import org.sonar.cxx.CxxAstScanner;
import org.sonar.cxx.CxxFileTesterHelper;

Expand All @@ -34,11 +34,11 @@ class CxxParseErrorLoggerVisitorTest {

@Test
void handleParseErrorTest() throws Exception {
logTester.setLevel(LoggerLevel.DEBUG);
logTester.setLevel(Level.DEBUG);
var tester = CxxFileTesterHelper.create("src/test/resources/visitors/syntaxerror.cc", ".", "");
CxxAstScanner.scanSingleInputFile(tester.asInputFile());

var log = String.join("\n", logTester.logs(LoggerLevel.DEBUG));
var log = String.join("\n", logTester.logs(Level.DEBUG));

assertThat(log)
.isNotEmpty()
Expand Down
2 changes: 1 addition & 1 deletion cxx-sslr-toolkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
<configuration>
<rules>
<requireFilesSize>
<maxsize>8500000</maxsize>
<maxsize>8600000</maxsize>
<minsize>6000000</minsize>
<files>
<file>${project.build.directory}/${project.build.finalName}.jar</file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void requires_final_methods_to_be_non_public() {
var thrown = catchThrowableOfType(() -> Interceptor.create(PublicFinalMethod.class, new Class[]{},
new Object[]{},
methodInterceptor),
VerifyError.class);
IncompatibleClassChangeError.class);
assertThat(thrown)
// Note that details of the message are different between JDK versions
.hasMessageStartingWith("class GeneratedBySSLR overrides final method");
Expand Down
3 changes: 0 additions & 3 deletions integration-tests/features/smoketest.feature
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Feature: Smoketests
| statements | 36 |
| classes | 1 |
| files | 8 |
| directories | None |
| functions | 5 |
| comment_lines_density | 30 |
| comment_lines | 24 |
Expand Down Expand Up @@ -95,7 +94,6 @@ Feature: Smoketests
| statements | 36 |
| classes | 1 |
| files | 8 |
| directories | None |
| functions | 5 |
| comment_lines_density | 30 |
| comment_lines | 24 |
Expand Down Expand Up @@ -160,7 +158,6 @@ Feature: Smoketests
| statements | 36 |
| classes | 1 |
| files | 8 |
| directories | None |
| functions | 5 |
| comment_lines_density | 30 |
| comment_lines | 24 |
Expand Down
Loading

0 comments on commit 21dee86

Please sign in to comment.