Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt Ruff #1372

Merged
merged 2 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .flake8

This file was deleted.

38 changes: 9 additions & 29 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,13 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
hooks:
- id: black
args: [--skip-string-normalization]

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: [--profile=black]

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
[flake8-2020, flake8-implicit-str-concat]

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
hooks:
- id: ruff-format
name: Run Ruff (format)
args: [--check]
- id: ruff
name: Run Ruff (lint)
args: [--exit-non-zero-on-fix]
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand Down
34 changes: 34 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
target-version = "py312"
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved
fix = true
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved
output-format = "full"
line-length = 88

[lint]
preview = true
select = [
"C4", # flake8-comprehensions
"B", # flake8-bugbear
"E", # pycodestyle
"F", # pyflakes
"FA", # flake8-future-annotations
"FLY", # flynt
"FURB", # refurb
"G", # flake8-logging-format
"I", # isort
"ISC", # flake8-implicit-str-concat
"LOG", # flake8-logging
"PERF", # perflint
"PGH", # pygrep-hooks
"PT", # flake8-pytest-style
"TCH", # flake8-type-checking
"UP", # pyupgrade
"W", # pycodestyle
AA-Turner marked this conversation as resolved.
Show resolved Hide resolved
]
ignore = [
"E501", # Ignore line length errors (we use auto-formatting)
]

[format]
preview = true
quote-style = "preserve"
docstring-code-format = true
7 changes: 2 additions & 5 deletions _tools/generate_release_cycle.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Read in a JSON and generate two CSVs and an SVG file."""

from __future__ import annotations

import argparse
import csv
import datetime as dt
import json
import sys

import jinja2

Expand Down Expand Up @@ -45,10 +45,7 @@ def __init__(self) -> None:

def write_csv(self) -> None:
"""Output CSV files."""
if sys.version_info >= (3, 11):
now_str = str(dt.datetime.now(dt.UTC))
else:
now_str = str(dt.datetime.utcnow())
now_str = str(dt.datetime.now(dt.UTC))

versions_by_category = {"branches": {}, "end-of-life": {}}
headers = None
Expand Down
Loading