From 55259fe13738bd07def850ec68076095adf367fb Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 27 Aug 2024 10:11:37 +0100 Subject: [PATCH] Add pre-commit and linting --- .pre-commit-config.yaml | 26 ++++++++++++++++++++++++++ requirements.txt | 1 + schema.yaml | 16 ++++++++-------- src/instances/demo.yaml | 4 ++-- 4 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 .pre-commit-config.yaml create mode 100644 requirements.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..65e6399 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,26 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-symlinks + - id: check-yaml + - id: check-json + - id: destroyed-symlinks + - id: end-of-file-fixer + - id: requirements-txt-fixer + name: Fix requirements*.txt + files: ^requirements.*\.txt$ + - id: trailing-whitespace + + - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.2.3 + hooks: + - id: yamlfmt + args: [--width, '100'] + + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.33.0 # or higher tag + hooks: + - id: yamllint + args: [--format, parsable, --strict, -d, '{line-length: {max: 100}}'] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..1509fe7 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pre-commit==3.8.0 diff --git a/schema.yaml b/schema.yaml index 04aff2f..f31e3f3 100644 --- a/schema.yaml +++ b/schema.yaml @@ -13,12 +13,12 @@ description: >- classes: Contact: - description: >- - Contact information for a person or organisation. - slots: - - name - - email - - affiliation + description: >- + Contact information for a person or organisation. + slots: + - name + - email + - affiliation DatalabInstance: description: >- A *datalab* instance that is part of the *datalab* federation. @@ -36,7 +36,7 @@ classes: id: required: true description: >- - A unique identifier for the *datalab* instance. This *MUST* match the identifier prefix + A unique identifier for the *datalab* instance. This *MUST* match the identifier prefix reported by the instance, and should be unique across all instances in the federation. name: required: true @@ -66,5 +66,5 @@ classes: A canonical URL or URI for any documentation associated specifically with this *datalab* instance. homepage: - description: >- + description: >- A web page relevant to the *datalab* instance, for example, a group or company website. diff --git a/src/instances/demo.yaml b/src/instances/demo.yaml index 8827429..909a2ce 100644 --- a/src/instances/demo.yaml +++ b/src/instances/demo.yaml @@ -1,7 +1,7 @@ --- id: demo name: >- - *datalab* demo instance + *datalab* demo instance contact: - name: datalab demo team email: demo@datalab-org.io @@ -10,7 +10,7 @@ api_url: https://demo-api.datalab-org.io description: >- The *datalab* demo instance is a public instance of the *datalab* federation, hosted by datalab industries ltd. It is intended to provide a demonstration of the capabilities - of *datalab*, and to provide a sandbox environment for testing and development. Any data + of *datalab*, and to provide a sandbox environment for testing and development. Any data stored in the *datalab* demo instance is private unless otherwise shared, but can be removed without warning. source_repository: https://github.com/datalab-org/datalab-demo-deployment