Skip to content

Commit

Permalink
Merge pull request #168 from melexis/urls
Browse files Browse the repository at this point in the history
Merge #164 to master
  • Loading branch information
JasperCraeghs authored Dec 16, 2024
2 parents d0ea557 + 1d74c5e commit fd05e60
Show file tree
Hide file tree
Showing 28 changed files with 1,790 additions and 1,337 deletions.
249 changes: 132 additions & 117 deletions docs/design.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,157 +10,172 @@ Software Design
Class Diagram
=============

.. uml generated by `pyreverse mlx.warnings --filter ALL -o plantuml`
.. uml generated by `pyreverse mlx.warnings --filter PUB_ONLY -o plantuml`
.. uml::

@startuml classes
set namespaceSeparator none
class "CoverityChecker" as mlx.warnings.regex_checker.CoverityChecker {
CLASSIFICATION : str
count
name : str
pattern
check(content)
checkers : dict
count : int
cq_default_path
cq_description_template
cq_findings
name : str
pattern
check(content)
parse_config(config)
return_check_limits()
return_count()
}
class "CoverityClassificationChecker" as mlx.warnings.regex_checker.CoverityClassificationChecker {
SEVERITY_MAP : dict
classification
count
cq_description_template
logging_fmt : str
name : str
add_code_quality_finding(match)
check(content)
}
class "DebugOnlyFilter" as mlx.warnings.warnings_checker.DebugOnlyFilter {
filter(record: logging.LogRecord) -> bool
}
class "DoxyChecker" as mlx.warnings.regex_checker.DoxyChecker {
name : str
pattern
name : str
pattern
}
class "Finding" as mlx.warnings.code_quality.Finding {
column
description
fingerprint
fingerprints : dict
line
path
severity
to_dict()
}
class "JUnitChecker" as mlx.warnings.junit_checker.JUnitChecker {
count
name : str
_check_testcase(testcase)
check(content)
prepare_tree(root_input)
count
name : str
name_repr
check(content)
prepare_tree(root_input)
}
class "PolyspaceChecker" as mlx.warnings.polyspace_checker.PolyspaceChecker {
_cq_description_template : Template
checkers : list
count : int
counted_warnings
cq_default_path
cq_description_template
maximum
minimum
name : str
__init__(verbose)
check(content)
parse_config(config)
return_check_limits()
return_count()
checkers : list
count : int
cq_default_path
cq_description_template
cq_findings
maximum
minimum
name : str
check(content)
parse_config(config)
return_check_limits()
return_count()
}
class "PolyspaceFamilyChecker" as mlx.warnings.polyspace_checker.PolyspaceFamilyChecker {
_cq_description_template
check_value
code_quality_severity : dict
column_name
count
cq_description_template
cq_findings : list
family_value
__init__(family_value, column_name, check_value)
add_code_quality_finding(row)
check(content)
return_count()
check_value
code_quality_severity : dict
column_name
count
cq_description_template
family_value
logging_fmt : str
name : str
add_code_quality_finding(row)
check(content)
}
class "RegexChecker" as mlx.warnings.regex_checker.RegexChecker {
SEVERITY_MAP : dict
count
name : str
pattern : NoneType
add_code_quality_finding(match)
check(content)
SEVERITY_MAP : dict
count
name : str
pattern : NoneType
add_code_quality_finding(match)
check(content)
}
class "RobotChecker" as mlx.warnings.robot_checker.RobotChecker {
checkers : list
count : int
counted_warnings
maximum
minimum
name : str
check(content)
parse_config(config)
return_check_limits()
return_count()
checkers : list
count : int
logging_fmt : str
maximum
minimum
name : str
check(content)
parse_config(config)
return_check_limits()
return_count()
}
class "RobotSuiteChecker" as mlx.warnings.robot_checker.RobotSuiteChecker {
check_suite_name : bool
is_valid_suite_name : bool
name
__init__(name, check_suite_name)
_check_testcase(testcase)
check(content)
return_count()
check_suite_name : bool
is_valid_suite_name : bool
logging_fmt : str
name : str
suite_name
suite_name_repr
check(content)
}
class "SphinxChecker" as mlx.warnings.regex_checker.SphinxChecker {
name : str
pattern
sphinx_deprecation_regex : str
sphinx_deprecation_regex_in_match : str
include_sphinx_deprecation()
name : str
pattern
sphinx_deprecation_regex : str
sphinx_deprecation_regex_in_match : str
include_sphinx_deprecation()
}
class "WarningsChecker" as mlx.warnings.warnings_checker.WarningsChecker {
_counted_warnings : list
_cq_description_template : Template
_maximum : int
_minimum : int
count : int
counted_warnings
cq_default_path : str
cq_description_template
cq_enabled : bool
cq_findings : list
exclude_patterns : list
include_patterns : list
maximum
minimum
name : str
verbose : bool
__init__(verbose)
_is_excluded(content)
_return_error_code()
_search_patterns(content, patterns)
add_patterns(regexes, pattern_container)
{abstract}check(content)
parse_config(config)
print_when_verbose(message)
return_check_limits()
return_count()
count : int
cq_default_path : str
cq_description_template
cq_enabled : bool
cq_findings
exclude_patterns : list
include_patterns : list
is_sub_checker
logger : LoggerAdapter, NoneType, RootLogger
logging_args : tuple
logging_fmt : str
maximum
minimum
name : str
name_repr
add_patterns(regexes, pattern_container)
{abstract}check(content)
parse_config(config)
return_check_limits()
return_count()
}
class "<color:red>WarningsConfigError</color>" as mlx.warnings.exceptions.WarningsConfigError {
}
class "WarningsPlugin" as mlx.warnings.warnings.WarningsPlugin {
_maximum : int
_minimum : int
activated_checkers : dict
count : int
cq_enabled : bool
printout : bool
public_checkers : list
verbose : bool
__init__(verbose, config_file, cq_enabled)
activate_checker(checker)
activate_checker_name(name)
check(content)
check_logfile(file)
config_parser(config)
configure_maximum(maximum)
configure_minimum(minimum)
get_checker(name)
return_check_limits(name)
return_count(name)
toggle_printout(printout)
write_code_quality_report(out_file)
write_counted_warnings(out_file)
activated_checkers : dict
count : int
cq_enabled : bool
printout : bool
public_checkers : tuple
activate_checker(checker_type)
activate_checker_name(name)
check(content)
check_logfile(file)
config_parser(config)
configure_maximum(maximum)
configure_minimum(minimum)
get_checker(name)
return_check_limits(name)
return_count(name)
toggle_printout(printout)
write_code_quality_report(out_file)
}
class "XMLRunnerChecker" as mlx.warnings.regex_checker.XMLRunnerChecker {
name : str
pattern
name : str
pattern
}
mlx.warnings.junit_checker.JUnitChecker --|> mlx.warnings.warnings_checker.WarningsChecker
mlx.warnings.polyspace_checker.PolyspaceChecker --|> mlx.warnings.warnings_checker.WarningsChecker
mlx.warnings.polyspace_checker.PolyspaceFamilyChecker --|> mlx.warnings.warnings_checker.WarningsChecker
mlx.warnings.regex_checker.CoverityChecker --|> mlx.warnings.regex_checker.RegexChecker
mlx.warnings.regex_checker.CoverityClassificationChecker --|> mlx.warnings.warnings_checker.WarningsChecker
mlx.warnings.regex_checker.DoxyChecker --|> mlx.warnings.regex_checker.RegexChecker
mlx.warnings.regex_checker.RegexChecker --|> mlx.warnings.warnings_checker.WarningsChecker
mlx.warnings.regex_checker.SphinxChecker --|> mlx.warnings.regex_checker.RegexChecker
Expand Down
32 changes: 16 additions & 16 deletions src/mlx/warnings/__init__.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
""" Melexis fork of warnings plugin """

__all__ = [
'CoverityChecker',
'DoxyChecker',
'Finding',
'JUnitChecker',
'PolyspaceChecker',
'PolyspaceFamilyChecker',
'RobotChecker',
'RobotSuiteChecker',
'SphinxChecker',
'WarningsChecker',
'WarningsPlugin',
'XMLRunnerChecker',
'__version__',
'warnings_wrapper',
'WarningsConfigError',
"CoverityChecker",
"DoxyChecker",
"Finding",
"JUnitChecker",
"PolyspaceChecker",
"PolyspaceFamilyChecker",
"RobotChecker",
"RobotSuiteChecker",
"SphinxChecker",
"WarningsChecker",
"WarningsPlugin",
"XMLRunnerChecker",
"__version__",
"warnings_wrapper",
"WarningsConfigError",
]


from .__version__ import __version__
from .code_quality import Finding
from .exceptions import WarningsConfigError
from .junit_checker import JUnitChecker
from .polyspace_checker import PolyspaceChecker, PolyspaceFamilyChecker
from .regex_checker import CoverityChecker, DoxyChecker, SphinxChecker, XMLRunnerChecker
from .robot_checker import RobotChecker, RobotSuiteChecker
from .polyspace_checker import PolyspaceChecker, PolyspaceFamilyChecker
from .warnings import WarningsPlugin, warnings_wrapper
from .warnings_checker import WarningsChecker
4 changes: 1 addition & 3 deletions src/mlx/warnings/__main__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0

"""
Python module for running the warnings plugin
"""
from mlx.warnings.warnings import main


if __name__ == '__main__':
if __name__ == "__main__":
main()
8 changes: 2 additions & 6 deletions src/mlx/warnings/code_quality.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import hashlib
from pathlib import Path

Expand Down Expand Up @@ -32,9 +31,9 @@ def fingerprint(self):
4. Step 3 is repeated until a unique hash is obtained.
"""
hashable_string = f"{self.severity}{self.path}{self.description}"
new_hash = hashlib.md5(str(hashable_string).encode('utf-8')).hexdigest()
new_hash = hashlib.md5(str(hashable_string).encode("utf-8")).hexdigest()
while new_hash in self.fingerprints and self.fingerprints[new_hash] != self:
new_hash = hashlib.md5(f"{hashable_string}{new_hash}".encode('utf-8')).hexdigest()
new_hash = hashlib.md5(f"{hashable_string}{new_hash}".encode()).hexdigest()
type(self).fingerprints[new_hash] = self
return new_hash

Expand Down Expand Up @@ -114,6 +113,3 @@ def to_dict(self):
},
"fingerprint": self.fingerprint
}



Loading

0 comments on commit fd05e60

Please sign in to comment.