Remediate one wafer thing decision logic bug

Previously we were hitting the catch-all return that decided the error
was selected. Instead, let's add specific logic since we now know how we
would hit that and we actually don't want it to be selected.

Closes #354
This commit is contained in:
Ian Stapleton Cordasco 2017-07-28 06:10:12 -05:00
parent 0239f15dcc
commit a44a09f87a
No known key found for this signature in database
GPG key ID: C9D7A2604B4FCB2A
2 changed files with 6 additions and 4 deletions

View file

@ -263,6 +263,9 @@ class DecisionEngine(object):
if (select is None and
(extra_select is None or not self.using_default_ignore)):
return Decision.Ignored
if ((select is None and not self.using_default_select) and
(ignore is None and self.using_default_ignore)):
return Decision.Ignored
return Decision.Selected
def make_decision(self, code):

View file

@ -162,11 +162,10 @@ def test_decision_for(select_list, ignore_list, error_code, expected):
style_guide.Decision.Ignored),
(defaults.SELECT, ['E126'], [], ['I'], 'I101',
style_guide.Decision.Selected),
# This next one should exercise the catch-all return and yes, this is
# a *very* odd combination but users find much odder combinations
# anyway.
(['E', 'W'], defaults.IGNORE, ['I'], [], 'I101',
style_guide.Decision.Selected),
style_guide.Decision.Ignored),
# TODO(sigmavirus24) Figure out how to exercise the final catch-all
# return statement
]
)
def test_more_specific_decision_for_logic(select, ignore, extend_select,