Recipe to check that Kotlin test methods return Unit#871
Recipe to check that Kotlin test methods return Unit#871timtebeek merged 14 commits intoopenrewrite:mainfrom
Conversation
src/main/java/org/openrewrite/java/testing/cleanup/KotlinTestMethodsShouldBeUnit.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/testing/cleanup/KotlinTestMethodsShouldBeUnit.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/testing/cleanup/KotlinTestMethodsShouldBeUnit.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/testing/cleanup/KotlinTestMethodsShouldReturnUnitTest.java
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/testing/cleanup/KotlinTestMethodsShouldBeUnitTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/testing/cleanup/KotlinTestMethodsShouldReturnUnitTest.java
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/testing/cleanup/KotlinTestMethodsShouldBeUnit.java
Outdated
Show resolved
Hide resolved
src/test/java/org/openrewrite/java/testing/cleanup/KotlinTestMethodsShouldReturnUnitTest.java
Show resolved
Hide resolved
timtebeek
left a comment
There was a problem hiding this comment.
Thanks a lot for the initiative and help here @greg-dennis ! Nice to have this addition as I imagine it's a subtle and quiet bug that nevertheless can have negative consequences.
After the merge you can already use our snapshot versions; we'll release probably next Tuesday.
|
Thanks for your help getting this done! So the type validation of |
Yep; we have that as an additional check there as it might affect how recipes can be chained together. In this case I think it's fine to have that be imperfect, as we can still achieve the change you're after and likely won't see overlapping changes be affected. Hope you're ok with me closing your other PRs that merely aimed to demonstrate the issue, or provide a workaround not using |
Yup, feel free to close those PRs |
|
Reported #874 which might be related to this PR. |
…rom 3.23.0 to 3.24.0 [skip ci] Bumps [org.openrewrite.recipe:rewrite-testing-frameworks](https://github.com/openrewrite/rewrite-testing-frameworks) from 3.23.0 to 3.24.0. Release notes *Sourced from [org.openrewrite.recipe:rewrite-testing-frameworks's releases](https://github.com/openrewrite/rewrite-testing-frameworks/releases).* > 3.24.0 > ------ > > What's Changed > -------------- > > * Recipe to check that Kotlin test methods return Unit by [`@greg-dennis`](https://github.com/greg-dennis) in [openrewrite/rewrite-testing-frameworks#871](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/871) > * Reorder `maybeRemoveImport` before `maybeAddImport` by [`@timtebeek`](https://github.com/timtebeek) in [openrewrite/rewrite-testing-frameworks#873](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/873) > * Add test for Kotlin by [`@Laurens-W`](https://github.com/Laurens-W) in [openrewrite/rewrite-testing-frameworks#876](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/876) > > New Contributors > ---------------- > > * [`@greg-dennis`](https://github.com/greg-dennis) made their first contribution in [openrewrite/rewrite-testing-frameworks#871](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/pull/871) > > **Full Changelog**: <openrewrite/rewrite-testing-frameworks@v3.23.0...v3.24.0> Commits * [`5459e88`](openrewrite/rewrite-testing-frameworks@5459e88) Add test for Kotlin ([#876](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/issues/876)) * [`20cca13`](openrewrite/rewrite-testing-frameworks@20cca13) Only match methods with test annotations * [`9803871`](openrewrite/rewrite-testing-frameworks@9803871) Reorder `maybeRemoveImport` before `maybeAddImport` ([#873](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/issues/873)) * [`42c22af`](openrewrite/rewrite-testing-frameworks@42c22af) Add documentation example for `KotlinTestMethodsShouldReturnUnit` * [`f378cb5`](openrewrite/rewrite-testing-frameworks@f378cb5) Recipe to check that Kotlin test methods return Unit ([#871](https://redirect.github.com/openrewrite/rewrite-testing-frameworks/issues/871)) * [`69f23b7`](openrewrite/rewrite-testing-frameworks@69f23b7) OpenRewrite recipe best practices * [`76041b7`](openrewrite/rewrite-testing-frameworks@76041b7) Remove unused local variable * [`edf6bcd`](openrewrite/rewrite-testing-frameworks@edf6bcd) Add test for Kotlin * See full diff in [compare view](openrewrite/rewrite-testing-frameworks@v3.23.0...v3.24.0) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
What's changed?
Recipe to check that Kotlin test methods return Unit.
What's your motivation?
To catch and rewrite Kotlin test methods that do not return Unit and so would be skipped by the JUnit test runner.
Anything in particular you'd like reviewers to focus on?
Stylistic consistency.
Anyone you would like to review specifically?
@timtebeek
Have you considered any alternatives or workarounds?
No
Any additional context
Checklist