Skip to content

Commit

Permalink
remove 'subchecker' attr by relying on 'name' attr
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperCraeghs committed Dec 16, 2024
1 parent 6dc425d commit ad66c25
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/mlx/warnings/polyspace_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,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_main_checker(self):
return not 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_main_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 ad66c25

Please sign in to comment.