{"id":19309986,"url":"https://github.com/cedadev/cc-yaml","last_synced_at":"2026-05-12T12:32:49.540Z","repository":{"id":66788657,"uuid":"141154568","full_name":"cedadev/cc-yaml","owner":"cedadev","description":"compliance-checker plugin that generates check suites from YAML descriptions","archived":false,"fork":false,"pushed_at":"2020-07-21T11:41:26.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-02-24T03:26:34.157Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cedadev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-16T15:03:04.000Z","updated_at":"2020-07-21T11:41:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"69f3fdaf-c9aa-4705-978f-1a27a235c067","html_url":"https://github.com/cedadev/cc-yaml","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/cedadev/cc-yaml","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedadev%2Fcc-yaml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedadev%2Fcc-yaml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedadev%2Fcc-yaml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedadev%2Fcc-yaml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cedadev","download_url":"https://codeload.github.com/cedadev/cc-yaml/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedadev%2Fcc-yaml/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32939309,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T09:19:52.626Z","status":"ssl_error","status_checked_at":"2026-05-12T09:17:33.438Z","response_time":102,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T00:22:04.774Z","updated_at":"2026-05-12T12:32:49.524Z","avatar_url":"https://github.com/cedadev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cc-yaml\n\nThis repo holds a [compliance-checker](https://github.com/ioos/compliance-checker)\nplugin that generates check suites from YAML descriptions.\n\nIt is to be used with the\n[cedadev fork](https://github.com/cedadev/compliance-checker)\nof `compliance-checker` that allows plugins to generate check suites.\n\n## Installation\n\nTo set up you must install `compliance-checker` itself and this plugin (`cc-yaml`).\n\n```\npip install -e git+https://github.com/cedadev/compliance-checker\npip install -e git+https://github.com/cedadev/cc-yaml\n\ncompliance-checker --yaml \u003cpath-to-YAML-file\u003e --test \u003ctest name\u003e \u003cdataset\u003e\n```\n\n## Creating check suites from YAML descriptions\n\nThis plugin allows check suites to be generated from *base checks* using YAML\nfiles containing parameters to call these base checks with.\n\nThis allows you to write generic check methods that can be used across\ndifferent projects and called with different parameters (which can be\nproject-specific).\n\n### Example\n\nAn example YAML file is shown below. It uses base checks from\n[compliance-check-lib](https://github.com/cedadev/compliance-check-lib).\n\n```yaml\nsuite_name: \"custom-check-suite\"\n\nchecks:\n  - check_id: \"filesize_check\"\n    parameters: {\"threshold\": 1}\n    check_name: \"checklib.register.FileSizeCheck\"\n\n  - check_id: \"filename_check\"\n    parameters: {\"delimiter\": \"_\", \"extension\": \".nc\"}\n    check_name: \"checklib.register.FileNameStructureCheck\"\n\n  - check_id: \"attribute_check\"\n    parameters: {\"regex\": \"\\\\d+\", \"attribute\": \"author\"}\n    check_name: \"checklib.register.GlobalAttrRegexCheck\"\n    check_level: \"LOW\"\n```\n\nExplanation:\n\n* `suite_name` (in this example 'custom-check-suite') is the name of the generated suite (i.e. the\n  name to use after `--test` when running Compliance Checker from the command line)\n* Each item in the list `checks` defines a single check method:\n  * `check_id` is an identifier for the check (the identifier used is somewhat arbitrary, and is\n    only used for the name of the check method in the generated class)\n  * `check_name` is the *base check* where the actual code to perform the check is defined. It\n    should be of the form `\u003cmodule\u003e.class`. This module needs to be importable from the environment\n    in which Compliance Checker is run. Details on what this class should look like are given below.\n  * `parameters` is a dictionary that is passed to `__init__` when instantiating the class\n    specified in `check_name`.\n  * `check_level` is one of `HIGH`, `MEDIUM`, `LOW` and determines the priority level of the check.\n\nThis check suite can be run from the command line by using the `--yaml` option:\n```\ncompliance-checker --yaml \u003cpath-to-YAML-file\u003e --test custom-check-suite \u003cdataset\u003e\n```\n\n### Base Checks\n\nEach base check is represented as a class implementing the following interface:\n\n* **Define a property `supported_ds`**. This should be a list of dataset types\n  acceptable to run this check on. For example, this could be `[Dataset]` to\n  run checks against NetCDF files only, or `[Dataset, GenericFile]` to check\n  any file (including NetCDF files). Here `Dataset` and `GenericFile` are\n  defined in `compliance_checker.base`.\n\n* **Take a dictionary of parameters as first argument to `__init__`** (this is\n  the value of `parameters` in the YAML file)\n\n* **Accept `level` as an optional kwarg to `__init__`** (this is the value of\n  `check_level` from the YAML file)\n\n* **Implement `__call__(self, ds)`**. Here `ds` is the dataset object\n  constructed by compliance-checker (it will always be one of the types in\n  `supported_ds`). The return value from this method should be the same as for\n  any other compliance-checker check method. Documentation can be found on the\n  [compliance-checker development wiki page](https://github.com/ioos/compliance-checker/wiki/Development).\n\nA minimal example is provided below. This example check succeeds if a dataset\ncontains a given variable. The variable name is extracted from the YAML file.\n\n```python\nfrom compliance_checker.base import BaseCheck, Dataset, Result\n\nclass VariableExistsCheck(object):\n    supported_ds = [Dataset]\n\n    level = BaseCheck.MEDIUM\n\n    def __init__(self, params, level=None):\n        self.var_id = params[\"var_id\"]\n        if level:\n            self.level = getattr(BaseCheck, level)\n\n    def __call__(self, ds):\n        messages = []\n        success = self.var_id in ds.variables\n        if not success:\n            messages.append(\"Variable {} not found in dataset\".format(self.var_id))\n\n        return Result(\n            weight=self.level,\n            value=success,\n            name=\"Variable '{}' check\".format(self.var_id),\n            msgs=messages\n        )\n```\n\n### compliance-check-lib\n\nThe interface described above has been designed to be as general as possible.\nThe [compliance-check-lib](https://github.com/cedadev/compliance-check-lib)\nlibrary provides a base class `CallableCheckBase` that implements this\ninterface and provides extra features, such default parameters and validation\nof required parameters from YAML.\n\nIt also contains a plethora of real-world checks to use as examples:\n[see the code on GitHub](https://github.com/cedadev/compliance-check-lib/tree/master/checklib/register).\n\n### Including other YAML files\n\nChecks from one file can be included into another using the `__INCLUDE__`\nkeyword, e.g.\n\n`suite_1.yml`:\n```\nsuite_name: suite_one\nchecks:\nchecks:\n  - check_id: \"filesize_check\"\n    parameters: {\"threshold\": 1}\n    check_name: \"checklib.register.FileSizeCheck\"\n\n  - __INCLUDE__: suite_2.yml\n```\n\n`suite_2.yml`:\n```\nsuite_name: suite_two\nchecks:\n  - check_id: \"attribute_check\"\n    parameters: {\"regex\": \"\\\\d+\", \"attribute\": \"author\"}\n    check_name: \"checklib.register.GlobalAttrRegexCheck\"\n    check_level: \"LOW\"\n```\n\nRunning `compliance-checker --yaml suite_1.yml --test suite_one \u003cdataset\u003e` will\nthen run both `filesize_check` and `attribute_check`.\n\nNote that *all* checks from `suite_2.yml` will be included (if there is more\nthan one). It is also possible to have several `__INCLUDE__` directives to\ninclude checks from several files.\n\nRecursive inclusions are also supported -- i.e. A includes checks from B which\nin turn include checks from C.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedadev%2Fcc-yaml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcedadev%2Fcc-yaml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedadev%2Fcc-yaml/lists"}