Skip to content

Commit

Permalink
#312 Fix order of checkers
Browse files Browse the repository at this point in the history
- Align with version 1.1.6 to make results comparable.
- Fix html links in reports (remove "'").
  • Loading branch information
ascheman committed Mar 28, 2024
1 parent 9127ad3 commit 20e6ca7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@
public class AllCheckers {
public static final List<Class<? extends Checker>> CHECKER_CLASSES =
Arrays.asList(
BrokenCrossReferencesChecker.class,
BrokenHttpLinksChecker.class,
DuplicateIdChecker.class,
ImageMapChecker.class,
// Keep the list ordering to ensure comparability with HSC 1.x versions
MissingAltInImageTagsChecker.class,
MissingImageFilesChecker.class,
MissingLocalResourcesChecker.class);
DuplicateIdChecker.class,
BrokenHttpLinksChecker.class,
ImageMapChecker.class,
BrokenCrossReferencesChecker.class,
MissingLocalResourcesChecker.class
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

/**
* Check html anchor href attributes
*
* @see <a href="https://www.w3schools.com/tags/att_a_href.asp">https://www.w3schools.com/tags/att_a_href.asp</a>
*/
class BrokenHttpLinksChecker extends Checker {
Expand All @@ -35,9 +36,9 @@ class BrokenHttpLinksChecker extends Checker {
BrokenHttpLinksChecker(Configuration pConfig) {
super(pConfig);

errorCodes = getMyConfig().getHttpErrorCodes();
warningCodes = getMyConfig().getHttpWarningCodes();
successCodes = getMyConfig().getHttpSuccessCodes();
errorCodes = getMyConfig().getHttpErrorCodes();
warningCodes = getMyConfig().getHttpWarningCodes();
successCodes = getMyConfig().getHttpSuccessCodes();
}

@Override
Expand Down Expand Up @@ -129,7 +130,7 @@ else if (Web.HTTP_REDIRECT_CODES.contains(responseCode)) {
if (firstConnection.getHeaderField("Location") != null) {
newLocation = firstConnection.getHeaderField("Location");

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

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

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

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

Expand Down

0 comments on commit 20e6ca7

Please sign in to comment.