-
Notifications
You must be signed in to change notification settings - Fork 3
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
Enforce default formatter, imports and license headers on OpenRewrite contributions #45
Comments
Now documented in https://github.com/openrewrite/.github/blob/main/CONTRIBUTING.md and the pull request template from the same repository. Still even better to enforce this through integrating with GitHub Actions, so renaming the issue for that use case. |
@timtebeek Should this perhaps be in the rewrite repository instead? If this is a GitHub action to enforce formatting for rewrite - I'm not sure what the docs would have to do with that but maybe I'm missing something. |
Yes thanks! I've moved it to |
We can likely combine some of the existing Rewrite best practices together into a declarative recipe such as type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.recipes.RewriteBestPractices
displayName: OpenRewrite best practices
description: |
A collection of recipes that are generally considered to be best practices for Rewite modules.
recipeList:
- org.openrewrite.java.upgrade.MigrateToRewrite8
- org.openrewrite.java.recipes.ExecutionContextParameterName
- org.openrewrite.java.recipes.SelectRecipeExamples
- org.openrewrite.java.recipes.SourceSpecTextBlockIndentation
# TODO Move to rewrite-all or something, such that we can also add recipes like UseTextblocks of test sources
# Further ideas
# - Flag any use of System.err/out
# - Flag any use of throwing Exceptions
# - Flag asserting latest version of dependency
# - Apply testing best practices
# - Apply formatter
# -
# - |
Another good option here is to nudge folks to provide example values on options; as identified on the OSS Slack by @koppor :
|
As came up in Slack: openrewrite/gh-automation#45 (comment)
* Find `@Option` annotations without `example` values As came up in Slack: openrewrite/gh-automation#45 (comment) * Skip boolean fields
We now run a first set of recipes on every pull request, to produce code suggestions such as these openrewrite/rewrite-testing-frameworks#343 (review) . That concludes the first iteration of this feature; we will expand and refine still but can already close this issue. |
Right now https://github.com/openrewrite/rewrite/blob/main/CONTRIBUTING.md does not mention the formatter or import order; I believe we assume IntelliJ defaults. Might be good to make that explicit, so contributors are made aware and reviewers are less likely to have to point it out. Even better if we enforce adherence (lightly) through an automated check that signals or even fixes violations. We should have all the necessary components to do that already.
The text was updated successfully, but these errors were encountered: