import re


def commit_message_contains_query(message, query_terms):
    """
    Check if the commit message contains the query terms
    @param message: The commit message
    @param query_terms: The terms that we look for in the message
    @return:
    """
    tester = r'\b(' + '|'.join(query_terms) + ')'
    has_refactor_string = r'\b(refactor)'
    return bool(re.search(tester, message, re.IGNORECASE)) and not bool(
        re.search(has_refactor_string, message, re.IGNORECASE))