large_tuple - ApplebaumIan/BitbucketAPI GitHub Wiki

Large Tuple

Tuples shouldn't have too many members. Create a custom type instead.

  • Identifier: large_tuple
  • Enabled by default: Enabled
  • Supports autocorrection: No
  • Kind: metrics
  • Analyzer rule: No
  • Minimum Swift compiler version: 3.0.0
  • Default configuration: warning: 2, error: 3

Non Triggering Examples

let foo: (Int, Int)

let foo: (start: Int, end: Int)

let foo: (Int, (Int, String))

func foo() -> (Int, Int)

func foo() -> (Int, Int) {}

func foo(bar: String) -> (Int, Int)

func foo(bar: String) -> (Int, Int) {}

func foo() throws -> (Int, Int)

func foo() throws -> (Int, Int) {}

let foo: (Int, Int, Int) -> Void

let foo: (Int, Int, Int) throws -> Void

func foo(bar: (Int, String, Float) -> Void)

func foo(bar: (Int, String, Float) throws -> Void)

var completionHandler: ((_ data: Data?, _ resp: URLResponse?, _ e: NSError?) -> Void)!

func getDictionaryAndInt() -> (Dictionary<Int, String>, Int)?

func getGenericTypeAndInt() -> (Type<Int, String, Float>, Int)?

Triggering Examples

↓let foo: (Int, Int, Int)

↓let foo: (start: Int, end: Int, value: String)

↓let foo: (Int, (Int, Int, Int))

func foo(↓bar: (Int, Int, Int))

func foo() -> ↓(Int, Int, Int)

func foo() -> ↓(Int, Int, Int) {}

func foo(bar: String) -> ↓(Int, Int, Int)

func foo(bar: String) -> ↓(Int, Int, Int) {}

func foo() throws -> ↓(Int, Int, Int)

func foo() throws -> ↓(Int, Int, Int) {}

func foo() throws -> ↓(Int, ↓(String, String, String), Int) {}

func getDictionaryAndInt() -> (Dictionary<Int, ↓(String, String, String)>, Int)?