Skip to content

feat: Add support for variables in checkstyle config file #699

@SaptarshiSarkar12

Description

@SaptarshiSarkar12

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 strimzi/strimzi-kafka-operator#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 👇

<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.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions