filetabcharacter检查对checkstyle不起作用。

问题描述 投票:6回答:1

FileTabCharacter 检查似乎对我不起作用。以下是我的配置。

<module name="Checker">
..
..
<!-- No TAB characters in the source code -->
<module name="FileTabCharacter">
    <property name="eachLine" value="true" />
    <property name="fileExtensions" value="java,xml" />
</module>
..
..
<module name="TreeWalker">
..
..
</module>
</module>

我有XML文件 pom.xml 和checkstyle配置xml - 其中包含标签,但没有一个被标记为违规。

一些额外的信息 - 我的插件配置是这样的。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-checkstyle-plugin</artifactId>
    <version>2.9.1</version>
    <executions>
        <execution>
            <phase>verify</phase>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <configLocation>checkstyle/kepler-checkstyle-config.xml</configLocation>
        <suppressionsLocation>${project.parent.basedir}${file.separator}checkstyle/kepler-checkstyle-suppressions.xml</suppressionsLocation>
    </configuration>
</plugin>
checkstyle
1个回答
0
投票

我也遇到了这个问题,问题是默认配置只在源代码目录中查找,而不是在顶层目录中查找。 我用下面的配置解决了这个问题,这个配置将java代码限制在源代码目录下,但在任何地方都能查找xml文件,除了目标目录。

                        <configuration>
                            <sourceDirectories>${project.basedir}</sourceDirectories>
                            <includes>${project.compileSourceRoots}/**/*.java,**/*.xml</includes>
                            <excludes>**/target/**</excludes>
                        </configuration>


© www.soinside.com 2019 - 2024. All rights reserved.