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

Add analyzer for GetOrElse usage #521

Open
bash opened this issue Feb 10, 2022 · 1 comment
Open

Add analyzer for GetOrElse usage #521

bash opened this issue Feb 10, 2022 · 1 comment

Comments

@bash
Copy link
Member

bash commented Feb 10, 2022

The uses of the two overloads of GetOrElse are not always clear to people, so I think an analyzer would help.

option.GetOrElse(() => 0f) // Warning: Pass 0f directly to GetOrElse
option.GetOrElse(Function()) // Warning: Potential misuse of GetOrElse, pass method group instead.
@bash bash added area: Analyzer to discuss There are open points which need to be discussed labels Feb 10, 2022
@FreeApophis
Copy link
Member

This should not only be done for GetOrElse, but also for the following:

  • AndThen
  • OrElse
  • Match

@FreeApophis FreeApophis removed the to discuss There are open points which need to be discussed label Feb 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants