Skip to content

Commit

Permalink
changed if structure of _check method
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Utz <[email protected]>
  • Loading branch information
ant-u committed Nov 22, 2024
1 parent abf0c4d commit 8687856
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/ros_license_toolkit/license_checks/schema_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,21 @@ def _check(self, package):
self._success(f"Detected package.xml version {version}, "
"validation of scheme successful.")
else:
if version == -1:
self._failed("package.xml does not contain correct package "
"format number. Please use a real version. "
"(e.g. <package format=\"3\">)")
elif version == 1:
self._failed(
"package.xml contains errors: "
f"{self.xml_schema_1.error_log.last_error.message}")
reason = ''
if version == 1:
reason = "package.xml contains errors: " +\
f"{self.xml_schema_1.error_log.last_error.message}"
elif version == 2:
self._failed(
"package.xml contains errors: "
f"{self.xml_schema_2.error_log.last_error.message}")
reason = "package.xml contains errors: " +\
f"{self.xml_schema_2.error_log.last_error.message}"
elif version == 3:
self._failed(
"package.xml contains errors: "
f"{self.xml_schema_3.error_log.last_error.message}")
reason = "package.xml contains errors: " +\
f"{self.xml_schema_3.error_log.last_error.message}"
elif version == -1:
reason = "package.xml does not contain correct package " +\
"format number. Please use a real version. " +\
"(e.g. <package format=\"3\">)"
self._failed(reason)

def validate(self, pck_xml_path: str) -> Tuple[int, bool]:
"""This is validating package.xml file from given path.
Expand Down

0 comments on commit 8687856

Please sign in to comment.