Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Checkstyle: how to disable Missing package-info.java file?

Can I disable somehow Checkstyle warning?

Missing package-info.java file.

My IDE is IntelliJ IDEA.

like image 687
zappee Avatar asked Sep 17 '16 20:09

zappee


People also ask

What is Package-info Java in JAXB?

package-info. java is a way to apply java annotations at the package level. In this case Jaxb is using package-level annotations to indicate the namespace, and to specify namespace qualification for attributes (source).

What is a package-Info Java file?

The package-info. java is a Java file that can be added to any Java source package. Its purpose is to provide a home for package level documentation and package level annotations. Simply create the package-info. java file and add the package declaration that it relates to in the file.

How do I use checkstyle in IntelliJ?

Configuring Checkstyle-IDEA Install the Checkstyle-IDEA plugin by going to File > Settings (Windows/Linux), or IntelliJ IDEA > Preferences… ​ (macOS). Select Plugins , press Browse Repository , and find the plugin. Restart the IDE to complete the installation.


1 Answers

If you haven't configured anything yet, and you are using IntelliJ, this means you are using the Sun checks configuration. You may not like this answer, but don't shoot the messenger ...

  • Download a copy of sun_checks.xml. Make sure that you modify the Checkstyle version in the URL to the one you are using (important!). To find out the version, select the Checkstyle-IDEA plugin in IntelliJ's Plugins dialog; it gives the version number in the description text.
  • Remove the <module name="JavadocPackage">...</module> from the XML.
  • Configure the resulting file as a new Checkstyle configuration and use that.

There is currently (as of Checkstyle 7.1.1) no other way to disable a rule from the standard configuration.

If you just want to suppress a single violation, or a group of violations, you may also consider the many suppression configuration options. In order to suppress one rule entirely, you would still have to change the XML, so the above method is better.

like image 164
barfuin Avatar answered Oct 10 '22 09:10

barfuin