-
Notifications
You must be signed in to change notification settings - Fork 88
feat: Add support for Checkstyle Configuration file properties #700
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
base: main
Are you sure you want to change the base?
feat: Add support for Checkstyle Configuration file properties #700
Conversation
|
@timtebeek I have created a blank test class. Can you please tell how I should test for the working of the checkstyle config file variables? |
|
Hi @SaptarshiSarkar12 ! You'll want to create matching files in https://github.com/openrewrite/rewrite-maven-plugin/tree/main/src/test/resources-its/org/openrewrite/maven as you can see there for other unit tests too. All those tests use https://khmarbaise.github.io/maven-it-extension/itf-documentation/usersguide/usersguide.html, which might help to read up on as well. Thanks for helping out here! |
|
Hi @timtebeek 👋! |
|
@timtebeek As a side question, is there a general rule of this project to assign the PRs to the contributors? I have seen projects assign the issues to the contributors. If this is a silly question, please do not mind 🙃. I asked this out of curiosity 😄. |
We typically assign the issue or pull request to whoever is working on it, also if they are community contributors. That way it's easy to see at a glance who (if anyone) is working on something from our project board. Sometimes when folks then later indicate they do not have the time or expertise to finish something, we can unassign them to indicate someone else needs to step up. Not a silly question at all; hope my answer helps you understand! |
|
Yeah, I understood. Thank you for the explanation @timtebeek 😁! |
|
@timtebeek Which recipe should I use in the plugin configuration for tests - the custom configuration that I made in strimzi/strimzi-kafka-operator#9422 or the one described in the docs of open-rewrite? |
|
|
Yeah, it should 😄. |
|
@timtebeek I have added a small test project in the resource-its folder as well as I have added a method in the test directory. Can you please check if those changes are right? Can you please tell me what are the next steps to do? |
@timtebeek Have you checked? |
|
@timtebeek Please tell me what changes are required. |
src/test/java/org/openrewrite/maven/CheckstylePropertiesTest.java
Outdated
Show resolved
Hide resolved
|
Hi @SaptarshiSarkar12 ; Appreciate your enthusiasm to get this going! I've not had time yet to dive into what would be needed next; I did push two small changes to hopefully get the test going, after seeing the tests previously failed with Sadly now there's a different puzzling error. |
|
Now finally we fail with Time to work in this earlier suggestion #699 (comment) ; Would you want to try your hand at that @SaptarshiSarkar12 ? |
@timtebeek Thank you for spending your valuable time! Sorry, I was very busy the last three days. So, I couldn't reply. |
|
@timtebeek I wanted to know how I can print the content of the checkstyle config that I modified in this code block. I tried this one, but it didn't work. Also, the output of // Print out each line of the resulting string
getLog().info("Checkstyle config file contents:\n" + checkstyleConfig); |
|
Hi @SaptarshiSarkar12 I suppose you want to print as a form of debugging? Might be better to attach an actual debugger if at all possible. We don't use logging much, but you can assert a particular message was logged with the pattern seen here. rewrite-maven-plugin/src/test/java/org/openrewrite/maven/BasicIT.java Lines 43 to 47 in e8b5855
|
Yeah, I wanted to test if the checkstyle config string is modified or not.
@timtebeek But I wanted to see what the content of the checkstyle config string is. How do I do that? |
You can either create an assertion that fails (does the |
There's no method named @timtebeek I tried to see if I can get anything I logged previously in the I tried setting breakpoints but they didn't get triggered during the execution of the test via IntelliJ. No notification for ignoring a breakpoint (the usual behaviour of IntelliJ) was observed. |
|
@timtebeek Please reply 😄. |
|
Hi @SaptarshiSarkar12 ! Apologies; it's hard to get to everything. As far as I can tell breakpoints indeed do not work with the tst framework we use for the plugin, so that will complicate the work that you're doing. You can see how assertions on the logged output are handled in this recent example. rewrite-maven-plugin/src/test/java/org/openrewrite/maven/RewriteRunIT.java Lines 48 to 57 in d86d22c
A similar approach could help you in working through your plugin changes there. |
|
Hi Tim 👋! |
|
This PR is stale because it has been open for 90 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
Hi 👋! |
…hiSarkar12/rewrite-maven-plugin into 699-add-checkstyle-props-support
Signed-off-by: Saptarshi Sarkar <saptarshi.programmer@gmail.com>
|
@timtebeek I tried to go through the codebase and figured out the following findings. Please tell me if my approach requires any change.
|
|
It looks like your earlier change in d25aed2 cleared out any changes you had proposed adding; would it make sense to try to restore those on your end? |
Hi @timtebeek 👋! |
|
Welcome to force push your new approach here! |
|
This PR is stale because it has been open for 90 days with no activity. Remove |
…to 699-add-checkstyle-props-support
Signed-off-by: Saptarshi Sarkar <saptarshi.programmer@gmail.com>
|
@timtebeek I made some changes in |
src/main/java/org/openrewrite/maven/ConfigurableRewriteMojo.java
Outdated
Show resolved
Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
Thanks @SaptarshiSarkar12 ! Yes it would be great to have a unit test for your case, just to ensure we don't unintentionally break things in the future. You can look at the existing tests we have as a combination of I've myself seen some challenges running those tests from IntelliJ unless you correctly set your PATH variable; might help to test using |





What's changed?
Anyone you would like to review specifically?
@timtebeek
Checklist