Skip to content

Commit 3fc6d94

Browse files
committed
Fixup linter setup
1 parent b88a941 commit 3fc6d94

File tree

4 files changed

+52
-52
lines changed

4 files changed

+52
-52
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Check http://editorconfig.org for more information
1+
# Check https://editorconfig.org for more information
22
# This is the main config file for this project:
33
root = true
44

.github/workflows/main.yaml

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ name: Build and test linkml-runtime
88
on:
99
push:
1010
branches:
11-
- main
11+
- main
1212
pull_request:
1313
workflow_dispatch:
1414

1515
jobs:
16-
1716
quality-checks:
1817
runs-on: ubuntu-latest
1918
steps:
20-
- uses: actions/checkout@v4.2.2
19+
- uses: actions/checkout@4.2.2
2120
- name: Install Poetry
2221
run: |
2322
pipx install poetry
@@ -29,10 +28,10 @@ jobs:
2928
run: poetry check
3029
- name: Install tox
3130
run: python -m pip install tox
32-
- name: Run codespell
33-
run: tox -e codespell
34-
- name: Run code format checks
35-
run: tox -e format_check
31+
- name: Run pre-commit checks
32+
uses: pre-commit/action@v3.0.1
33+
with:
34+
extra_args: --all-files
3635

3736
test:
3837
needs:
@@ -42,61 +41,49 @@ jobs:
4241
matrix:
4342
os: [ubuntu-latest, windows-latest]
4443
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
44+
# Test on Windows with only the oldest and newest Python versions
4545
exclude:
46-
- os: windows-latest
47-
python-version: "3.10"
48-
- os: windows-latest
49-
python-version: "3.11"
50-
- os: windows-latest
51-
python-version: "3.12"
46+
- os: windows-latest
47+
python-version: "3.10"
48+
- os: windows-latest
49+
python-version: "3.11"
50+
- os: windows-latest
51+
python-version: "3.12"
52+
# See https://github.com/snok/install-poetry#running-on-windows
53+
defaults:
54+
run:
55+
shell: bash
5256

5357
runs-on: ${{ matrix.os }}
5458

5559
steps:
60+
- name: Check out repository
61+
uses: actions/checkout@4.2.2
62+
with:
63+
fetch-depth: 0
64+
5665

57-
#----------------------------------------------
58-
# install poetry
59-
#----------------------------------------------
6066
- name: Install Poetry
6167
run: |
6268
pipx install poetry
6369
pipx inject poetry poetry-dynamic-versioning
6470
65-
#----------------------------------------------
66-
# check-out repo and set-up python
67-
#----------------------------------------------
68-
- name: Check out repository
69-
uses: actions/checkout@v4.2.2
70-
with:
71-
fetch-depth: 0
72-
7371
- name: Set up Python ${{ matrix.python-version }}
7472
uses: actions/setup-python@v5.6.0
7573
with:
7674
python-version: ${{ matrix.python-version }}
7775
cache: 'poetry'
7876

79-
#----------------------------------------------
80-
# install your root project, if required
81-
#----------------------------------------------
8277
- name: Install library
8378
run: |
8479
poetry install --no-interaction
85-
86-
#----------------------------------------------
87-
# coverage report
88-
#----------------------------------------------
8980
- name: Generate coverage results
9081
# Set bash shell to fail correctly on Windows https://github.com/actions/runner-images/issues/6668
9182
shell: bash
9283
run: |
9384
poetry run coverage run -m pytest
9485
poetry run coverage xml
9586
poetry run coverage report -m
96-
97-
#----------------------------------------------
98-
# upload coverage results
99-
#----------------------------------------------
10087
- name: Upload coverage report
10188
uses: codecov/codecov-action@v5
10289
with:

.pre-commit-config.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ repos:
99
- id: end-of-file-fixer
1010
exclude: __snapshots__
1111
- id: check-yaml
12-
exclude: (__snapshots__|test_utils/input)
1312
- id: check-toml
1413
- id: trailing-whitespace
15-
# TODO: This is temporary while bioliank is being fixed upstream.
16-
# TODO: Should look at snapshot exclusion to find upstream problems
17-
exclude: (__snapshots__|biolink-model.yaml)
1814
- repo: https://github.com/astral-sh/ruff-pre-commit
1915
# Ensure this version stays in sync with tox.ini
2016
rev: v0.11.13

pyproject.toml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,21 @@ style = "pep440"
7575
coverage = "^6.2"
7676
requests-cache = "^1.2.0"
7777

78+
79+
[tool.codespell]
80+
skip = [
81+
".git", "*.pdf", "*.svg", "*.dill",
82+
"poetry.lock",
83+
]
84+
# Ignore table where words could be split across rows
85+
ignore-regex = '(\|.*\|.*\|.*\||\[[A-Z][a-z]\][a-z][a-z])'
86+
ignore-words-list = [
87+
]
88+
quiet-level = 3
7889
# https://docs.astral.sh/ruff/settings/
7990
[tool.ruff]
80-
extend-exclude = []
91+
extend-exclude = [
92+
]
8193
force-exclude = true
8294
line-length = 120
8395
# Assume Python 3.9
@@ -86,12 +98,11 @@ target-version = "py39"
8698
[tool.ruff.lint]
8799

88100
select = [
89-
# core
90-
"F", # Pyflakes
91-
"E", # pycodestyle errors
101+
"E", # pycodestyle errors
102+
"F", # Pyflakes
103+
"I", # isort
92104
"W", # pycodestyle warnings
93105
"C90", # mccabe +
94-
"I", # isort
95106
"N", # pep8-naming
96107
# "D", # pydocstyle
97108
"UP", # pyupgrade
@@ -177,6 +188,14 @@ max-complexity = 15
177188
requires = ["tox>=4"]
178189
env_list = ["lint", "py{39,310,311,312,313}"]
179190

191+
[tool.tox.env_run_base]
192+
allowlist_externals = ["poetry"]
193+
deps = ["pytest"]
194+
commands = [
195+
["poetry", "install", "--no-root", "--sync", "--all-extras"],
196+
["poetry", "run", "pytest", "{posargs}"],
197+
]
198+
180199
[tool.tox.env.codespell]
181200
description = "Run spell checkers."
182201
skip_install = true
@@ -189,25 +208,23 @@ commands = [
189208
]
190209

191210
[tool.tox.env.format]
192-
description = "Run ruff code formatter."
211+
description = "Run code formatter and code-fixing linter."
193212
skip_install = true
194-
deps = ["ruff==0.11.13"]
213+
deps = ["pre-commit"]
195214
commands = [
196-
["ruff", "format", "{posargs:.}"],
215+
["pre-commit", "run", "--all-files", "--show-diff-on-failure", { replace = "posargs", extend = true }]
197216
]
198217

199218
[tool.tox.env.format_check]
200219
description = "Check that code is correctly formatted by ruff."
201220
skip_install = true
202221
deps = ["ruff==0.11.13"]
203-
commands = [
204-
["ruff", "format", "--check", "{posargs:.}"],
205-
]
206222

207223
[tool.tox.env.lint]
208-
description = "Run code linter (no fixes)."
224+
description = "Run code linter and formatter (no fixes)."
209225
skip_install = true
210226
deps = ["ruff==0.11.13"]
211227
commands = [
212228
["ruff", "check", "{posargs:.}"],
229+
["ruff", "format", "{posargs:.}"],
213230
]

0 commit comments

Comments
 (0)