Skip to content

Commit

Permalink
chore: replace black by ruff formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
GabDug committed Feb 18, 2024
1 parent 3a968e2 commit 63d2173
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 50 deletions.
1 change: 0 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ variables:
PYTHON_LINT_RUFF: "true"
PYTHON_LINT_MYPY: "true"
PYTHON_LINT_PYLINT: "true"
PYTHON_FMT_BLACK: "true"
PYTHON_JOB_PYTEST: "true"

MYPY_CMD: pdm run lint-mypy
Expand Down
5 changes: 1 addition & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,4 @@ repos:
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
hooks:
- id: black
- id: ruff-format
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"mikestead.dotenv",
"davidanson.vscode-markdownlint",
"ms-python.vscode-pylance",
"ms-python.black-formatter",
"tamasfe.even-better-toml",
"charliermarsh.ruff"
]
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"--rootdir=."
],
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Loggia

[![PyPI - Version](https://img.shields.io/pypi/v/loggia)](https://pypi.org/project/loggia/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/loggia)](https://pypi.org/project/loggia/) [![PyPI - License](https://img.shields.io/pypi/l/loggia)](https://github.com/ManoManoTech/loggia/blob/main/LICENSE) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy) [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json)](https://github.com/astral-sh/ruff)
[![PyPI - Version](https://img.shields.io/pypi/v/loggia)](https://pypi.org/project/loggia/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/loggia)](https://pypi.org/project/loggia/) [![PyPI - License](https://img.shields.io/pypi/l/loggia)](https://github.com/ManoManoTech/loggia/blob/main/LICENSE) [![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev) [![types - Mypy](https://img.shields.io/badge/types-Mypy-blue.svg)](https://github.com/python/mypy) [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v0.json)](https://github.com/astral-sh/ruff)

> **The documentation is available on Github Pages**
>
Expand Down
37 changes: 1 addition & 36 deletions pdm.lock

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

10 changes: 4 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ lint = { composite = [
"lint-mypy",
], help = "Run all linters (ruff, pylint, mypy)." }
# Format
fmt-black = { cmd = "black .", help = "Run black formatter" }
fmt-black = { cmd = "ruff format .", help = "Run ruff black-like formatter" }
fmt-ruff = { cmd = "ruff . --fix --select I001", help = "Run isort-like import sorting with ruff" }
fmt = { composite = [
"fmt-black",
"fmt-ruff",
], help = "Run all formatters (black, isort-like ruff)" }
], help = "Run all formatters (black-like ruff, isort-like ruff)" }
# Tests
test = { cmd = "pytest", help = "Run the tests" }
test-cov = { cmd = "pytest --junitxml=pytest-report.xml --cov --cov-report xml:pytest-coverage.xml --cov-fail-under=0 --cov-report html", help = "Run the tests with coverage, and generate reports" }
Expand All @@ -88,7 +88,6 @@ docs-build = { cmd = "mkdocs build --strict", help = "Build the docs" }

[tool.pdm.dev-dependencies]
dev = [
"black>=22.12.0",
"mypy>=1.4",
"pylint>=3.0.3",
"pytest-cov>=4.0.0",
Expand Down Expand Up @@ -146,9 +145,6 @@ exclude_lines = [
'@(abc\.)?abstractmethod]',
]

[tool.black]
line-length = 140
target-version = ['py39']

[tool.pylint]
[tool.pylint.main]
Expand Down Expand Up @@ -194,6 +190,8 @@ ignore = [
"N817", # CamelCase `XxXx` imported as acronym `XX`
"N813", # CamelCase `XxXx` imported as lowercase `xxxx`
"ICN003", # Members of `datetime` should not be imported explicitely
"COM812", # Conflicts with formatter
"ISC001", # Conflicts with formatter
]
select = ["ALL"]
[tool.ruff.pydocstyle]
Expand Down

0 comments on commit 63d2173

Please sign in to comment.