Skip to content

Commit

Permalink
using new version of ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
bandophahita committed Feb 26, 2024
1 parent 5d46ef7 commit 48e37f5
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 70 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ jobs:
run: |
black --check .
- name: Lint with isort
run: |
isort --check .
- name: Lint with ruff
run: |
ruff .
Expand Down
110 changes: 44 additions & 66 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,15 @@ typing-extensions = "*"
pytest = {version="*", optional = true}
black = {version="*", optional = true}
mypy = {version="*", optional = true}
ruff = {version="*", optional = true}
ruff = {version = ">=0.2.0", optional = true}
tox = {version="*", optional = true}
isort = {version = "*", optional = true}

[tool.poetry.extras]
dev = [
"pytest",
"black",
"mypy",
"ruff",
"isort",
"tox",
]
test = [
Expand All @@ -50,15 +48,6 @@ test = [
]


[tool.isort]
line_length = 88
multi_line_output = 3
include_trailing_comma = "True"
use_parentheses = "True"
combine_as_imports = "True"
skip = [".idea", ".tox"]


[build-system]
requires = ["poetry-core>=1.2.0"]
build-backend = "poetry.core.masonry.api"
Expand All @@ -77,9 +66,36 @@ build-backend = "poetry.core.masonry.api"


[tool.ruff]
# Enable the pycodestyle (`E`) and Pyflakes (`F`) rules by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
target-version = "py38"
line-length = 88
extend-exclude = [
".github",
".pytest_cache",
".venv",
"venv",
"dockerfiles",
"docs",
".coverage",
".coveragerc",
".env",
".env.example",
".flake8",
".gitignore",
"alembic.ini",
"bandit.yaml",
"docker-compose-dev.yaml",
"docker-compose-pro.yaml",
"Makefile",
"mkdocks.yml",
"mypy.ini",
"poetry.lock",
"pyproject.toml",
"pytest.ini",
"README.md",
".idea",
]

[tool.ruff.lint]
select = [
"A", # flake8-builtins
"ANN", # flake8-annotations # coming back to this one later to compare against mypy
Expand Down Expand Up @@ -163,72 +179,34 @@ ignore = [
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
]

# Same as Black.
line-length = 88
target-version = "py310"

exclude = [
".github",
".pytest_cache",
".venv",
"venv",
"dockerfiles",
"docs",
".coverage",
".coveragerc",
".env",
".env.example",
".flake8",
".gitignore",
"alembic.ini",
"bandit.yaml",
"docker-compose-dev.yaml",
"docker-compose-pro.yaml",
"Makefile",
"mkdocks.yml",
"mypy.ini",
"poetry.lock",
"pyproject.toml",
"pytest.ini",
"README.md",
".idea",
]

[tool.ruff.lint]
extend-safe-fixes = [
"EM101",
"EM102",
"EM101", "EM102",
"TCH001", "TCH002", "TCH003", "TCH004",
# "SIM108"
"C419",
"D200", "D205",
"PT003", "PT006", "PT018",
"RET504",
"UP007",
]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.flake8-pytest-style]
mark-parentheses = false

[tool.ruff.lint.pycodestyle]
ignore-overlong-task-comments = true

[tool.ruff.lint.isort]
combine-as-imports = true
split-on-trailing-comma = false

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"tests/**" = [
"D", # we don't need public-API-polished docstrings in tests.
"FBT", # using a boolean as a test object is useful!
"PLR", # likewise using specific numbers and strings in tests.
]

[tool.ruff.isort]
combine-as-imports = true
split-on-trailing-comma = true


[tool.ruff.flake8-pytest-style]
mark-parentheses = false


[tool.ruff.pycodestyle]
ignore-overlong-task-comments = true


[tool.ruff.flake8-annotations]
[tool.ruff.lint.flake8-annotations]
# ignore returns types for functions that implicity or explicitly only return None
suppress-none-returning = true
allow-star-arg-any = true
Expand Down

0 comments on commit 48e37f5

Please sign in to comment.