簡體   English   中英

Checkstyle:無法總結每個作者的問題嗎?

[英]Checkstyle: cannot summarise issues per author?

我正在嘗試將checkstyle用於Java項目,但似乎無法正常工作:

盡管它顯然運行平穩,但html報表並未按作者提供任何信息,即authors表為空。

問題是我不知道checkstyle如何識別作者。 它會查看java doc標簽@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>

非常感謝您的幫助

大衛

請注意,我還沒有對此進行測試,當我閱讀Checkstyle的文檔時(在不久前提到對它進行測試!),我只是遇到了有關author標記的內容。 文檔中

檢查Javadoc注釋中的類和接口定義。 默認情況下,不檢查作者或版本標簽。 使用Scope類指定要驗證的范圍,默認范圍為Scope.PRIVATE。 若要驗證另一個范圍,請將屬性范圍設置為范圍常量之一。 要定義作者標簽或版本標簽的格式,請將屬性authorFormat或versionFormat分別設置為正則表達式。

和:

要為@author標簽配置檢查:

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

最后,我放棄了……與這段貢獻的代碼的作者聯系,但沒有答復。 回到使用更簡單的模式checkstyle-simpler.xsl來代替

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM