prospector/ranking/rules.py
def apply_rule_code_tokens_in_msg(
    candidate: Commit, advisory_record: AdvisoryRecord
) -> str:
    """
    This rule matches commits whose commit message contain some of the special "code tokens"
    extracted from the advisory.
    """

    explanation_template = "The commit message includes the following keywords: {}"

    matching_keywords = set(
        [kw for kw in advisory_record.code_tokens if kw in candidate.message]
    )

    if len(matching_keywords) > 0:
        return explanation_template.format(", ".join(matching_keywords))

    return None

    This rule matches commits whose commit message contain some of the special "code tokens"
    extracted from the advisory.
    
This rule matches commits whose commit message contain some of the special "code tokens"
extracted from the advisory.
This rule matches commits whose commit message contain some of the special " code tokens " extracted from the advisory .
def apply_rule_code_tokens_in_msg(
    candidate: Commit, advisory_record: AdvisoryRecord
) -> str:
    explanation_template = "The commit message includes the following keywords: {}"
    matching_keywords = set(
        [kw for kw in advisory_record.code_tokens if kw in candidate.message]
    )
    if len(matching_keywords) > 0:
        return explanation_template.format(", ".join(matching_keywords))
    return None
def apply_rule_code_tokens_in_msg ( candidate : Commit , advisory_record : AdvisoryRecord ) -> str : explanation_template = "The commit message includes the following keywords: {}" matching_keywords = set ( [ kw for kw in advisory_record . code_tokens if kw in candidate . message ] ) if len ( matching_keywords ) > 0 : return explanation_template . format ( ", " . join ( matching_keywords ) ) return None
This rule matches commits whose commit message contain some of the special "code tokens"
extracted from the advisory.
This rule matches commits whose commit message contain some of the special " code tokens " extracted from the advisory .
"""
    This rule matches commits whose commit message contain some of the special "code tokens"
    extracted from the advisory.
    """
candidate
Commit
advisory_record
AdvisoryRecord