Menu

#1506 [core] When runing any RuleTst , start/end methods not called

PMD-5.3.8
closed
core (10)
PMD
2-Critical
Bug
All
2016-08-07
2016-07-16
blundell
No

When runing any RuleTst , the overrideable methods for each rule are not called.

Look at this screenshot, it should print out start and end for the rule, as you can see it prints nothing but visit is printed. This means any rule that override start and end and use them to update report will not be tested correctly.

1 Attachments

Related

Issues: #1511

Discussion

  • blundell

    blundell - 2016-07-16

    Have I understood this correctly?
    I would have expected this in the console:

    start
    visit
    visit
    visit
    end

     

    Last edit: blundell 2016-07-16
  • blundell

    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

    ruleSets.start(ctx);
    ruleSets.apply(acus, ctx, language);
    ruleSets.end(ctx);
    

    Can make a PullRequest if you agree?

     
    • Andreas Dangel

      Andreas Dangel - 2016-08-03

      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....

       
  • Andreas Dangel

    Andreas Dangel - 2016-08-06
    • labels: --> core
    • summary: When runing any RuleTst , methods not called --> [core] When runing any RuleTst , start/stop methods not called
    • status: open --> in-progress
    • assigned_to: Andreas Dangel
     
  • Andreas Dangel

    Andreas Dangel - 2016-08-06
    • summary: [core] When runing any RuleTst , start/stop methods not called --> [core] When runing any RuleTst , start/end methods not called
     
  • Andreas Dangel

    Andreas Dangel - 2016-08-06

    Related issue [#974]

     

    Related

    Issues: #974

  • Andreas Dangel

    Andreas Dangel - 2016-08-07
    • status: in-progress --> closed
    • Milestone: New Tickets --> PMD-5.3.8
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.