Details

    • Number of attachments :
      0

      Description

      It seems it is completely wrong.

      Fix the calculation
      Fix the check to use the cumulated value on the function declaration

        Activity

        Hide
        Tamas Kende added a comment -

        Hi,

        I do not know what is wrong here. In the BranchesOfRecursionCheck I get the actual function with: (SourceFunction) getContext().peekSourceCode() (it is subscribed to functionDeclarations) and I try to get the cumulated value (3) of the ErlangMetric.BRANCHES_OF_RECURSION. It says it is zero, but in the sub-SourceFunctions (all the function clasues are nested SourceFunctions) I can get the values 1 and 2... why isn't it cumulated? What did I wrong?

        Thanks

        Tamas

        Show
        Tamas Kende added a comment - Hi, I do not know what is wrong here. In the BranchesOfRecursionCheck I get the actual function with: (SourceFunction) getContext().peekSourceCode() (it is subscribed to functionDeclarations) and I try to get the cumulated value (3) of the ErlangMetric.BRANCHES_OF_RECURSION. It says it is zero, but in the sub-SourceFunctions (all the function clasues are nested SourceFunctions) I can get the values 1 and 2... why isn't it cumulated? What did I wrong? Thanks Tamas
        Hide
        Tamas Kende added a comment -

        I think I figured out where is the problem... the leaveNode of check is executed earlier than the leaveNode of the metric calculation, so I guess that is the reason why the measures are not cumulated...
        is it executed by reversed order right? so all the leave* of the checks will be executed before the metrics, so I cannot check any measure in leave*, am I right?

        Show
        Tamas Kende added a comment - I think I figured out where is the problem... the leaveNode of check is executed earlier than the leaveNode of the metric calculation, so I guess that is the reason why the measures are not cumulated... is it executed by reversed order right? so all the leave* of the checks will be executed before the metrics, so I cannot check any measure in leave*, am I right?
        Hide
        Evgeny Mandrikov added a comment -
        Show
        Evgeny Mandrikov added a comment - Indeed - this is a known limitation, but I guess that you can use https://github.com/SonarSource/sslr-squid-bridge/blob/master/src/main/java/com/sonar/sslr/squid/checks/ChecksHelper.java
        Hide
        Tamas Kende added a comment -

        Thanks for the tip, it works fine!

        Show
        Tamas Kende added a comment - Thanks for the tip, it works fine!

          People

          • Assignee:
            Tamas Kende
            Reporter:
            Tamas Kende
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: