Skip to content

Commit 49511bc

Browse files
Merge pull request #59 from jarrodmillman/ruff-conf
Update ruff config
2 parents 6ab3824 + 4793cf9 commit 49511bc

6 files changed

Lines changed: 49 additions & 27 deletions

File tree

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cdd3f5ae3b842e9e1ddfa76e9efa02c2eba337bd

.pre-commit-config.yaml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,19 @@ repos:
1818
- id: mixed-line-ending
1919
- id: trailing-whitespace
2020

21-
- repo: https://github.com/psf/black
22-
rev: 3702ba224ecffbcec30af640c149f231d90aebdb # frozen: 24.4.2
23-
hooks:
24-
- id: black
25-
26-
- repo: https://github.com/adamchainz/blacken-docs
27-
rev: 4c97c4a0d921007af6fefae92d8447cfbf63720b # frozen: 1.18.0
28-
hooks:
29-
- id: blacken-docs
30-
3121
- repo: https://github.com/pre-commit/mirrors-prettier
3222
rev: ffb6a759a979008c0e6dff86e39f4745a2d9eac4 # frozen: v3.1.0
3323
hooks:
3424
- id: prettier
3525
files: \.(css|html|md|yml|yaml)
3626
args: [--prose-wrap=preserve]
3727

38-
- repo: https://github.com/asottile/pyupgrade
39-
rev: 32151ac97cbfd7f9dcd22e49516fb32266db45b4 # frozen: v3.16.0
28+
- repo: https://github.com/astral-sh/ruff-pre-commit
29+
rev: 1dc9eb131c2ea4816c708e4d85820d2cc8542683 # frozen: v0.5.0
4030
hooks:
41-
- id: pyupgrade
42-
args: [--py38-plus]
31+
- id: ruff
32+
args: ["--fix", "--show-fixes", "--exit-non-zero-on-fix"]
33+
- id: ruff-format
4334

4435
ci:
4536
autofix_prs: false

devstats/__main__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import json
1+
import collections
22
import os
33
import re
44
import sys
55
from glob import glob
6-
import collections
76

87
import click
9-
import requests
108

9+
from .publish import publish, template
1110
from .query import GithubGrabber
12-
from .publish import template, publish
1311

1412

1513
class OrderedGroup(click.Group):

devstats/publish.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
import functools
12
import os
2-
import sys
3-
from glob import glob
4-
import shutil
53
import re
6-
import functools
4+
import shutil
5+
from glob import glob
76

87
import click
98

devstats/query.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
import json
2-
import os
3-
import re
4-
import sys
5-
from glob import glob
62

73
import requests
84

@@ -98,7 +94,7 @@ def get_all_responses(query, query_type, headers):
9894
Helper function to bypass GitHub GraphQL API node limit.
9995
"""
10096
# Get data from a single response
101-
print(f"Retrieving first page...", end="", flush=True)
97+
print("Retrieving first page...", end="", flush=True)
10298
initial_data = send_query(query, query_type, headers)
10399
data, last_cursor, total_count = parse_single_query(initial_data, query_type)
104100

pyproject.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,43 @@ homepage = "https://github.com/scientific-python/devstats"
3838
[tool.changelist]
3939
ignored_user_logins = ["dependabot[bot]", "pre-commit-ci[bot]", "web-flow"]
4040

41+
[tool.ruff.lint]
42+
extend-select = [
43+
"B", # flake8-bugbear
44+
"I", # isort
45+
"ARG", # flake8-unused-arguments
46+
"C4", # flake8-comprehensions
47+
"EM", # flake8-errmsg
48+
"ICN", # flake8-import-conventions
49+
"G", # flake8-logging-format
50+
"PGH", # pygrep-hooks
51+
"PIE", # flake8-pie
52+
"PL", # pylint
53+
"PT", # flake8-pytest-style
54+
# "PTH", # flake8-use-pathlib
55+
"RET", # flake8-return
56+
"RUF", # Ruff-specific
57+
"SIM", # flake8-simplify
58+
"T20", # flake8-print
59+
"UP", # pyupgrade
60+
"YTT", # flake8-2020
61+
"EXE", # flake8-executable
62+
"NPY", # NumPy specific rules
63+
"PD", # pandas-vet
64+
"FURB", # refurb
65+
"PYI", # flake8-pyi
66+
]
67+
ignore = [
68+
"PLR09", # Too many <...>
69+
"PLR2004", # Magic value used in comparison
70+
"ISC001", # Conflicts with formatter
71+
"ARG002", # Unused method argument
72+
"EM101", # Exception must not use a string literal
73+
"SIM115", # Use context handler for opening files
74+
"RET504", # Unnecessary assignment before `return` statement
75+
"T201", # `print` found
76+
]
77+
4178
[tool.setuptools.packages.find]
4279
include = ["devstats*"]
4380

0 commit comments

Comments
 (0)