Skip to content

Commit

Permalink
refactor: Format code with Ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Jan 18, 2024
1 parent 432673b commit 2c0c9f1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

<!-- insertion marker -->
## [1.2.1](https://github.com/pawamoy/copier-pdm/releases/tag/1.2.1) - 2024-01-12

<small>[Compare with 1.2.0](https://github.com/pawamoy/copier-pdm/compare/1.2.0...1.2.1)</small>

### Code Refactoring

- Format code with Ruff ([609c48f](https://github.com/pawamoy/copier-pdm/commit/609c48f3950b2720b9c840f5b7e061ccaac8b524) by Timothée Mazzucotelli).

## [1.2.0](https://github.com/pawamoy/copier-pdm/releases/tag/1.2.0) - 2024-01-08

<small>[Compare with 1.1.3](https://github.com/pawamoy/copier-pdm/compare/1.1.3...1.2.0)</small>
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -14,6 +14,9 @@ docs:
docs-deploy:
@mkdocs gh-deploy

format:
@ruff format

gen generate:
@bash -c 'source tests/helpers.sh && generate ${PWD} tests/tmp'

Expand Down
6 changes: 5 additions & 1 deletion project/config/ruff.toml.jinja
@@ -1,5 +1,5 @@
target-version = "py38"
line-length = 132
line-length = 120
exclude = [
"fixtures",
"site",
Expand Down Expand Up @@ -102,3 +102,7 @@ known-first-party = ["{{ python_package_import_name }}"]

[pydocstyle]
convention = "google"

[format]
docstring-code-format = true
docstring-code-line-length = 80
4 changes: 2 additions & 2 deletions project/duties.py.jinja
Expand Up @@ -10,7 +10,7 @@ from pathlib import Path
from typing import TYPE_CHECKING, Iterator

from duty import duty
from duty.callables import black, coverage, lazy, mkdocs, mypy, pytest, ruff, safety
from duty.callables import coverage, lazy, mkdocs, mypy, pytest, ruff, safety

if TYPE_CHECKING:
from duty.context import Context
Expand Down Expand Up @@ -227,7 +227,7 @@ def format(ctx: Context) -> None:
ruff.check(*PY_SRC_LIST, config="config/ruff.toml", fix_only=True, exit_zero=True),
title="Auto-fixing code",
)
ctx.run(black.run(*PY_SRC_LIST, config="config/black.toml"), title="Formatting code")
ctx.run(ruff.format(*PY_SRC_LIST, config="config/ruff.toml"), title="Formatting code")
{#- ctx.run(
blacken_docs.run(*PY_SRC_LIST, "docs", exts=["py", "md"], line_length=120),
title="Formatting docs",
Expand Down
6 changes: 6 additions & 0 deletions ruff.toml
@@ -0,0 +1,6 @@
target-version = "py38"
line-length = 120

[format]
docstring-code-format = true
docstring-code-line-length = 80

0 comments on commit 2c0c9f1

Please sign in to comment.