Skip to content

Commit 84a359c

Browse files
authored
use ruff rules for isort, add codespell (#70)
1 parent 7e2be50 commit 84a359c

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Continuous Integration
22

3-
# alwas run CI on new commits to any branch
3+
# always run CI on new commits to any branch
44
on: push
55

66
jobs:
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Docker Buildx
2121
uses: docker/setup-buildx-action@v3
2222
with:
23-
# 'driver: docker' allows one build to re-use images from a prior build
23+
# 'driver: docker' allows one build to reuse images from a prior build
2424
# ref: https://github.com/docker/setup-buildx-action/issues/251
2525
driver: docker
2626
install: true

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,8 @@ repos:
1111
- id: check-toml
1212
- id: end-of-file-fixer
1313
- id: trailing-whitespace
14-
- repo: https://github.com/pycqa/isort
15-
rev: 5.13.2
16-
hooks:
17-
- id: isort
18-
name: isort (python)
19-
args: ["--settings-path", "pyproject.toml"]
2014
- repo: https://github.com/pre-commit/mirrors-mypy
21-
rev: v1.14.0
15+
rev: v1.14.1
2216
hooks:
2317
- id: mypy
2418
args: ["--config-file", "pyproject.toml"]
@@ -31,7 +25,7 @@ repos:
3125
hooks:
3226
# Run the linter.
3327
- id: ruff
34-
args: ["--config", "pyproject.toml"]
28+
args: ["--config", "pyproject.toml", "--fix"]
3529
types_or: [jupyter, python]
3630
# Run the formatter.
3731
- id: ruff-format
@@ -51,3 +45,9 @@ repos:
5145
rev: v1.35.1
5246
hooks:
5347
- id: yamllint
48+
- repo: https://github.com/codespell-project/codespell
49+
rev: v2.3.0
50+
hooks:
51+
- id: codespell
52+
additional_dependencies: [tomli]
53+
args: ["--toml", "pyproject.toml"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Testing `lightgbm.dask`
22

3-
[![GitHub Actions status](https://github.com/jameslamb/lightgbm-dask-testing/workflows/Continuous%20Integration/badge.svg?branch=main)](https://github.com/jameslamb/lightgbm-dask-testing/actions)
3+
[![GitHub Actions](https://github.com/jameslamb/lightgbm-dask-testing/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/jameslamb/lightgbm-dask-testing/actions/workflows/main.yml)
44

55
This repository can be used to test and develop changes to LightGBM's Dask integration.
66
It contains the following useful features:
@@ -110,7 +110,7 @@ pip install --upgrade awscli
110110
Next, configure your shell to make authenticated requests to AWS.
111111
If you've never done this, you can see [the AWS CLI docs](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html).
112112

113-
The rest of this section assums that the shell variables `AWS_SECRET_ACCESS_KEY` and `AWS_ACCESS_KEY_ID` have been sett.
113+
The rest of this section assumes that the shell variables `AWS_SECRET_ACCESS_KEY` and `AWS_ACCESS_KEY_ID` have been sett.
114114

115115
I like to set these by keeping them in a file
116116

pyproject.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ select = [
88
"E",
99
# pyflakes
1010
"F",
11+
# isort
12+
"I",
1113
# NumPy-specific rules
1214
"NPY",
1315
# pylint
@@ -18,6 +20,19 @@ select = [
1820
"SIM401",
1921
]
2022

23+
[tool.ruff.lint.isort]
24+
25+
# prevent ruff from thinking that 'lightgbm.dask' imports should
26+
# come after all others
27+
known-third-party = [
28+
"dask",
29+
"dask_cloudprovider",
30+
"lightgbm",
31+
"pandas",
32+
"scipy",
33+
"sklearn",
34+
]
35+
2136
[tool.ruff.lint.per-file-ignores]
2237
"*.ipynb" = [
2338
# (pylint) Unnecessary list() call

0 commit comments

Comments
 (0)