Check the messages of the commits.

def message(obj, commit='HEAD', skip_merge_commits=False):
    """Check the messages of the commits."""
    from ..kwalitee import check_message
    options = obj.options
    repository = obj.repository

    if options.get('colors') is not False:
        colorama.init(autoreset=True)
        reset = colorama.Style.RESET_ALL
        yellow = colorama.Fore.YELLOW
        green = colorama.Fore.GREEN
        red = colorama.Fore.RED
    else:
        reset = yellow = green = red = ''

    try:
        sha = 'oid'
        commits = _pygit2_commits(commit, repository)
    except ImportError:
        try:
            sha = 'hexsha'
            commits = _git_commits(commit, repository)
        except ImportError:
            click.echo('To use this feature, please install pygit2. '
                       'GitPython will also work but is not recommended '
                       '(python <= 2.7 only).',
                       file=sys.stderr)
            return 2

    template = '{0}commit {{commit.{1}}}{2}\n\n'.format(yellow, sha, reset)
    template += '{message}{errors}'

    count = 0
    ident = '    '
    re_line = re.compile('^', re.MULTILINE)
    for commit in commits:
        if skip_merge_commits and _is_merge_commit(commit):
            continue
        message = commit.message
        errors = check_message(message, **options)
        message = re.sub(re_line, ident, message)
        if errors:
            count += 1
            errors.insert(0, red)
        else:
            errors = [green, 'Everything is OK.']
        errors.append(reset)

        click.echo(template.format(commit=commit,
                                   message=message.encode('utf-8'),
                                   errors='\n'.join(errors)))

    if min(count, 1):
        raise click.Abort