Skip to content

[Rule Request] Tuple Pattern Rule #2203

Closed

Description

@marcelofabri

New Issue Checklist

Rule Request

  1. Why should this rule be added? Share links to existing discussion about what
    the community thinks about this.

From Google's Swift Style Guide:

Assigning variables through a tuple pattern (sometimes referred to as a tuple shuffle) is only permitted if the left-hand side of the assignment is unlabeled.

Labels on the left-hand side closely resemble type annotations, and can lead to confusing code.

  1. Provide several examples of what would and wouldn't trigger violations.
// ok
let (a, b) = (y: 4, x: 5.0)

// triggers
let (x: a, y: b) = (y: 4, x: 5.0)
let (x: Int, y: Double) = (y: 4, x: 5.0)
  1. Should the rule be configurable, if so what parameters should be configurable?

Just severity.

  1. Should the rule be opt-in or enabled by default? Why?
    See README.md for guidelines on when to mark a
    rule as opt-in.

Probably enabled by default, depends on oss-check.

Activity

  1. added
    rule-request
    on May 11, 2018
  2. added 2 commits that reference this issue on Feb 8, 2020
    22a4a7f
    e6a00b9
  3. added a commit that references this issue on Feb 8, 2020
    f95768d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    rule-request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions