Eclipse 格式化程序与 Checkstyle 不一致
我们正在使用 Eclipse 格式化配置文件,该配置文件规定行宽为 125 个字符,并且方法参数应在必要时进行换行。现在该行不会断成两半:
public FeaturePart(final Long fooBarBarBarBar, final String foo, final int sequenceNumber, final boolean fooBarBarBazBar) {
请注意,第 125 个之后的字符是非字母。具有相同行宽设置(125 个字符)的 Checkstyle 会抱怨该行的长度。
此时有没有办法使 eclipse 自动格式化程序和 checkstyle 线宽检查保持一致?我试图找到任何可能对 checkstyle 和格式化程序都有帮助的设置,但失败了。
we are using an eclipse formatting profile, that states that line width is 125 characters and that the method parameters should be wrapped when necessary. Now this line does not get broken in two:
public FeaturePart(final Long fooBarBarBarBar, final String foo, final int sequenceNumber, final boolean fooBarBarBazBar) {
Note that the characters beyond 125th are non-letters. Checkstyle with the same line-width setting (125 characters) complains about the length of this line.
Is there a way to make the eclipse autoformatter and checkstyle line-width check consistent at this point? I have tried to find any settings that might help in both checkstyle and formatter but failed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简短的回答是不。 Eclipse 格式化程序和 Checkstyle 是配置不同的不同工具。因此他们的行为会有所不同。
我个人发现 Eclipse 格式化程序的行为有时很笨拙。幸运的是,在 Eclipse 3.6 中,您可以关闭代码段的格式化程序。请参阅这个答案如何。
The short answer is no. The Eclipse formatter and Checkstyle are different tools that are configured differently. Hence their behavior will differ.
I personally find that the Eclipse formatter is at times unwieldy in its behaviour. Luckily in Eclipse 3.6 you can turn off the formatter for sections of code. See this answer for how.