summaryrefslogtreecommitdiff
path: root/monkey
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2017-02-28 11:44:57 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2017-02-28 11:44:57 +0100
commit3eab86dfb1232d46420005f2d0ccccbeaadda59d (patch)
tree3e35c996b3b95656709cb2d5446a4aa421c7f312 /monkey
parent265e44cd53d43f581f13fb31dccdc4da35144dc1 (diff)
monkey.rules: give intent hints only when at least two patterns match
Diffstat (limited to 'monkey')
-rw-r--r--monkey/rules.py8
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