SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

Falsepositive multiline_arguments

Open NikKovIos opened this issue 1 year ago • 5 comments

Version 0.51.0

            DispatchQueue.main.async {
                handler(self.userInfo, { animated, completion in                        <- multiline_arguments
                    self.delegate?.close(animated: animated, completion: completion)
                }, { error in
                    self.processError(error)
                })
            }

case checkPinCode(completion: PinCodeCheckingCompletion, cancelCompletion: PinCodeCancelClosure?)
typealias PinCodeCheckingCompletion = (_ userInfo: [String: Any]?, _ dismiss: @escaping PinCodeDismissCompletion, _ showError: @escaping PlatformErrorClosure) -> Void

Autolint enabled and line with handler(self.userInfo, and line { animated, completion in always concate.

NikKovIos avatar Jun 29 '24 09:06 NikKovIos

Please be a bit more specific. Provide a simplified example together with your expectation and the location where the rule actually triggers. Also check your example with the latest release 0.55.1 and try if the rule's configuration options are of any help.

SimplyDanny avatar Jun 29 '24 13:06 SimplyDanny

Sorry, the code is under NDA.

swiftlint rules:

reporter: "xcode"
excluded:
    - ${PWD}/Pods
opt_in_rules:
    - attributes
    - vertical_whitespace_closing_braces
    - vertical_whitespace_opening_braces
    - conditional_returns_on_newline
    - vertical_parameter_alignment_on_call
    - closure_end_indentation
    - closure_spacing
    - collection_alignment
    - discarded_notification_center_observer
    - empty_string
    - literal_expression_end_indentation
    - modifier_order
    - multiline_arguments
    - multiline_function_chains
    - multiline_literal_brackets
    - multiline_parameters
    - operator_usage_whitespace
    - overridden_super_call
    - private_action
    - private_outlet
    - switch_case_on_newline
    - large_tuple
    - first_where
    - last_where
    - discouraged_object_literal
    - no_extension_access_modifier
    - yoda_condition
    - expiring_todo
    - discouraged_none_name
    - discouraged_assert
    - lower_acl_than_parent
    - prefer_self_in_static_references
    - prefer_self_type_over_type_of_self
    - prefer_zero_over_explicit_init
    - prefixed_toplevel_constant
    - redundant_nil_coalescing
    - sorted_first_last
    - static_operator
    - trailing_closure
    - unavailable_function
    - multiple_closures_with_trailing_closure
    
disabled_rules:
    - class_delegate_protocol
    - line_length
    - type_body_length
    - function_body_length
    - file_length
    - identifier_name
    - type_name
    - function_parameter_count
    - cyclomatic_complexity
    - inclusive_language
    - todo
    - large_tuple
    - force_cast
    - number_separator
nesting:
    type_level:
        warning: 3
conditional_returns_on_newline:
    if_only: true
    
trailing_closure:
    only_single_muted_parameter: true
    severity: error
    
unavailable_function:
    severity: error

attributes:
    severity: error
    
multiple_closures_with_trailing_closure:
    severity: error

private_outlet:
    severity: error
    allow_private_set: true

multiline_parameters:
    severity: error

multiline_literal_brackets:
    severity: error

vertical_parameter_alignment_on_call:
    severity: error

vertical_parameter_alignment:
    severity: error

multiline_arguments:
    severity: error

closure_parameter_position:
    severity: error

NikKovIos avatar Jun 29 '24 18:06 NikKovIos

Sorry, the code is under NDA.

Sorry, but if you don't spend the effort to provide some simplified example to help people make sense of your code, you can also not expect anyone to fix this for you.

SimplyDanny avatar Jun 29 '24 20:06 SimplyDanny

There is already simplified example in first message. What's wrong with it?

NikKovIos avatar Jun 29 '24 21:06 NikKovIos

  • Try if 0.55.1 changes anything.
  • Check if the rule's options change anything.
  • What does "always concat" mean?
  • Does the rule trigger in the first line or does it not?
  • What do you expect?

SimplyDanny avatar Jun 29 '24 21:06 SimplyDanny

With

handler(self.userInfo,
                        { animated, completion in
                    self.delegate?.close(animated: animated, completion: completion)
                },
                        { error in
                    self.processError(error)
                })

works correctly

NikKovIos avatar Jul 07 '24 10:07 NikKovIos