[英]Eclipse checkstyle and formatter
There is confusion . 有混乱。
For my project i created my own Formatter
and checkstyle
. 对于我的项目,我创建了自己的
Formatter
和checkstyle
。
example:-Formatter 示例:格式化程序
there is a Brace
tag in Formatter so i made two changes. 在Formatter中有一个
Brace
标签,所以我做了两个更改。
Brace Position:- 支撑位置:-
Class/interface ..NextLine 类/接口..NextLine
Constructor Declaration ..Next line 构造函数声明..下一行
after write some code i am not following formatted rules . 编写一些代码后,我没有遵循格式化的规则。
Then why my checkstyle
not showing any message like "Brace should be next line"
. 那为什么我的
checkstyle
不显示任何消息,如"Brace should be next line"
。
Currently i am using my own style and previous using Sun Checks(eclipse)-global
目前,我使用自己的样式,以前使用
Sun Checks(eclipse)-global
Checkstyle and formatter are two different things. Checkstyle和Formatter是两回事。 Your formatter can help in respecting the rules you've defined in your checkstyle configuration, but your checkstyle configuration does not use the formatter to define its rules.
格式化程序可以帮助您遵循在checkstyle配置中定义的规则,但是checkstyle配置不使用格式化程序来定义其规则。
I do not remember what the "Sun Checks(eclipse)-global" set of rules defines in terms of white spaces around the left curly brace, but whatever the case you might want to define your own rules. 我不记得“ Sun Checks(eclipse)-global”规则集是根据左花括号周围的空白来定义的,但是无论如何,您可能想要定义自己的规则。
This is where you configure your own customized set of checkstyle rules. 在这里,您可以配置自己的自定义Checkstyle规则集。 For example in order to make a rule that will mark an error in your editor if the "left curly brace" is on the same line as its block's signature instead of being on a new line :
例如,为了制定一条规则,如果“左花括号”与其块的签名在同一行而不是在新行,则将在编辑器中标记错误:
You can configure a lot of custom rules for your project, see checkstyle's documentation for help. 您可以为项目配置许多自定义规则,请参阅checkstyle的文档以获取帮助。
[edit : a thought after I wrote this ... maybe the fact that you do not see a warning with the "Sun checks(eclipse)" basic configuration comes from the last point I outlined above : make sure that the "checkstyle active for this project" checkbox is ticked in your project's properties ] [编辑 :我写完这篇文章后的一个想法……也许您没有在基本配置中看到“ Sun check(eclipse)”警告的事实来自我在上面概述的最后一点:请确保“此项目”复选框在项目的属性中打勾]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.