Large Tuple

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

  • Identifier: large_tuple
  • Enabled by default: Yes
  • Supports autocorrection: No
  • Kind: metrics
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    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)?
func foo() async -> (Int, Int)
func foo() async -> (Int, Int) {}
func foo(bar: String) async -> (Int, Int)
func foo(bar: String) async -> (Int, Int) {}
func foo() async throws -> (Int, Int)
func foo() async throws -> (Int, Int) {}
let foo: (Int, Int, Int) async -> Void
let foo: (Int, Int, Int) async throws -> Void
func foo(bar: (Int, String, Float) async -> Void)
func foo(bar: (Int, String, Float) async throws -> Void)
func getDictionaryAndInt() async -> (Dictionary<Int, String>, Int)?
func getGenericTypeAndInt() async -> (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)?
func foo(bar: (Int, Int, Int)) async
func foo() async -> (Int, Int, Int)
func foo() async -> (Int, Int, Int) {}
func foo(bar: String) async -> (Int, Int, Int)
func foo(bar: String) async -> (Int, Int, Int) {}
func foo() async throws -> (Int, Int, Int)
func foo() async throws -> (Int, Int, Int) {}
func foo() async throws -> (Int, (String, String, String), Int) {}
func getDictionaryAndInt() async -> (Dictionary<Int, (String, String, String)>, Int)?