简体   繁体   English

使用Checkstyle格式化代码

[英]Using checkstyle to format code

I have just installed checkstyle in eclipse. 我刚刚在Eclipse中安装了checkstyle。 It works by bringing up the appropriate errors in the part of the screen where you place break points. 它通过在您放置断点的屏幕部分显示适当的错误来起作用。 However, I was just wondering whether it actually will format the code for you and indeed add the empty comments etc for you to fill in? 但是,我只是想知道它是否真的会为您格式化代码并确实添加空注释等供您填写?

If it does, how do you get it to do it. 如果是这样,您将如何做。 Thanks 谢谢

No, checkstyle doesn't format code, it only identifies violations of different types. 否,checkstyle不会格式化代码,它只能识别不同类型的违例。 You can configure Jalopy to format as per your checkstyle configuration. 您可以将Jalopy配置为按照您的checkstyle配置进行格式化。

Checkstyle is a static code analysis tool. Checkstyle是静态代码分析工具。 It doesn't do formating. 它不进行格式化。

However Eclipse has a preinstalled Java Code Formatter. 但是,Eclipse已预装了Java代码格式化程序。 Have a look here for details: http://www.ralfebert.de/blog/eclipseide/source_formatting/ 在这里查看详细信息: http : //www.ralfebert.de/blog/eclipseide/source_formatting/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM