Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False-positive for empty_enum_arguments rule #3562

Closed
2 tasks done
umbertovolta opened this issue Mar 9, 2021 · 0 comments · Fixed by #3616
Closed
2 tasks done

False-positive for empty_enum_arguments rule #3562

umbertovolta opened this issue Mar 9, 2021 · 0 comments · Fixed by #3616
Labels
bug Unexpected and reproducible misbehavior.

Comments

@umbertovolta
Copy link

New Issue Checklist

Describe the bug

The empty_enum_arguments rule matches in if statements when using dot notation on a function without parameters.

Complete output when running SwiftLint, including the stack trace and command used
$ Pods/SwiftLint/swiftlint lint empty_enum_arguments.swift
Linting Swift files at paths empty_enum_arguments.swift
Linting 'empty_enum_arguments.swift' (1/1)
/Users/umv/dev/swiftlint_test/empty_enum_arguments.swift:13:24: warning: Empty Enum Arguments Violation: Arguments can be omitted when matching enums with associated values if they are not used. (empty_enum_arguments)
Done linting! Found 1 violation, 0 serious in 1 file.

Environment

  • SwiftLint version (run swiftlint version to be sure)?
    0.43.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    CocoaPods
  • Paste your configuration file:
only_rules:
    - empty_enum_arguments
  • Which Xcode version are you using (check xcodebuild -version)?
    12.4
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
    to quickly test if your example is really demonstrating the issue. If your example is more
    complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.
struct TestSwiftlint {
  struct Person: Equatable {
    let name: String

    static func mocked(name: String = "Mock") -> Self {
      return Self(name: name)
    }
  }

  let pippo = Person(name: "Pippo")

  func check() {
    if pippo == .mocked() { // <-- empty_enum_arguments
      print("Pippo is mocked")
    } else {
      print("Pippo is real")
    }
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants