Eclipse Checkstyle vs Formatter vs Cleanup? [英] Eclipse Checkstyle vs Formatter vs Cleanup?

查看:113
本文介绍了Eclipse Checkstyle vs Formatter vs Cleanup?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在日食下看到这三个功能。我对它们有个想法,但我不知道它们之间的确切区别。

I see these 3 features under eclipse. I have an idea about them but I don't know the exact difference between them.

它们都定义了某种规则并应用了更改。例如:-如果您有任何未使用的导入,则可以根据清除,格式化程序或检查样式的设置删除未使用的导入。 checkstyle,formatter和cleanup有什么区别?

All of them define some type of rule and applies the change. For example :- If you have any unused imports you can remove unused ones based on the settings of either cleanup, formatter or checkstyle. What's the difference between checkstyle, formatter and cleanup?

推荐答案

Checkstyle 可用于检查一致性特定的编码标准/惯例。这不会更改您的代码,只会标记不符合要求的行。

Checkstyle can be used to check for adherence to specific coding standards/conventions. This does not change your code, but only flags lines that are not compliant.

Formatter 用于使所有源代码遵循指定的格式约定。它确实会更改您的代码,例如

The Formatter is used to make all source code follow specified formatting conventions. It does change your code, e.g. it may indent a certain amount, move brackets to a new line, break long lines, or other such operations.

Cleanup 更通用,并且可能会缩进一定的金额,将括号移到新行,打破长行或其他类似操作。可能还会更改您的代码。它可以称为格式化程序,组织导入(必要时添加或删除导入),添加缺少的批注或删除未使用的代码。

Cleanup is more generic and may also change your code. It may call e.g. the formatter, organise imports (adding or removing them as necessary), add missing annotations, or remove unused code.

简而言之,Checkstyle仅检查规则,但不会不会修改代码,格式化程序会修改源文件,但只会进行与格式相关的更改,而清除程序不仅会更改源文件,而且还可以通过添加或删除行来更改代码。

In a nutshell, Checkstyle only checks for rules, but does not modify code, the Formatter modifies source files but only does changes related to formatting, while Cleanup not only changes source files, but may also change code by adding or removing lines.

这篇关于Eclipse Checkstyle vs Formatter vs Cleanup?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆