Skip to content

[doc] Strip rule description when generating docs - #7032

Merged
UncleOwen merged 2 commits into
pmd:mainfrom
zbynek:strip-description
Sep 5, 2026
Merged

UncleOwen merged 2 commits into
pmd:mainfrom
zbynek:strip-description

Conversation

@zbynek

@zbynek zbynek commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Describe the PR

Strip leading whitespace of rule descriptions more aggressively.

Currently adding description with an indented CDATA section (done by Copilot in 9df417e, happened to me as well in my previous PR) results in invalid Markdown docs and a slightly cryptic error message:


YAML Exception reading /home/runner/work/pmd/pmd/docs/pages/pmd/rules/java/codestyle.md: (<unknown>): did not find expected key while parsing a block mapping at line 10 column 3 
  Liquid Exception: no category for rule reference, and no implicit category name available in pages/pmd/rules/java/codestyle.md

Note that the same indentation is used elsewhere in the file, since XPath properties are less sensitive than markdown.

Skipping leading lines that are blank, not just empty, fixes the issue.

Related issues

None.

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by github actions)
  • Added (in-code) documentation (if needed)

@pmd-actions-helper

pmd-actions-helper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Documentation Preview

Compared to main:
This changeset changes 0 violations,
introduces 0 new violations, 0 new errors and 0 new configuration errors,
removes 0 violations, 0 errors and 0 configuration errors.
There are 0 changed duplications, 0 new duplications and 0 removed duplications.
There are 0 changed CPD errors, 0 new CPD errors and 0 removed CPD errors.

Regression Tester Report

(comment created at 2026-09-05 20:12:40+00:00 for 55d0d61)

@UncleOwen UncleOwen added the in:documentation Affects the documentation [doc] label Sep 5, 2026
@UncleOwen

Copy link
Copy Markdown
Member

Hey, could you do me a favor an look at #6963? It's a PR for the same file.

@zbynek

zbynek commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor Author

I merged the ther PR and resolved conflicts here.

@UncleOwen UncleOwen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything else looks good.

@UncleOwen UncleOwen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@UncleOwen UncleOwen added this to the 7.28.0 milestone Sep 5, 2026
@UncleOwen
UncleOwen merged commit 63cd02f into pmd:main Sep 5, 2026
13 checks passed
@adangel adangel changed the title [chore] Strip rule description when generating docs [doc] Strip rule description when generating docs Sep 6, 2026
@adangel adangel added the in:pmd-internals Affects PMD's internals label Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in:documentation Affects the documentation [doc] in:pmd-internals Affects PMD's internals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants