Skip to content

Commit

Permalink
style: convert formatter from black to ruff (python-semantic-release#746
Browse files Browse the repository at this point in the history
)
bernardcooke53 authored Nov 1, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent f145257 commit deb4dba
Showing 11 changed files with 647 additions and 614 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -53,7 +53,11 @@ jobs:
python -m pip install ".[dev, mypy]"
- name: ruff
run: |
python -m ruff check . --config pyproject.toml --diff --show-source
python -m ruff check . \
--config pyproject.toml \
--diff \
--show-source \
--exit-non-zero-on-fix
- name: mypy
run: |
python -m mypy --ignore-missing-imports semantic_release
@@ -78,11 +82,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Black
run: python -m pip install black
- name: Install Ruff
run: python -m pip install ruff==0.1.2

- name: Beautify with Black
run: python -m black .
- name: Format
run: |
python -m ruff format .
- name: Commit and push changes
uses: github-actions-x/commit@v2.9
7 changes: 6 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -50,7 +50,12 @@ jobs:
python -m pip install ".[dev, mypy]"
- name: ruff
run: |
python -m ruff check . --config pyproject.toml --diff --show-source
python -m ruff check . \
--config pyproject.toml \
--diff \
--show-source \
--exit-non-zero-on-fix
- name: mypy
run: python -m mypy --ignore-missing-imports semantic_release

18 changes: 11 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -30,15 +30,18 @@ repos:
- id: check-ast

# Formatters that may modify source files automatically
- repo: https://github.com/psf/black
rev: 23.9.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.2
hooks:
- id: black
- id: ruff-format
name: ruff (format)
args: ["."]
pass_filenames: false
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: ["black==23.7.0"]
additional_dependencies: ["black==23.10.1"]

- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
@@ -48,19 +51,20 @@ repos:

# Linters and validation
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
rev: v0.1.2
hooks:
- id: ruff
name: ruff (lint)
args:
- "--fix"
- "--exit-non-zero-on-fix"
- "--statistics"
- "--format=text"
- "--output-format=text"
- "."
pass_filenames: false

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.5.1"
rev: "v1.6.1"
hooks:
- id: mypy
args: ["--config-file", "pyproject.toml"]
Loading

0 comments on commit deb4dba

Please sign in to comment.