[core] Restore behavior with thread=1 setting #4550
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the PR
Found this while upgrading the manual integration tests (see pmd/pmd-regression-tester#119): The errors where different when comparing to the baseline - but only the stacktrace. I could see, that the stacktraces are either from the main thread (including PmdCli) or from a worker thread (then they are shorter).
As we didn't specify the thread count for the regression tester baseline, it should be the default, which is "1" - and that should actually run the MultiThreadProcessor. Only with thread count=0 we should use MonoThreadProcessor. See the CLI documentation on threads:
Keeping to this behavior, it should make the error stacktraces more comparable regardless whether you run it with 4 threads or only with 1.
See also the old impl:
pmd/pmd-core/src/main/java/net/sourceforge/pmd/PmdAnalysis.java
Line 309 in ef34553
Additionally, I took the chance to set the threads now when creating the baseline or running regression tester. Maybe it makes it a bit faster (don't know, how powerful the GitHub action instance runners are).
Ready?
./mvnw clean verify
passes (checked automatically by github actions)