如何让 mvn checkstyle 检查我的所有 javadoc 注释内容是否以大写字母开头?
我想配置我的 checkstyle,以便它验证我所有以大写字母开头的 javadoc 注释:
/**
* Hello
我在哪里可以设置它?我想我必须首先在评论上启用 checkstyle,但我不知道如何启用。
然后如何设置一个过滤器来检查 \/\*\*
的出现,然后确保 \s*\*\s[AZ]+
接下来?
编辑: 如果 checkstyle 目前不支持我需要的内容:How do I set up my own checkstyle modul and include it?
I'd like to have my checkstyle configured so that it verifies all my javadoc comments start with an upper case letter:
/**
* Hello
Where can I set that up? I think I'll have to enable checkstyle on comments first but I'm not sure how.
And then how do I set up a filter that checks for the occurence of \/\*\*
and then ensures a \s*\*\s[A-Z]+
follows?
EDIT:
If What I need is not supported by checkstyle at the moment: How do I set up my own checkstyle modul and include it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前,Checkstyle 不支持你想要得到的东西(据我所知)。但执行此操作的过程应该如下所示:
org.apache.maven.plugins:maven-checkstyle-plugin
添加到 Maven2 POM。configLocation
。Checkstyle 支持类和样式的规则:
您可以做的(从长远来看)是扩展 checkstyle,并增强社区,因此它可能会集成到 Checkstyle 本身和 Checkstyle 的 Maven 插件中。看看“扩展Checkstyle”,这并不难,我已经在我的自己的。请参阅 Checkstyle JavaDoc 样式 的实现示例。困难的部分是将其放入项目中,并在您需要的任何地方获取它:Maven、Eclipse、NetBeans、Sonar,...
Currently, Checkstyle does not support what you want to get (as I know). But the process to do that should be the following:
org.apache.maven.plugins:maven-checkstyle-plugin
to your Maven2 POM.configLocation
.Checkstyle supports as rules for classes and style:
What you can do (in the long run) is to expand checkstyle, and to give your enhancement to the community, so it may be integrated into Checkstyle itself and the Maven plugin for Checkstyle. Have a look at "Extending Checkstyle", it is not so difficult, I have done that on my own. See for an example the implementation of Checkstyle JavaDoc Style. The difficult part is to put that in the project, and get it everywhere you will need it: Maven, Eclipse, NetBeans, Sonar, ...