Intellij IDEA checkstyle

Go to the Checkstyle configuration page via File → Settings, then typing checkstyle into the search box: Press the plus icon to add your checkstyle.xml. Activate your checkstyle.xml by clicking the checkbox in the column labeled Active. That’s it! If you want real-time scans, you can go to the Inspections dialog and activate the real-time …

Read more

How to generate an Eclipse formatter configuration from a checkstyle configuration?

In Eclipse (3.6): Install Checkstyle plug-in Import stylesheet using Windows –> Preferences, General –> Checkstyle –> New. Since you have an external file, choose “external file” as the type. Right-click on your project in the Package view and select Checkstyle –> Create Formatter-Profile. Then enable the formatter for your workspace: Windows –> Preferences –> Java …

Read more

Excluding classes in Maven Checkstyle plugin reports

If, like me, you arrived here searching for a way to exclude generated sources from checkstyle, do this: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.15</version> <configuration> <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory> </configuration> </plugin> By default, the checkstyle:checkstyle goal of the checkstyle plugin uses ${project.compileSourceRoots}, which apparently includes generated source directories. If you change it to ${project.build.sourceDirectory}, it will use only the source …

Read more

IntelliJ IDEA code format from checkstyle configuration

finally there is something: checkstyle-IDEA since 4.24.0 features import of checkstyle config. A solution is available now: Please install CheckStyle-IDEA plugin (http://plugins.jetbrains.com/plugin/1065?pr=idea), it can be found via plug-in repository (Settings|Plugins|Browse repositories). Go to Settings|Editor|Code Style, choose a code style you want to import CheckStyle configuration to. Click Manage…|Import.., choose “CheckStyle Configuration” and select a corresponding …

Read more

Checkstyle, Unable to create Root Module

This happened to me when I updated Android Gradle Plugin to 3.3.0 Please run this: ./gradlew checkstyle –stacktrace Probably you will need to check your checkstyle.xml config file. I needed to move those two tags: <module name=”SuppressionCommentFilter”/> <!–Enable usage SUPPRESS CHECKSTYLE comment–> <module name=”SuppressWithNearbyCommentFilter”> <property name=”commentFormat” value=”CHECKSTYLE IGNORE”/> <property name=”checkFormat” value=”.*”/> <property name=”influenceFormat” value=”0″/> </module> …

Read more

How to suppress all checks for a file in Checkstyle?

Don’t know whether you’re using command line or in an IDE, but you’ll basically need a suppresions file. If you’re manually editing the Checkstyle config file, add a new module to it: <module name=”SuppressionFilter”> <property name=”file” value=”mysuppressions.xml” /> </module> Your mysuppression.xml can be something like: <?xml version=”1.0″?> <!DOCTYPE suppressions PUBLIC “-//Puppy Crawl//DTD Suppressions 1.1//EN” “http://www.puppycrawl.com/dtds/suppressions_1_1.dtd”> …

Read more