简体   繁体   中英

How to remove default checkstyle in eclipse?

I have a custom checkstyle.xml imported and set as the default. It works great. I just upgraded to the newest version of checkstyle and now I have a warning on just about every line of code. It looks like the warnings are coming from the two build in checkstyle xml's but they are not removable!

How can I disable these two checkstyle rule files so they stop bothering me?

The built-in configurations are not removable and cannot be changed or edited. Instead, people are supposed to create their own configurations, which is just what you did.

There are a few things you can try:

  • Make sure that your upgrade of the Checkstyle Eclipse plugin was performed correctly. Stop Eclipse. Check the plugins and features folders for contained folders called edu.umd.cs.findbugs.plugin.eclipse_ version. There should only be one such folder in plugins and one in features , both with the same version number. If there are more, delete the ones with the older version numbers. Restart Eclipse with the -clean option as first argument.

  • Make sure that your custom Checkstyle configuration is still the default after the plugin upgrade.

  • Check the Eclipse projects in your workspace and make sure that they do not have project-specific settings for Checkstyle. Right-click on project, select Properties, then Checkstyle. Make sure that the selected configuration is correct.

  • Configuration names are case sensitive. This can be an issue if someone made a case mistake in the .checkstyle file located in each project's root directory. Or the configuration name was mistyped on import. This last point should result in different errors though (such as configuration not found ).

Looks like Checkstyle locks in the 2 default rule sets. Two options occur to me: 1) Edit the default rules to diable the conflicting rules (or all of them). Or 2) delete the two xml files off the files system from the plugins/checkstyle (whatever the actual dir name is called).

Put the following in the projects that you want check-style disabled for, edit your pom.xml change the check-style skip to true :

<properties>

    <!-- Checkstyle -->

    <checkstyle.skip>true</checkstyle.skip>

</properties>

you should also configure it like this:

            <plugin>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>2.17</version>
            <executions>
                <execution>
                    <id>validate</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>check</goal>
                    </goals>
                    <configuration>
                        <configLocation>checkstyle.xml</configLocation>
                        <encoding>UTF-8</encoding>
                        <consoleOutput>true</consoleOutput>
                        <outputFileFormat>xml</outputFileFormat>
                        <failsOnError>false</failsOnError>
                        <failOnViolation>true</failOnViolation>
                        <skip>true</skip>
                    </configuration>
                </execution>
            </executions>
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>

Checkstyle will still run, but will perform a no-op...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM