Search code examples
intellij-ideajavadocintellij-15

IntelliJ - Find undocumented public methods


Using IntelliJ IDEA 15, how can I find public methods that lack javadoc and therefore lead to a decrease of the SonarQube metric Public Documented API as shown here?


Solution

  • IntelliJ has the ability to Inspect Code.

    1. Adjust inspection settings

    In order to identify missing public documentation, firstly enable the issue Declaration has Javadoc problems. You do this by opening the IDE Settings and select Editor -> Inspections. In the right menu select Java -> Javadoc issues -> Declaration has Javadoc problems. Activate this issue.

    enter image description here

    Again in the lower right corner you will see some options for this issue. Make sure, that for the tab Method, the Scope is set to public. Also check Ignore simple property access as you don't want to be informed of getters and setters lacking documentation.

    enter image description here

    Click OK to save.

    2. Inspect the code

    In the top menu bar in IntelliJ open Analyze -> Inspect Code..., select how much shall be inspected and run it by clicking on OK. In the Inspection Results look for Javadoc issues -> Declaration has Javadoc problems. Those issues stating Required Javadoc is absent are what you are looking for.