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

Allow boolean function reference properties for NonBooleanPropertyPrefixedWithIs #4675

Closed
eygraber opened this issue Apr 4, 2022 · 5 comments
Labels

Comments

@eygraber
Copy link
Contributor

eygraber commented Apr 4, 2022

Since is prefix is used for functions that return a boolean, I think it would make sense to allow function references that return a boolean to be prefixed with is:

val isRemoved = suspend { theThing == null }
val isAdded = interactor::isAdded
@eygraber eygraber added the rules label Apr 4, 2022
@cortinico
Copy link
Member

This sounds like a valid edge case to add to the rule 🤔 or maybe worth a local suppress. I'm not sure how fine grained the rule should behave (like understand if the functional type is returning Boolean or not).

@eygraber
Copy link
Contributor Author

eygraber commented Apr 5, 2022

I use these a lot and I try to suppress as little as possible.

With type resolution, would the type of the reference be available? If so would it be simple to check if it is a function reference, and then check the return type parameter?

@BraisGabin
Copy link
Member

#4684 fixed this

@eygraber
Copy link
Contributor Author

eygraber commented Apr 8, 2022

Should this be extended to also allow AtomicBoolean to be prefixed with is?

@BraisGabin
Copy link
Member

🤔 I don't think so. That seems like a edge case to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants