Skip to content

Commit 8623889

Browse files
committed
312 Fix order of checkers
- Align with version 1.1.6 to make results comparable. - Add arc42 as integration test reference. - Fix html links in reports (remove "'").
1 parent 2414ecd commit 8623889

File tree

6 files changed

+2395
-706
lines changed

6 files changed

+2395
-706
lines changed

htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/AllCheckers.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@
2525
public class AllCheckers {
2626
public static final List<Class<? extends Checker>> CHECKER_CLASSES =
2727
Arrays.asList(
28-
BrokenCrossReferencesChecker.class,
29-
BrokenHttpLinksChecker.class,
30-
DuplicateIdChecker.class,
31-
ImageMapChecker.class,
28+
// Keep the list ordering to ensure comparability with HSC 1.x versions
3229
MissingAltInImageTagsChecker.class,
3330
MissingImageFilesChecker.class,
34-
MissingLocalResourcesChecker.class);
31+
DuplicateIdChecker.class,
32+
BrokenHttpLinksChecker.class,
33+
ImageMapChecker.class,
34+
BrokenCrossReferencesChecker.class,
35+
MissingLocalResourcesChecker.class
36+
);
3537
}

htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/BrokenHttpLinksChecker.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
/**
1919
* Check html anchor href attributes
20+
*
2021
* @see <a href="https://www.w3schools.com/tags/att_a_href.asp">https://www.w3schools.com/tags/att_a_href.asp</a>
2122
*/
2223
class BrokenHttpLinksChecker extends Checker {
@@ -35,9 +36,9 @@ class BrokenHttpLinksChecker extends Checker {
3536
BrokenHttpLinksChecker(Configuration pConfig) {
3637
super(pConfig);
3738

38-
errorCodes = getMyConfig().getHttpErrorCodes();
39-
warningCodes = getMyConfig().getHttpWarningCodes();
40-
successCodes = getMyConfig().getHttpSuccessCodes();
39+
errorCodes = getMyConfig().getHttpErrorCodes();
40+
warningCodes = getMyConfig().getHttpWarningCodes();
41+
successCodes = getMyConfig().getHttpSuccessCodes();
4142
}
4243

4344
@Override
@@ -129,7 +130,7 @@ else if (Web.HTTP_REDIRECT_CODES.contains(responseCode)) {
129130
if (firstConnection.getHeaderField("Location") != null) {
130131
newLocation = firstConnection.getHeaderField("Location");
131132

132-
problem = "Warning: " + href + " returned statuscode " + responseCode + ", new location: " + newLocation;
133+
problem = String.format("Warning: %s returned statuscode %d, new location: %s", href, responseCode, newLocation);
133134
getCheckingResults().addFinding(new Finding(problem));
134135

135136
}
@@ -152,7 +153,7 @@ else if (Web.HTTP_REDIRECT_CODES.contains(responseCode)) {
152153
problem = "Error: Unknown or unclassified response code:";
153154
}
154155

155-
problem += String.format("'%s' returned statuscode %d.", href, responseCode);
156+
problem += String.format(" %s returned statuscode %d.", href, responseCode);
156157

157158
getCheckingResults().addFinding(new Finding(problem));
158159

0 commit comments

Comments
 (0)