RangeField mis-handles max < min

XMLWordPrintable

Details

• Type: Bug
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
None
• Templates:
• Story Points:
1
• Sprint:
Science Pipelines DM-W16-2
• Team:

Description

RangeField contains the following bit of code to handle the case that max < min:

  if min is not None and max is not None and min > max:  swap(min, max) 

This is broken because there is no swap function and if there was it could not work in-place like this. However, rather than replace this with the standard min, max = max, min I suggest we raise an exception. If max < min then this probably indicates some kind of error or sloppiness that should not be silently ignored. If we insist on swapping the values then at least we should print a warning.

The fact that this bug has never been reported strongly suggests that we never do set min > max and thus that an exception will be fine.

People

• Assignee:
Russell Owen
Reporter:
Russell Owen
Reviewers:
John Swinbank
Watchers:
Jim Bosch, John Swinbank, Kian-Tat Lim, Robert Lupton, Russell Owen, Simon Krughoff