bamaer commented on code in PR #8896:
URL: https://github.com/apache/hop/pull/8896#discussion_r4267256970


##########
plugins/misc/lint/src/main/java/org/apache/hop/lint/BackgroundLintService.java:
##########
@@ -141,11 +149,62 @@ public void scheduleGraphLint(HopGuiAbstractGraph graph, 
boolean force) {
         });
   }
 
+  /**
+   * Called when a project is enabled. When it is another project than before, 
the findings and the
+   * record of what was checked belong to the project that was left: drop 
both, and stop the passes
+   * still running for it from publishing.
+   *
+   * <p>The tracker has to go as well. It skips files that have not changed 
since they were last
+   * checked, so switching back to a project would otherwise leave it without 
findings.
+   */
+  public void switchProject(String projectPath) {

Review Comment:
   @mattcasters Fixed: every writer you listed, plus Lint Project, now captures 
the generation when it starts and publishes through `publish()`, which drops 
the findings and skips `markChecked` when the generation has moved on. Added a 
test where a file lint started before `switchProject` finishes after it.



##########
plugins/misc/lint/src/main/java/org/apache/hop/lint/LinterConfigPlugin.java:
##########
@@ -221,6 +221,9 @@ public Map<String, Object> saveToHopConfig() {
   void applyEnabledState() {
     if (!isLinterEnabled()) {
       LintResultsManager.getInstance().clearResults();
+      // Without this, switching the linter back on skips every file that has 
not changed since it
+      // was last checked, and the project comes back without findings.
+      BackgroundLintService.getInstance().getTracker().clear();

Review Comment:
   @mattcasters Fixed: switching the linter off now goes through 
`discardResults()`, which bumps the generation and clears the tracker and the 
results under the same lock as `publish()`. `publish()` also returns before 
`markChecked` when the linter is off. The new test finishes a pass after the 
linter is switched off.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to