From 4c749d8b6caa6bed3a2abd49bec5080ddb0c9293 Mon Sep 17 00:00:00 2001 From: Simon Ilyushchenko Date: Mon, 13 Nov 2023 08:50:00 -0800 Subject: [PATCH] Set an upper limit on the number of visualizations to 50 Clarify error about not referencing incomplete datasets in catalog.jsonnet PiperOrigin-RevId: 581978130 --- checker/node/visualizations.py | 2 +- checker/node/visualizations_test.py | 5 +++-- checker/tree/parent_child.py | 6 ++++-- checker/tree/parent_child_test.py | 4 +++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/checker/node/visualizations.py b/checker/node/visualizations.py index 2336aada9..46bc00dff 100644 --- a/checker/node/visualizations.py +++ b/checker/node/visualizations.py @@ -253,7 +253,7 @@ def run(cls, node: stac.Node) -> Iterator[stac.Issue]: yield cls.new_issue(node, f'{VISUALIZATIONS} must have at least 1 entry') return - if len(visualizations) > 4: + if len(visualizations) > 50: yield cls.new_issue( node, f'{VISUALIZATIONS} has too many entries: {len(visualizations)}') diff --git a/checker/node/visualizations_test.py b/checker/node/visualizations_test.py index e6129e46b..a29277e5d 100644 --- a/checker/node/visualizations_test.py +++ b/checker/node/visualizations_test.py @@ -121,8 +121,9 @@ def test_visualizations_too_many(self): 'image_visualization': {}, 'lookat': {'lat': 1, 'lon': 2, 'zoom': 3}} self.assert_collection( - {'summaries': {'gee:visualizations': [vis, vis, vis, vis, vis]}}, - 'gee:visualizations has too many entries: 5') + {'summaries': {'gee:visualizations': [vis] * 51}}, + 'gee:visualizations has too many entries: 51', + ) def test_visualization_not_dict(self): self.assert_collection( diff --git a/checker/tree/parent_child.py b/checker/tree/parent_child.py index 6eb21c294..554c13d42 100644 --- a/checker/tree/parent_child.py +++ b/checker/tree/parent_child.py @@ -89,8 +89,10 @@ def run(cls, nodes: list[stac.Node]) -> Iterator[stac.Issue]: f'catalog_url != parent_url: {catalog_url} {a_parent_url}') elif node.stac.get(GEE_SKIP_INDEXING): message = ( - f'Child link when {GEE_SKIP_INDEXING} is true: ' - f'{catalog_url} {a_self_url}') + "Please don't reference in catalog.jsonnet datasets that have " + f'{GEE_SKIP_INDEXING} set to true: ' + f'{catalog_url} {a_self_url}' + ) yield cls.new_issue(node, message) else: if (node.id != GEE_CATALOG and not node.stac.get(GEE_SKIP_INDEXING) and diff --git a/checker/tree/parent_child_test.py b/checker/tree/parent_child_test.py index 58be4495e..a320bd878 100644 --- a/checker/tree/parent_child_test.py +++ b/checker/tree/parent_child_test.py @@ -153,7 +153,9 @@ def test_incorrectly_have_child_link_with_skip_indexing(self): issues = list(Check.run(nodes)) message = ( - 'Child link when gee:skip_indexing is true: AAFC/catalog AAFC/AAFC_ACI') + "Please don't reference in catalog.jsonnet datasets that have " + 'gee:skip_indexing set to true: AAFC/catalog AAFC/AAFC_ACI' + ) expect = [Check.new_issue(a_collection_node, message)] self.assertEqual(expect, issues)