Skip to content

Commit

Permalink
feat: Add link checker for conforms to urls
Browse files Browse the repository at this point in the history
  • Loading branch information
kovalch committed Jan 18, 2024
1 parent 7b9113b commit 4365d2e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ckan_pkg_checker/checkers/link_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
TEST_QUALIFIED_RELATION_URL = "dcat:qualifiedRelation"
TEST_LANDING_PAGE_URL = "dcat:landingPage"
TEST_PUBLISHER_URL = "dct:publisher"
TEST_CONFORMS_TO_URL = "dct:conformsTo"
TEST_DOWNLOAD_URL = "dcat:downloadURL"
link_checks = [
TEST_ACCESS_URL,
TEST_RELATION_URL,
TEST_QUALIFIED_RELATION_URL,
TEST_LANDING_PAGE_URL,
TEST_PUBLISHER_URL,
TEST_CONFORMS_TO_URL,
TEST_DOWNLOAD_URL,
]

Expand Down Expand Up @@ -117,6 +119,16 @@ def check_package(self, pkg):
if check_result:
check_results.append(check_result)

# Check conforms to URL
if "conforms_to" in pkg:
for conforms_to_url in pkg["conforms_to"]:
if conforms_to_url:
check_result = self._check_url_status(
TEST_CONFORMS_TO_URL, conforms_to_url
)
if check_result:
check_results.append(check_result)

for resource in pkg["resources"]:
log.info(
f"LINKCHECKER: checking RESOURCE: {utils.get_field_in_one_language(resource['display_name'], '')}"
Expand Down

0 comments on commit 4365d2e

Please sign in to comment.