-
Notifications
You must be signed in to change notification settings - Fork 172
Integration & Testing of the Problems API #927
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?
Conversation
plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/reporter/ProblemsApiReporter.kt
Outdated
Show resolved
Hide resolved
Hi, could I get some eyes on this pr? Thanks in advance! @Tapchicoma @JLLeitschuh @wakingrufus |
Thanks for the PR! Please give us some time to look this over, as it is a fairly impactful change. I also would like to have some TestKit integration tests for this, and perhaps with those, we would not have a need for the current test that use mocks (depending on what we are able to assert in a TestKit test) |
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.
I'm finding myself confused, it's not clear to me how the ProblemsApiReporter
is actually used in the codebase in this PR. The ProblemsApiReporter
is never instantiated via dependency injection, and doesn't seem to be properly wired into Gradle's problems API in any meaningful way.
Am I missing something? I'm finding myself confused here.
plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/worker/ConsoleReportWorkAction.kt
Outdated
Show resolved
Hide resolved
plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/reporter/ProblemsApiReporter.kt
Outdated
Show resolved
Hide resolved
plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/reporter/ProblemsApiReporter.kt
Outdated
Show resolved
Hide resolved
Sorry about that! When I was creating the no op constructor it was supposed to be covering when the problems api couldn't be used because of the gradle version but I fixed your points and injected the problems and got rid of the constructors. |
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.
I agree with @wakingrufus, I'd like to see at least one integration test for this change before I'm willing to merge this.
The current test as they stand do not capture whether or not this logic functions correctly within the context of the use of the plugin. The current tests only capture whether or not the new ProblemsApiReporter
calls the correct Gradle APIs.
plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/reporter/ProblemsApiReporter.kt
Outdated
Show resolved
Hide resolved
plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/reporter/ProblemsApiReporter.kt
Outdated
Show resolved
Hide resolved
plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/reporter/ProblemsApiReporter.kt
Outdated
Show resolved
Hide resolved
plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/reporter/ProblemsApiReporter.kt
Outdated
Show resolved
Hide resolved
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.
- Please make sure to modify https://github.com/JLLeitschuh/ktlint-gradle/blob/main/CHANGELOG.md
- It would be also nice to have a documentation entry for Problems API integration. Maybe, the best location is after the https://github.com/JLLeitschuh/ktlint-gradle?tab=readme-ov-file#baseline-support section
Overall, I'm finding myself quite confused about these changes and the back-and-forth we had to engage with on this PR. The vibe I was getting for many of the changes made in this PR were that the code generated was coming from an AI. The original set of changes didn't seem to understand the nuance of what was actually being implemented, nor following the repositories norms around testing things. The Overall feedback: in the future, if using AI, please utilize critical thinking around the changes proposed to ensure that the changes are actually implementing the feature desired. |
The reason I used mockito is because that is the testing framework I usually used but I see I should have used the testing already done in this repo. I was implementing this in a different repo but is different here. Will fix the changelog and README. |
This PR has conflicts with |
@JLLeitschuh it was merged |
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.
One simple change requested. I'm also going to run the unit tests. Assuming the tests pass, and this change is made, I'm good to merge this.
plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/reporter/ProblemsApiReporter.kt
Show resolved
Hide resolved
Sorry about the delay! I was and am traveling for a conference. I'll look back into this in the next couple of days. |
No worries. Could you rebase when you get a moment? |
…sting file using mockito
…ction specified in comments
dd7873e
to
4c19380
Compare
I rebased and I was looking at back the integration tests and deleted the file since it doesn't directly test the integration of the problems api. Not sure if there is an easy way to test the integration. |
Per this conversation in the Gradle Community slack channel: https://gradle-community.slack.com/archives/CA745PZHN/p1758831121015639 Would you be willing to implement an integration test that verifies the output of the problems API ends up in the report file that is created when using this API? Related: |
Also, you can safely ignore the "Build and check / build (ubuntu-latest, 25)" and "Build and check / build (windows-latest, 25)" CI job failures. Those are known issues. See: #963 |
A new file was created to report ktlint issues to the problems API to act as another option of error reporting. A testing file was also added to test the functionality of the new integration using mockito.