From 47bcea693845a285c859312904c61d50e8928f0c Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
<66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Tue, 13 Feb 2024 08:54:12 -0800
Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#3217)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
---
.github/ISSUE_TEMPLATE/bug-report.md | 2 +-
.github/workflows/check.yml | 2 +-
.pre-commit-config.yaml | 27 +++++++++++++++------------
docs/changelog.rst | 6 +++---
docs/changelog/3197.doc.rst | 2 +-
docs/config.rst | 2 +-
ignore-words.txt | 2 ++
pyproject.toml | 24 +++++++++++++-----------
src/tox/config/set_env.py | 2 +-
src/tox/plugin/__init__.py | 2 +-
src/tox/session/cmd/run/common.py | 8 ++++----
src/tox/session/env_select.py | 4 ++--
src/tox/tox_env/api.py | 4 ++--
src/tox/util/graph.py | 4 ++--
14 files changed, 49 insertions(+), 42 deletions(-)
create mode 100644 ignore-words.txt
diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md
index 83bdd15f1..be31bc61f 100644
--- a/.github/ISSUE_TEMPLATE/bug-report.md
+++ b/.github/ISSUE_TEMPLATE/bug-report.md
@@ -8,7 +8,7 @@ assignees: ""
## Issue
-
+
## Environment
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index bf68c7968..987725469 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -2,7 +2,7 @@ name: check
on:
workflow_dispatch:
push:
- branches: "main"
+ branches: ["main"]
tags-ignore: [ "**" ]
pull_request:
schedule:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 6a822bfed..4a8e580c2 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -4,34 +4,37 @@ repos:
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
+ - repo: https://github.com/python-jsonschema/check-jsonschema
+ rev: 0.28.0
+ hooks:
+ - id: check-github-workflows
+ args: [ "--verbose" ]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
- args: ["--ignore-words-list", "crate,releas", "--skip", "*.svg"]
- additional_dependencies:
- - tomli>=2.0.1
+ additional_dependencies: ["tomli>=2.0.1"]
- repo: https://github.com/tox-dev/tox-ini-fmt
- rev: 1.3.1
+ rev: "1.3.1"
hooks:
- id: tox-ini-fmt
args: ["-p", "fix"]
- repo: https://github.com/tox-dev/pyproject-fmt
- rev: 1.7.0
+ rev: "1.7.0"
hooks:
- id: pyproject-fmt
- additional_dependencies: ["tox>=4.11.4"]
- - repo: https://github.com/asottile/blacken-docs
- rev: 1.16.0
- hooks:
- - id: blacken-docs
- additional_dependencies: [black==23.12.1]
+ additional_dependencies: ["tox>=4.12.1"]
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.1.14
+ rev: "v0.2.1"
hooks:
- id: ruff-format
- id: ruff
args: ["--fix", "--unsafe-fixes", "--exit-non-zero-on-fix"]
+ - repo: https://github.com/asottile/blacken-docs
+ rev: 1.16.0
+ hooks:
+ - id: blacken-docs
+ additional_dependencies: [black==23.12.1]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 986657524..6e2679791 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -559,8 +559,8 @@ v4.1.2 (2022-12-30)
Bugfixes - 4.1.2
~~~~~~~~~~~~~~~~
-- Fix ``--skip-missing-interpreters`` behaviour - by :user:`q0w`. (:issue:`2649`)
-- Restore tox 3 behaviour of showing the output of pip freeze, however now only active when running inside a CI
+- Fix ``--skip-missing-interpreters`` behavior - by :user:`q0w`. (:issue:`2649`)
+- Restore tox 3 behavior of showing the output of pip freeze, however now only active when running inside a CI
environment - by :user:`gaborbernat`. (:issue:`2685`)
- Fix extracting extras from markers with many extras - by :user:`q0w`. (:issue:`2791`)
@@ -614,7 +614,7 @@ Features - 4.0.17
Bugfixes - 4.0.17
~~~~~~~~~~~~~~~~~
-- Fix ``--sdistonly`` behaviour. (:issue:`2653`)
+- Fix ``--sdistonly`` behavior. (:issue:`2653`)
- Override toxworkdir with --workdir. (:issue:`2654`)
diff --git a/docs/changelog/3197.doc.rst b/docs/changelog/3197.doc.rst
index 09fa45f62..7697a37ed 100644
--- a/docs/changelog/3197.doc.rst
+++ b/docs/changelog/3197.doc.rst
@@ -1 +1 @@
-Development: summarise important points experienced developers need to know - by :user:`0cjs`.
+Development: summarize important points experienced developers need to know - by :user:`0cjs`.
diff --git a/docs/config.rst b/docs/config.rst
index d6bb850e0..a1cb834f6 100644
--- a/docs/config.rst
+++ b/docs/config.rst
@@ -454,7 +454,7 @@ Run
.. note::
Inline scripts can be used, however note these are discovered from the project root directory, and is not
- influenced by :ref:`change_dir` (this only affects the runtime current working directory). To make this behaviour
+ influenced by :ref:`change_dir` (this only affects the runtime current working directory). To make this behavior
explicit we recommend that you make inline scripts absolute paths by prepending ``{tox_root}``, instead of
``path/to/my_script`` prefer ``{tox_root}{/}path{/}to{/}my_script``. If your inline script is platform dependent
refer to :ref:`platform-specification` on how to select different script per platform.
diff --git a/ignore-words.txt b/ignore-words.txt
new file mode 100644
index 000000000..c290503b0
--- /dev/null
+++ b/ignore-words.txt
@@ -0,0 +1,2 @@
+releas
+master
diff --git a/pyproject.toml b/pyproject.toml
index 7cb8de3ca..5e9b104a8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -103,11 +103,11 @@ build.targets.sdist.include = ["/src", "/tests", "/tox.ini"]
version.source = "vcs"
[tool.ruff]
-select = ["ALL"]
line-length = 120
target-version = "py38"
-isort = { known-first-party = ["tox", "tests"], required-imports = ["from __future__ import annotations"] }
-ignore = [
+lint.isort = { known-first-party = ["tox", "tests"], required-imports = ["from __future__ import annotations"] }
+lint.select = ["ALL"]
+lint.ignore = [
"CPY", # No copyright header
"INP001", # no implicit namespaces here
"D", # ignore documentation for now
@@ -118,21 +118,16 @@ ignore = [
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible
"S104", # Possible binding to all interfaces
"COM812", # conflicts with formatter
- "COM819", # conflicts with formatter
- "E501", # conflicts with formatter
"ISC001", # conflicts with formatter
- "Q000", # conflicts with formatter
- "Q001", # conflicts with formatter
- "Q002", # conflicts with formatter
- "Q003", # conflicts with formatter
- "W191", # conflicts with formatter
"S404", # Using subprocess is alright.
"PLR0914", ## Too many local variables
"PLR0917", ## Too many positional arguments
]
format.preview = true
lint.preview = true
-[tool.ruff.per-file-ignores]
+format.docstring-code-format = true
+format.docstring-code-line-length = 100
+[tool.ruff.lint.per-file-ignores]
"tests/**/*.py" = [
"S101", # asserts allowed in tests...
"FBT", # don"t care about booleans as positional arguments in tests
@@ -142,6 +137,13 @@ lint.preview = true
"PLR2004", # Magic value used in comparison, consider replacing with a constant variable
]
+[tool.codespell]
+builtin = "clear,usage,en-GB_to_en-US"
+write-changes = true
+skip = "*.svg"
+ignore-words = "ignore-words.txt"
+count = true
+
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=auto -ra --showlocals --no-success-flaky-report"
diff --git a/src/tox/config/set_env.py b/src/tox/config/set_env.py
index 1fdcbc05a..3d98c902d 100644
--- a/src/tox/config/set_env.py
+++ b/src/tox/config/set_env.py
@@ -20,7 +20,7 @@ def __init__(self, raw: str, name: str, env_name: str | None, root: Path) -> Non
self._name, self._env_name, self._root = name, env_name, root
from .loader.ini.replace import MatchExpression, find_replace_expr # noqa: PLC0415
- for line in raw.splitlines():
+ for line in raw.splitlines(): # noqa: PLR1702
if line.strip():
if line.startswith("file|"):
self._env_files.append(line[len("file|") :])
diff --git a/src/tox/plugin/__init__.py b/src/tox/plugin/__init__.py
index 508c7f64d..7ec350875 100644
--- a/src/tox/plugin/__init__.py
+++ b/src/tox/plugin/__init__.py
@@ -1,5 +1,5 @@
"""
-tox uses `pluggy `_ to customize the default behaviour. It provides an
+tox uses `pluggy `_ to customize the default behavior. It provides an
extension mechanism for plugin management an calling hooks.
Pluggy discovers a plugin by looking up for entry-points named ``tox``, for example in a pyproject.toml:
diff --git a/src/tox/session/cmd/run/common.py b/src/tox/session/cmd/run/common.py
index 365cc15c6..fbddbcce9 100644
--- a/src/tox/session/cmd/run/common.py
+++ b/src/tox/session/cmd/run/common.py
@@ -256,9 +256,9 @@ def execute(state: State, max_workers: int | None, has_spinner: bool, live: bool
interrupt.set()
# cancel in reverse order to not allow submitting new jobs as we cancel running ones
for future, tox_env in reversed(list(future_to_env.items())):
- cancelled = future.cancel()
- # if cannot be cancelled and not done -> still runs
- if cancelled is False and not future.done(): # pragma: no branch
+ canceled = future.cancel()
+ # if cannot be canceled and not done -> still runs
+ if canceled is False and not future.done(): # pragma: no branch
tox_env.interrupt()
done.wait()
# workaround for https://bugs.python.org/issue45274
@@ -310,7 +310,7 @@ def _queue_and_wait( # noqa: C901, PLR0913, PLR0915
spinner: ToxSpinner,
live: bool, # noqa: FBT001
) -> None:
- try:
+ try: # noqa: PLR1702
options = state._options # noqa: SLF001
with spinner:
max_workers = len(to_run_list) if max_workers is None else max_workers
diff --git a/src/tox/session/env_select.py b/src/tox/session/env_select.py
index a654eaa49..9d6c25c2f 100644
--- a/src/tox/session/env_select.py
+++ b/src/tox/session/env_select.py
@@ -189,7 +189,7 @@ def _ensure_envs_valid(self) -> None:
for env in self._cli_envs or []:
if env.startswith(".pkg_external"): # external package
continue
- factors: dict[str, str | None] = {k: None for k in env.split("-")}
+ factors: dict[str, str | None] = dict.fromkeys(env.split("-"))
found_factors: set[str] = set()
for factor in factors:
if (
@@ -247,7 +247,7 @@ def _defined_envs(self) -> dict[str, _ToxEnvInfo]: # noqa: C901, PLR0912
# we need to redefine it, e.g. when it shows up in config as [testenv:.package] and afterwards by a run env is
# marked as package_env.
- if self._defined_envs_ is None:
+ if self._defined_envs_ is None: # noqa: PLR1702
self._defined_envs_ = {}
failed: dict[str, Exception] = {}
env_name_to_active = self._env_name_to_active()
diff --git a/src/tox/tox_env/api.py b/src/tox/tox_env/api.py
index 5b4bb7c30..367209306 100644
--- a/src/tox/tox_env/api.py
+++ b/src/tox/tox_env/api.py
@@ -139,7 +139,7 @@ def register_config(self) -> None:
def pass_env_post_process(values: list[str]) -> list[str]:
values.extend(self._default_pass_env())
- result = sorted({k: None for k in values}.keys())
+ result = sorted(dict.fromkeys(values).keys())
invalid_chars = set(string.whitespace)
invalid = [v for v in result if any(c in invalid_chars for c in v)]
if invalid:
@@ -436,7 +436,7 @@ def execute_async( # noqa: PLR0913
finally:
self._execute_statuses.pop(execute_id)
if show and self._hidden_outcomes is not None and execute_status.outcome is not None:
- # if it gets cancelled before even starting
+ # if it gets canceled before even starting
self._hidden_outcomes.append(execute_status.outcome)
if self.journal and execute_status.outcome is not None:
self.journal.add_execute(execute_status.outcome, run_id)
diff --git a/src/tox/util/graph.py b/src/tox/util/graph.py
index 4786578cd..fb7f331ff 100644
--- a/src/tox/util/graph.py
+++ b/src/tox/util/graph.py
@@ -58,8 +58,8 @@ def visit(vertex: str) -> dict[str, None] | None:
return None
visited.add(vertex)
path[vertex] = None
- for neighbour in graph.get(vertex, ()):
- if neighbour in path or visit(neighbour):
+ for neighbor in graph.get(vertex, ()):
+ if neighbor in path or visit(neighbor):
return path
del path[vertex]
return None