-
Notifications
You must be signed in to change notification settings - Fork 5
Run OpenRewriteRecipeBestPractices on pull requests
#92
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
Conversation
|
The comment-pr workflow runs from the main branch; so this PR needs to be merged before seeing the full effect. |
646c56e to
00ff3ba
Compare
|
Is this a concern ? |
|
I think that might be the self-check that's configured on this project; how intentional were you in running those checks here too? checkstyle-openrewrite-recipes/pom.xml Lines 174 to 177 in 00ff3ba
Any preference between those options? |
It was intentional. We want to run all recipes we create against ourselves. I think we should go with option 1, run checkstyle before openrewrite, and run auto-fix and best practices recipes afterwards |
|
Ok I can't seem to get it to produce the report you're after locally; any help appreciated! |
Looks like we need to move <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven.checkstyle.plugin.version}</version>
<dependencies>
...
</dependencies>
<!-- This configuration block is currently under <execution> and needs to be moved to this level -->
<configuration>
...
</configuration>
<executions>
<execution>
<id>check</id>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>At the moment it is on the mvn checkstyle:checkstyle \
-Dcheckstyle.config.location=https://raw.githubusercontent.com/checkstyle/checkstyle/checkstyle-10.26.1/config/checkstyle-checks.xml \
-Dcheckstyle.output.file=target/checkstyle/checkstyle-report.xml \
-Dcheckstyle.output.format=xml \
-Dcheckstyle.properties.location=config/checkstyle.properties \
-Dcheckstyle.failOnViolation=falseBy making configuration global should allow to avoid setting those properties manually. |
rdiachenko
left a comment
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.
lgtm
@timtebeek could you squash all commits into one please and prefix it with PR number please?
26cffe0 to
29f7495
Compare
|
not sure if we need to change commit message in such updates, but done. @timtebeek , please finalize review |
romani
left a comment
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.
ok to merge and play with it.
| rm pr_number.txt | ||
|
|
||
| # Post suggestions as a comment on the PR | ||
| - uses: googleapis/code-suggester@v4 |
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.
@timtebeek , do you have visual examples in web on how this workflow works?
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.
Yes sure! The blog above links to this pull request that has a few of such resolved comments
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 approach if very noisy, we tried it with Sonar, long time ago, it produce too much comments, and PRs started to load slow and we need to close PR and open it again. When you have pre-junior contributors as majority in projects, this is not very good approach. Just failed CI and contributors open failed job to see suggestions is better.
in slow traffic project and experienced contributors it will work.
we can try it in this project and see how it will go.
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.
Yes I find it works best when the suggestions are immediately applied, but I do like how contextualized they are and that they don't break flow ideally: just press a button and move on. I hope that'll be your experience as well.
Thanks for squashing those commits! Looks good on my end. Out of curiosity: any reason you all aren't using the squash option in GitHub? |
in main repo, commits generate release notes, so it critical to follow format and some format. In this project, effect is not seen yet, but if you open main library project, you can trace all changes and all decisions and you can detangle even very nuanced issues: who , when, why. |

As discussed on
The goal here is to run recipes, report violations with a suggested code fix, and in that way keep new issues out, as documented: