Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-3638

RangeField mis-handles max < min

    Details

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

      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.

        Attachments

          Activity

            People

            • Assignee:
              rowen Russell Owen
              Reporter:
              rowen Russell Owen
              Reviewers:
              John Swinbank
              Watchers:
              Jim Bosch, John Swinbank, Kian-Tat Lim, Robert Lupton, Russell Owen, Simon Krughoff
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Summary Panel