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

Tuples should not be too large

    XMLWordPrintable

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Reduce the size of this tuple or convert it to a named structure (class or struct).
    • Highlighting:
      Hide

      (...)

      Show
      (...)
    • List of parameters:
      • key: threshold
      • description: The maximum number of items allowed in a threshold
      • default value: 2
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Targeted languages:
      PHP
    • Covered Languages:
      Swift
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      10min
    • Analysis Scope:
      Main Sources, Test Sources
    • SwiftLint:
      large_tuple

      Description

      An unordered pair is easy to handle, but the longer an unordered set gets, the harder it is to deal with.

      This rule raises an issue when a tuple of more than the allowed number of elements is returned.

      Noncompliant Code Example

      With the default threshold of 2

      func doTheThing() -> (Int, Int, Int) {}  // Noncompliant
      

      Compliant Solution

      func doTheThing() -> MyIntStruct {}
      

        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: