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 FavourNonMutablePropertyInitialization rule #683

Conversation

webwarrior-ws
Copy link
Contributor

@webwarrior-ws webwarrior-ws commented Jan 16, 2024

Add FavourNonMutablePropertyInitialization rule and tests for it.
Apply suggestions of this rule to FSharpLint code.

Supersedes #662

Fixes #535

@knocte
Copy link
Collaborator

knocte commented Jan 16, 2024

Please squash a36ff properly.

@webwarrior-ws webwarrior-ws force-pushed the favourNonMutablePropertyInitialization-rebased branch from a36ff3b to 4808332 Compare January 16, 2024 13:49
@webwarrior-ws
Copy link
Contributor Author

Please squash a36ff properly.

done

@knocte
Copy link
Collaborator

knocte commented Jan 18, 2024

Let's also squash d18acf7, otherwise all commits' CI status will be red except the last one.

janus and others added 11 commits January 18, 2024 10:17
Added failing test for FavourNonMutablePropertyInitialization
rule for case when property assignent is not the last
statement.
Fix FavourNonMutablePropertyInitialization rule for cases when
threre are statements after property assignment.
Added failing test for FavourNonMutablePropertyInitialization
rule for case when mutable variable is assigned (false
positive).
Use property initialization instead of property mutation as
suggested by FavourNonMutablePropertyInitialization rule.
Added failing test for FavourNonMutablePropertyInitialization
rule for case when several properties are assigned.
Fix in FavourNonMutablePropertyInitialization rule for case
when several properties are assigned.
Added failing tests for FavourNonMutablePropertyInitialization
rule for different constructs that may contain instance
creation with subsequent property initialization.
Rewrite FavourNonMutablePropertyInitialization rule code so
that more cases are covered and not only code in modules and
functions.
Use property initialization instead of property mutation as
suggested by FavourNonMutablePropertyInitialization rule.
@webwarrior-ws webwarrior-ws force-pushed the favourNonMutablePropertyInitialization-rebased branch from d18acf7 to 3de1d16 Compare January 18, 2024 09:32
@webwarrior-ws
Copy link
Contributor Author

Let's also squash d18acf7, otherwise all commits' CI status will be red except the last one.

Done

@knocte knocte merged commit 0ae7c7b into fsprojects:master Jan 18, 2024
5 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.

[Feature] New rule to prefer non-mutable property initialization
3 participants