Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support environment variables in the configuration for CoverityChecker #150

Merged
merged 22 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d1b3ff4
Fix error when env variable is used
JokeWaumans Nov 15, 2024
dcb292d
Use env variables for unclassified Coverity classification to test di…
JokeWaumans Nov 18, 2024
30871cb
Order imports
JokeWaumans Nov 18, 2024
62bf2dc
Unnecessary use of "r" when opening file
JokeWaumans Nov 18, 2024
70ab119
Use unittest.mock.patch.dict to set envvar
JokeWaumans Nov 18, 2024
00509e2
Add newline before class
JokeWaumans Nov 18, 2024
fd9c776
Revert "Add newline before class"
JokeWaumans Nov 18, 2024
6b16c6d
Add new line before class
JokeWaumans Nov 18, 2024
185700f
Merge branch 'master' of https://github.com/melexis/warnings-plugin i…
JasperCraeghs Nov 23, 2024
14790e6
Merge branch 'master' into fix-cov-var
JokeWaumans Nov 25, 2024
45fcc8a
Make sure that the code quality report always has the same order
JokeWaumans Nov 25, 2024
a3d2119
Merge branch 'fix-cov-var' of github.com:melexis/warnings-plugin into…
JokeWaumans Nov 25, 2024
01c0c39
Reorder checkers
JokeWaumans Nov 25, 2024
00ddb3c
Reorder code quality report of test
JokeWaumans Nov 25, 2024
dbff44b
Delete min/max from coverity since they are seen as "classifications"
JokeWaumans Nov 25, 2024
03dec47
Revert "Delete min/max from coverity since they are seen as "classifi…
JokeWaumans Nov 25, 2024
7912233
Add warning when Polyspace checker is used with other checkers
JokeWaumans Nov 25, 2024
00044dc
Fix tests by emptying fingerprints of Finding for each test
JokeWaumans Nov 25, 2024
62bb682
Fix test code quality
JokeWaumans Nov 25, 2024
feb643e
Update test_cq_description_format to check if warnings were printed
JokeWaumans Nov 25, 2024
575d372
Add test to catch error of using Polyspace checker together with othe…
JokeWaumans Nov 25, 2024
8dd1bbd
Simplify TC
JasperCraeghs Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/mlx/warnings/regex_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
8 changes: 8 additions & 0 deletions tests/test_coverity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from io import StringIO
import os
from unittest import TestCase
from pathlib import Path
import filecmp
Expand All @@ -13,9 +14,16 @@

class TestCoverityWarnings(TestCase):
def setUp(self):
os.environ['MIN_COV_WARNINGS'] = '0'
JasperCraeghs marked this conversation as resolved.
Show resolved Hide resolved
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]
JasperCraeghs marked this conversation as resolved.
Show resolved Hide resolved

def test_no_warning_normal_text(self):
dut = 'This should not be treated as warning'
self.warnings.check(dut)
Expand Down
6 changes: 4 additions & 2 deletions tests/test_in/config_example_coverity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading