realm / SwiftLint

A tool to enforce Swift style and conventions.
https://realm.github.io/SwiftLint
MIT License
18.61k stars 2.22k forks source link

False Positive `empty_enum_arguments` #3883

Closed utahwithak closed 2 years ago

utahwithak commented 2 years ago

New Issue Checklist

Describe the bug

I'm getting a false empty_enum_arguments on this line:

guard case let .success(tracksTableResult) = result, !newOperationGroup.isCanceled() else {

Only on the Xcode 13.3 beta though, it doesn't trigger on Xcode 13.2. Worth mentioning, isCanceled is a function, not a var, definitely not an enum.

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint

Environment

opt_in_rules:
    - nslocalizedstring_require_bundle

disabled_rules:
    - cyclomatic_complexity
    - discarded_notification_center_observer
    - identifier_name
    - implicit_getter
    - file_length
    - force_cast
    - force_try
    - function_body_length
    - function_parameter_count
    - large_tuple
    - legacy_constructor
    - line_length
    - mark
    - nesting
    - notification_center_detachment
    - todo
    - type_body_length
    - weak_delegate
    - fallthrough
    - block_based_kvo
    - xctfail_message

custom_rules:
  backgroundtask_usage:
    name: begin/endbackgroundTask Usage
    message: Do not use beginBackgroundTask or endBackgroundTask. Instead, use the BackgroundTask wrapper in Utilities.
    regex: beginBackgroundTask\(|endBackgroundTask\(
    severity: error
  apply_usage:
    name: DiffableDataSource Apply Usage
    message: Do not use apply. iOS 14 and iOS 15 have different behaviors when using apply with no animation. Use sf_apply.
    regex: (?<!sf_)apply\([^\n]*animatingDifferences
    severity: error
  id_usage:
    name: ID Suffix
    message: Identifier, arguments, parameters should not use mixed case for ID.
    regex: Ids?\b
    match_kinds: 
      - identifier
      - argument
    severity: warning
  url_usage:
    name: URL Suffix
    message: Identifier, arguments, parameters should not use mixed case for URL.
    regex: Urls?\b
    match_kinds:
      - identifier
      - argument
    severity: warning
// This triggers a violation:
guard case let .success(tracksTableResult) = result, !newOperationGroup.isCanceled() else {

With Xcode version 13.3

marcelofabri commented 2 years ago

This should be fixed in 0.46.4 (https://github.com/realm/SwiftLint/issues/3850)