Movatterモバイル変換


[0]ホーム

URL:


 
» Documentation Edit on GitHub

Documentation

Rules that are related to code documentation.
Table of Contents

ApexDoc

Since: PMD 6.8.0

Priority: Medium (3)

This rule validates that:

  • ApexDoc comments are present for classes, methods, and properties that are public or global, excludingoverrides and test classes (as well as the contents of test classes).
  • ApexDoc comments are present for classes, methods, and properties that are protected or private, dependingon the propertiesreportPrivate andreportProtected.
  • ApexDoc comments should contain a main description depending on the propertyreportMissingDescription.
  • ApexDoc comments on non-void, non-constructor methods should contain @return.
  • ApexDoc comments on void or constructor methods should not contain @return.
  • ApexDoc comments on methods with parameters should contain @param for each parameter, in the sameorder as the method signature.
  • ApexDoc comments are present on properties is only validated, if the propertyreportProperty is enabled.By settingreportProperty to false, you can ignore missing comments on properties.

Method overrides and tests are both exempted from having ApexDoc.

This rule is defined by the following Java class:net.sourceforge.pmd.lang.apex.rule.documentation.ApexDocRule

Example(s):

/** * Hello World */publicclassHelloWorld{/**     * Bar     * @return Bar     */publicObjectbar(){returnnull;}}

This rule has the following properties:

NameDefault ValueDescription
reportPrivatefalseReport private classes, methods and properties
reportProtectedfalseReport protected classes, methods and properties
reportMissingDescriptiontrueReport missing main description
reportPropertytrueReport properties without comments

Use this rule with the default properties by just referencing it:

<ruleref="category/apex/documentation.xml/ApexDoc"/>

Use this rule and customize it:

<ruleref="category/apex/documentation.xml/ApexDoc"><properties><propertyname="reportPrivate"value="false"/><propertyname="reportProtected"value="false"/><propertyname="reportMissingDescription"value="true"/><propertyname="reportProperty"value="true"/></properties></rule>

This documentation is written in markdown.
If there is something missing or can be improved, edit this page on github and create a PR: Edit on GitHub

©2025 PMD Open Source Project. All rights reserved.
Site last generated: Nov 28, 2025

PMD                logo


[8]ページ先頭

©2009-2025 Movatter.jp