-
Notifications
You must be signed in to change notification settings - Fork 39
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
Inline most {BugCheckerRefactoring,Compilation}TestHelper
fields
#442
Inline most {BugCheckerRefactoring,Compilation}TestHelper
fields
#442
Conversation
Suggested commit message:
|
Looks good. No mutations were possible for these changes. |
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.
Ah, I think we had a misunderstanding. We can simply inline all helpers that are used in only a single test, right? (And perhaps even if they are reused?)
2e5527f
to
d4ce9e6
Compare
Looks good. No mutations were possible for these changes. |
1 similar comment
Looks good. No mutations were possible for these changes. |
The only one where it would make the test clearer is the |
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.
Quick Github UI-based review :)
private final CompilationTestHelper compilationHelper = | ||
CompilationTestHelper.newInstance(Refaster.class, getClass()) | ||
.matchAllDiagnostics() | ||
.expectErrorMessage( | ||
"StringOfSizeZeroRule", | ||
containsPattern( | ||
"\\[Refaster Rule\\] FooRules\\.StringOfSizeZeroRule: Refactoring opportunity\\s+.+\\s+")) | ||
.expectErrorMessage( | ||
"StringOfSizeOneRule", | ||
containsPattern( | ||
"\\[Refaster Rule\\] FooRules\\.StringOfSizeOneRule: " | ||
+ "A custom description about matching single-char strings\\s+.+\\s+" | ||
+ "\\(see https://error-prone.picnic.tech/refasterrules/FooRules#StringOfSizeOneRule\\)")) | ||
.expectErrorMessage( | ||
"StringOfSizeTwoRule", | ||
containsPattern( | ||
"\\[Refaster Rule\\] FooRules\\.ExtraGrouping\\.StringOfSizeTwoRule: " | ||
+ "A custom subgroup description\\s+.+\\s+" | ||
+ "\\(see https://example.com/rule/FooRules#ExtraGrouping.StringOfSizeTwoRule\\)")) | ||
.expectErrorMessage( | ||
"StringOfSizeThreeRule", | ||
containsPattern( | ||
"\\[Refaster Rule\\] FooRules\\.ExtraGrouping\\.StringOfSizeThreeRule: " | ||
+ "A custom description about matching three-char strings\\s+.+\\s+" | ||
+ "\\(see https://example.com/custom\\)")); |
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.
This one is now duplicated 😬
private final CompilationTestHelper compilationTestHelper = | ||
CompilationTestHelper.newInstance(TestChecker.class, getClass()); |
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.
Here 100% of tests use this field; I'd keep this one as-is.
@@ -54,7 +48,7 @@ void identification() { | |||
|
|||
@Test | |||
void replacementFirstSuggestedFix() { | |||
refactoringTestHelper | |||
newInstance(StringCaseLocaleUsage.class, getClass()) |
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.
newInstance(StringCaseLocaleUsage.class, getClass()) | |
BugCheckerRefactoringTestHelper.newInstance(StringCaseLocaleUsage.class, getClass()) |
Likewise below.
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.
Started working on that upstream fix. Will do that after applying this feedback.
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.
Opened: PicnicSupermarket/error-prone#58.
// XXX: Can we perhaps work-around this by describing the fixes in reverse order? | ||
|
||
// The logic for `char` and `short` is exactly analogous to the `byte` case. | ||
/* The logic for `char` and `short` is exactly analogous to the `byte` case. */ |
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.
/* The logic for `char` and `short` is exactly analogous to the `byte` case. */ | |
/** @implNote The logic for `char` and `short` is exactly analogous to the `byte` case. */ |
Perhaps.
@@ -10,19 +10,9 @@ | |||
// `String.valueOf(null)` may not. That is because the latter matches `String#valueOf(char[])`. We | |||
// could special-case `null` arguments, but that doesn't seem worth the trouble. | |||
final class RedundantStringConversionTest { |
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.
This one is an edge case, w.r.t. field reuse 🤔
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.
Added a commit with all feedback fixed.
Looks good. No mutations were possible for these changes. |
@@ -73,7 +67,7 @@ void identification() { | |||
|
|||
@Test | |||
void replacementFirstSuggestedFix() { | |||
refactoringTestHelper | |||
newInstance(FluxFlatMapUsage.class, getClass()) |
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.
We can apply the same for the method below as well.
newInstance(FluxFlatMapUsage.class, getClass()) | |
BugCheckerRefactoringTestHelper.newInstance(FluxFlatMapUsage.class, getClass()) |
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.
Added one more commit. Nice!
Suggested commit message:
Inline most `{BugCheckerRefactoring,Compilation}TestHelper` fields (#442)
Looks good. No mutations were possible for these changes. |
d64afa2
to
5077920
Compare
Looks good. No mutations were possible for these changes. |
Made a tweak to the suggested commit message and sorted the two entries. This fits the number of characters, WDYT? |
Works for me 👍 |
CompilationTestHelper
s that specify command-line arguments{BugCheckerRefactoring,Compilation}TestHelper
fields
As discussed in #426 (comment).