Skip to content

unused-parameter rule should not trigger on parameters used for their type #5742

@sindresorhus

Description

@sindresorhus

New Issue Checklist

Bug Description

It should not report for cases where the parameter is used for its type and not value.

extension Data {
	func jsonDecoded<T: Decodable>(ofType type: T.Type) throws -> T {
		try JSONDecoder().decode(T.self, from: self)
	}
}

Here the type parameter decides the return type.

Environment

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionTopics that cannot be categorized as bugs or enhancements yet. They require further discussions.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions