Skip to content

Commit

Permalink
[build] replaces flake8 with ruff (#1179)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixT2K authored Apr 24, 2023
1 parent 70ff4fd commit 23a00e1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: main

jobs:
flake8:
ruff:
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -20,11 +20,11 @@ jobs:
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Run flake8
- name: Run ruff
run: |
pip install flake8
flake8 --version
flake8
pip install ruff
ruff --version
ruff check --diff .
black:
runs-on: ${{ matrix.os }}
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this target runs checks on all files
quality:
isort . -c
flake8 ./
ruff check .
black --check .
mypy doctr/
pydocstyle doctr/
Expand All @@ -11,6 +11,7 @@ quality:
style:
isort .
black .
ruff --fix .

# Run tests for the library
test:
Expand Down
16 changes: 14 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ testing = [
"requests>=2.20.0",
]
quality = [
"flake8>=3.9.0",
"ruff>=0.0.260",
"isort>=5.7.0",
"black>=22.1,<24.0",
"mypy>=0.812",
Expand Down Expand Up @@ -101,7 +101,7 @@ dev = [
"onnxruntime>=1.11.0",
"requests>=2.20.0",
# Quality
"flake8>=3.9.0",
"ruff>=0.0.260",
"isort>=5.7.0",
"black>=22.1,<24.0",
"mypy>=0.812",
Expand Down Expand Up @@ -170,6 +170,18 @@ src_paths = ["doctr", "tests", "scripts", "references", "demo", "docs", "api"]
skip_glob = "**/__init__.py"
known_third_party = ["tensorflow", "torch", "torchvision", "wandb", "fastprogress"]

[tool.ruff]
ignore = ["E402", "F403", "E731"]
exclude = [".git", "venv*", "build"]
line-length = 120
target-version = "py38"

[tool.ruff.per-file-ignores]
"**/__init__.py" = ["F401"]

[tool.ruff.flake8-quotes]
docstring-quotes = "double"

[tool.pydocstyle]
select = "D300,D301,D417"
match = ".*\\.py"
Expand Down

0 comments on commit 23a00e1

Please sign in to comment.