Skip to content

unused-parameter rule should not trigger on binding closure parameter #5740

Description

@sindresorhus

New Issue Checklist

Bug Description

The rule triggers on $historyItem, but the parameter is kinda used. $historyItem results in a binding, but it also makes it possible to access the normal variable with historyItem implicitly. So even though $historyItem is not directly used, it cannot be removed.

List($history) { $historyItem in
	Foo(
		url: historyItem.url
	)
}

In short, make it not trigger on $-prefixed parameters in a closure.

Environment

  • SwiftLint version: 0.56.0
  • Xcode version: Xcode 15.4, Build version 15F31d
  • Installation method used: Installer
  • Configuration file:
only_rules:
  - unused_parameter

Activity

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

    bugUnexpected and reproducible misbehavior.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions