Skip to content

Commit 8e00ff2

Browse files
AA-Turnerhugovk
andauthored
Adopt Ruff (#1372)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent cedcb49 commit 8e00ff2

File tree

4 files changed

+46
-36
lines changed

4 files changed

+46
-36
lines changed

.flake8

Lines changed: 0 additions & 2 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,13 @@
11
repos:
2-
- repo: https://github.com/asottile/pyupgrade
3-
rev: v3.15.0
4-
hooks:
5-
- id: pyupgrade
6-
args: [--py38-plus]
7-
8-
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 23.12.1
10-
hooks:
11-
- id: black
12-
args: [--skip-string-normalization]
13-
14-
- repo: https://github.com/PyCQA/isort
15-
rev: 5.13.2
16-
hooks:
17-
- id: isort
18-
args: [--profile=black]
19-
20-
- repo: https://github.com/PyCQA/flake8
21-
rev: 6.1.0
22-
hooks:
23-
- id: flake8
24-
additional_dependencies:
25-
[flake8-2020, flake8-implicit-str-concat]
26-
27-
- repo: https://github.com/pre-commit/pygrep-hooks
28-
rev: v1.10.0
29-
hooks:
30-
- id: python-check-blanket-noqa
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.5.7
4+
hooks:
5+
- id: ruff
6+
name: Run Ruff (lint)
7+
args: [--exit-non-zero-on-fix]
8+
- id: ruff-format
9+
name: Run Ruff (format)
10+
args: [--check]
3111

3212
- repo: https://github.com/pre-commit/pre-commit-hooks
3313
rev: v4.5.0

.ruff.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
target-version = "py311"
2+
fix = true
3+
output-format = "full"
4+
line-length = 88
5+
6+
[lint]
7+
preview = true
8+
select = [
9+
"C4", # flake8-comprehensions
10+
"B", # flake8-bugbear
11+
"E", # pycodestyle
12+
"F", # pyflakes
13+
"FA", # flake8-future-annotations
14+
"FLY", # flynt
15+
"FURB", # refurb
16+
"G", # flake8-logging-format
17+
"I", # isort
18+
"ISC", # flake8-implicit-str-concat
19+
"LOG", # flake8-logging
20+
"PERF", # perflint
21+
"PGH", # pygrep-hooks
22+
"PT", # flake8-pytest-style
23+
"TCH", # flake8-type-checking
24+
"UP", # pyupgrade
25+
"W", # pycodestyle
26+
"YTT", # flake8-2020
27+
]
28+
ignore = [
29+
"E501", # Ignore line length errors (we use auto-formatting)
30+
]
31+
32+
[format]
33+
preview = true
34+
quote-style = "preserve"
35+
docstring-code-format = true

_tools/generate_release_cycle.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""Read in a JSON and generate two CSVs and an SVG file."""
2+
23
from __future__ import annotations
34

45
import argparse
56
import csv
67
import datetime as dt
78
import json
8-
import sys
99

1010
import jinja2
1111

@@ -45,10 +45,7 @@ def __init__(self) -> None:
4545

4646
def write_csv(self) -> None:
4747
"""Output CSV files."""
48-
if sys.version_info >= (3, 11):
49-
now_str = str(dt.datetime.now(dt.UTC))
50-
else:
51-
now_str = str(dt.datetime.utcnow())
48+
now_str = str(dt.datetime.now(dt.UTC))
5249

5350
versions_by_category = {"branches": {}, "end-of-life": {}}
5451
headers = None

0 commit comments

Comments
 (0)