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

Rule that suggest using auto-property #625

Merged
merged 13 commits into from
Dec 16, 2023

Conversation

webwarrior-ws
Copy link
Contributor

@webwarrior-ws webwarrior-ws commented Dec 6, 2023

Add rule that suggests usage of auto-property (member val Foo) when member self.Foo is unnecessary.

Fixes #596.

@knocte
Copy link
Collaborator

knocte commented Dec 7, 2023

@webwarrior-ws can you rebase this please?

@knocte
Copy link
Collaborator

knocte commented Dec 7, 2023

@webwarrior-ws also update the Introduced in... text.

@webwarrior-ws
Copy link
Contributor Author

@knocte rebased


let rule =
{ Name = "SuggestUseAutoProperty"
Identifier = Identifiers.FavourConsistentThis
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@webwarrior-ws this is a typo here, please fix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

webwarrior-ws and others added 13 commits December 15, 2023 10:35
Add a rule that suggest usage of auto-property for property
with getter that only returns some (immutable) value. Add
tests for it.

Co-authored-by: Mehrshad <code.rezaei@gmail.com>
Implement rule introduced in previous commit and make it pass
the tests.

Co-authored-by: Mehrshad <code.rezaei@gmail.com>
Added 2 more tests: for porperty returning literal value and
for property returing mutable variable.
Check if returned value is a mutable variable, and only return
warning if it's not. Makes test added in previous commit green.
Update configuration and docs to include SuggestUseAutoProperty
rule.
Added tests for cases when property returns array or list of
immutable values.
Make rule pass tests introduced in previous commit by checking
if poperty returns list or array of immutable values.
Added test that checks that rule is not applied to static properties.
Make rule pass test introduced in previous commit by checking
if poperty is static or instance property.
Added a test for suggested fix.
Implement quick fix suggestion for the rule.
Added unit tests where `__` and `this` is used (instead of self).
@knocte knocte merged commit 1722d12 into fsprojects:master Dec 16, 2023
4 checks passed
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

Successfully merging this pull request may close these issues.

Suggest usage of member val Foo when member self.Foo is unnecessary
2 participants