From 3eab86dfb1232d46420005f2d0ccccbeaadda59d Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 28 Feb 2017 11:44:57 +0100 Subject: monkey.rules: give intent hints only when at least two patterns match --- monkey/rules.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'monkey') diff --git a/monkey/rules.py b/monkey/rules.py index c8e1a65..d3bdf71 100644 --- a/monkey/rules.py +++ b/monkey/rules.py @@ -71,11 +71,15 @@ def suggest_true(bugs, program, patterns): n_found = len(match[True]) matches[n_found].append(match) + # we want at least two matching patterns to consider hinting + if max(matches) < 2: + return None + # consider only rules that have maximum matching patterns candidate_rules = matches[max(matches)] - # if there is candidate with no missing patterns, the program should already - # be correct, so do not try hinting + # if there is candidate a with no missing patterns, the program should + # already be correct, so do not try hinting because we know nothing if any(not match[False] for match in candidate_rules): return None -- cgit v1.2.1