SonarQube
  1. SonarQube
  2. SONAR-1641

Exclude certain member variables (esp. logger instances) from the LCOM4 calculation

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.3
    • Component/s: Metrics
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Since unrelated methods of a class may all use the same logger instance, it could cause to calculate LCOM4=1 even though it might be really higher.
      It would be good, if certain member variables could be excluded from the LCOM4 calculation.

        Issue Links

          Activity

          Hide
          Andreas Hochsteger added a comment -

          It seems that I can't change the summary of this issue - it should read "LCOM4 calculation" instead of "the calculation".
          Maybe someone with enough permissions could fix this.

          Thanks,

          Andreas

          Show
          Andreas Hochsteger added a comment - It seems that I can't change the summary of this issue - it should read "LCOM4 calculation" instead of "the calculation". Maybe someone with enough permissions could fix this. Thanks, Andreas
          Hide
          Aakash Murari added a comment - - edited

          This is a very important issue. In our application, there is an instance of a "message bus" which is stored in many classes, which methods use to send messages.

          Since unrelated methods can use this instance, the true LCOM for the classes do not show up.

          Thanks,
          Aakash

          Show
          Aakash Murari added a comment - - edited This is a very important issue. In our application, there is an instance of a "message bus" which is stored in many classes, which methods use to send messages. Since unrelated methods can use this instance, the true LCOM for the classes do not show up. Thanks, Aakash
          Hide
          Freddy Mallet added a comment -

          The Java Squid plugin has a new "Fields to exclude from LCOM4 computation" property which allows to define a list of fields. The default value is "LOG, logger"

          Show
          Freddy Mallet added a comment - The Java Squid plugin has a new "Fields to exclude from LCOM4 computation" property which allows to define a list of fields. The default value is "LOG, logger"

            People

            • Assignee:
              Freddy Mallet
              Reporter:
              Andreas Hochsteger
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: