diff --git a/src/mlx/warnings/regex_checker.py b/src/mlx/warnings/regex_checker.py index dc6075c8..c40fdf27 100644 --- a/src/mlx/warnings/regex_checker.py +++ b/src/mlx/warnings/regex_checker.py @@ -196,10 +196,7 @@ def parse_config(self, config): classification_key = classification.lower().replace("_", " ") if classification_key in CoverityClassificationChecker.SEVERITY_MAP: checker = CoverityClassificationChecker(classification=classification_key, verbose=self.verbose) - if maximum := checker_config.get("max", 0): - checker.maximum = int(maximum) - if minimum := checker_config.get("min", 0): - checker.minimum = int(minimum) + checker.parse_config(checker_config) self.checkers[classification_key] = checker else: print(f"WARNING: Unrecognized classification {classification!r}") diff --git a/tests/test_coverity.py b/tests/test_coverity.py index 5ff43ef7..5bb2394d 100644 --- a/tests/test_coverity.py +++ b/tests/test_coverity.py @@ -1,4 +1,5 @@ from io import StringIO +import os from unittest import TestCase from pathlib import Path import filecmp @@ -13,9 +14,16 @@ class TestCoverityWarnings(TestCase): def setUp(self): + os.environ['MIN_COV_WARNINGS'] = '0' + os.environ['MAX_COV_WARNINGS'] = '0' self.warnings = WarningsPlugin(verbose=True) self.warnings.activate_checker_name('coverity') + def tearDown(self): + for var in ('MIN_POLY_WARNINGS', 'MAX_POLY_WARNINGS'): + if var in os.environ: + del os.environ[var] + def test_no_warning_normal_text(self): dut = 'This should not be treated as warning' self.warnings.check(dut) diff --git a/tests/test_in/config_example_coverity.yml b/tests/test_in/config_example_coverity.yml index 52f1eba5..22c85122 100644 --- a/tests/test_in/config_example_coverity.yml +++ b/tests/test_in/config_example_coverity.yml @@ -4,11 +4,13 @@ coverity: min: 0 max: -1 bug: - max: 0 - pending: min: 0 max: 0 + pending: + min: $MIN_COV_WARNINGS + max: '$MAX_COV_WARNINGS' false_positive: + min: 0 max: -1 sphinx: enabled: false