Skip to content

Commit

Permalink
Migrate to ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLovering committed May 8, 2023
1 parent 89e546b commit bad6541
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 287 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,12 @@ jobs:
CLIENT_IN_CI: true
CLIENT_TOKEN: ""

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

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

# Prepare the Pull Request Payload artifact. If this fails, we
# we fail silently using the `continue-on-error` option. It's
Expand Down
29 changes: 15 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.5.1
hooks:
- id: python-check-blanket-noqa
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)

- repo: local
hooks:
- id: flake8
name: Flake8
description: This hook runs flake8 within our project's poetry environment.
entry: poetry run flake8
- id: isort
name: isort
description: This hook runs isort within our project's environment.
entry: poetry run isort
language: system
types: [python]
require_serial: true

- id: ruff
name: ruff
description: Run ruff linting
entry: poetry run ruff check --force-exclude
language: system
'types_or': [python, pyi]
require_serial: true
args: [--fix, --exit-non-zero-on-fix]
Loading

0 comments on commit bad6541

Please sign in to comment.