-
Notifications
You must be signed in to change notification settings - Fork 157
Configure the plugin based on the Maven plugin configuration #671
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
4d44a70 to
d048dd6
Compare
|
Ooo, interesting. There's definitely demand for this, and the implementation seems nice & contained. It's definitely something I'd be open to adding as long as it's covered by test cases. Thank you! |
afd2438 to
fe748c4
Compare
|
I think this is roughly feature complete, with the exception of it not having any tests. I wonder if this should wait until any Checkstyle version can be configured (ideally an outcome of #672). Otherwise, if the Maven project has a Checkstyle version specified that isn't supported then it will fallback to the IntelliJ plugin default. An alternative to this would be if the Maven project has 10.1.2 configured and the known compatible version is 10.4.5, then we could set the configuration to use 10.4.5 directly. Testing IntelliJ plugins is not something I've got much experience with, so it'll probably take a while for me to get suitable testing in place. |
|
Hopefully this goes without saying, but please let me know if there's any suggested changes that should be made. For example, I know using |
|
Thanks - preference is definitely for modern Java, as long as it's good for 17 (min IDEA version). Tests are a definite for inclusion, as I've spent 20 years regretting not writing this project with tests (not enough to retrospectively add them, mind). I'll try have a poke around later this week. |
fe748c4 to
9c35314
Compare
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.
Sorry, have been very AFK, but here's a first review. You've already marked most of the points of interest with TODOs in any case.
Big blocker to merging remains tests.
src/main/java/org/infernus/idea/checkstyle/maven/MavenCheckstyleConfigurator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/infernus/idea/checkstyle/maven/MavenCheckstyleConfigurator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/infernus/idea/checkstyle/maven/MavenCheckstyleConfigurator.java
Show resolved
Hide resolved
src/main/java/org/infernus/idea/checkstyle/maven/MavenCheckstyleConfigurator.java
Outdated
Show resolved
Hide resolved
src/main/java/org/infernus/idea/checkstyle/maven/MavenCheckstyleConfigurator.java
Outdated
Show resolved
Hide resolved
|
Not an issue about the speed that this or the other PR gets reviewed. I’ll change them from draft when I think I’m done with it, any review before then is mostly just to help save me from wasting time if you notice something you disagree with early on. I only get to work on this for a few hours a week at most anyways, so I’ll be just as slow on my side for making updates. |
c8d71dd to
7b93661
Compare
|
I need to add additional tests, but I think this should be getting close. |
10d18d6 to
592162c
Compare
|
This should be ready for review now. It's likely more tests could be added, but I think what is there covers most common scenarios at this point. Just FYI, I won't have much availability until the beginning of October so if you want to wait until then to merge this and release it so I'm around to support it if needed, then that's not an issue for me. |
|
Sorry about the failing build, I don’t actually recall if I ran the full build/test locally, or if I only ran tests against my changes. Feel free to fix it and push changes or wait for me to get back from vacation. |
|
No worries, go enjoy your holiday! 😄 |
592162c to
b3b4863
Compare
|
Updated the tests, |
e08a98a to
4a3d60c
Compare
|
Build still passes locally. I don't expect I changed anything that would fix CI though, so I'll have to look at that some more. |
|
I'm afraid it fails locally for me (Mac OS 26.0.1). It doesn't seem to be obviously OS-specific though - it's failing on being unable to find the Checkstyle dependency: final var checkstyleDependency = mavenDomProjectModel.getDependencies()
.getDependencies().stream().filter(
dependency -> CHECKSTYLE_MAVEN_ID.equals(dependency.getGroupId().getValue(),
dependency.getArtifactId().getValue())).findFirst().orElseThrow();blows up with e.g. for createProjectPom(PROJECT_INFO + """
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.6.0</version>
</plugin>
</plugins>
</build>
""".stripIndent());However, if you are explicit about the dependency then it passes: createProjectPom(PROJECT_INFO + """
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.6.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.26.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
""".stripIndent()); |
|
The code seems to rely on some files already being downloaded and cached into the local Maven repository. Mine are all there from my testing so it works for me. I'll get the code updated and add a test for that specific scenario. |
… settings When the Maven sync action is triggered within the IDE, the project settings will be synced. This currently requires users to opt-in with a Checkstyle IntelliJ plugin setting.
4a3d60c to
9790f59
Compare
|
Updated the code with the new logic to download the file if it isn't available. Most of that logic is in |
|
Apologies for the delay here - I'm in the middle of 3 weeks of work travel, so hoping to look at this once I'm back 🤞 |
|
No rush. It will be here whenever you get to it. Looks like the tests are still failing in CI anyways. |
Fixes #107.
The way this works is that when you click the Maven sync action within IntelliJ, the Maven plugin configuration is read and synced with the IntelliJ plugin configuration.
This hasn't been tested on Windows. I don't have a Windows device that I can easily test on until after a release is made.