Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic LinkML linting of schema on each PR changing schema #896

Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/lint-linkml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: LinkML Linting GitHub Action
on:
push:
paths:
- "src/mixs/schema/mixs.yaml"
jobs:
linkml:
permissions:
pull-requests: write
name: LinkML Linting
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
cache: 'poetry'

- name: Install Poetry
run: pipx install poetry

- name: Install dependencies
run: poetry install --no-interaction --no-root

- name: Run LinkML Linting
run: |
## Results file header and basic formatting
printf '# LinkML Linting Results \n\n' > linting-results.md
printf "$(linkml --version) linting found the following issues. \n\n" >> linting-results.md
printf "_For more information about the linting rule categories, see the [LinkML linter documentation](https://linkml.io/linkml/schemas/linter.html#rules)._\n" >> linting-results.md
## Lint the schema, and further format
poetry run linkml lint --config .linkml-lint-config.yml --ignore-warnings -f markdown src/mixs/schema/mixs.yaml >> linting-results.md
- name: Reformat log
run: |
sed -i -e 's/#### Errors/> [!CAUTION]/' -e 's/#### Warnings/> [!WARNING]/' -e 's/^*/> */' -e '/###.*yaml/ s/$/\n/' -e '/###.*yaml/ s/^###/**File**:/' linting-results.md
- name: Post PR comment
uses: mshick/add-pr-comment@v2 # v2
with:
message-path: linting-results.md
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-repeats: true
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,7 @@ dmypy.json
# Excel files dumped in project/excel
project/excel

.DS_Store
.DS_Store

.vscode/
linting-results*
4 changes: 4 additions & 0 deletions .linkml-lint-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends: recommended
rules:
standard_naming:
level: disabled
sujaypatil96 marked this conversation as resolved.
Show resolved Hide resolved
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 1 addition & 2 deletions src/mixs/schema/mixs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8501,8 +8501,7 @@ slots:
discovery rates should be included, either computed de novo or from the literature
title: host prediction estimated accuracy
examples:
- value: 'CRISPR spacer match: 0 or 1 mismatches, estimated 8% FDR at the host
genus rank (Edwards et al. 2016 doi:10.1093/femsre/fuv048)'
- value: 'CRISPR spacer match: 0 or 1 mismatches, estimated 8% FDR at the host genus rank (Edwards et al. 2016 doi:10.1093/femsre/fuv048)'
in_subset:
- sequencing
keywords:
Expand Down