Skip to content

Conversation

@ascheman
Copy link
Member

The Maven source document configuration should be optional (it was mandatory as it seems).

This closes #429

ascheman and others added 5 commits October 29, 2025 14:35
Auto-populate sourceDocuments from sourceDir when not explicitly
configured, matching the behavior of Gradle plugin and CLI.

- Add findHtmlFiles() method to recursively scan for .html files
- Modify setupConfiguration() to auto-populate when sourceDocuments is null
- Add integration test executeWithOnlySourceDir_ShouldSucceed()
- All existing tests pass without regression

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Rename defaultIndeFilenames to defaultIndexFilenames

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Update Gradle and Maven plugins to automatically search for both
.html and .htm files when sourceDocuments is not specified.

- Gradle plugin: Add .htm pattern to fileTree includes
- Maven plugin: Update findHtmlFiles() to check for .htm extension
- Update README.adoc in both plugins to document default behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Add tests to verify both .html and .htm files are discovered when
sourceDocuments is auto-populated from sourceDir.

- Maven plugin: Test verifies 3 files (.htm, .html, nested .htm)
- Gradle plugin: Test verifies same file discovery pattern
- Both tests confirm recursive directory scanning works for .htm
- Fix Maven README: Use correct <sourceDocument> element name
- All tests pass with no regressions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Increases test count from 10 to 18 tests to improve SonarCloud
coverage for HtmlSanityCheckMojo.

- Add tests for HTTP status code overrides (success/error/warning)
- Add tests for findHtmlFiles() edge cases (null, non-existent, empty)
- Verify non-HTML files are properly ignored
- Refactor setField() helper to shared static method
@ascheman ascheman requested review from Copilot and truhroth October 29, 2025 15:07
@ascheman ascheman self-assigned this Oct 29, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request enhances the HTML Sanity Check Maven and Gradle plugins to automatically discover HTML files (including .htm extension) from the sourceDir when sourceDocuments is not explicitly configured. Key changes include:

  • Auto-population of sourceDocuments from sourceDir when not specified
  • Support for both .html and .htm file extensions
  • Addition of a recursive file discovery mechanism for the Maven plugin
  • Comprehensive test coverage for the new functionality
  • Fixed a typo in method name (defaultIndeFilenamesdefaultIndexFilenames)
  • Updated documentation to reflect .htm support

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
HtmlSanityCheckMojo.java Added findHtmlFiles() method to recursively discover HTML/HTM files and modified setupConfiguration() to auto-populate sourceDocuments
HtmlSanityCheckMojoTest.java Added comprehensive test suite covering HTTP status code configuration, file discovery scenarios, and edge cases
HtmlSanityCheckTask.groovy Added .htm file pattern to Gradle plugin's auto-population logic
HtmlSanityCheckTaskSpec.groovy Added test to verify .htm files are included in auto-population
Configuration.java Fixed typo in method name from defaultIndeFilenames to defaultIndexFilenames
htmlSanityCheck-maven-plugin/README.adoc Updated documentation to reflect .htm support and corrected XML tag name
htmlSanityCheck-gradle-plugin/README.adoc Updated documentation to reflect .htm support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

github-actions bot commented Oct 29, 2025

Test Results

123 files  ± 0  123 suites  ±0   5m 16s ⏱️ - 7m 20s
498 tests +11  496 ✅ +11  0 💤 ±0   2 ❌ ±0 
638 runs  +11  573 ✅ +11  0 💤 ±0  65 ❌ ±0 

For more details on these failures, see this check.

Results for commit 2d1b66c. ± Comparison against base commit 9efca5e.

This pull request removes 60 and adds 34 tests. Note that renamed tests count towards both.
                                <a href="http://aim.org">improve</a>' 
                                <a href="http://arc42.de">arc42.de</a> and some more text
                                <a href="https://arc42.org">arc42 over https</a> even more
                                <a href="local-file.jpg">local file</a> again, text
                                <img src="" alt="2">
                                <img src="t.doc" alt="r"> '
    <area shape="circle" coords="0,1,1" href="#test2">
    <area shape="rect" coords="0,0,1,1" href="#id1" >
    <area shape="rect" coords="0,0,1,1" href="#test1" >
    <area shape="rect" coords="0,0,1,1" href="#test1">
…
org.aim42.htmlsanitycheck.check.ImageMapsCheckerSpec ‑ find image map issues [nrOfFindings: 1, imageMapStr: <img src="image1.jpg" usemap="#map1"><map name="map1">
    <area shape="rect" coords="0,0,1,1" href="#id1" >
</map>
<h2 id="foo" >bad header</h2>, msg: ImageMap "map1" refers to missing link "id1"., #4]
org.aim42.htmlsanitycheck.check.ImageMapsCheckerSpec ‑ find image map issues [nrOfFindings: 1, imageMapStr: <img src="image1.jpg" usemap="#map1"><map name="map1">
    <area shape="rect" coords="0,0,1,1" href="#id1" >
</map>
<map name="map1">
    <area shape="rect" coords="0,0,1,1" href="#id1" >
</map>
<h2 id="id1">aim42 header</h2>, msg: 2 imagemaps with identical name "map1" exist., #1]
org.aim42.htmlsanitycheck.check.ImageMapsCheckerSpec ‑ find image map issues [nrOfFindings: 1, imageMapStr: <img src="image1.jpg" usemap="#map1"><map name="map1">
</map>
, msg: ImageMap "map1" has no area tags., #3]
org.aim42.htmlsanitycheck.check.ImageMapsCheckerSpec ‑ find image map issues [nrOfFindings: 1, imageMapStr: <map name="map1">
    <area shape="rect" coords="0,0,1,1" href="#id1" >
</map>
<h2 id="id1">aim42 header</h2>, msg: ImageMap "map1" not referenced by any image., #2]
org.aim42.htmlsanitycheck.gradle.HtmlSanityCheckTaskSpec ‑ should include .htm files when auto-populating sourceDocuments
org.aim42.htmlsanitycheck.html.HtmlPageSpec ‑ can extract alt attributes from imageTag ' <img alt="1" >
                                <img src="" alt="2">
                                <img src="t.doc" alt="r"> '
org.aim42.htmlsanitycheck.html.HtmlPageSpec ‑ detect correct number of external http links in anchors '<a href="http://arc42.org">arc42</a> and some text
                                <a href="http://arc42.de">arc42.de</a> and some more text
                                <a href="https://arc42.org">arc42 over https</a> even more
                                <a href="local-file.jpg">local file</a> again, text
                                <a href="http://aim.org">improve</a>' 
org.aim42.htmlsanitycheck.html.HtmlPageSpec ‑ detect missing alt attributes in imageTag ' <img alt="1" >
                                <img src="" alt="2">
                                <img src="t.doc" alt="r"> '
org.aim42.htmlsanitycheck.html.ImageMapParserSpec ‑ find all areas within map [nrOfAreas: 1, mapName: mymap, htmlBody: <img src="image.gif" usemap="#mymap">
<map name="mymap">
    <area shape="rect" coords="0,0,1,1" href="#test1" >
</map> , #1]
org.aim42.htmlsanitycheck.html.ImageMapParserSpec ‑ find all areas within map [nrOfAreas: 2, mapName: mymap, htmlBody: <img src="image.gif" usemap="#mymap">
<map name="mymap">
    <area shape="rect" coords="0,0,1,1" href="#test1" >
    <area shape="circle" coords="0,1,1" href="#test2">
</map> , #0]
…

♻️ This comment has been updated with latest results.

@ascheman ascheman force-pushed the bugfix/429-maven-sourcedocs-optional branch 2 times, most recently from b474f66 to 2d1b66c Compare October 31, 2025 08:10
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Maven Plugin: sourceDocuments are not optional but required

2 participants