Skip to content
Snippets Groups Projects
Commit 7f1c0ab0 authored by Moul's avatar Moul
Browse files

Replace Black with Ruff-format (#458)

Remove line-length, somehow already 88 characters, Black’s default
CI: Move format check to Ruff job
parent 7fddac59
No related branches found
No related tags found
No related merge requests found
Pipeline #39439 passed
......@@ -56,14 +56,6 @@ build:
paths:
- ${PRE_COMMIT_HOME}
black:
extends:
- .code_changes
- .pre-commit
stage: checks
script:
- pre-commit run -a black
mypy:
extends:
- .code_changes
......@@ -95,6 +87,7 @@ ruff:
stage: checks
script:
- pre-commit run -a ruff
- pre-commit run -a ruff-format
.tests:
extends: .changes
......
......@@ -15,10 +15,7 @@ repos:
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
......
......@@ -88,10 +88,10 @@ In case you want to commit while the hooks are failing, run the following to [sk
git commit -m "msg" --no-verify/-n
```
To manually run one of the tool above, run (eg for `black`):
To manually run one of the tool above, run (eg for `ruff-format`):
```bash
pre-commit run --all-files black
pre-commit run --all-files ruff-format
```
To run all checks on all files:
......
......@@ -58,7 +58,6 @@ classifiers = [
ignore_missing_imports = true
[tool.ruff]
line-length = 101
target-version = "py39"
lint.select = ["F", "W", "I", "UP", "YTT", "B", "A", "DTZ", "T10",
"EXE", "ISC", "ICN", "G", "INP", "PIE", "PYI", "Q", "RSE", "SLF", "TID", "PL",
......
......@@ -127,7 +127,10 @@ def test_gen_pubkey_checksum(pubkey, checksum):
assert f"{pubkey}:{checksum}" == public_key.gen_pubkey_checksum(pubkey)
assert (
f"{pubkey[:SHORT_PUBKEY_SIZE]}…:{checksum}"
== public_key.gen_pubkey_checksum(pubkey, short=True)
== public_key.gen_pubkey_checksum(
pubkey,
short=True,
)
)
assert f"{pubkey[:14]}…:{checksum}" == public_key.gen_pubkey_checksum(
pubkey,
......
......@@ -107,7 +107,8 @@ def test_display_alternate_ids():
id_claudius_maximus,
]
expected = "+------------------+--------------------------------------------+--------------+\n\
expected = (
"+------------------+--------------------------------------------+--------------+\n\
| uid | public key | timestamp |\n\
+==================+============================================+==============+\n\
| moul-test | 5B8iMAzq1dNmFe3ZxFTBQkqhq4fsztg1gZvxHXCk1X | 167750-0000A |\n\
......@@ -119,6 +120,7 @@ def test_display_alternate_ids():
| Claudius Maximus | 6upqFiJ66WV6N3bPc8x8y7rXT3syqKRmwnVyunCtEj | 7334-002A45E |\n\
| | 7o:7xo | |\n\
+------------------+--------------------------------------------+--------------+"
)
table = idty_tools.display_alternate_ids(ids_list)
assert expected == table.draw()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment