Automated Checker Factory

Issue 185 proposes to automatically detect and instantiate Checker (sub-)classes.

Problem

We want to adhere to the Open-Close principle (OCP) when adding new checkers:

There shall be no need to touch other code when writing a new checker, especially should there be no central registry of checkers.

Up to v 1.0.0-RC-1 we violated the OCP and allowed major redundancies in code:

class AllCheckers {

    public final static LinkedHashSet<Class> checkerClazzes =
            [BrokenCrossReferencesChecker,
             BrokenHttpLinksChecker,
             DuplicateIdChecker,
             ImageMapChecker,
             MissingAltInImageTagsChecker,
             MissingImageFilesChecker,
             MissingLocalResourcesChecker].toSet()
}

Solution Approach

A solution needs to address two issues:

1.) find all Checker subclasses One approach here relies on Java annotations, described by Przemysław Wojnowski, and uses the Reflections library.

2.) instantiate these classes (aka Factory for the checkers)