in bugbot/rules/crash_small_volume.py [0:0]
def set_autofix(self, bugs):
"""Set the autofix for each bug."""
low_volume_signatures = self._get_low_volume_crash_signatures(bugs)
for bugid, bug in bugs.items():
autofix = {}
reasons = []
if bug["keywords_to_remove"]:
reasons.append(
"Based on the [topcrash criteria](https://wiki.mozilla.org/CrashKill/Topcrash), the crash "
+ (
"signature linked to this bug is not a topcrash signature anymore."
if len(bug["signatures"]) == 1
else "signatures linked to this bug are not in the topcrash signatures anymore."
)
)
autofix["keywords"] = {"remove": list(bug["keywords_to_remove"])}
autofix["flags"] = [
{
"id": flag_id,
"status": "X",
}
for flag_id in bug["needinfos_to_remove"]
]
if not bug["ignore_severity"] and all(
signature in low_volume_signatures for signature in bug["signatures"]
):
reasons.append(
f"Since the crash volume is low (less than {self.min_crash_volume} per week), "
"the severity is downgraded to `S3`. "
"Feel free to change it back if you think the bug is still critical."
)
autofix["severity"] = "S3"
bug["severity"] += " → " + autofix["severity"]
if autofix:
bug["deleted_keywords_count"] = (
len(bug["keywords_to_remove"]) if bug["keywords_to_remove"] else "-"
)
reasons.append(self.get_documentation())
autofix["comment"] = {
"body": "\n\n".join(reasons),
}
self.autofix_changes[bugid] = autofix