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 Positives with Hashable #721

Closed
iv-mexx opened this issue Mar 11, 2024 · 1 comment
Closed

False Positives with Hashable #721

iv-mexx opened this issue Mar 11, 2024 · 1 comment

Comments

@iv-mexx
Copy link

iv-mexx commented Mar 11, 2024

Hi, I think I'm getting these false positives with a Strict thats Hashable in Periphery 2.18.0

  private struct LootToggleIdentifier: Hashable {
    let categoryName: String
    let typeName: String
    let usages: Set<Usage>
    let categories: Set<Category>
  }

Screenshot 2024-03-11 at 10 27 24

Its true, categoryName and typeName are never read explicitly, but they are factored into automatically synthesized hash function ( https://developer.apple.com/documentation/swift/hashable#Conforming-to-the-Hashable-Protocol )

@ileitch
Copy link
Contributor

ileitch commented Apr 29, 2024

This isn't a false positive, Periphery correctly identifies that the property isn't read from anywhere else in your code. No tool can determine that these properties are used only for altering the hash value. You can either implement hash(into:) or use a comment command to retain these properties.

@ileitch ileitch closed this as completed Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants