Skip to content

Commit 72705c6

Browse files
authored
Merge pull request #50 from WhyNotHugo/ruff
Use ruff for linting and error checking
2 parents c5631d1 + a00f1f7 commit 72705c6

File tree

4 files changed

+21
-40
lines changed

4 files changed

+21
-40
lines changed

.github/workflows/linting.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,8 @@ jobs:
77
- uses: actions/checkout@v2
88
- uses: actions/setup-python@v2
99
- uses: psf/black@stable
10-
isort:
10+
ruff:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v2
14-
- uses: actions/setup-python@v2
15-
- uses: jamescurtin/isort-action@master
16-
with:
17-
configuration: --check-only
18-
flake8:
19-
runs-on: ubuntu-latest
20-
steps:
21-
- uses: actions/checkout@v2
22-
- uses: actions/setup-python@v2
23-
- name: Install dependencies
24-
run: pip install flake8 flake8-pyproject
25-
- name: Run flake8
26-
run: flake8 .
14+
- uses: chartboost/ruff-action@v1

.pre-commit-config.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,8 @@ repos:
33
rev: 23.1.0
44
hooks:
55
- id: black
6-
- repo: https://github.com/PyCQA/isort
7-
rev: 5.12.0
6+
- repo: https://github.com/astral-sh/ruff-pre-commit
7+
rev: v0.0.291
88
hooks:
9-
- id: isort
10-
- repo: https://github.com/pycqa/flake8
11-
rev: 6.0.0
12-
hooks:
13-
- id: flake8
14-
additional_dependencies:
15-
- flake8-pyproject
9+
- id: ruff
10+
args: [--fix, --exit-non-zero-on-fix]

pyproject.toml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,17 @@
8181
minversion = "6.0"
8282
testpaths = ["tests"]
8383

84-
[tool.flake8]
85-
ignore = [
86-
"D1", # Missing docstrings
87-
"E203", # whitespace before ':' in slice (incompatible with black)
88-
"E731", # Allow lambdas
89-
"F405", # name undefined due to star imports
90-
"W503", # line break before binary operator (incompatible with black)
91-
]
92-
max-line-length = 99
93-
94-
[tool.isort]
95-
known_first_party = "sphinxcontrib_django"
96-
# Approach Black compatibility (just run black after isort)
97-
include_trailing_comma = true
98-
line_length = 88
99-
multi_line_output = 3
84+
[tool.ruff]
85+
select = [
86+
"F",
87+
"E",
88+
"W",
89+
"I",
90+
# "D",
91+
"RET",
92+
"SIM",
93+
]
94+
ignore = [
95+
"D1", # Missing docstrings
96+
]
97+
line-length = 99

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def do_autodoc():
5353
"""
5454
This function simulates the autodoc functionality.
5555
56-
Taken from https://github.com/sphinx-doc/sphinx/blob/d635d94eebbca0ebb1a5402aa07ed58c0464c6d3/tests/test_ext_autodoc.py#L33-L45 # noqa: E501
56+
Taken from https://github.com/sphinx-doc/sphinx/blob/d635d94eebbca0ebb1a5402aa07ed58c0464c6d3/tests/test_ext_autodoc.py#L33-L45
5757
"""
5858

5959
def do_autodoc(app, objtype, name, options=None):

0 commit comments

Comments
 (0)