openrewrite / rewrite

Automated mass refactoring of source code.
https://docs.openrewrite.org
Apache License 2.0
1.97k stars 290 forks source link

add clang-format style #4251

Open samuelfac opened 2 weeks ago

samuelfac commented 2 weeks ago

What problem are you trying to solve?

Format the code with clang-format style

Describe the solution you'd like

create a new style that will use ".clang-format" file from source project to format the code.

timtebeek commented 2 weeks ago

Hi @samuelfac ; I'm not too familiar with clang-format; would you mind explaining in some more detail exactly what you're after? Perhaps with some examples of a configuration file to take in and apply to projects?

You might know we already support various named styles, and even allow you to customize styles to your needs. https://docs.openrewrite.org/concepts-explanations/styles Could this be used to achieve what you're after already?

I'm not sure how widely used clang-format is, but it's a high bar for us to add two ways to do one thing; in this case to define how you want to define your project style.

There's also other competing standards like checkstyle and .editorconfig that on the surface seem similar, as are tools like spotless and Google Java format that do not allow customization. I'd be hesitant to add support for each of these and have to support all going forward.

What's the context behind your specific request for clang support?