Skip to content

Commit c54ec86

Browse files
authored
chore: update pre-commit hooks (python-semantic-release#957)
- Update pre-commit hooks - Switch away from deprecated flag to `ruff` - Resolve two minor pre-commit hook findings
1 parent 0f4c0b1 commit c54ec86

6 files changed

Lines changed: 10 additions & 25 deletions

File tree

.github/workflows/pr.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ jobs:
7373
- name: ruff
7474
run: |
7575
python -m ruff check . \
76-
--config pyproject.toml \
7776
--diff \
7877
--output-format=full \
7978
--exit-non-zero-on-fix

.pre-commit-config.yaml

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@ repos:
1313

1414
# Security & credential scanning/alerting
1515
- repo: https://github.com/pre-commit/pre-commit-hooks
16-
rev: v4.5.0
16+
rev: v4.6.0
1717
hooks:
1818
- id: debug-statements
1919
- id: detect-aws-credentials
2020
args: ["--allow-missing-credentials"]
2121
- id: detect-private-key
2222
- id: check-builtin-literals
23-
- id: check-executables-have-shebangs
24-
- id: check-shebang-scripts-are-executable
2523
- id: check-yaml
2624
- id: check-toml
2725
- id: check-case-conflict
@@ -31,47 +29,36 @@ repos:
3129
- id: mixed-line-ending
3230
- id: check-ast
3331

34-
# Formatters that may modify source files automatically
35-
- repo: https://github.com/astral-sh/ruff-pre-commit
36-
# Keep old ruff formatting rules until other merge requests are completed
37-
rev: v0.1.11
38-
hooks:
39-
- id: ruff-format
40-
name: ruff (format)
41-
args: ["."]
42-
pass_filenames: false
43-
4432
- repo: https://github.com/adamchainz/blacken-docs
4533
rev: 1.16.0
4634
hooks:
4735
- id: blacken-docs
4836
additional_dependencies: ["black==23.10.1"]
4937

5038
- repo: https://github.com/asottile/pyupgrade
51-
rev: v3.15.1
39+
rev: v3.16.0
5240
hooks:
5341
- id: pyupgrade
5442
args: ["--py38-plus", "--keep-runtime-typing"]
5543

5644
# Linters and validation
5745
- repo: https://github.com/astral-sh/ruff-pre-commit
58-
rev: v0.3.2
46+
rev: v0.4.9
5947
hooks:
6048
- id: ruff
6149
name: ruff (lint)
6250
args:
6351
- "--fix"
6452
- "--exit-non-zero-on-fix"
6553
- "--statistics"
66-
- "--output-format=text"
67-
- "."
68-
pass_filenames: false
54+
- "--output-format=full"
55+
- id: ruff-format
56+
name: ruff (format)
6957

7058
- repo: https://github.com/pre-commit/mirrors-mypy
71-
rev: "v1.9.0"
59+
rev: "v1.10.0"
7260
hooks:
7361
- id: mypy
74-
args: ["--config-file", "pyproject.toml"]
7562
additional_dependencies:
7663
- "pydantic>=2,<3"
7764
- "types-requests"

docs/configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ If a setting is not provided, than PSR will fill in the value with the default v
107107
Python Semantic Release expects a root level key to start the configuration definition. Make
108108
sure to use the correct root key dependending on the configuration format you are using.
109109
110-
.. note:: If you are using ``pyproject.toml``, this heading should include the `tool`` prefix
110+
.. note:: If you are using ``pyproject.toml``, this heading should include the ``tool`` prefix
111111
as specified within PEP 517, resulting in ``[tool.semantic_release]``.
112112
113113
.. note:: If you are using a ``releaserc.toml``, use ``[semantic_release]`` as the root key

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ ignore = [
282282
]
283283

284284
external = ["V"]
285-
ignore-init-module-imports = true
286285
task-tags = ["NOTE", "TODO", "FIXME", "XXX"]
287286

288287
[tool.ruff.format]

semantic_release/cli/commands/publish.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ def publish(cli_ctx: CliContextObj, tag: str = "latest") -> None:
6363

6464
log.info("Uploading distributions to release")
6565
for pattern in dist_glob_patterns:
66-
hvcs_client.upload_dists(tag=tag, dist_glob=pattern)
66+
hvcs_client.upload_dists(tag=tag, dist_glob=pattern) # type: ignore[attr-defined]

semantic_release/cli/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def from_raw_config(
558558
# with our forced empty value at the end which can be dropped
559559
parts = [*env_var_def.split("=", 1), ""]
560560
# removes any odd spacing around =, and extracts name=value
561-
name, env_val = [part.strip() for part in parts[:2]]
561+
name, env_val = (part.strip() for part in parts[:2])
562562

563563
if not name:
564564
# Skip when invalid format (ex. starting with = and no name)

0 commit comments

Comments
 (0)