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

Method overloads should be grouped together

    XMLWordPrintable

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Move this method [signature] to somewhere between line x and y.
    • Highlighting:
      Hide

      signature

      Show
      signature
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way recommended
    • Targeted languages:
      Java, Objective-C
    • Covered Languages:
      C#, C++, TypeScript, VB.Net
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      1min
    • Analysis Scope:
      Main Sources, Test Sources
    • TSLint:
      adjacent-overload-signatures

      Description

      For clarity, all overloads of the same method should be grouped together. That lets both users and maintainers quickly understand all the current available options.

      Noncompliant Code Example

      interface MyInterface {
        doTheThing(): number;
        doTheOtherThing(): string;
        doTheThing(str: string): string;  // Noncompliant
      }
      

      Compliant Solution

      interface MyInterface {
        doTheThing(): number;
        doTheThing(str: string): string;
        doTheOtherThing(): string;
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              ann.campbell.2 Ann Campbell
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: