Skip to content

Commit

Permalink
Refactor to use one checker per rule
Browse files Browse the repository at this point in the history
Signed-off-by: hoangtungdinh <[email protected]>
  • Loading branch information
hoangtungdinh committed Sep 16, 2024
1 parent 4ca6128 commit 15984be
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
1 change: 0 additions & 1 deletion qc_otx/checks/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class CheckerData:
input_file_xml_root: etree._ElementTree
config: Configuration
result: Result
schema_version: str


@dataclass
Expand Down
5 changes: 0 additions & 5 deletions qc_otx/checks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ def get_all_attributes(
return attributes


def get_standard_schema_version(root: etree._ElementTree) -> Union[str, None]:
root_attrib = root.getroot().attrib
return root_attrib["version"]


def compare_versions(version1: str, version2: str) -> int:
"""Compare two version strings like "X.x.x"
This function is to avoid comparing version string basing on lexicographical order
Expand Down
4 changes: 1 addition & 3 deletions qc_otx/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,12 @@ def main():
input_param
)

root = etree.parse(config.get_config_param("InputFile"))
otx_schema_version = utils.get_standard_schema_version(root)
root = etree.parse(input_file_path)

checker_data = models.CheckerData(
input_file_xml_root=root,
config=config,
result=result,
schema_version=otx_schema_version,
)
# 1. Run basic checks
core_checker.run_checks(checker_data)
Expand Down

0 comments on commit 15984be

Please sign in to comment.