in bugbot/rules/topcrash_highlight.py [0:0]
def handle_bug(self, bug, data):
bugid = str(bug["id"])
if bugid in data:
return
topcrash_signatures = self._get_topcrash_signatures(bug)
keywords_to_add = self._get_keywords_to_be_added(bug, topcrash_signatures)
is_keywords_removed = utils.is_keywords_removed_by_bugbot(bug, keywords_to_add)
actions = []
autofix = {
"comment": {
"body": "",
},
}
if keywords_to_add and not is_keywords_removed:
autofix["keywords"] = {"add": keywords_to_add}
autofix["comment"]["body"] += self.get_matching_criteria_comment(
topcrash_signatures, is_keywords_removed
)
actions.extend(f"Add {keyword} keyword" for keyword in keywords_to_add)
if (
keywords_to_add
and is_keywords_removed
and self._is_matching_restrictive_criteria(topcrash_signatures)
):
# FIXME: This is a workaround to monitor the cases where the bot
# supposed re-add topcrash keywords.
# More context in: https://github.com/mozilla/bugbot/issues/2100
actions.extend(
f"Add {keyword} keyword (not applied to avoid noise)"
for keyword in keywords_to_add
)
data[bugid] = {
"severity": bug["severity"],
"actions": actions,
}
return bug
ni_person = utils.get_mail_to_ni(bug)
if (
ni_person
and bug["severity"] in LOW_SEVERITY
and "meta" not in bug["keywords"]
and not self._has_severity_increase_comment(bug)
and not self._was_severity_set_after_topcrash(bug)
):
autofix["flags"] = [
{
"name": "needinfo",
"requestee": ni_person["mail"],
"status": "?",
"new": "true",
}
]
autofix["comment"]["body"] += (
f'\n:{ ni_person["nickname"] }, '
"could you consider increasing the severity of this top-crash bug?"
)
actions.append("Suggest increasing the severity")
if not actions:
return
autofix["comment"]["body"] += f"\n\n{ self.get_documentation() }\n"
self.autofix_changes[bugid] = autofix
data[bugid] = {
"severity": bug["severity"],
"actions": actions,
}
return bug