Checkstyle 来测试 XML 个文件?

Checkstyle to test XML files?

我目前正在我的 POM 文件中使用 checkstyle。 Checkstyle 似乎仅限于 Java 个文件。是否存在允许检查 XML 文件的模块?

Checkstyle 目前仅支持 Java。它的架构将允许支持其他语言(如 XML),但该团队目前没有资源或计划(截至 2017 年初)。

来自 Checkstyle GitHub site:

Checkstyle have small team and a huge plans on extending for java language, and it should focus on one language, to be at the top among java analysers. [...]

For next few years i have no plans to support other languages.

所以现在,您可能想看看其他可以分析 XML 的工具,例如 PMD, SonarQube

您可以对 Java 以外的文件使用 checkstyle。有关使用 Checkstyle 在 Java、XML 和 .properties 文件上强制使用空格的示例,请参阅 Checkstyle 存储库中的 google_checks.xml

<property name="fileExtensions" value="java, properties, xml"/>
<!-- Checks for whitespace                               -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter">
    <property name="eachLine" value="true"/>
</module>