Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Add a nested comment explaining why this method is empty, throw an [UnsupportedOperationException|NotSupportedException| IllegalOperationError] or complete the implementation.
    • Default Severity:
      Critical
    • Impact:
      High
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Targeted languages:
      ABAP, PL/I, PL/SQL, RPG, TypeScript
    • Covered Languages:
      C#, C, C++, Flex, Go, Java, JavaScript, Kotlin, Objective-C, PHP, Python, Ruby, Scala, Swift, VB.Net, VB6
    • Irrelevant for Languages:
      Cobol, HTML, T-SQL, XML
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      5min
    • Analysis Level:
      Semantic Analysis
    • Analysis Scope:
      Main Sources, Test Sources
    • Common Rule:
      Yes
    • ESLint:
      no-empty-function, no-useless-constructor
    • FindBugs:
      FI_EMPTY, FI_NULLIFY_SUPER
    • PMD:
      EmptyFinalizer, UncommentedEmptyMethodBody, UncommentedEmptyMethod, UnnecessaryConstructor
    • TSLint:
      no-empty

      Description

      There are several reasons for a method not to have a method body:

      • It is an unintentional omission, and should be fixed to prevent an unexpected behavior in production.
      • It is not yet, or never will be, supported. In this case an exception should be thrown.
      • The method is an intentionally-blank override. In this case a nested comment should explain the reason for the blank override.

        Attachments

          Issue Links

          1.
          Java RSPEC-1837 Language-Specification Active Unassigned
          2.
          C# RSPEC-1838 Language-Specification Active Unassigned
          3.
          Flex RSPEC-1839 Language-Specification Active Unassigned
          4.
          C-Family RSPEC-1973 Language-Specification Active Unassigned
          5.
          Swift: Functions and closures should not be empty RSPEC-2954 Language-Specification Active Unassigned
          6.
          Javascript: Functions should not be empty RSPEC-3765 Language-Specification Active Unassigned
          7.
          Go: Functions should not be empty RSPEC-4573 Language-Specification Active Unassigned
          8.
          Kotlin: Functions should not be empty RSPEC-4693 Language-Specification Active Unassigned
          9.
          VB.Net RSPEC-4847 Language-Specification Active Unassigned
          10.
          Apex RSPEC-4985 Language-Specification Active Unassigned
          11.
          Python: Functions and methods should not be empty RSPEC-5584 Language-Specification Active Unassigned
          12.
          PHP RSPEC-5836 Language-Specification Active Unassigned
          13.
          VB6 RSPEC-6042 Language-Specification Active Unassigned

            Activity

              People

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

                Dates

                • Created:
                  Updated: