Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ruff for formatting and linting #171

Merged
merged 8 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 7 additions & 20 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,11 @@ repos:
"--diff_command='diff'",
"--warnings=-module-docstring,-function-docstring,-function-docstring-header,-print"
]

- repo: local
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.9
hooks:
- id: black
name: black
entry: poetry run black
language: system
types: [ python ]

- id: isort
name: isort
entry: poetry run isort
language: system
types: [ python ]

- id: pyupgrade
name: pyupgrade
entry: poetry run pyupgrade
args: [ --py38-plus ]
language: system
types: [ python ]
- id: ruff-format
# Linting
- id: ruff
args: [ --fix ]
203 changes: 14 additions & 189 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,8 @@ authors = ["Martin Medler"]
[tool.poetry.dependencies]
python = "^3.8.1"

[tool.black]
line-length = 120

[tool.isort]
multi_line_output = 3
profile = "black"

[tool.poetry.dev-dependencies]
black = "^23.11.0"
isort = "^5.12.0"
pre-commit = "^3.5.0"
pyupgrade = "^3.15.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down
47 changes: 47 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
exclude = [
".git",
".ruff_cache",
]
line-length = 120
indent-width = 4
# Minimum Python version which we support
target-version = "py38"

[format]
quote-style = "double"
indent-style = "space"
# We want to be able to force spreading things over multiple lines by adding a ',' for readability
skip-magic-trailing-comma = false
line-ending = "auto"
# We have no Python code in documentation
docstring-code-format = false

[lint]
select = [
# pycodestyle
"E",
# Pyflakes
"F",
# pyupgrade
"UP",
# flake8-builtins
"A",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I",
# Pylint
"PL",
# Ruff-specific
"RUF"
]
ignore = [
# It is fine tha some line are longer than the length limit
"E501",
# High false positive rate. Often a plain number is the most expressive, e.g. when checling lengths.
"PLR2004",
# Using Optinal and '= None' at once is overly verbose and hurts readability
"RUF013",
]
Loading