rewrite-maven-plugin icon indicating copy to clipboard operation
rewrite-maven-plugin copied to clipboard

feat: Add support for variables in checkstyle config file

Open SaptarshiSarkar12 opened this issue 8 months ago • 9 comments

What problem are you trying to solve?

Currently, there is no support for accepting values of the variables defined in the checkstyle configuration file. This causes a warning from OpenRewrite that it has failed to parse the checkstyle configuration file. This problem has been observed in https://github.com/strimzi/strimzi-kafka-operator/pull/9422 hence, this issue has been raised.

Describe the solution you'd like

The checkstyle variables can be input through maven/gradle plugin configurations like for maven :point_down:

<configuration>
    <checkstyleVariables>
        ........
        <checkstyleVariable>importControlFile=${pom.baseDir}/.checkstyle/import-control.xml<checkstyleVariable>
        ........
    </checkstyleVariables>
</configuration>

Similar case will be for gradle. We can then replace the variable defined in that file with the expected value (By using some Java methods and File Operations like creating a copy of the original file) and send the edited checkstyle config file to the next steps. It is not going to show any warning anymore and it will be able to parse the file.

Are you interested in contributing this feature to OpenRewrite?

Yes, I would love to work on this issue. I would require some help from the maintainers to let me know if any changes needs to be made in the solution I have thought.

SaptarshiSarkar12 avatar Dec 24 '23 18:12 SaptarshiSarkar12