Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: SonarSource/SonarJS
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3b4ef37e905207d416f950a0906935468d0b60c0
Choose a base ref
...
head repository: SonarSource/SonarJS
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bfa844ffd8554106a45138107a01869d6a165101
Choose a head ref

Commits on Dec 2, 2024

  1. Update dependency org.sonarsource.orchestrator:sonar-orchestrator-jun…

    …it5 to v5.1.0.2254 (#4977)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2024
    Copy the full SHA
    8ee4730 View commit details
  2. Update dependency type-fest to v4.29.1 (#4975)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2024
    Copy the full SHA
    b644d71 View commit details
  3. Update dependency ch.qos.logback:logback-classic to v1.5.12 (#4973)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2024
    Copy the full SHA
    7c06be1 View commit details
  4. Update dependency one-double-zero to v1.0.0 (#4974)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2024
    Copy the full SHA
    3cf272b View commit details
  5. Update dependency typedoc to v0.27.2 (#4976)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2024
    Copy the full SHA
    fae7aff View commit details
  6. Update protobuf.version to v4 (major) (#4953)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2024
    Copy the full SHA
    1449635 View commit details
  7. Update dependency org.eclipse.jgit:org.eclipse.jgit to v7 (#4949)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2024
    Copy the full SHA
    7452b05 View commit details
  8. Update dependency @types/node to v22 (#4944)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2024
    Copy the full SHA
    f69c7da View commit details
  9. Update dependency com.google.code.findbugs:jsr305 to v3 (#4946)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 2, 2024
    Copy the full SHA
    f9039cf View commit details

Commits on Dec 3, 2024

  1. Update sonar.version to v24 (major) (#4982)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 3, 2024
    Copy the full SHA
    c8b8909 View commit details
  2. Update dependency type-fest to v4.30.0 (#4981)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 3, 2024
    Copy the full SHA
    534f134 View commit details
  3. Update dependency org.mockito:mockito-core to v5 (#4950)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: Tibor Blenessy <saberduck@users.noreply.github.com>
    renovate[bot] and saberduck authored Dec 3, 2024
    Copy the full SHA
    70428c3 View commit details
  4. Copy the full SHA
    13066ab View commit details
  5. JS-471 SonarLint can configure persistent bundle path (#4980)

    Co-authored-by: Victor Diez <victor.diez@sonarsource.com>
    zglicz and vdiez authored Dec 3, 2024
    Copy the full SHA
    5242c58 View commit details

Commits on Dec 4, 2024

  1. Update dependency org.eclipse.jgit:org.eclipse.jgit to v7.1.0.2024112…

    …61347-r (#4988)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 4, 2024
    Copy the full SHA
    bed5361 View commit details
  2. Copy the full SHA
    6586548 View commit details
  3. Copy the full SHA
    01cfe53 View commit details
  4. Update dependency @types/bytes to v3.1.5 (#4987)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    Co-authored-by: Tibor Blenessy <saberduck@users.noreply.github.com>
    renovate[bot] and saberduck authored Dec 4, 2024
    Copy the full SHA
    a9062bf View commit details
  5. Add prettier sha to blame-ignore-revs

    zglicz authored and vdiez committed Dec 4, 2024
    Copy the full SHA
    c307bda View commit details
  6. JS-472 Improve instantiation of Analysis classes (Analysis with progr…

    …am or watch program) (#4984)
    
    Co-authored-by: Victor Diez <victor.diez@sonarsource.com>
    zglicz and vdiez authored Dec 4, 2024
    Copy the full SHA
    6b6eff0 View commit details
  7. Copy the full SHA
    89e788a View commit details

Commits on Dec 5, 2024

  1. Update dependency com.google.protobuf:protobuf-java to v4.29.1 (#4996)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 5, 2024
    Copy the full SHA
    3b6a738 View commit details
  2. Update dependency prettier to v3.4.2 (#4997)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 5, 2024
    Copy the full SHA
    36a25ed View commit details
  3. Update dependency @babel/preset-react to v7.26.3 (#4999)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Dec 5, 2024
    Copy the full SHA
    cb7ea05 View commit details
  4. Copy the full SHA
    0957f2e View commit details
  5. Add license header

    vdiez committed Dec 5, 2024
    Copy the full SHA
    9eb5510 View commit details
  6. Copy the full SHA
    bfa844f View commit details
Showing 624 changed files with 4,480 additions and 4,760 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
@@ -225,7 +225,7 @@ plugin_qa_sq_dev_task:
eks_container:
image: ${CIRRUS_AWS_ACCOUNT}.dkr.ecr.eu-central-1.amazonaws.com/base:j17-latest
env:
SQ_VERSION: 'DEV[10.8]' # replace this with "DEV" when platform squad is ready
SQ_VERSION: 'DEV'
SONARJS_ARTIFACT: multi
MVN_TEST: '-Dtest=!EslintCustomRulesTest,!SonarJsIntegrationTest --projects !org.sonarsource.javascript:eslint-custom-rules-plugin'

1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -3,3 +3,4 @@

# Prettified everything
091f56fa8f2375ad3eaed5db2507f030ff8806c7
01cfe53ba203ded1003ba0ffe5f8c4b3ec0b8b93
6 changes: 5 additions & 1 deletion generate-eslint-package-json.mjs
Original file line number Diff line number Diff line change
@@ -36,6 +36,10 @@ const eslintPluginDependencies = [
'typescript',
];

const fixedVersions = {
typescript: '^5',
};

const mainPackageJson = JSON.parse(
await fs.readFile(join(dirname(fileURLToPath(import.meta.url)), 'package.json'), 'utf8'),
);
@@ -47,7 +51,7 @@ for (const [name, value] of Object.entries(mainPackageJson.dependencies).concat(
Object.entries(mainPackageJson.devDependencies),
)) {
if (eslintPluginDependencies.includes(name)) {
dependencies[name] = value;
dependencies[name] = fixedVersions[name] ?? value;
const i = missingDependencies.indexOf(name);
missingDependencies.splice(i, 1);
}
Original file line number Diff line number Diff line change
@@ -155,7 +155,7 @@ private static void compare(Collection<RunResult> baseline, Collection<RunResult
println("Baseline: " + baselineScore);
println("Candidate: " + candidateScore);
var delta = Math.abs(baselineScore - candidateScore);
var deltaPercent = delta / baselineScore * 100;
var deltaPercent = (delta / baselineScore) * 100;
printf("Delta: %.3f (%.3f %%)%n", delta, deltaPercent);
if (deltaPercent > MARGIN_PERCENT) {
println("Performance degradation is greater than " + MARGIN_PERCENT + "%");
@@ -217,17 +217,15 @@ private static Optional<String> getJsPluginVersion(Orchestrator orchestrator) {
.execute()
.getBodyAsString();
var plugins = new Gson().fromJson(installed, JsonObject.class).get("plugins").getAsJsonArray();
return StreamSupport
.stream(plugins.spliterator(), false)
return StreamSupport.stream(plugins.spliterator(), false)
.map(JsonElement::getAsJsonObject)
.filter(e -> "javascript".equals(e.get("key").getAsString()))
.map(e -> e.get("version").getAsString())
.findFirst();
}

private static Orchestrator orchestrator(Location pluginLocation) {
return OrchestratorExtension
.builderEnv()
return OrchestratorExtension.builderEnv()
.setSonarVersion("LATEST_RELEASE")
.setOrchestratorProperty("orchestrator.container.port", "9000")
.useDefaultAdminCredentialsForBuilds(true)
@@ -236,8 +234,7 @@ private static Orchestrator orchestrator(Location pluginLocation) {
}

private static BuildResult runScan(String token, String projectKey, int maxspace) {
var build = SonarScanner
.create(Path.of("../sources/jsts/projects/", projectKey).toFile())
var build = SonarScanner.create(Path.of("../sources/jsts/projects/", projectKey).toFile())
.setProjectKey(projectKey)
.setProjectName(projectKey)
.setProjectVersion("1")
Original file line number Diff line number Diff line change
@@ -22,9 +22,6 @@ public class ConsumerPlugin implements Plugin {

@Override
public void define(Context context) {
context.addExtensions(
Consumer.class,
ConsumerSensor.class
);
context.addExtensions(Consumer.class, ConsumerSensor.class);
}
}
Original file line number Diff line number Diff line change
@@ -24,9 +24,8 @@ class ConsumerTest {

@Test
void test() {
var consumer = new Consumer();
consumer.doneAnalysis();
assertTrue(consumer.isDone());
var consumer = new Consumer();
consumer.doneAnalysis();
assertTrue(consumer.isDone());
}

}
Original file line number Diff line number Diff line change
@@ -109,8 +109,7 @@ void should_raise_issues() throws IOException {
.anyMatch(s ->
s.matches("Using Node\\.js executable .* from property sonar\\.nodejs\\.executable\\.")
)
)
.isTrue();
).isTrue();
}
}

@@ -179,10 +178,9 @@ void should_log_failure_only_once() throws IOException {
// we need to stop engine initialized in @BeforeEach prepare() method, because we need configuration with different node
sonarlintEngine.stop();
// version `42` will let us pass SonarLint check of version
sonarlintEngine =
new StandaloneSonarLintEngineImpl(
getSonarLintConfig(new File("invalid/path/node").toPath(), Version.create("42"))
);
sonarlintEngine = new StandaloneSonarLintEngineImpl(
getSonarLintConfig(new File("invalid/path/node").toPath(), Version.create("42"))
);
List<Issue> issues = analyze(FILE_PATH, "");
assertThat(logs).contains("Provided Node.js executable file does not exist.");
assertThat(issues).isEmpty();
@@ -300,8 +298,7 @@ private StandaloneGlobalConfiguration getSonarLintConfig(Path nodePath, Version
System.out.println(formattedMessage);
};

return StandaloneGlobalConfiguration
.builder()
return StandaloneGlobalConfiguration.builder()
.addEnabledLanguage(Language.JS)
.addEnabledLanguage(Language.TS)
.addEnabledLanguage(Language.CSS)
Original file line number Diff line number Diff line change
@@ -46,8 +46,7 @@ void sonarlint() throws Exception {
NodeJsHelper nodeJsHelper = new NodeJsHelper();
nodeJsHelper.detect(null);

StandaloneGlobalConfiguration globalConfig = StandaloneGlobalConfiguration
.builder()
StandaloneGlobalConfiguration globalConfig = StandaloneGlobalConfiguration.builder()
.addEnabledLanguage(Language.JS)
.addEnabledLanguage(Language.TS)
.addPlugin(TestUtils.JAVASCRIPT_PLUGIN_LOCATION)
@@ -65,8 +64,7 @@ void sonarlint() throws Exception {
TestUtils.sonarLintInputFile(testFile, Files.readString(testFile))
);

StandaloneAnalysisConfiguration analysisConfig = StandaloneAnalysisConfiguration
.builder()
StandaloneAnalysisConfiguration analysisConfig = StandaloneAnalysisConfiguration.builder()
.setBaseDir(baseDir)
.addInputFiles(inputFiles)
.build();
Original file line number Diff line number Diff line change
@@ -33,7 +33,16 @@ public class TestUtils {

static final Path JAVASCRIPT_PLUGIN_LOCATION = artifact();

static final List<String> platformStrings = List.of("darwin-arm64", "darwin-x64", "linux-arm64", "linux-x64", "linux-x64-musl", "win-x64", "multi");
static final List<String> platformStrings = List.of(
"darwin-arm64",
"darwin-x64",
"linux-arm64",
"linux-x64",
"linux-x64-musl",
"win-x64",
"multi"
);

/**
* This is used to test artifact with and without embedded runtime during plugin QA integration tests
*
@@ -54,15 +63,18 @@ private static Path artifact() {

private static Pattern pluginFilenameMatcher() {
if (System.getenv("SONARJS_ARTIFACT") != null) {
return Pattern.compile(String.format("sonar-javascript-plugin-.*-%s\\.jar", System.getenv("SONARJS_ARTIFACT")));
return Pattern.compile(
String.format("sonar-javascript-plugin-.*-%s\\.jar", System.getenv("SONARJS_ARTIFACT"))
);
}

return Pattern.compile("sonar-javascript-plugin-[0-9.]*(?:-SNAPSHOT)?\\.jar");
}


static boolean usingEmbeddedNode() {
return platformStrings.stream().anyMatch(TestUtils.JAVASCRIPT_PLUGIN_LOCATION.toString()::contains);
return platformStrings
.stream()
.anyMatch(TestUtils.JAVASCRIPT_PLUGIN_LOCATION.toString()::contains);
}

public static Path projectDir(String projectName) {
Original file line number Diff line number Diff line change
@@ -16,6 +16,9 @@
*/
package com.sonar.javascript.it.plugin;

import static com.sonar.javascript.it.plugin.OrchestratorStarter.JAVASCRIPT_PLUGIN_LOCATION;
import static org.assertj.core.api.Assertions.assertThat;

import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.build.BuildResult;
import com.sonar.orchestrator.build.SonarScanner;
@@ -26,9 +29,6 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import static com.sonar.javascript.it.plugin.OrchestratorStarter.JAVASCRIPT_PLUGIN_LOCATION;
import static org.assertj.core.api.Assertions.assertThat;

class ConsumerPluginTest {

private static final String PLUGIN_ARTIFACT_ID = "consumer-plugin";
@@ -46,8 +46,7 @@ public static void after() {
}

static OrchestratorExtension initOrchestrator(String customRulesArtifactId) {
var orchestrator = OrchestratorExtension
.builderEnv()
var orchestrator = OrchestratorExtension.builderEnv()
.useDefaultAdminCredentialsForBuilds(true)
.setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE"))
.addPlugin(JAVASCRIPT_PLUGIN_LOCATION)
@@ -70,8 +69,7 @@ static OrchestratorExtension initOrchestrator(String customRulesArtifactId) {
}

static BuildResult runBuild(Orchestrator orchestrator) {
SonarScanner build = OrchestratorStarter
.createScanner()
SonarScanner build = OrchestratorStarter.createScanner()
.setProjectDir(TestUtils.projectDirNoCopy("custom_rules"))
.setProjectKey("custom-rules")
.setProjectName("Custom Rules")
@@ -93,7 +91,8 @@ static BuildResult runBuild(Orchestrator orchestrator) {
@Test
void test() {
var buildResult = runBuild(orchestrator);
var logMatch = ".*DEBUG: Registered JsAnalysisConsumers \\[org.sonar.samples.javascript.consumer.Consumer.*]";
var logMatch =
".*DEBUG: Registered JsAnalysisConsumers \\[org.sonar.samples.javascript.consumer.Consumer.*]";
assertThat(buildResult.getLogsLines(l -> l.matches(logMatch))).hasSize(1);

// TS file is not processed yet.
Original file line number Diff line number Diff line change
@@ -34,8 +34,7 @@ class CoverageTest {
@Test
void LCOV_path_can_be_relative() {
final String projectKey = "LcovPathCanBeRelative";
SonarScanner build = OrchestratorStarter
.createScanner()
SonarScanner build = OrchestratorStarter.createScanner()
.setProjectDir(TestUtils.projectDir("lcov"))
.setProjectKey(projectKey)
.setProjectName(projectKey)
@@ -55,8 +54,7 @@ void LCOV_path_can_be_relative() {
@Test
void LCOV_path_can_be_absolute() {
final String projectKey = "LcovPathCanBeAbsolute";
SonarScanner build = OrchestratorStarter
.createScanner()
SonarScanner build = OrchestratorStarter.createScanner()
.setProjectDir(TestUtils.projectDir("lcov"))
.setProjectKey(projectKey)
.setProjectName(projectKey)
@@ -79,8 +77,7 @@ void LCOV_path_can_be_absolute() {
@Test
void LCOV_report_paths() {
final String projectKey = "LcovReportPaths";
SonarScanner build = OrchestratorStarter
.createScanner()
SonarScanner build = OrchestratorStarter.createScanner()
.setProjectDir(TestUtils.projectDir("lcov"))
.setProjectKey(projectKey)
.setProjectName(projectKey)
@@ -103,8 +100,7 @@ void LCOV_report_paths() {
@Test
void LCOV_report_paths_alias() {
final String projectKey = "LcovReportPathsAlias";
SonarScanner build = OrchestratorStarter
.createScanner()
SonarScanner build = OrchestratorStarter.createScanner()
.setProjectDir(TestUtils.projectDir("lcov"))
.setProjectKey(projectKey)
.setProjectName(projectKey)
@@ -124,8 +120,7 @@ void LCOV_report_paths_alias() {
@Test
void zero_coverage() {
final String projectKey = "ZeroCoverage";
SonarScanner build = OrchestratorStarter
.createScanner()
SonarScanner build = OrchestratorStarter.createScanner()
.setProjectDir(TestUtils.projectDir("lcov"))
.setProjectKey(projectKey)
.setProjectName(projectKey)
@@ -147,8 +142,7 @@ void zero_coverage() {
// SONARJS-301
public void print_log_for_not_found_resource() {
final String projectKey = "PrintLogForNotFoundResource";
SonarScanner build = OrchestratorStarter
.createScanner()
SonarScanner build = OrchestratorStarter.createScanner()
.setProjectDir(TestUtils.projectDir("lcov"))
.setProjectKey(projectKey)
.setProjectName(projectKey)
@@ -177,8 +171,7 @@ public void print_log_for_not_found_resource() {
// SONARJS-547
void wrong_line_in_report() {
final String projectKey = "WrongLineInReport";
SonarScanner build = OrchestratorStarter
.createScanner()
SonarScanner build = OrchestratorStarter.createScanner()
.setProjectDir(TestUtils.projectDir("lcov"))
.setProjectKey(projectKey)
.setProjectName(projectKey)
@@ -211,8 +204,7 @@ void wrong_line_in_report() {
@Test
void conditions_on_non_executable_lines() {
final String projectKey = "ConditionsOnNonExecutableLines";
SonarScanner build = OrchestratorStarter
.createScanner()
SonarScanner build = OrchestratorStarter.createScanner()
.setProjectDir(TestUtils.projectDir("lcov-jsx"))
.setProjectKey(projectKey)
.setProjectName(projectKey)
@@ -221,9 +213,9 @@ void conditions_on_non_executable_lines() {
.setDebugLogs(true)
.setProperty(
"sonar.javascript.lcov.reportPaths",
TestUtils
.file("projects/lcov-jsx/conditions-on-non-executable-lines.lcov")
.getAbsolutePath()
TestUtils.file(
"projects/lcov-jsx/conditions-on-non-executable-lines.lcov"
).getAbsolutePath()
);
OrchestratorStarter.setEmptyProfile(projectKey);
orchestrator.executeBuild(build);
@@ -237,8 +229,7 @@ void conditions_on_non_executable_lines() {
@Test
void wildcard_LCOV_report_paths() {
final String projectKey = "LcovWildcardReportPaths";
SonarScanner build = OrchestratorStarter
.createScanner()
SonarScanner build = OrchestratorStarter.createScanner()
.setProjectDir(TestUtils.projectDir("lcov-wildcard"))
.setProjectKey(projectKey)
.setProjectName(projectKey)
@@ -257,8 +248,7 @@ void wildcard_LCOV_report_paths() {
@Test
void LCOV_report_outside_module() {
final String projectKey = "LcovReportOutsideModule";
SonarScanner build = OrchestratorStarter
.createScanner()
SonarScanner build = OrchestratorStarter.createScanner()
.setProjectDir(TestUtils.projectDir("lcov"))
.setProperty("sonar.modules", "dir")
.setProjectKey(projectKey)
Loading