-
Notifications
You must be signed in to change notification settings - Fork 731
Refactor StringValidator to avoid inheritance
#2296
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
Refactor StringValidator to avoid inheritance
#2296
Conversation
Qodana for .NETIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at qodana-support@jetbrains.com
|
StringValidatorStringValidator to avoid inheritance
|
Something to rethink either: I think it is odd to have a What about aligning them either use into If we agree to the latter: Should then |
The |
|
I believe that enough work is done and there's no need to increase the scope. Moreover, the involved classes are all |
jnyrup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's some nice untangling of this unnecessary class hierarchy 🧹
Src/FluentAssertions/Primitives/StringWildcardMatchingStrategy.cs
Outdated
Show resolved
Hide resolved
(cherry picked from commit bb50da5)
… for equality" (#2972) * Refactor `StringValidator` to avoid inheritance (#2296) (cherry picked from commit bb50da5) * Improve failure message for string assertions when checking for equality (#2307) * Draft improved failure message when checking for equality. * Use line and column for multiline strings * Fix failing tests * Fix Qodana issues * Fix further failing tests * Also fix tests on MacOS (due to different newline) * Calculate expected index * Fix paranthesis * Move specific methods from common StringExtensions to the `StringEqualityStrategy` class * Fix review comments from @dennisdoomen and add tests for word boundary algorithm * Improve tests by using [raw string literals](https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/strings/#raw-string-literals) * Update releases.md * Implement review comments from @jnyrup * Adapt due to survived mutants * Adapt test names --------- Co-authored-by: Valentin Breuß <v.breuss@tig.at> (cherry picked from commit 6859575)
… for equality" (#2972) * Refactor `StringValidator` to avoid inheritance (#2296) (cherry picked from commit bb50da5) * Improve failure message for string assertions when checking for equality (#2307) * Draft improved failure message when checking for equality. * Use line and column for multiline strings * Fix failing tests * Fix Qodana issues * Fix further failing tests * Also fix tests on MacOS (due to different newline) * Calculate expected index * Fix paranthesis * Move specific methods from common StringExtensions to the `StringEqualityStrategy` class * Fix review comments from @dennisdoomen and add tests for word boundary algorithm * Improve tests by using [raw string literals](https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/strings/#raw-string-literals) * Update releases.md * Implement review comments from @jnyrup * Adapt due to survived mutants * Adapt test names --------- Co-authored-by: Valentin Breuß <v.breuss@tig.at> (cherry picked from commit 6859575)
Refactor the
StringValidatorto favor composition over inheritance (see this comment):Instead of subclassing the abstract
StringValidatorclass, this class now accepts an interfaceIStringMismatchValidatorwhich provides the necessary implementation details.If this PR is merged, it should simplify implementing #2050.
IMPORTANT
./build.sh --target spellcheckor.\build.ps1 --target spellcheckbefore pushing and check the good outcome