Skip to content

Commit

Permalink
Merge branch 'logging' of github.com:melexis/warnings-plugin into log…
Browse files Browse the repository at this point in the history
…ging
  • Loading branch information
JokeWaumans committed Dec 16, 2024
2 parents a40dd4c + d1a3c3a commit 6f1f32e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/mlx/warnings/junit_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def _check_testcase(self, testcase):
"""Handles the check of a test case element by checking if the result is a failure/error.
If it is to be excluded by a configured regex, 1 is returned.
Otherwise, when in verbose/output mode, the suite name and test case name are printed/written along with the
failure/error message.
Otherwise, when in verbose/output mode, the suite name and test case name are printed/written
In output mode, the failure/error message is written additionally.
Args:
testcase (junitparser.TestCase): Test case element to check for failure or error
Expand Down
3 changes: 0 additions & 3 deletions src/mlx/warnings/polyspace_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def parse_config(self, config):
{\n <column-name>: <value_to_check>,\n min: <number>,\n max: <number>\n}
"""
self.checkers = []
padding = 0
for family_value, data in config.items():
if family_value == "enabled":
continue
Expand All @@ -144,7 +143,6 @@ def parse_config(self, config):
continue
column_name = key.lower()
check_value = value.lower()
padding = max(padding, len(f"{family_value}: {column_name}: {check_value}"))
checker = PolyspaceFamilyChecker(family_value, column_name, check_value, *self.logging_args)
checker.parse_config(check)
self.checkers.append(checker)
Expand All @@ -165,7 +163,6 @@ def parse_config(self, config):

class PolyspaceFamilyChecker(WarningsChecker):
name = "polyspace_sub"
subchecker = True
code_quality_severity = {
"impact: high": "critical",
"impact: medium": "major",
Expand Down
1 change: 0 additions & 1 deletion src/mlx/warnings/regex_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ def parse_config(self, config):

class CoverityClassificationChecker(WarningsChecker):
name = "coverity_sub"
subchecker = True
logging_fmt = "{checker.name_repr}: {checker.classification:<14} | {message}"
SEVERITY_MAP = {
"false positive": "info",
Expand Down
1 change: 0 additions & 1 deletion src/mlx/warnings/robot_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def parse_config(self, config):

class RobotSuiteChecker(JUnitChecker):
name = "robot_sub"
subchecker = True
logging_fmt = "{checker.name_repr}: {checker.suite_name_repr:<20} {message}"

def __init__(self, suite_name, *logging_args, check_suite_name=False):
Expand Down
7 changes: 5 additions & 2 deletions src/mlx/warnings/warnings_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def filter(self, record: logging.LogRecord) -> bool:

class WarningsChecker:
name = "checker"
subchecker = False
logging_fmt = "{checker.name_repr}: {message}"

def __init__(self, verbose, output):
Expand Down Expand Up @@ -92,6 +91,10 @@ def __init__(self, verbose, output):
def name_repr(self):
return self.name.replace("_sub", "").capitalize()

@property
def is_sub_checker(self):
return self.name.endswith("_sub")

@property
def cq_findings(self):
"""List[dict]: list of code quality findings"""
Expand Down Expand Up @@ -209,7 +212,7 @@ def _return_error_code(self):
if error_code == 0:
error_code = 1
string_to_print = f"number of warnings ({self.count}) is {error_reason}."
if not self.subchecker:
if not self.is_sub_checker:
string_to_print += f" Returning error code {error_code}."
self.logger.warning(string_to_print)
return error_code
Expand Down

0 comments on commit 6f1f32e

Please sign in to comment.