Skip to content

Transfer getPageFromDestination functionality to verapdf-parser#729

Merged
MaximPlusov merged 2 commits intointegrationfrom
destinations
Apr 28, 2026
Merged

Transfer getPageFromDestination functionality to verapdf-parser#729
MaximPlusov merged 2 commits intointegrationfrom
destinations

Conversation

@LonelyMidoriya
Copy link
Copy Markdown
Contributor

@LonelyMidoriya LonelyMidoriya commented Apr 28, 2026

Summary by CodeRabbit

  • Refactor
    • Streamlined annotation validation by centralizing crop box detection, destination resolution, and alternative text handling into shared utility methods. This ensures consistent behavior in annotation processing across validation modules.

@LonelyMidoriya LonelyMidoriya self-assigned this Apr 28, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 282dd582-9fc4-4bbf-83b7-4a44b2d80754

📥 Commits

Reviewing files that changed from the base of the PR and between c8fb5d0 and 2b51cad.

📒 Files selected for processing (4)
  • validation-model/src/main/java/org/verapdf/gf/model/impl/pd/GFPDAnnot.java
  • validation-model/src/main/java/org/verapdf/gf/model/impl/pd/actions/GFPDMediaClip.java
  • wcag-validation/src/main/java/org/verapdf/gf/model/impl/sa/GFSAAnnotation.java
  • wcag-validation/src/main/java/org/verapdf/gf/model/impl/sa/GFSAAnnotationNode.java

📝 Walkthrough

Walkthrough

This PR consolidates annotation-related validation logic across four Java files by delegating to shared static helper methods in PDAnnotation classes. The changes reduce code duplication for crop box boundary checks, alternative text validation, and destination resolution.

Changes

Cohort / File(s) Summary
Crop Box Boundary Checks
validation-model/src/main/java/org/verapdf/gf/model/impl/pd/GFPDAnnot.java, wcag-validation/src/main/java/org/verapdf/gf/model/impl/sa/GFSAAnnotation.java
Both getisOutsideCropBox() methods now delegate to the shared PDAnnotation.isOutsideCropBox(page, annotation) helper instead of performing local crop box and rectangle boundary calculations.
Alternative Text Validation
validation-model/src/main/java/org/verapdf/gf/model/impl/pd/actions/GFPDMediaClip.java
gethasCorrectAlt() delegates entirely to underlying PDMediaClip implementation, removing local ALT entry parsing and COS-related imports (COSArray, COSObjType).
Destination Resolution
wcag-validation/src/main/java/org/verapdf/gf/model/impl/sa/GFSAAnnotationNode.java
getDestination() delegates destination-to-page/object extraction to PDAnnotation.getPageFromDestination(destination, key) instead of manually resolving via catalog name trees and COS type interpretation.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Four methods spring from shared wells deep,
No code is doubled, helpers reap!
Crop boxes checked with single call,
Refactoring cleans the hall! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'Transfer getPageFromDestination functionality to verapdf-parser' directly references the primary refactoring: moving destination-handling logic to the PDAnnotation utility class in verapdf-parser.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch destinations

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MaximPlusov MaximPlusov merged commit 48b88fb into integration Apr 28, 2026
8 checks passed
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.

2 participants