Skip to content

Commit 3d5c585

Browse files
committed
Tune ruff config and fix existing code
1 parent dc5c554 commit 3d5c585

File tree

3 files changed

+59
-8
lines changed

3 files changed

+59
-8
lines changed

pyproject.toml

+53
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,58 @@ markers = [
2424
"integration: mark as an integration test.",
2525
]
2626

27+
[tool.ruff]
28+
target-version = "py37"
29+
30+
[tool.ruff.lint]
31+
select = [
32+
# pycodestyle
33+
"E",
34+
"W",
35+
# Pyflakes
36+
"F",
37+
# pydocstyle
38+
"D",
39+
# isort
40+
"I",
41+
# pyupgrade
42+
"UP",
43+
# flake8-annotations
44+
"ANN",
45+
# flake8-bandit
46+
"S",
47+
# flake8-bugbear
48+
"B",
49+
# flake8-implicit-str-concat
50+
"ISC",
51+
# flake8-logging
52+
"LOG",
53+
# flake8-logging-format
54+
"G",
55+
# flake8-simplify
56+
"SIM",
57+
# Ruff-specific rules
58+
"RUF",
59+
]
60+
ignore = [
61+
"D100",
62+
"D101",
63+
"D102",
64+
"D103",
65+
"D104",
66+
"D400",
67+
"D401",
68+
"D415",
69+
]
70+
71+
[tool.ruff.lint.isort]
72+
force-sort-within-sections = true
73+
74+
[tool.ruff.lint.per-file-ignores]
75+
"tests/*" = [
76+
# flake8-bandit: assert
77+
"S101",
78+
]
79+
2780
[tool.setuptools_scm]
2881
write_to = "src/tox_gh_actions/version.py"

src/tox_gh_actions/plugin.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from itertools import product
2-
32
from logging import getLogger
43
import os
54
import sys
@@ -42,7 +41,7 @@ def tox_add_core_config(core_conf: ConfigSet, state: State) -> None:
4241
logger.debug("original envlist: %s", original_envlist.envs)
4342

4443
versions = get_python_version_keys()
45-
logger.debug("Python versions: {}".format(versions))
44+
logger.debug("Python versions: %s", versions)
4645

4746
gh_actions_config = load_config(config)
4847
logger.debug("tox-gh-actions config: %s", gh_actions_config)
@@ -166,6 +165,7 @@ def get_python_version_keys() -> List[str]:
166165
- CPython 3.8.z => [3.8, 3]
167166
- PyPy 3.6 (v7.3.z) => [pypy-3.6, pypy-3, pypy3]
168167
- Pyston based on Python CPython 3.8.8 (v2.2) => [pyston-3.8, pyston-3]
168+
169169
"""
170170
major_version = str(sys.version_info[0])
171171
major_minor_version = ".".join([str(i) for i in sys.version_info[:2]])
@@ -226,11 +226,9 @@ def is_log_grouping_enabled(options: Parsed) -> bool:
226226

227227
def is_env_specified(config: Config) -> bool:
228228
"""Returns True when environments are explicitly given"""
229-
if hasattr(config.options, "env") and not config.options.env.is_default_list:
230-
# is_default_list becomes False when TOXENV is a non-empty string
231-
# and when command line argument (-e) is given.
232-
return True
233-
return False
229+
# is_default_list becomes False when TOXENV is a non-empty string
230+
# and when command line argument (-e) is given.
231+
return hasattr(config.options, "env") and not config.options.env.is_default_list
234232

235233

236234
def parse_factors_dict(value: str) -> Dict[str, List[str]]:
@@ -256,6 +254,7 @@ def parse_factors_dict(value: str) -> Dict[str, List[str]]:
256254

257255
def parse_dict(value: str) -> Dict[str, str]:
258256
"""Parse a dict value from the tox config.
257+
259258
.. code-block: ini
260259
[travis]
261260
python =

tests/test_integration.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from pytest import MonkeyPatch
55
from tox.pytest import ToxProjectCreator, init_fixture # noqa: F401
66

7-
87
requires_cpython = pytest.mark.skipif(
98
sys.implementation.name != "cpython", reason="Requires CPython to run this test"
109
)

0 commit comments

Comments
 (0)