8000 Merge pull request #1096 from DimitriPapadopoulos/ruff_0.9.1 · pypa/setuptools-scm@836eb42 · GitHub
[go: up one dir, main page]

Skip to content

Commit 836eb42

Browse files
Merge pull request #1096 from DimitriPapadopoulos/ruff_0.9.1
Bump ruff from 0.3.4 to 0.9.1
2 parents 98b7078 + 2d43b14 commit 836eb42

15 files changed

+25
-26
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ repos:
55
- id: trailing-whitespace
66
- id: check-yaml
77
- id: debug-statements
8+
89
- repo: https://github.com/astral-sh/ruff-pre-commit
9-
rev: v0.3.4
10+
rev: v0.9.1
1011
hooks:
1112
- id: ruff
1213
args: [--fix, --exit-non-zero-on-fix, --show-fixes]

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ version = { attr = "_own_version_helper.version"}
118118

119119
[tool.ruff]
120120
src = ["src"]
121-
fix = true
122121
lint.select = ["E", "F", "B", "UP", "YTT", "C", "DTZ", "PYI", "PT", "I", "FURB", "RUF"]
123122
lint.ignore = ["B028"]
124123
lint.preview = true

src/setuptools_scm/_integration/setuptools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ def version_keyword(
8282
assert isinstance(value, dict), "version_keyword expects a dict or True"
8383
overrides = value
8484

85-
assert (
86-
"dist_name" not in overrides
87-
), "dist_name may not be specified in the setup keyword "
85+
assert "dist_name" not in overrides, (
86+
"dist_name may not be specified in the setup keyword "
87+
)
8888
dist_name: str | None = dist.metadata.name
8989
_log_hookstart("version_keyword", dist)
9090

src/setuptools_scm/git.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ def fetch_shallow(self) -> None:
145145
run_git(["fetch", "--unshallow"], self.path, check=True, timeout=240)
146146

147147
def node(self) -> str | None:
148-
_unsafe_short_node = operator.itemgetter(slice(7))
148+
unsafe_short_node = operator.itemgetter(slice(7))
149149

150150
return run_git(
151151
["rev-parse", "--verify", "--quiet", "HEAD"], self.path
152152
).parse_success(
153-
parse=_unsafe_short_node,
153+
parse=unsafe_short_node,
154154
)
155155

156156
def count_all_nodes(self) -> int:
@@ -250,7 +250,7 @@ def parse_describe(output: str) -> ScmVersion:
250250
def _git_parse_inner(
251251
config: Configuration,
252252
wd: GitWorkdir | hg_git.GitWorkdirHgClient,
253-
pre_parse: None | (Callable[[GitWorkdir | hg_git.GitWorkdirHgClient], None]) = None,
253+
pre_parse: (Callable[[GitWorkdir | hg_git.GitWorkdirHgClient], None]) | None = None,
254254
describe_command: _t.CMD_TYPE | None = None,
255255
) -> ScmVersion:
256256
if pre_parse:

src/setuptools_scm/integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
log = logging.getLogger(__name__)
1111

1212

13-
def data_from_mime(path: _t.PathT, content: None | str = None) -> dict[str, str]:
13+
def data_from_mime(path: _t.PathT, content: str | None = None) -> dict[str, str]:
1414
"""return a mapping from mime/pseudo-mime content
1515
:param path: path to the mime file
1616
:param content: content of the mime file, if None, read from path

src/setuptools_scm/version.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,7 @@ def guess_next_date_ver(
381381
if tag_date > head_date and match is not None:
382382
# warn on future times
383383
warnings.warn(
384-
f"your previous tag ({tag_date})"
385-
f" is ahead your node date ({head_date})"
384+
f"your previous tag ({tag_date}) is ahead your node date ({head_date})"
386385
)
387386
patch = 0
388387
next_version = "{node_date:{date_fmt}}.{patch}".format(

testing/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ def debug_mode() -> Iterator[DebugMode]:
7979
yield debug_mode
8080

8181

82-
@pytest.fixture()
82+
@pytest.fixture
8383
def wd(tmp_path: Path) -> WorkDir:
8484
target_wd = tmp_path.resolve() / "wd"
8585
target_wd.mkdir()
8686
return WorkDir(target_wd)
8787

8888

89-
@pytest.fixture()
89+
@pytest.fixture
9090
def repositories_hg_git(tmp_path: Path) -> tuple[WorkDir, WorkDir]:
9191
tmp_path = tmp_path.resolve()
9292
path_git = tmp_path / "repo_git"

testing/test_file_finder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def test_symlink_not_in_scm_while_target_is(inwd: WorkDir) -> None:
212212

213213

214214
@pytest.mark.issue(587)
215-
@pytest.mark.skip_commit()
215+
@pytest.mark.skip_commit
216216
def test_not_commited(inwd: WorkDir) -> None:
217217
assert find_files() == []
218218

testing/test_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def test_dump_version_doesnt_bail_on_value_error(tmp_path: Path) -> None:
8181
write_to = "VERSION"
8282
version = str(VERSIONS["exact"].tag)
8383
scm_version = meta(VERSIONS["exact"].tag, config=c)
84-
with pytest.raises(ValueError, match="^bad file format:"):
84+
with pytest.raises(ValueError, match=r"^bad file format:"):
8585
dump_version(tmp_path, version, write_to, scm_version=scm_version)
8686

8787

testing/test_git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def test_git_worktree_support(wd: WorkDir, tmp_path: Path) -> None:
307307
assert str(worktree) in res.stdout
308308

309309

310-
@pytest.fixture()
310+
@pytest.fixture
311311
def shallow_wd(wd: WorkDir, tmp_path: Path) -> Path:
312312
wd.commit_testfile()
313313
wd.commit_testfile()
@@ -515,7 +515,7 @@ def test_git_getdate_git_2_45_0_plus(
515515
assert git_wd.get_head_date() == date(2024, 4, 30)
516516

517517

518-
@pytest.fixture()
518+
@pytest.fixture
519519
def signed_commit_wd(monkeypatch: pytest.MonkeyPatch, wd: WorkDir) -> WorkDir:
520520
if not has_command("gpg", args=["--version"], warn=False):
521521
pytest.skip("gpg executable not found")

0 commit comments

Comments
 (0)
0