Skip to content

Invalid trigger for unused_closure_parameter when parameter is used in string interpolation #2062

Closed
@JRHeaton

Description

New Issue Checklist

Bug Report

Complete output when running SwiftLint, including the stack trace and command used
~> swiftlint lint
Loading configuration from '.swiftlint.yml'
Linting Swift files in current working directory
# ... non problematic files
/.../Mapper.swift:53:31: warning: Unused Closure Parameter Violation: Unused parameter "input" in a closure should be replaced with _. (unused_closure_parameter)
/.../Mapper.swift:53:38: warning: Unused Closure Parameter Violation: Unused parameter "context" in a closure should be replaced with _. (unused_closure_parameter)
/.../Mapper.swift:53:47: warning: Unused Closure Parameter Violation: Unused parameter "output" in a closure should be replaced with _. (unused_closure_parameter)
Done linting! Found 3 violations, 0 serious in 37 files.

Environment

  • SwiftLint version (run swiftlint version to be sure)?
~> swiftlint version
0.25.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    Homebrew
  • Paste your configuration file:
included:
  - Sources

opt_in_rules:
  - array_init
  - attributes
  - closure_end_indentation
  - closure_spacing
  - conditional_returns_on_newline
  - contains_over_first_not_nil
  - empty_count
  - explicit_enum_raw_value
  - explicit_init
  - explicit_top_level_acl
  - explicit_type_interface
  - extension_access_modifier
  - fatal_error_message
  - first_where
  - force_unwrapping
  - implicitly_unwrapped_optional
  - joined_default_parameter
  - let_var_whitespace
  - literal_expression_end_indentation
  - multiline_arguments
  - multiline_parameters
  - nimble_operator
  - no_extension_access_modifier
  - no_grouping_extension
  - number_separator
  - object_literal
  - operator_usage_whitespace
  - overridden_super_call
  - pattern_matching_keywords
  - private_outlet
  - prohibited_super_call
  - quick_discouraged_call
  - redundant_nil_coalescing
  - single_test_class
  - sorted_imports
  - strict_fileprivate
  - switch_case_on_newline
  - trailing_closure
  - unneeded_parentheses_in_closure_argument
  - vertical_parameter_alignment_on_call

disabled_rules:
  - extension_access_modifier
  - explicit_enum_raw_value
  - void_return
  - explicit_type_interface
  - number_separator
  - trailing_whitespace
  - function_body_length
  - line_length
  - redundant_optional_initialization
  - explicit_top_level_acl
  - identifier_name
  - no_grouping_extension

nesting:
  type_level: 2

colon:
  apply_to_dictionaries: false

statement_position:
  statement_mode: uncuddled_else

No

  • Which Xcode version are you using (check xcode-select -p)?
~> xcode-select -p
/Applications/Xcode.app/Contents/Developer

As the title state, the rule doesn't appear to see the variables referenced via string interpolation in the scope of this function.
screen shot 2018-02-23 at 5 24 52 pm
screen shot 2018-02-23 at 5 25 02 pm

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