-
Notifications
You must be signed in to change notification settings - Fork 24
Convert configured mass threshold to integer #20
Conversation
@@ -15,7 +15,11 @@ def languages | |||
end | |||
|
|||
def mass_threshold_for(language) | |||
fetch_language(language).fetch("mass_threshold", nil) | |||
threshold = fetch_language(language).fetch("mass_threshold", nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when this returns nil? Do we default it somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't the YAML parsing properly casting this value to an integer? |
Do we have an upstream bug where we're incorrectly casting the value from an integer to a string in the YAML -> JSON translation? |
That may be it, by the time it gets to the
Returns |
For reference, when running |
I would have to guess it's this logic that introduced an incorrect cast within the "arbitrary" |
Being defensive here is probably right regardless so 👍 from me on this pull. I'll log a card to look at the upstream bug so it doesn't get lost. |
I also think being defensive is the best approach since it will work even if they pass |
Currently a configured mass threshold will be returned as a string when flay expects an integer when it tries to compare mass to mass threshold. This also renames the assertion since the previous title was incorrect.
ad20fca
to
79da837
Compare
👍 as well |
Currently a configured mass threshold will be returned as a string when
flay expects an integer when it tries to compare mass to mass threshold.
This also renames the assertion since the previous title was incorrect.