-
Hello, within the PmdAnalysis class in the core library there is a "performAnalysis" method, but I do not see any API methods that can cancel / stop the current analysis. Did I look at the wrong place or it is not yer developed ? This feature is needed when we use PMD within a plugin such as PMD-Intellij. The IDE has hooks for "progress start" and "progress end" and "progress cancel" events that should be respected if possible. Thank you for your help References: https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/PmdAnalysis.java#L360 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
@sashokbg there is currently no public API to do this. What you can do at the moment is simply interrupting the thread used to launch the PMD analysis. Even if the analysis is multi-threaded it will completely shutdown the analysis. We can't expose this as an API, as it assumes the current thread can be discarded, or requires to run everything in a worker thread in the off-scenario where this is actually needed… so it seems better to leave the consumer of such scenario to do the wrapping. Alternatively we could drop the mono thread processor, have everything run on an executor service, even if it's only 1 thread, and expose an API to shutdown the executor, but that would fail to stop the analysis unless it has completely finalized the setup step, including figuring out the exhaustive list of files to be analyzed by each subset of rules… but unlikely to happen in the short term as we focus on PMD 7.0.0 final release. |
Beta Was this translation helpful? Give feedback.
@sashokbg there is currently no public API to do this. What you can do at the moment is simply interrupting the thread used to launch the PMD analysis. Even if the analysis is multi-threaded it will completely shutdown the analysis.
We can't expose this as an API, as it assumes the current thread can be discarded, or requires to run everything in a worker thread in the off-scenario where this is actually needed… so it seems better to leave the consumer of such scenario to do the wrapping.
Alternatively we could drop the mono thread processor, have everything run on an executor service, even if it's only 1 thread, and expose an API to shutdown the executor, but that would fail to stop the …