Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS-435 Clear dependencies cache when a package.json is modified. #4934

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

zglicz
Copy link
Contributor

@zglicz zglicz commented Nov 27, 2024

JS-435

As it might happen when the package.json is changed, we should dirty the cache.

I've tested, building the jar, copying it into the plugins and verifying that the 2 logs I've added are being triggered. I will add tests once the integration tests for SonarIDE are available.

I've verified, that opening a file from node_modules directory, does not trigger this event:

Trigger: EDITOR_OPEN
[EDITOR_OPEN] 1 file(s) submitted
File 'package.json' excluded: file is excluded or ignored in project structure

@zglicz zglicz requested a review from vdiez November 27, 2024 10:49
@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod bot changed the title Clear dependencies cache when a package.json is modified. JS-435 Clear dependencies cache when a package.json is modified. Nov 27, 2024
@@ -51,7 +51,7 @@ public void analyzeFiles(List<InputFile> inputFiles, List<String> tsConfigs) thr
progressReport.start(inputFiles.size(), inputFiles.iterator().next().toString());
for (InputFile inputFile : inputFiles) {
var tsConfigFile = tsConfigCache.getTsConfigForInputFile(inputFile);
analyzeFile(inputFile, tsConfigFile == null ? List.of() : List.of(tsConfigFile.getFilename()), null);
analyzeFile(inputFile, tsConfigFile == null ? List.of() : List.of(tsConfigFile.getFilename()), null, this.tsConfigCache != null && this.tsConfigCache.getAndResetShouldClearDependenciesCache());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the line on top just uses tsConfigCache directly without null checks. Can we just do the same here?

Copy link
Contributor

@vdiez vdiez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! just a small remark on AnalysisWithWatchProgram.java

@zglicz zglicz merged commit eb16f7d into master Nov 27, 2024
17 of 18 checks passed
@zglicz zglicz deleted the dirty-cache branch November 27, 2024 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants