Este producto no es compatible con el sitio Datadog seleccionado. ().
Esta página aún no está disponible en español. Estamos trabajando en su traducción.
Si tienes alguna pregunta o comentario sobre nuestro actual proyecto de traducción, no dudes en ponerte en contacto con nosotros.

Metadata

ID: swift-code-style/tuples-too-large

Language: Unknown

Severity: Notice

Category: Best Practices

Description

Tuples should not be too large. This is because tuples are designed to be simple, quick ways to group related values. They are not meant to serve as data structures or record types, which are better suited to handle larger amounts of data.

To avoid the violation of this rule, you should consider using a struct or a class when you find yourself needing a tuple with more than two or three items. For example, instead of func myfunction() -> (Int, Int, Int, String) {}, you could define a struct like this: struct MyFunctionResult { let a: Int; let b: Int; let c: Int; let d: String }, and then have myfunction() return a MyFunctionResult. This makes your code more readable and easier to maintain.

Non-Compliant Code Examples

func myfunction() -> (Int, Int, Int, String) {}
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Integraciones sin problemas. Prueba Datadog Code Security