[core] When runing any RuleTst , start/end methods not called
A source code analyzer
Brought to you by:
adangel,
juansotuyo
Have I understood this correctly?
I would have expected this in the console:
start
visit
visit
visit
end
Last edit: blundell 2016-07-16
It looks like SourceCodeProcessor.java never calls start() or end(), but MonoThreadProcessor & MultiThreadProcessor do?
SourceCodeProcessor.java could be "fixed" at this line:
https://github.com/pmd/pmd/blob/master/pmd-core/src/main/java/net/sourceforge/pmd/SourceCodeProcessor.java#L146
like so
Can make a PullRequest if you agree?
Your expectation about start/end is correct.
As you have seen, MonoThreadProcessor and MultiThreadProcessor call correclty start/end - and then they call the SourceCodeProcessor. That's why the SourceCodeProcessor doesn't do this anymore - and it shouldn't.
So, we have a problem with the test framework.
Looking at the code, there is a difference in when/how often start&end is called: MonoThreadProcessor calls it for each file, while the MultiThreadProcessor calls it only once - and for a ruleset instance, that is never used, as for the threads, new rule instances will be created.
So, I suspect, this doesn't really work yet....
Related issue [#974]
Related
Issues:
#974I've created a follow-up issue: [#1511] in order to make the implementation consistent.
The bug within the test framework is fixed, so that RuleTst now calls start and end.
The bugfix will be available in PMD 5.3.8, 5.4.3, 5.5.2 and later.
Commit: https://github.com/pmd/pmd/commit/cf4938a65b26fdc039aafbf3b5da77baf2ca61e2
Related
Issues:
#1511