prospector/ranking/rules.py
def apply_rule_changes_relevant_path(
    candidate: Commit, advisory_record: AdvisoryRecord
) -> str:
    """
    This rule matches commits that touch some file that is mentioned
    in the text of the advisory.
    """

    relevant_paths = []

    explanation_template = "This commit touches the following relevant paths: {}"

    relevant_paths = set(
        [
            path
            for path in candidate.changed_files
            for adv_path in advisory_record.paths
            if adv_path in path
        ]
    )

    if len(relevant_paths) > 0:
        explanation = explanation_template.format(", ".join(relevant_paths))
        return explanation

    return None

    This rule matches commits that touch some file that is mentioned
    in the text of the advisory.
    
This rule matches commits that touch some file that is mentioned
in the text of the advisory.
This rule matches commits that touch some file that is mentioned in the text of the advisory .
def apply_rule_changes_relevant_path(
    candidate: Commit, advisory_record: AdvisoryRecord
) -> str:
    relevant_paths = []
    explanation_template = "This commit touches the following relevant paths: {}"
    relevant_paths = set(
        [
            path
            for path in candidate.changed_files
            for adv_path in advisory_record.paths
            if adv_path in path
        ]
    )
    if len(relevant_paths) > 0:
        explanation = explanation_template.format(", ".join(relevant_paths))
        return explanation
    return None
def apply_rule_changes_relevant_path ( candidate : Commit , advisory_record : AdvisoryRecord ) -> str : relevant_paths = [ ] explanation_template = "This commit touches the following relevant paths: {}" relevant_paths = set ( [ path for path in candidate . changed_files for adv_path in advisory_record . paths if adv_path in path ] ) if len ( relevant_paths ) > 0 : explanation = explanation_template . format ( ", " . join ( relevant_paths ) ) return explanation return None
This rule matches commits that touch some file that is mentioned
in the text of the advisory.
This rule matches commits that touch some file that is mentioned in the text of the advisory .
"""
    This rule matches commits that touch some file that is mentioned
    in the text of the advisory.
    """
candidate
Commit
advisory_record
AdvisoryRecord