Skip to content

Commit

Permalink
Apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
PromiseFru committed Feb 1, 2024
1 parent 6442aff commit 595768b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions bugbot/rules/performancebug.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@


class PerformanceBug(BzCleaner):
def __init__(self):
def __init__(self, confidence_threshold=0.9):
super().__init__()
self.confidence_threshold = confidence_threshold

def description(self):
return "[Using ML] Bugs with Missing Performance Impact"
Expand Down Expand Up @@ -52,9 +53,6 @@ def get_bugs(self, date="today", bug_ids=[]):
# security bug
continue

if not {"prob", "index"}.issubset(bug_data.keys()):
raise Exception(f"Invalid bug response {bug_id}: {bug_data!r}")

bug = raw_bugs[bug_id]
prob = bug_data["prob"]

Expand All @@ -68,6 +66,10 @@ def get_bugs(self, date="today", bug_ids=[]):
"autofixed": False,
}

# Only autofix results for which we are sure enough.
if prob[1] >= self.confidence_threshold:
results[bug_id]["autofixed"] = True

return results


Expand Down
4 changes: 2 additions & 2 deletions configs/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@
"cc": []
},
"performancebug": {
"days_lookup": 7,
"confidence_threshold": 0.9
"max_days_in_cache": 7,
"days_lookup": 7
},
"stepstoreproduce": {
"max_days_in_cache": 7,
Expand Down

0 comments on commit 595768b

Please sign in to comment.