Skip to content

Commit 11ef0c9

Browse files
committed
Migrate to ruff
1 parent e92119e commit 11ef0c9

File tree

5 files changed

+96
-249
lines changed

5 files changed

+96
-249
lines changed

.github/workflows/lint-test.yaml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,12 @@ jobs:
2020
python_version: ${{ matrix.python_version }}
2121
install_args: "--extras async-rediscache --only main --only lint --only test"
2222

23-
# We will not run `flake8` here, as we will use a separate flake8
24-
# action.
2523
- name: Run pre-commit hooks
26-
run: SKIP=flake8 pre-commit run --all-files
24+
run: SKIP=ruff pre-commit run --all-files
2725

28-
# Run flake8 and have it format the linting errors in the format of
29-
# the GitHub Workflow command to register error annotations. This
30-
# means that our flake8 output is automatically added as an error
31-
# annotation to both the run result and in the "Files" tab of a
32-
# pull request.
33-
#
34-
# Format used:
35-
# ::error file={filename},line={line},col={col}::{message}
36-
- name: Run flake8
37-
run: "flake8 \
38-
--format='::error file=%(path)s,line=%(row)d,col=%(col)d::[flake8] %(code)s: %(text)s'"
26+
# Run `ruff` using github formatting to enable automatic inline annotations.
27+
- name: Run ruff
28+
run: "ruff check --format=github ."
3929

4030
- name: Run tests and generate coverage report
4131
run: python -m pytest -n auto --cov pydis_core -q

.pre-commit-config.yaml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,25 @@ repos:
55
- id: check-merge-conflict
66
- id: check-toml
77
- id: check-yaml
8-
args: [--unsafe] # Required due to custom constructors (e.g. !ENV)
98
- id: end-of-file-fixer
109
- id: trailing-whitespace
1110
args: [--markdown-linebreak-ext=md]
12-
- repo: https://github.com/pre-commit/pygrep-hooks
13-
rev: v1.9.0
14-
hooks:
15-
- id: python-check-blanket-noqa
11+
1612
- repo: local
1713
hooks:
18-
- id: flake8
19-
name: Flake8
20-
description: This hook runs flake8 within our project's poetry environment.
21-
entry: poetry run flake8
14+
- id: isort
15+
name: isort
16+
description: This hook runs isort within our project's environment.
17+
entry: poetry run isort
2218
language: system
2319
types: [python]
2420
require_serial: true
21+
22+
- id: ruff
23+
name: ruff
24+
description: Run ruff linting
25+
entry: poetry run ruff check --force-exclude
26+
language: system
27+
'types_or': [python, pyi]
28+
require_serial: true
29+
args: [--fix, --exit-non-zero-on-fix]

poetry.lock

Lines changed: 46 additions & 198 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)