Lint/UnusedParameterRule.swift

SwiftLint · Source/SwiftLintBuiltInRules/Rules/Lint/UnusedParameterRule.swift · swift · MIT
dev-tools, tag:knn-classified

SwiftLint rule that flags unused function parameters as code smells.

// Source: https://github.com/realm/SwiftLint | License: MIT | Copyright 2025 The SwiftLint Contributors
// Provided via justclaw.it.com; keep this notice with the code.
import SwiftLintCore
import SwiftSyntax

@SwiftSyntaxRule(correctable: true, optIn: true)
struct UnusedParameterRule: Rule {
    var configuration = UnusedParameterConfiguration()

    private static let allowUnderscorePrefixedNames = ["allow_underscore_prefixed_names": true]

    static let description = RuleDescription(
        identifier: "unused_parameter",
        name: "Unused Parameter",
        description: """
            Other than unused local variable declarations, unused function/initializer/subscript parameters are not \
            marked by the Swift compiler. Since unused parameters are code smells, they s

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key