Skip to content

Commit 049aa3d

Browse files
committed
util: add check to not update to failing value
Signed-off-by: Vitor Bandeira <[email protected]>
1 parent a396b6f commit 049aa3d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

flow/util/genRuleFile.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,13 @@
248248

249249
compare = ops[option['compare']]
250250

251+
if compare(rule_value, metrics[field]) and 'padding' in option.keys():
252+
rule_value = metrics[field] * (1 + option['padding'] / 100)
253+
if option['round_value'] and not isinf(rule_value):
254+
rule_value = int(round(rule_value))
255+
else:
256+
rule_value = ceil(rule_value * 100) / 100.0
257+
251258
UPDATE = False
252259
if args.tighten \
253260
and rule_value != old_rule['value'] \

0 commit comments

Comments
 (0)