2010-02-16 39 views
2

虽然它看起来运行平稳,但是HTML报告并没有给出每个作者的任何信息,因为它应该是这样的,即作者表是空的。Checkstyle:不能总结每个作者的问题?

事情是我不知道checkstyle如何识别作者。它看着java文档标签@author?在课堂上还是在方法层面?

我使用Ant任务是下面:

<taskdef resource="checkstyletask.properties" classpath="${libs.dir}/checkstyle-all-5.0.jar"/> 
<target name="checkstyle" description="Generates a report of code convention violations."> 
     <mkdir dir="${checkstyle.dir}"/> 
    <checkstyle config="${util.dir}/checkstyle/sun_checks.xml" failureProperty="checkstyle.failure" failOnViolation="false"> 
     <formatter type="xml" tofile="${checkstyle.dir}/checkstyle_report.xml"/> 
     <fileset dir="${src.dir}" includes="**/*.java"/> 
    </checkstyle> 
    <xslt in="${checkstyle.dir}/checkstyle_report.xml" out="${checkstyle.dir}/checkstyle_report.html" style="${util.dir}/checkstyle/checkstyle-author.xsl"/> 
</target> 

的帮助

大卫

+0

以前真的没有人遇到过这个问题吗? – dm76 2010-02-26 17:17:59

回答

0

最后,我放弃了......这样的联系笔者贡献片的代码,但没有回复。 移回使用稍简单的模式checkstyle-simpler.xsl而不是

0

请注意,我没有测试过这一点,我只是遇到了一些关于author标签非常感谢当我阅读Checkstyle的文档时(在你提到测试它之后,一会儿回来!)。来自documentation

检查Javadoc对类和接口定义的注释。默认情况下,不检查作者或版本标签。要验证的范围是使用Scope类指定的,并且默认为Scope.PRIVATE。要验证另一个作用域,请将属性范围设置为其中一个作用域常量。要定义作者标签或版本标签的格式,请分别将属性authorFormat或versionFormat设置为正则表达式。

和:

要配置检查的@author标签:

<module name="JavadocType"> 
    <property name="authorFormat" value="\S"/> 
</module> 
+0

嘿巴特!很高兴在这里看到你:-) 谢谢,我已经做到了,但仍然无法正常工作。在checkstyle官方论坛上,人们似乎不知道。要使用的xslt实际上是一种贡献,而不是官方发布的一部分。我认为那里有一个问题..联系了编写它的人,但迄今为止没有回复... – dm76 2010-03-09 11:21:42

+0

好吧,好吧,我想你会让我发布...... :)明天和你谈谈! – 2010-03-09 11:24:24