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

Introduce IsIdentityOperation matcher for use by Refaster templates #749

Merged
merged 4 commits into from
Oct 23, 2023

Conversation

Stephan202
Copy link
Member

@Stephan202 Stephan202 commented Aug 12, 2023

Suggested commit message:

Introduce `IsIdentityOperation` matcher for use by Refaster templates (#749)

@Stephan202 Stephan202 added this to the 0.13.0 milestone Aug 12, 2023
@Stephan202 Stephan202 requested a review from rickie August 12, 2023 15:01
@github-actions
Copy link

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 8
class surviving killed
🧟tech.picnic.errorprone.refaster.matchers.IsIdentityOperation 2 8

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

Copy link
Member Author

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

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

Some context.

@@ -31,6 +31,7 @@ ImmutableSet<Comparator<String>> testNaturalOrder() {
String::compareTo,
Comparator.comparing(identity()),
Comparator.comparing(s -> s),
Comparator.comparing(s -> 0),
Copy link
Member Author

Choose a reason for hiding this comment

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

For each rule, added a non-identity transformation test case, to validate that the @Matcher annotation is present.

Comment on lines +28 to +55
" DoubleUnaryOperator positive1() {",
" // BUG: Diagnostic contains:",
" return DoubleUnaryOperator.identity();",
" }",
"",
" Function<Integer, Integer> positive2() {",
" // BUG: Diagnostic contains:",
" return Function.identity();",
" }",
"",
" UnaryOperator<String> positive3() {",
" // BUG: Diagnostic contains:",
" return UnaryOperator.identity();",
" }",
"",
" IntUnaryOperator positive4() {",
" // BUG: Diagnostic contains:",
" return IntUnaryOperator.identity();",
" }",
"",
" LongUnaryOperator positive5() {",
" // BUG: Diagnostic contains:",
" return LongUnaryOperator.identity();",
" }",
Copy link
Member Author

Choose a reason for hiding this comment

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

Previously we would only match Function.identity(). Our internal code base contains a number of UnaryOperator.identity() usages that were thus not matched by the Refaster rules.

@github-actions
Copy link

Looks good. All 8 mutations in this change were killed.

class surviving killed
🎉tech.picnic.errorprone.refaster.matchers.IsIdentityOperation 0 8

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@Stephan202 Stephan202 force-pushed the sschroevers/introduce-IsIdentityOperation branch from 7397826 to 4fb3656 Compare August 14, 2023 09:32
@Stephan202
Copy link
Member Author

Rebased and resolved conflicts.

@github-actions
Copy link

Looks good. All 8 mutations in this change were killed.

class surviving killed
🎉tech.picnic.errorprone.refaster.matchers.IsIdentityOperation 0 8

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@rickie rickie modified the milestones: 0.13.0, 0.14.0 Aug 25, 2023
@Stephan202 Stephan202 force-pushed the sschroevers/introduce-IsIdentityOperation branch from 4fb3656 to 3a3a6c5 Compare August 29, 2023 06:46
@sonarcloud
Copy link

sonarcloud bot commented Aug 29, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

95.7% 95.7% Coverage
0.0% 0.0% Duplication

@github-actions
Copy link

Looks good. All 8 mutations in this change were killed.

class surviving killed
🎉tech.picnic.errorprone.refaster.matchers.IsIdentityOperation 0 8

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@rickie rickie modified the milestones: 0.14.0, 0.15.0 Oct 4, 2023
@Stephan202 Stephan202 force-pushed the sschroevers/introduce-IsIdentityOperation branch from 3a3a6c5 to f65c02b Compare October 7, 2023 14:56
@Stephan202
Copy link
Member Author

Rebased and resolved conflicts.

@github-actions
Copy link

github-actions bot commented Oct 7, 2023

Looks good. All 8 mutations in this change were killed.

class surviving killed
🎉tech.picnic.errorprone.refaster.matchers.IsIdentityOperation 0 8

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@Stephan202
Copy link
Member Author

Generalized a few more Refaster rules this way.

@github-actions
Copy link

github-actions bot commented Oct 7, 2023

Looks good. All 8 mutations in this change were killed.

class surviving killed
🎉tech.picnic.errorprone.refaster.matchers.IsIdentityOperation 0 8

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

1 similar comment
@github-actions
Copy link

github-actions bot commented Oct 8, 2023

Looks good. All 8 mutations in this change were killed.

class surviving killed
🎉tech.picnic.errorprone.refaster.matchers.IsIdentityOperation 0 8

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

Copy link
Contributor

@Venorcis Venorcis left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@Stephan202 Stephan202 force-pushed the sschroevers/introduce-IsIdentityOperation branch from 92689b9 to 92e98fe Compare October 9, 2023 10:57
@Stephan202
Copy link
Member Author

Rebased and resolved conflicts.

@github-actions
Copy link

github-actions bot commented Oct 9, 2023

Looks good. All 8 mutations in this change were killed.

class surviving killed
🎉tech.picnic.errorprone.refaster.matchers.IsIdentityOperation 0 8

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

Copy link
Member

@rickie rickie left a comment

Choose a reason for hiding this comment

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

Nice one ✨ ! Love the improvements in the rule collections 😄 !

@rickie rickie force-pushed the sschroevers/introduce-IsIdentityOperation branch from 92e98fe to b682638 Compare October 22, 2023 19:42
@rickie
Copy link
Member

rickie commented Oct 22, 2023

Generalized a few more Refaster rules this way.

Want to add something to the commit message? Something like While there, generalized Refaster rules using this matcher.?

@github-actions
Copy link

Looks good. All 8 mutations in this change were killed.

class surviving killed
🎉tech.picnic.errorprone.refaster.matchers.IsIdentityOperation 0 8

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@Stephan202
Copy link
Member Author

Stephan202 commented Oct 23, 2023

Good point @rickie. How about (slightly tweaked):

Introduce `IsIdentityOperation` matcher for use by Refaster templates (#749)

While there, generalize a number of Refaster rules using this new matcher.

@Stephan202
Copy link
Member Author

I'll have a look at the conflict.

@Stephan202
Copy link
Member Author

Conflict was trivial. Rebased.

@Stephan202 Stephan202 force-pushed the sschroevers/introduce-IsIdentityOperation branch from b682638 to 209970e Compare October 23, 2023 07:12
@github-actions
Copy link

Looks good. All 8 mutations in this change were killed.

class surviving killed
🎉tech.picnic.errorprone.refaster.matchers.IsIdentityOperation 0 8

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@rickie rickie force-pushed the sschroevers/introduce-IsIdentityOperation branch from 209970e to 7880617 Compare October 23, 2023 11:54
@github-actions
Copy link

Looks good. All 8 mutations in this change were killed.

class surviving killed
🎉tech.picnic.errorprone.refaster.matchers.IsIdentityOperation 0 8

Mutation testing report by Pitest. Review any surviving mutants by inspecting the line comments under Files changed.

@sonarcloud
Copy link

sonarcloud bot commented Oct 23, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

95.7% 95.7% Coverage
0.0% 0.0% Duplication

@rickie rickie merged commit 8130ddf into master Oct 23, 2023
17 checks passed
@rickie rickie deleted the sschroevers/introduce-IsIdentityOperation branch October 23, 2023 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants