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

style: update ruff and precommit #28

Merged
merged 3 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
21 changes: 20 additions & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: python3 -m pip install ".[dev]"

- name: Check style
run: python3 -m ruff check . && ruff format --check .
run: python3 -m ruff check . && python3 -m ruff format --check .
rust-test:
runs-on: ubuntu-latest
defaults:
Expand Down Expand Up @@ -62,3 +62,22 @@ jobs:
run: rustup component add rustfmt

- run: cargo fmt -- --check
precommit_hooks:
runs-on: ubuntu-latest
strategy:
matrix:
cmd:
- "end-of-file-fixer"
- "trailing-whitespace"
- "mixed-line-ending"
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12

- uses: pre-commit/action@v3.0.1
with:
extra_args: ${{ matrix.cmd }} --all-files
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ repos:
- id: check-merge-conflict
- id: detect-aws-credentials
args: [ --allow-missing-credentials ]
- id: mixed-line-ending
args: [ --fix=lf ]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.0 # ruff version
rev: v0.8.6 # ruff version
hooks:
- id: ruff-format
- id: ruff
Expand All @@ -22,4 +24,4 @@ repos:
entry: bash -c 'cd rust && cargo fmt'
args: ['--verbose', '--']

minimum_pre_commit_version: 3.7.1
minimum_pre_commit_version: 4.0.1
52 changes: 17 additions & 35 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ tests = [
]
dev = [
"maturin",
"ruff==0.5.0",
"pre-commit>=3.7.1",
"ruff==0.8.6",
"pre-commit>=4.0.1",
]

[project.urls]
Expand Down Expand Up @@ -94,6 +94,9 @@ select = [
"ARG", # https://docs.astral.sh/ruff/rules/#flake8-unused-arguments-arg
"PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
"PGH", # https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
"PLC", # https://docs.astral.sh/ruff/rules/#convention-c
"PLE", # https://docs.astral.sh/ruff/rules/#error-e_1
"TRY", # https://docs.astral.sh/ruff/rules/#tryceratops-try
"PERF", # https://docs.astral.sh/ruff/rules/#perflint-perf
"FURB", # https://docs.astral.sh/ruff/rules/#refurb-furb
"RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
Expand All @@ -112,51 +115,27 @@ fixable = [
"PT",
"RSE",
"SIM",
"PLC",
"PLE",
"TRY",
"PERF",
"FURB",
"RUF"
]
# ANN003 - missing-type-kwargs
# ANN101 - missing-type-self
# ANN102 - missing-type-cls
# D203 - one-blank-line-before-class
# D205 - blank-line-after-summary
# D206 - indent-with-spaces*
# D213 - multi-line-summary-second-line
# D300 - triple-single-quotes*
# D400 - ends-in-period
# D415 - ends-in-punctuation
# E111 - indentation-with-invalid-multiple*
# E114 - indentation-with-invalid-multiple-comment*
# E117 - over-indented*
# E501 - line-too-long*
# W191 - tab-indentation*
# S321 - suspicious-ftp-lib-usage
# *ignored for compatibility with formatter
ignore = [
"ANN003", "ANN101", "ANN102",
"D203", "D205", "D206", "D213", "D300", "D400", "D415",
"E111", "E114", "E117", "E501",
"W191",
# ignored for compatibility with formatter:
"D206", "D300", "E111", "E114", "E117", "E501", "W191",
# other
"ANN003",
"D203", "D205", "D213", "D400", "D415",
"S321",
"PLC0206",
]

[tool.ruff.lint.per-file-ignores]
# ANN001 - missing-type-function-argument
# ANN2 - missing-return-type
# ANN102 - missing-type-cls
# D301 - escape-sequence-in-docstring
# S101 - assert
# B011 - assert-false
# D100 - undocumented-public-module
# D101 - undocumented-public-class
# D102 - undocumented-public-method
# D103 - undocumented-public-function
# INP001 - implicit-namespace-package
"tests/*" = [
"ANN001",
"ANN2",
"ANN102",
"S101",
"B011",
"INP001",
Expand All @@ -167,5 +146,8 @@ ignore = [
]
"src/vrsix/cli.py" = ["D301"]

[tool.ruff.lint.flake8-annotations]
mypy-init-return = true

[tool.ruff.format]
docstring-code-format = true
6 changes: 3 additions & 3 deletions src/vrsix/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
from vrsix.sqlite import DEFAULT_SQLITE_LOCATION

__all__ = [
"load_vcf",
"vcf_to_sqlite",
"FiletypeError",
"SqliteFileError",
"VrsixError",
"VcfError",
"VrsixDbError",
"VrsixError",
"load_vcf",
"vcf_to_sqlite",
]

_logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from vrsix import load


@pytest.fixture()
@pytest.fixture
def temp_dir() -> Generator:
with tempfile.TemporaryDirectory() as temp_dir:
yield Path(temp_dir)
Expand Down