Skip to content

Add a Vale rule to check abstract length#5013

Merged
aneta-petrova merged 4 commits into
theforeman:masterfrom
aneta-petrova:vale-abstract-char-limit
Jul 8, 2026
Merged

Add a Vale rule to check abstract length#5013
aneta-petrova merged 4 commits into
theforeman:masterfrom
aneta-petrova:vale-abstract-char-limit

Conversation

@aneta-petrova

@aneta-petrova aneta-petrova commented Jul 3, 2026

Copy link
Copy Markdown
Member

What changes are you introducing?

Adding a new Vale rule that reports paragraphs that do not conform to the length requirement for abstracts.

Why are you introducing these changes? (Explanation, links to references, issues, etc.)

Abstracts must be 50-300 characters long.

Anything else to add? (Considerations, potential downsides, alternative solutions you have explored, etc.)

There are some limitations with this implementation:

  • Vale checks the source only, which means that it will count the characters of an attribute ({RHBK}) but not the string the attribute translates to in a given build context (Red Hat build of Keycloak). This can mean that the real abstract in the preview build could be longer than what Vale checks, potentially exceeding the 300 character limit.
  • Some abstracts use conditionals, for example:
[role="_abstract"]
ifdef::satellite[]
This is the abstract for Satellite.
endif::[]
ifndef::satellite[]
This is the same abstract, but for other build targets.
endif::[]

This, of course, would also not report accurate character count.

IMO this doesn't really pose an issue for the rule as I propose it. Upstream, even an approximate character count limit helps ensure abstracts don't get too long. Downstream, we'll have an additional check (but the upstream one will help us catch some violations before merging, which is still helpful).

Contributor checklists

  • I am okay with my commits getting squashed when you merge this PR.
  • I am familiar with the contributing guidelines.

Please cherry-pick my commits into:

  • Foreman 3.19/Katello 4.21
  • Foreman 3.18/Katello 4.20 (Satellite 6.19)
  • Foreman 3.17/Katello 4.19
  • Foreman 3.16/Katello 4.18 (Satellite 6.18; orcharhino 7.6, 7.7, and 7.8)
  • Foreman 3.15/Katello 4.17
  • Foreman 3.14/Katello 4.16 (Satellite 6.17; orcharhino 7.4; orcharhino 7.5)
  • We do not accept PRs for Foreman older than 3.14.

aneta-petrova and others added 2 commits July 3, 2026 20:31
Add AbstractLength.yml Vale rule to check that module abstracts
are between 50 and 300 characters long.

The rule uses a Tengo script to:
- Find the [role="_abstract"] marker in AsciiDoc modules
- Capture the abstract paragraph (single paragraph per module)
- Count characters including text that spans multiple lines
- Report errors with actual character count for clarity

The script includes detailed comments explaining:
- Import purposes and regex pattern breakdown
- How the match array works and what each element contains
- Why [\s\S] is used instead of . to match multi-line content
- The one-abstract-per-module constraint

Integrates with the foreman-documentation Vale style package.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@aneta-petrova aneta-petrova linked an issue Jul 3, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

The PR preview for b79f841 is available at theforeman-foreman-documentation-preview-pr-5013.surge.sh

No diff compared to the current base

show diff

@aneta-petrova aneta-petrova force-pushed the vale-abstract-char-limit branch from 982e921 to 834995e Compare July 3, 2026 19:00
@maximiliankolb

Copy link
Copy Markdown
Contributor

IMO this doesn't really pose an issue for the rule as I propose it.

I agree.

@Lennonka Lennonka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you! Looks good to me.

@aneta-petrova

Copy link
Copy Markdown
Member Author

I reverted the test commit whose purpose was to demonstrate and test the behavior. I'll merge with green GHA.

@aneta-petrova aneta-petrova merged commit 63a4b47 into theforeman:master Jul 8, 2026
10 checks passed
@aneta-petrova aneta-petrova deleted the vale-abstract-char-limit branch July 8, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Vale rule: Character limit for abstracts

3 participants