2010-02-16 26 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