Skip to content

Commit 162dfc2

Browse files
committed
replace isort, flake and black with ruff
1 parent 5c989c7 commit 162dfc2

File tree

5 files changed

+85
-33
lines changed

5 files changed

+85
-33
lines changed

.flake8

-4
This file was deleted.

.isort.cfg

-7
This file was deleted.

.pre-commit-config.yaml

+7-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
repos:
2-
32
- repo: https://github.com/pre-commit/pre-commit-hooks
43
rev: v4.3.0
54
hooks:
@@ -11,22 +10,11 @@ repos:
1110
- id: name-tests-test
1211
- id: requirements-txt-fixer
1312
- id: trailing-whitespace
14-
15-
- repo: https://github.com/python/black
16-
rev: "22.6.0"
13+
- repo: https://github.com/astral-sh/ruff-pre-commit
14+
# Ruff version.
15+
rev: v0.1.4
1716
hooks:
18-
- id: black
19-
language_version: python3.9
20-
21-
- repo: https://github.com/pycqa/isort
22-
rev: 5.11.5
23-
hooks:
24-
- id: isort
25-
name: isort (python)
26-
27-
- repo: https://github.com/pycqa/flake8
28-
rev: 4.0.1
29-
hooks:
30-
- id: flake8
31-
language_version: "python3"
32-
exclude: migrations
17+
# Run the linter.
18+
- id: ruff
19+
# Run the formatter.
20+
- id: ruff-format

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# hhub
22

33
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
4+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
45
![Github CI](https://github.com/gbdev/homebrewhub/actions/workflows/ci.yaml/badge.svg)
56

67
This repository provides the source code of the [Homebrew Hub backend](https://hh3.gbdev.io/api), which powers [Homebrew Hub](https://hh.gbdev.io), the largest digital collection of Game Boy and Game Boy Color homebrews, playable natively in your browser.

pyproject.toml

+77-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,78 @@
1-
[tool.black]
1+
[tool.ruff]
2+
# Exclude a variety of commonly ignored directories.
3+
exclude = [
4+
".bzr",
5+
".direnv",
6+
".eggs",
7+
".git",
8+
".git-rewrite",
9+
".hg",
10+
".ipynb_checkpoints",
11+
".mypy_cache",
12+
".nox",
13+
".pants.d",
14+
".pyenv",
15+
".pytest_cache",
16+
".pytype",
17+
".ruff_cache",
18+
".svn",
19+
".tox",
20+
".venv",
21+
".vscode",
22+
"__pypackages__",
23+
"_build",
24+
"buck-out",
25+
"build",
26+
"dist",
27+
"node_modules",
28+
"site-packages",
29+
"venv",
30+
]
31+
32+
# Same as Black.
233
line-length = 88
3-
target-version = ['py39']
4-
exclude = '(\.git|env|database|database-gba|_build|build|dist|.*\/migrations\/.*)'
34+
indent-width = 4
35+
36+
# Assume Python 3.12
37+
target-version = "py312"
38+
39+
[tool.ruff.lint]
40+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
41+
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
42+
# McCabe complexity (`C901`) by default.
43+
select = ["E4", "E7", "E9", "F"]
44+
ignore = []
45+
46+
# Allow fix for all enabled rules (when `--fix`) is provided.
47+
fixable = ["ALL"]
48+
unfixable = []
49+
50+
# Allow unused variables when underscore-prefixed.
51+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
52+
53+
[tool.ruff.format]
54+
# Like Black, use double quotes for strings.
55+
quote-style = "double"
56+
57+
# Like Black, indent with spaces, rather than tabs.
58+
indent-style = "space"
59+
60+
# Like Black, respect magic trailing commas.
61+
skip-magic-trailing-comma = false
62+
63+
# Like Black, automatically detect the appropriate line ending.
64+
line-ending = "auto"
65+
66+
# Enable auto-formatting of code examples in docstrings. Markdown,
67+
# reStructuredText code/literal blocks and doctests are all supported.
68+
#
69+
# This is currently disabled by default, but it is planned for this
70+
# to be opt-out in the future.
71+
docstring-code-format = false
72+
73+
# Set the line length limit used when formatting code snippets in
74+
# docstrings.
75+
#
76+
# This only has an effect when the `docstring-code-format` setting is
77+
# enabled.
78+
docstring-code-line-length = "dynamic"

0 commit comments

Comments
 (0)