Are there any tools out there to refactor the coding-style of a java code base?

前端 未结 6 1242
时光说笑
时光说笑 2021-02-06 06:57

Normally, when doing some work on an existing project, I would just go with whatever style is already established in the code base. But our team has to maintain multiple small t

6条回答
  •  时光说笑
    2021-02-06 07:56

    Sounds like something like Jalopy might help.

    Jalopy allows you to define a code format style, and then it can read a file, package, or entire project and reformat it. I don't recall if it can do more sophisticated refactoring like changing the style of a local variable to not use Hungarian notation (the mVar crap), but it can change between whatever spacing, bracketing, ordering, and so on formatting you want.

    I've used Jalopy in the past and it worked well. I have even used it on teams where people had different personal coding styles and then at commit we all agreed on a certain format that was automatically handled by Jalopy. (When you check it out you format it your way, when it gets checked back in it gets formatted the team agreed upon way, etc.)

    One problem though, it looks like it hasn't been maintained for a year or so. But, there is a commercial version too that is much more recent -- seems the efforts went that direction. Still the older release might be fine.

    And there are other similar commercial offerings like Jindent.

提交回复
热议问题