Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-1185

Overriding methods should do more than simply call the same method in the super class

    XMLWordPrintable

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Remove this method "XXXX" to simply inherit it.
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Targeted languages:
      Swift
    • Covered Languages:
      C#, C, C++, Flex, Java, PHP
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      2min
    • Analysis Scope:
      Main Sources, Test Sources
    • Implementation details:
    • FindBugs:
      FI_USELESS, USM_USELESS_SUBCLASS_METHOD
    • PMD:
      FinalizeOnlyCallsSuperFinalize, UselessOverridingMethod
    • ReSharper:
      RedundantOverridenMember
    • Quick-fixes:
      Hide

      Remove redundant override

      Show
      Remove redundant override

      Description

      Overriding a method just to call the same method from the super class without performing any other actions is useless and misleading. The only time this is justified is in final overriding methods, where the effect is to lock in the parent class behavior. This rule ignores such overrides of equals, hashCode and toString.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              freddy.mallet Freddy Mallet (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: