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

Cleaner implementation of the equivalency validator #1026

Merged

Conversation

dennisdoomen
Copy link
Member

While preparing a talk about maintainable code, I realized that the EquivalencyValidator was the perfect candidate for refactoring.

@dennisdoomen dennisdoomen changed the title Cleaner implementation of the equivalency validator [WIP] Cleaner implementation of the equivalency validator Apr 19, 2019
@dennisdoomen dennisdoomen changed the title [WIP] Cleaner implementation of the equivalency validator Cleaner implementation of the equivalency validator Apr 19, 2019
Copy link
Member

@jnyrup jnyrup left a comment

Choose a reason for hiding this comment

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

Is it correct that the only semantical change is deferred execution of AssertionScope.Current.AddNonReportable("cyclic_reference_detector", objectTracker)?

@dennisdoomen dennisdoomen force-pushed the CleanerEquivalencyValidator branch 2 times, most recently from 7bfeff8 to da42ecc Compare April 21, 2019 12:52
Copy link
Member

@jnyrup jnyrup left a comment

Choose a reason for hiding this comment

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

Really minor note: it was a bit difficult to read the diff on GH when methods was move around and refactored in the same commit.

{
Key = key;
Value = value;
this.reportability = reportability;
Reportable = reportable;
RequiresFormatting = requiresFormatting;
Copy link
Member

Choose a reason for hiding this comment

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

🙃 double whitespace


public bool Reportable => reportability == Reportability.Reportable;
public bool RequiresFormatting {get; }
Copy link
Member

Choose a reason for hiding this comment

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

🙃 missing whitespace {get

{
if (config.AllowInfiniteRecursion || !HasReachedMaximumRecursionDepth(memberAccessPath))
if (expectation == null)
Copy link
Member

Choose a reason for hiding this comment

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

🙃 is null

@@ -1,16 +1,17 @@
#region


Copy link
Member

Choose a reason for hiding this comment

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

🙃 empty line

@dennisdoomen dennisdoomen merged commit 2a97362 into fluentassertions:master Apr 22, 2019
@dennisdoomen dennisdoomen deleted the CleanerEquivalencyValidator branch April 22, 2019 19:05
@@ -2,6 +2,6 @@ namespace FluentAssertions.Equivalency
{
public interface IEquivalencyValidator
{
void AssertEqualityUsing(IEquivalencyValidationContext context);
void RecursivelyAssertEquality(IEquivalencyValidationContext context);
Copy link
Member

Choose a reason for hiding this comment

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

@dennisdoomen renaming this is a breaking change and should be reverted.

Copy link
Member Author

Choose a reason for hiding this comment

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

How so?

Copy link
Member

@jnyrup jnyrup May 3, 2019

Choose a reason for hiding this comment

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

From the CoreFX Breaking Change Rules

Removing or renaming a member, including a getter or setter from a property or enum members

Though I can't find any code on the internet that implements IEquivalencyValidator except EquivalencyValidator, Every change breaks someone's workflow and last time we thought it didn't matter, it turned out bad.
I think the benefit of renaming a public method versus the risk of introducing a breaking change, does not seem justified.

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.

None yet

2 participants