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

Could not find artifact com.sun:tools:jar:0

tools.jar removed from Java 9+ You’re on JDK 11. No tools.jar found there. JEP 220: Modular Run-Time Images removed both tools.jar and rt.jar from the lib folder, as of Java 9. Removed: rt.jar and tools.jar The class and resource files previously stored in lib/rt.jar, lib/tools.jar, lib/dt.jar, and various other internal JAR files are now stored … 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

Disable a particular Checkstyle rule for a particular line of code?

Check out the use of the supressionCommentFilter at http://checkstyle.sourceforge.net/config_filters.html#SuppressionCommentFilter. You’ll need to add the module to your checkstyle.xml <module name=”SuppressionCommentFilter”/> and it’s configurable. Thus you can add comments to your code to turn off checkstyle (at various levels) and then back on again through the use of comments in your code. E.g. //CHECKSTYLE:OFF public void … Read more