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

chained references for linq expression #23

Open
sbradl opened this issue May 20, 2020 · 3 comments
Open

chained references for linq expression #23

sbradl opened this issue May 20, 2020 · 3 comments

Comments

@sbradl
Copy link

sbradl commented May 20, 2020

Probably this is tricky to implement in a general way but I would think of Linq as a fluent API and so it should not count into chained references. At the moment lots of warnings occur in my code because of Linq statements.

@MO2k4
Copy link
Owner

MO2k4 commented May 27, 2020

That is a good question - should it be only considered for linq expression or also for a fluent api?

There are also open discussions on the original code, regarding this issue:

hhariri#15
hhariri#20

The easiest way for you, would be to increase the setting for "MaximumChainedReferences" to a higher value.

@hoolie
Copy link

hoolie commented Aug 13, 2024

Linq statements are marked with the PureAttribute.

IMHO a method that is marked as Pure should not be counted as a viaolation of the Law of Demeter and thus be excluded.

The Law of Demeter (LoD) primarily aims to reduce coupling by ensuring that objects only interact with their immediate dependencies. However, LINQ queries, which are fluent in nature and often used to perform complex data transformations in a readable and declarative manner, do not contribute to this kind of tight coupling. Since LINQ operations and other pure functions typically don't violate the encapsulation or modularity that LoD seeks to preserve, they arguably should not be considered violations of LoD.

@MO2k4 What are your thoughts on this? Would this be a good distinction, and do you think it would be feasible to implement?

@MO2k4
Copy link
Owner

MO2k4 commented Aug 14, 2024

Hey there

Thanks for your input, but I am not sure if this can be implemented because I think the "pure"ness of a method is just a comment and no attribute to check on

Nevertheless I am very open for pull requests

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

3 participants