checkstyle icon indicating copy to clipboard operation
checkstyle copied to clipboard

Issue #17449: Add XDocs examples for MethodCountCheck max* properties

Open Vishalup29 opened this issue 3 weeks ago • 2 comments

Issue: #17449

This PR adds XDocs examples for the following MethodCountCheck properties:

  • maxPrivate
  • maxPackage
  • maxProtected

Changes included:

  • Added a new example configuration and code snippet (Example4) in methodcount.xml to demonstrate using separate maximums for private, package-private, and protected methods.
  • Added a corresponding XDocs example source file Example4.java under src/xdocs-examples/resources/com/puppycrawl/tools/checkstyle/checks/sizes/methodcount.
  • Updated methodcount.xml.template to wire in the new example using the standard <macro name="example"> pattern.
  • Removed MethodCountCheck (maxPrivate, maxPackage, maxProtected) from the SUPPRESSED_PROPERTIES_BY_CHECK map in XdocsExampleFileTest, as these properties are now covered by XDocs examples.

Testing:

  • mvn -Pno-validations -DskipITs -DskipUTs=false test
  • Verified that XdocsExampleFileTest now passes without suppressions for MethodCountCheck.

Vishalup29 avatar Dec 09 '25 07:12 Vishalup29

Please read and watch videos at Starting_Development. Please make CI green.

romani avatar Dec 09 '25 14:12 romani

@romani CI green

Vishalup29 avatar Dec 11 '25 08:12 Vishalup29

GitHub, generate website

romani avatar Dec 14 '25 17:12 romani

https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/6805c08_20251214171357/index.html

https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/6805c08_20251214171357/checks/sizes/methodcount.html#Examples

github-actions[bot] avatar Dec 14 '25 17:12 github-actions[bot]

Please read and watch videos at Starting_Development. Please make CI green.

romani avatar Dec 15 '25 01:12 romani

https://checkstyle.org/checks/sizes/methodcount.html#MethodCount

You might noticed that all examples are same by java code and changing only by comments. Please continue this approach. You can have 3 examples for each property to be used individually to show it's behavior idenpendetly

romani avatar Dec 15 '25 04:12 romani

@romani DOne CI green

Vishalup29 avatar Dec 18 '25 06:12 Vishalup29