对 Groovy 类型的公共成员强制执行类型规范
在 Groovy 中,指定类型是可选的。但在方法和属性等公共类成员上指定它们有一些优点。这是一种很好的文档形式,它使 IDE 能够更可靠地执行自动完成、重构代码、查找引用和其他静态分析任务,如 Groovy 编码风格 文章。
有没有办法在 Eclipse 中强制执行此策略,以便在公共成员缺少显式类型时出现警告?类似于 Checkstyle 或 FindBugs 工具会很棒。
In Groovy, specifying types is optional. But there are advantages to specifying them on public class members like methods and properties. It's a good form of documentation and it enables IDEs to perform auto-completion, refactor code, find references, and other static analysis tasks more reliably as described in this Groovy Coding Style article.
Is there a way to enforce this policy in Eclipse so that a warning will appear when a public member is missing an explicit type? Something along the lines of a Checkstyle or FindBugs tool for Groovy would be great.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,目前 Groovy-Eclipse 中还没有类似的东西,但这是一个有趣的想法。您可以为此提出增强请求:
http://jira.codehaus.org/browse/GRECLIPSE
No, there is nothing like this in Groovy-Eclipse at the moment, but this is an interesting idea. You can raise an enhancement request for this:
http://jira.codehaus.org/browse/GRECLIPSE
正如评论一样,groovy 静态分析的标准工具是 codenarc。不知道你提到的规则是否有,但它有很多选择,并且正在不断改进。
关于你关于 eclipse 支持的问题,我相信还没有这样的事情。
Just as a comment, the standard tool for groovy static analysis is codenarc. Don't know if the rule you mentioned is there, but it has a lot of options and it is continuously improving.
Regarding your question about eclipse support, I believe there is nothing like that yet.