-
Notifications
You must be signed in to change notification settings - Fork 34
Add quality checks and pre-commit & editor configs #406
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
Merged
+77
−1
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Check http://editorconfig.org for more information | ||
# This is the main config file for this project: | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
trim_trailing_whitespace = true | ||
|
||
[*.py] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.py.jinja] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,29 @@ on: | |
types: trigger-run-check-dependencies | ||
|
||
jobs: | ||
quality-checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Install Poetry | ||
run: | | ||
pipx install poetry | ||
pipx inject poetry poetry-dynamic-versioning | ||
- uses: actions/[email protected] | ||
with: | ||
python-version: 3.13 | ||
- name: Check pyproject.toml and poetry.lock | ||
run: poetry check | ||
- name: Install tox | ||
run: python -m pip install tox | ||
- name: Run codespell | ||
run: tox -e codespell | ||
- name: Run code quality checks | ||
run: tox -e lint | ||
|
||
test: | ||
needs: | ||
- quality-checks | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
|
@@ -35,7 +57,7 @@ jobs: | |
with: | ||
# Fetch all history for all branches and all tags. | ||
# The tags are required for dynamic versioning. | ||
fetch-depth: 0 | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/[email protected] | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
default_language_version: | ||
python: python3 | ||
# Specify files to exclude - pre-commit hook doesn't parse pyproject.toml | ||
exclude: tests/data/hp.ttl|tests/data/hp_f.ttl|.*\.svg|jsonschema_value_constraints.yaml | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
exclude: __snapshots__ | ||
- id: check-yaml | ||
exclude: (__snapshots__|test_utils/input) | ||
- id: check-toml | ||
- id: trailing-whitespace | ||
# TODO: This is temporary while bioliank is being fixed upstream. | ||
# TODO: Should look at snapshot exclusion to find upstream problems | ||
exclude: (__snapshots__|biolink-model.yaml) | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
# Ensure this version stays in sync with tox.ini | ||
rev: v0.11.13 | ||
hooks: | ||
# Run the linter. | ||
- id: ruff-check | ||
args: [--fix, --exit-non-zero-on-fix] | ||
# Run the formatter. | ||
- id: ruff-format | ||
- repo: https://github.com/codespell-project/codespell | ||
rev: v2.4.1 | ||
hooks: | ||
- id: codespell | ||
additional_dependencies: | ||
- tomli |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to merge editor config and lint rules first. Then clean up the code and finally enable quality check as merge gate.
Enabling it first would cause huge PR with all lint fixes.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current linkml config which I copied here is not yet very strict. The checks of this PR already ran with the action code from this PR (inspect the Workflow file for quality-checks in https://github.com/linkml/linkml-runtime/actions/runs/16326610375/workflow?pr=406). There should be no surprises after merge (I hope 😉).