diff options
Diffstat (limited to 'monkey')
-rw-r--r-- | monkey/rules.py | 8 |
1 files changed, 6 insertions, 2 deletions
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 |