Skip to content

Commit

Permalink
Merge pull request #940 from marksweb/ci/ruff
Browse files Browse the repository at this point in the history
ci: Cleanup linting & switch to ruff formatter
  • Loading branch information
amakarudze authored Feb 1, 2024
2 parents b49dbec + dea03e3 commit 303ec29
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 41 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Ruff

on:
push:
Expand All @@ -15,16 +15,11 @@ jobs:
ruff:
name: ruff
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip'
- run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run Ruff
run: ruff .
- uses: actions/checkout@v4

- run: python -Im pip install --user ruff

- name: Run Ruff
run: ruff --output-format=github .
27 changes: 5 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ ci:
autoupdate_commit_msg: 'ci: pre-commit autoupdate'
autoupdate_schedule: monthly

default_language_version:
python: python3.10

fail_fast: true

repos:
Expand All @@ -20,29 +23,9 @@ repos:
hooks:
- id: pyupgrade
args: ["--py310-plus"]
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
hooks:
- id: autoflake
entry: bash -c 'autoflake "$@"; git add -u;' --
language: python
args:
[
"--in-place",
"--remove-all-unused-imports",
"--remove-unused-variables",
"--expand-star-imports",
"--ignore-init-module-imports",
]
files: \.py$
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
entry: bash -c 'black "$@"; git add -u;' --
language_version: python3.10
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.9"
rev: v0.1.15
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
15 changes: 9 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[tool.black]
line-length = 120
target-version = ["py310"]

[tool.ruff]
# https://beta.ruff.rs/docs/configuration/
line-length = 120
Expand Down Expand Up @@ -29,19 +25,20 @@ select = [
"RUF"
]

exclude = [
extend-exclude = [
".eggs",
".git",
".mypy_cache",
".ruff_cache",
".env",
".venv",
"**locale/**",
"**migrations/**",
"node_modules",
"venv",
]

ignore = [
extend-ignore = [
"B006", # Do not use mutable data structures for argument defaults
"B011", # tests use assert False
"B019", # Use of `functools.lru_cache` or `functools.cache` on methods can lead to memory leaks
Expand Down Expand Up @@ -87,3 +84,9 @@ known-first-party = [
"story",
]
extra-standard-library = ["dataclasses"]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
docstring-code-format = true
docstring-code-line-length = 80

0 comments on commit 303ec29

Please sign in to comment.