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

Question: Can roslynator detect "collection of objects with a singular name" scenarios? #1476

Open
ChairmanMawh opened this issue May 31, 2024 · 1 comment

Comments

@ChairmanMawh
Copy link

Just wondering..

I'd like to be able to flag variables, fields and properties in the codebase that have a singular name. Also variables that are sole objects but have a plural name (less affected by this)

Expected Behavior:

var something = new[]{ "" }
    ^^^^^^^^^
    "variables that represent a collection should have a name that is a plural"
@josefpihrt
Copy link
Collaborator

It depends whether there is some general algorithm how to detect if a noun is a singular or a plural. If a word does not end with "s", it's singular, that seems to be easy. The tricky part is how to detect plural because the fact that a word ends with "s" does not mean that it's plural.

Another option is to have a full list of singular and plural nouns.

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