IntelliJ IDEA code format from checkstyle configuration

前端 未结 3 2121
面向向阳花
面向向阳花 2020-11-28 08:22

I\'ve decided to contribute to android maven plugin.

They use quite specific code style format. It will take some time for me to modify IDEA code format rules to sa

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-28 08:59

    There is an ugly workaround that I have been able to live with:

    First import the Checkstyle format into Eclipse, as explained here: How to generate an Eclipse formatter configuration from a checkstyle configuration?

    Then export the format from Eclipse (via Windows --> Preferences --> Java --> Code Style --> Formatter -> Edit -> Export and import the resulting *.xml file into IntelliJ IDEA

    Of course this is kinda bonkers especially if you do not have someone around who has Eclipse running anyway, as you have to install it just to be able to "translate" the checkstyle format into something IntelliJ can read; but if it only has to be done once per project it might be somewhat better than manually adjust the format.

提交回复
热议问题