Output analysis results in TAP format.

def output_tap(self):
        """Output analysis results in TAP format."""
        tracker = Tracker(streaming=True, stream=sys.stdout)
        for group in self.config.analysis_groups:
            n_providers = len(group.providers)
            n_checkers = len(group.checkers)
            if not group.providers and group.checkers:
                test_suite = group.name
                description_lambda = lambda r: r.checker.name
            elif not group.checkers:
                logger.warning(
                    'Invalid analysis group (no checkers), skipping')
                continue
            elif n_providers > n_checkers:
                test_suite = group.checkers[0].name
                description_lambda = lambda r: r.provider.name
            else:
                test_suite = group.providers[0].name
                description_lambda = lambda r: r.checker.name

            for result in group.results:
                description = description_lambda(result)
                if result.code == ResultCode.PASSED:
                    tracker.add_ok(test_suite, description)
                elif result.code == ResultCode.IGNORED:
                    tracker.add_ok(
                        test_suite, description + ' (ALLOWED FAILURE)')
                elif result.code == ResultCode.NOT_IMPLEMENTED:
                    tracker.add_not_ok(
                        test_suite, description, 'TODO implement the test')
                elif result.code == ResultCode.FAILED:
                    tracker.add_not_ok(
                        test_suite, description,
                        diagnostics='  ---\n  message: %s\n  hint: %s\n  ...' % (
                            '\n  message: '.join(result.messages.split('\n')),
                            result.checker.hint))