简体   繁体   English

使用checkstyle而不是使用Eclipse内置代码格式化程序的优势?

[英]Advantage of using checkstyle rather than using Eclipse built in code formatter?

Is there any functional advantage of using checkstyle instead of Eclipse own code formatter? 使用checkstyle而不是Eclipse自己的代码格式化程序是否有任何功能优势? In either case, we would add some custom rules, but it would largely be based on Sun's java code convention. 在任何一种情况下,我们都会添加一些自定义规则,但它主要基于Sun的java代码约定。

Here are some advantages for using checkstyle : 以下是使用checkstyle的一些优点:

  • portable between IDEs. 在IDE之间移植。 If you decide to use IntelliJ later, or you have a team using a variety of IDEs, you still have a way to enforce consistency. 如果您决定稍后使用IntelliJ ,或者您的团队使用各种IDE,您仍然可以实施一致性。
  • better external tooling. 更好的外部工具。 It's much easier to integrate checkstyle with your external tools since it was really designed as a standalone framework. checkstyle与外部工具集成起来要容易得多,因为它实际上是作为独立框架设计的。 You can plug into your SCM as a pre-commit hook, or into your build tool, quite easily. 您可以非常轻松地将SCM作为预提交挂钩插入到您的构建工具中。 Using Eclipse style convention you would need to write or locate a plugin to do the same thing. 使用Eclipse样式约定,您需要编写或定位插件来执行相同的操作。
  • ability of creating your own rules. 创建自己的规则的能力。 Eclipse defines a large set of styles, but checkstyle has more, and you can add your own custom rules. Eclipse定义了大量样式,但checkstyle有更多样式,您可以添加自己的自定义规则。

The advantage of Eclipse formatter/styler, of course, is that it's already built into the IDE, so if your team is already standardized on Eclipse you can get everyone up and running very quickly. 当然, Eclipse formatter / styler的优势在于它已经内置在IDE中,因此如果您的团队已经在Eclipse上标准化,那么您可以非常快速地启动并运行所有人。 But using checkstyles gives you more options. 但使用checkstyles可以为您提供更多选择。

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

相关问题 Eclipse Checkstyle和格式化程序 - Eclipse checkstyle and formatter 使用自己程序中的Eclipse代码格式化程序 - Using the Eclipse code formatter from own program 使用Java Eclipse代码格式化程序对if()中的条件进行缩进 - Indentation of conditions in if() using Eclipse Code Formatter for Java 在带有GWT的Eclipse中使用Google代码格式化程序 - Using Google code formatter in Eclipse with GWT 使用Checkstyle格式化代码 - Using checkstyle to format code Eclipse格式化程序:大于符号而不是点符号 - Eclipse Formatter: Break at Greater-Than Sign Rather Than at Dot Eclipse Checkstyle与Formatter与Cleanup? - Eclipse Checkstyle vs Formatter vs Cleanup? 如果不是为了延迟初始化,那么使用方法而不是静态类成员来构建单例是否有任何优势? - If not for lazy initialisation, is there any advantage of building singleton using method rather than static class member? Java - 使用JBOSS / WildFly邮件服务而不是Apache Commons Email发送邮件有什么好处吗? - Java - is there any advantage sending mail using JBOSS/WildFly mail service rather than Apache Commons Email? 在自动 eclipse 构建期间使用带有 Ant 的 checkstyle - Using checkstyle with Ant during an automated eclipse build
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM