Skip to content

Commit 35e2d21

Browse files
authored
Replace Flake8 with Ruff (#157)
2 parents 5034791 + 478ac1b commit 35e2d21

File tree

14 files changed

+91
-76
lines changed

14 files changed

+91
-76
lines changed

.flake8

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

.github/CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ pre-commit run --all-files # to run on all files now
1313

1414
## Docstrings
1515

16-
Follow [Google style](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings)
16+
Follow
17+
[Google style](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings)
1718
for docstrings.
1819

1920
## Localization

.github/ISSUE_TEMPLATE.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212

1313
Please include **code** that reproduces the issue.
1414

15-
The [best reproductions](https://stackoverflow.com/help/minimal-reproducible-example) are [self-contained scripts](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/) with minimal dependencies.
15+
The [best reproductions](https://stackoverflow.com/help/minimal-reproducible-example)
16+
are
17+
[self-contained scripts](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/)
18+
with minimal dependencies.
1619

1720
```python
1821
code goes here

.github/SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Security policy
22

3-
Security reports can be made via [Tidelift](https://tidelift.com/security).
4-
Tidelift will coordinate the fix and disclosure.
3+
Security reports can be made via [Tidelift](https://tidelift.com/security). Tidelift
4+
will coordinate the fix and disclosure.

.github/workflows/labels.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
name: Sync labels
2+
3+
permissions:
4+
pull-requests: write
5+
26
on:
37
push:
48
branches:

.github/workflows/lint.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: Lint
22

33
on: [push, pull_request, workflow_dispatch]
44

5+
env:
6+
FORCE_COLOR: 1
7+
8+
permissions:
9+
contents: read
10+
511
jobs:
612
lint:
713
runs-on: ubuntu-latest

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
allow-prereleases: true
2525
cache: pip
2626

27-
2827
- name: Install Linux dependencies
2928
if: startsWith(matrix.os, 'ubuntu')
3029
run: |

.pre-commit-config.yaml

Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,24 @@
11
repos:
2-
- repo: https://github.com/asottile/pyupgrade
3-
rev: v3.14.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.1.6
44
hooks:
5-
- id: pyupgrade
6-
args: [--py38-plus]
5+
- id: ruff
6+
args: [--fix, --exit-non-zero-on-fix]
77

88
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 23.9.1
9+
rev: 23.11.0
1010
hooks:
1111
- id: black
1212

13-
- repo: https://github.com/PyCQA/isort
14-
rev: 5.12.0
15-
hooks:
16-
- id: isort
17-
args: [--add-import=from __future__ import annotations]
18-
19-
- repo: https://github.com/PyCQA/autoflake
20-
rev: v2.2.1
21-
hooks:
22-
- id: autoflake
23-
name: autoflake
24-
args:
25-
[
26-
"--in-place",
27-
"--remove-unused-variables",
28-
"--remove-all-unused-imports",
29-
]
30-
language: python
31-
files: \.py$
32-
33-
- repo: https://github.com/PyCQA/flake8
34-
rev: 6.1.0
35-
hooks:
36-
- id: flake8
37-
additional_dependencies:
38-
[flake8-2020, flake8-errmsg, flake8-implicit-str-concat]
39-
40-
- repo: https://github.com/pre-commit/pygrep-hooks
41-
rev: v1.10.0
42-
hooks:
43-
- id: python-check-blanket-noqa
44-
- id: python-no-log-warn
45-
4613
- repo: https://github.com/pre-commit/pre-commit-hooks
47-
rev: v4.4.0
14+
rev: v4.5.0
4815
hooks:
4916
- id: check-case-conflict
5017
- id: check-merge-conflict
5118
- id: check-json
5219
- id: check-toml
5320
- id: check-yaml
21+
- id: debug-statements
5422
- id: end-of-file-fixer
5523
- id: trailing-whitespace
5624
exclude: \.github/ISSUE_TEMPLATE\.md|\.github/PULL_REQUEST_TEMPLATE\.md
@@ -63,20 +31,20 @@ repos:
6331
files: "src/"
6432

6533
- repo: https://github.com/pre-commit/mirrors-mypy
66-
rev: v1.5.1
34+
rev: v1.7.0
6735
hooks:
6836
- id: mypy
6937
additional_dependencies: [pytest, types-freezegun, types-setuptools]
7038
args: [--strict, --pretty, --show-error-codes]
7139

7240
- repo: https://github.com/tox-dev/pyproject-fmt
73-
rev: 1.2.0
41+
rev: 1.5.1
7442
hooks:
7543
- id: pyproject-fmt
7644
additional_dependencies: [tox]
7745

7846
- repo: https://github.com/abravalheri/validate-pyproject
79-
rev: v0.14
47+
rev: v0.15
8048
hooks:
8149
- id: validate-pyproject
8250

@@ -85,5 +53,17 @@ repos:
8553
hooks:
8654
- id: tox-ini-fmt
8755

56+
- repo: https://github.com/pre-commit/mirrors-prettier
57+
rev: v3.1.0
58+
hooks:
59+
- id: prettier
60+
args: [--prose-wrap=always, --print-width=88]
61+
exclude: \.github/ISSUE_TEMPLATE\.md|\.github/PULL_REQUEST_TEMPLATE\.md
62+
63+
- repo: meta
64+
hooks:
65+
- id: check-hooks-apply
66+
- id: check-useless-excludes
67+
8868
ci:
8969
autoupdate_schedule: quarterly

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
[![MIT License](https://img.shields.io/github/license/python-humanize/humanize.svg)](LICENCE)
1010
[![Tidelift](https://tidelift.com/badges/package/pypi/humanize)](https://tidelift.com/subscription/pkg/pypi-humanize?utm_source=pypi-humanize&utm_medium=badge)
1111

12-
This modest package contains various common humanization utilities, like turning
13-
a number into a fuzzy human-readable duration ("3 minutes ago") or into a
14-
human-readable size or throughput. It is localized to:
12+
This modest package contains various common humanization utilities, like turning a
13+
number into a fuzzy human-readable duration ("3 minutes ago") or into a human-readable
14+
size or throughput. It is localized to:
1515

1616
- Arabic
1717
- Basque

RELEASING.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Release Checklist
22

33
- [ ] Get `main` to the appropriate code release state.
4-
[GitHub Actions](https://github.com/python-humanize/humanize/actions) should be running
5-
cleanly for all merges to `main`.
4+
[GitHub Actions](https://github.com/python-humanize/humanize/actions) should be
5+
running cleanly for all merges to `main`.
66
[![GitHub Actions status](https://github.com/python-humanize/humanize/workflows/Test/badge.svg)](https://github.com/python-humanize/humanize/actions)
77

88
* [ ] Start from a freshly cloned repo:
@@ -16,7 +16,7 @@ cd humanize
1616
scripts/generate-translation-binaries.sh
1717
```
1818

19-
* [ ] (Optional) Create a distribution and release on **TestPyPI**:
19+
- [ ] (Optional) Create a distribution and release on **TestPyPI**:
2020

2121
```bash
2222
pip install -U pip build keyring twine
@@ -33,13 +33,13 @@ pip3 install -U -i https://test.pypi.org/simple/ humanize --pre
3333
python3 -c "import humanize; print(humanize.__version__)"
3434
```
3535

36-
* [ ] Tag with the version number:
36+
- [ ] Tag with the version number:
3737

3838
```bash
3939
git tag -a 2.1.0 -m "Release 2.1.0"
4040
```
4141

42-
* [ ] Create a distribution and release on **live PyPI**:
42+
- [ ] Create a distribution and release on **live PyPI**:
4343

4444
```bash
4545
pip install -U pip build keyring twine
@@ -48,21 +48,23 @@ python -m build
4848
twine check --strict dist/* && twine upload --repository pypi dist/*
4949
```
5050

51-
* [ ] Check installation:
51+
- [ ] Check installation:
5252

5353
```bash
5454
pip uninstall -y humanize
5555
pip install -U humanize
5656
python3 -c "import humanize; print(humanize.__version__)"
5757
```
5858

59-
* [ ] Push tag:
60-
```bash
59+
- [ ] Push tag:
60+
61+
```bash
6162
git push --tags
6263
```
6364

64-
* [ ] Edit release draft, adjust text if needed: https://github.com/python-humanize/humanize/releases
65+
- [ ] Edit release draft, adjust text if needed:
66+
https://github.com/python-humanize/humanize/releases
6567

66-
* [ ] Check next tag is correct, amend if needed
68+
- [ ] Check next tag is correct, amend if needed
6769

68-
* [ ] Publish release
70+
- [ ] Publish release

0 commit comments

Comments
 (0)