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 RefasterMethodParameterOrder check #775

Merged
merged 8 commits into from
Jan 13, 2024

Conversation

Stephan202
Copy link
Member

@Stephan202 Stephan202 commented Sep 2, 2023

❗ This PR is on top of #962

Another step towards canonical Refaster rule definitions.

Suggested commit message:

Introduce `RefasterMethodParameterOrder` check (#775)

While there, simplify some `EqualityRules` Refaster rules, as a suggested
parameter order change highlighted that they could be collapsed.

@Stephan202 Stephan202 added this to the 0.14.0 milestone Sep 2, 2023
@Stephan202 Stephan202 requested a review from rickie September 2, 2023 16:00
@github-actions
Copy link

github-actions bot commented Sep 2, 2023

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 22
class surviving killed
🧟tech.picnic.errorprone.bugpatterns.RefasterParameterOrder 1 20
🧟tech.picnic.errorprone.bugpatterns.RefasterParameterOrder$1 1 2

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 Sep 2, 2023

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 22
class surviving killed
🧟tech.picnic.errorprone.bugpatterns.RefasterParameterOrder 1 20
🧟tech.picnic.errorprone.bugpatterns.RefasterParameterOrder$1 1 2

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

@Stephan202 Stephan202 force-pushed the sschroevers/introduce-RefasterParameterOrder-check branch from d3a7620 to fdd5e38 Compare September 2, 2023 16:49
@Stephan202 Stephan202 changed the title Introduce RefasterParameterOrder check Introduce RefasterMethodParameterOrder check Sep 2, 2023
@github-actions
Copy link

github-actions bot commented Sep 2, 2023

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 22
class surviving killed
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder 1 20
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder$1 1 2

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 Sep 2, 2023

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 22
class surviving killed
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder 1 20
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder$1 1 2

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

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 2, 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 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@rickie rickie modified the milestones: 0.14.0, 0.15.0 Oct 4, 2023
@Stephan202 Stephan202 force-pushed the sschroevers/introduce-RefasterParameterOrder-check branch from fdd5e38 to ce4405d Compare October 8, 2023 13:23
@Stephan202
Copy link
Member Author

Rebased and added a commit to resolve a new violation.

@github-actions
Copy link

github-actions bot commented Oct 8, 2023

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 22
class surviving killed
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder 1 20
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder$1 1 2

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

@Stephan202 Stephan202 force-pushed the sschroevers/introduce-RefasterParameterOrder-check branch from ce4405d to 2d7224b Compare October 23, 2023 15:51
@Stephan202
Copy link
Member Author

Rebased and resolved conflict.

@github-actions
Copy link

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 22
class surviving killed
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder 1 20
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder$1 1 2

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

@sonarqubecloud
Copy link

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 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@mohamedsamehsalah mohamedsamehsalah left a comment

Choose a reason for hiding this comment

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

Clean 🧹

@rickie rickie force-pushed the sschroevers/introduce-RefasterParameterOrder-check branch from 2d7224b to eb51b24 Compare December 18, 2023 14:22
Copy link

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 22
class surviving killed
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder 1 20
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder$1 1 2

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.

Took some time to wrap my head around the algorithm, but it looks really nice 🚀 !

One question 👀.

" }",
" }",
"}")
.doTest();
Copy link
Member

Choose a reason for hiding this comment

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

It feels a bit odd to have an identification test with only things that should not be matched. I get that the replacement check is way more interesting here but I'd suggest we still add at least one 🤔?

Copy link
Member

Choose a reason for hiding this comment

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

Part of the reason that I put this comment here is that we could also choose to use expectNoDiagnostics here instead (?) of doTest to make the intention of the test clearer.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair point. We should add a positive case, as that verifies on which tree node the violation is reported.

@rickie rickie force-pushed the sschroevers/introduce-RefasterParameterOrder-check branch from eb51b24 to ea6cc7e Compare January 9, 2024 08:14
@rickie
Copy link
Member

rickie commented Jan 9, 2024

Hmm, interesting (currently in a different issue):

Error:  Failures: 
Error:    RefasterMethodParameterOrderTest.replacement:119 compilation failed unexpectedly: [/17892554101468984197/ARecipes.java:1: error: ';' expected
package unnamed package;
               ^]

@Stephan202
Copy link
Member Author

I can reproduce that locally, also when upgrading to the currently-latest template-writing (version 1.4.1).

Also, when I run the tests in IDEA (in an attempt to debug the problem 🙃), I get the same issue as mentioned in #925 (comment); it seems that issue breaks ~all tests in IDEA, not just StringRulesRecipesTest 😬.

This'll require a closer look (can't promise when; busy agenda). CC @timtebeek as an FYI.

@Stephan202
Copy link
Member Author

I traced the IDEA issue to IDEA-342187, for which I filed #958. This should unblock debugging the other issue.

@Stephan202 Stephan202 force-pushed the sschroevers/introduce-RefasterParameterOrder-check branch from ea6cc7e to 64148fe Compare January 10, 2024 19:05
@Stephan202
Copy link
Member Author

W.r.t. the other issue: I suspect it's due to this code, which doesn't properly handle the unnamed package.

I rebased and pushed a commit to fix the build, but would like to reference an issue or PR before merging. I may have time for a PR later today/this week; need to leave the train first ;)

Copy link

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 22
class surviving killed
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder 1 20
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder$1 1 2

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

@Stephan202
Copy link
Member Author

Stephan202 commented Jan 10, 2024

Alright, I filed openrewrite/rewrite-templating#64 and referenced it in the code.

Copy link

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 22
class surviving killed
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder 1 20
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder$1 1 2

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.

Added one more commit.

" }",
" }",
"}")
.doTest();
Copy link
Member Author

Choose a reason for hiding this comment

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

Fair point. We should add a positive case, as that verifies on which tree node the violation is reported.

Copy link

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 22
class surviving killed
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder 1 20
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder$1 1 2

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

@Stephan202 Stephan202 force-pushed the sschroevers/introduce-RefasterParameterOrder-check branch from d3f896b to 515a502 Compare January 11, 2024 06:36
@Stephan202
Copy link
Member Author

I rebased the PR on top of #962 and reverted the package workaround. (So we should merge the upgrade PR first.)

@Stephan202 Stephan202 changed the base branch from master to renovate/org.openrewrite-rewrite-templating-1.x January 11, 2024 06:37
Copy link

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 22
class surviving killed
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder 1 20
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder$1 1 2

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

@Picnic-Bot Picnic-Bot force-pushed the renovate/org.openrewrite-rewrite-templating-1.x branch from 8502934 to 8140f66 Compare January 13, 2024 02:01
@Stephan202 Stephan202 force-pushed the renovate/org.openrewrite-rewrite-templating-1.x branch from 8140f66 to 1096749 Compare January 13, 2024 14:32
Base automatically changed from renovate/org.openrewrite-rewrite-templating-1.x to master January 13, 2024 14:53
@Stephan202 Stephan202 force-pushed the sschroevers/introduce-RefasterParameterOrder-check branch from 515a502 to 4984efa Compare January 13, 2024 15:05
@Stephan202
Copy link
Member Author

Rebased; the PR now targets master. Can be merged once built.

Copy link

Copy link

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 22
class surviving killed
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder 1 20
🧟tech.picnic.errorprone.bugpatterns.RefasterMethodParameterOrder$1 1 2

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

@Stephan202 Stephan202 merged commit 14506ed into master Jan 13, 2024
16 checks passed
@Stephan202 Stephan202 deleted the sschroevers/introduce-RefasterParameterOrder-check branch January 13, 2024 15:13
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