Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps-dev): bump ruff from 0.8.5 to 0.9.3 #1342

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions commitizen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ def __call__(
{
"name": ["--template", "-t"],
"help": (
"changelog template file name "
"(relative to the current working directory)"
"changelog template file name (relative to the current working directory)"
),
},
{
Expand Down
7 changes: 3 additions & 4 deletions commitizen/commands/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def __call__(self) -> None: # noqa: C901
# Unless we previously had a prerelease.
if not commits and not current_version.is_prerelease:
raise NoCommitsFoundError(
"[NO_COMMITS_FOUND]\n" "No new commits found."
"[NO_COMMITS_FOUND]\nNo new commits found."
)

increment = self.find_increment(commits)
Expand Down Expand Up @@ -290,7 +290,7 @@ def __call__(self) -> None: # noqa: C901
raise GetNextExit()

# Report found information
information = f"{message}\n" f"tag to create: {new_tag_version}\n"
information = f"{message}\ntag to create: {new_tag_version}\n"
if increment:
information += f"increment detected: {increment}\n"

Expand All @@ -304,8 +304,7 @@ def __call__(self) -> None: # noqa: C901

if increment is None and new_tag_version == current_tag_version:
raise NoneIncrementExit(
"[NO_COMMITS_TO_BUMP]\n"
"The commits found are not eligible to be bumped"
"[NO_COMMITS_TO_BUMP]\nThe commits found are not eligible to be bumped"
)

files: list[str] = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ def questions(self) -> Questions:
},
{
"value": "test",
"name": (
"test: Adding missing or correcting " "existing tests"
),
"name": ("test: Adding missing or correcting existing tests"),
"key": "t",
},
{
Expand Down
40 changes: 20 additions & 20 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pytest-regressions = "^2.4.0"
pytest-freezer = "^0.4.6"
pytest-xdist = "^3.1.0"
# linter
ruff = ">=0.5.0,<0.9.0"
ruff = ">=0.5.0,<0.10.0"
pre-commit = ">=2.18,<5.0"
mypy = "^1.4"
types-PyYAML = ">=5.4.3,<7.0.0"
Expand Down
20 changes: 10 additions & 10 deletions tests/commands/test_bump_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_bump_minor_increment_annotated_config_file(
):
tmp_commitizen_cfg_file = tmp_commitizen_project.join("pyproject.toml")
tmp_commitizen_cfg_file.write(
f"{tmp_commitizen_cfg_file.read()}\n" f"annotated_tag = 1"
f"{tmp_commitizen_cfg_file.read()}\nannotated_tag = 1"
)
create_file_and_commit(commit_msg)
testargs = ["cz", "bump", "--yes"]
Expand All @@ -121,7 +121,7 @@ def test_bump_minor_increment_signed_config_file(
commit_msg, mocker: MockFixture, tmp_commitizen_project_with_gpg
):
tmp_commitizen_cfg_file = tmp_commitizen_project_with_gpg.join("pyproject.toml")
tmp_commitizen_cfg_file.write(f"{tmp_commitizen_cfg_file.read()}\n" f"gpg_sign = 1")
tmp_commitizen_cfg_file.write(f"{tmp_commitizen_cfg_file.read()}\ngpg_sign = 1")
create_file_and_commit(commit_msg)
testargs = ["cz", "bump", "--yes"]
mocker.patch.object(sys, "argv", testargs)
Expand Down Expand Up @@ -383,7 +383,7 @@ def test_bump_on_git_with_hooks_no_verify_disabled(mocker: MockFixture):
"""Bump commit without --no-verify"""
cmd.run("mkdir .git/hooks")
with open(".git/hooks/pre-commit", "w", encoding="utf-8") as f:
f.write("#!/usr/bin/env bash\n" 'echo "0.1.0"')
f.write('#!/usr/bin/env bash\necho "0.1.0"')
cmd.run("chmod +x .git/hooks/pre-commit")

# MINOR
Expand All @@ -402,7 +402,7 @@ def test_bump_on_git_with_hooks_no_verify_disabled(mocker: MockFixture):
def test_bump_tag_exists_raises_exception(mocker: MockFixture):
cmd.run("mkdir .git/hooks")
with open(".git/hooks/post-commit", "w", encoding="utf-8") as f:
f.write("#!/usr/bin/env bash\n" "exit 9")
f.write("#!/usr/bin/env bash\nexit 9")
cmd.run("chmod +x .git/hooks/post-commit")

# MINOR
Expand All @@ -421,7 +421,7 @@ def test_bump_tag_exists_raises_exception(mocker: MockFixture):
def test_bump_on_git_with_hooks_no_verify_enabled(mocker: MockFixture):
cmd.run("mkdir .git/hooks")
with open(".git/hooks/pre-commit", "w", encoding="utf-8") as f:
f.write("#!/usr/bin/env bash\n" 'echo "0.1.0"')
f.write('#!/usr/bin/env bash\necho "0.1.0"')
cmd.run("chmod +x .git/hooks/pre-commit")

# MINOR
Expand Down Expand Up @@ -478,7 +478,7 @@ def test_bump_when_no_new_commit(mocker: MockFixture):
with pytest.raises(NoCommitsFoundError) as excinfo:
cli.main()

expected_error_message = "[NO_COMMITS_FOUND]\n" "No new commits found."
expected_error_message = "[NO_COMMITS_FOUND]\nNo new commits found."
assert expected_error_message in str(excinfo.value)


Expand Down Expand Up @@ -710,7 +710,7 @@ def test_prevent_prerelease_when_no_increment_detected(mocker: MockFixture, caps
cli.main()

expected_error_message = (
"[NO_COMMITS_FOUND]\n" "No commits found to generate a pre-release."
"[NO_COMMITS_FOUND]\nNo commits found to generate a pre-release."
)
assert expected_error_message in str(excinfo.value)

Expand Down Expand Up @@ -862,7 +862,7 @@ def test_bump_changelog_command_commits_untracked_changelog_and_version_files(
mode="a",
encoding="utf-8",
) as commitizen_config:
commitizen_config.write(f"version_files = [\n" f"'{version_regex}'\n]")
commitizen_config.write(f"version_files = [\n'{version_regex}'\n]")

with tmp_commitizen_project.join(version_filepath).open(
mode="a+", encoding="utf-8"
Expand Down Expand Up @@ -917,7 +917,7 @@ def test_bump_invalid_manual_version_raises_exception(mocker, manual_version):
cli.main()

expected_error_message = (
"[INVALID_MANUAL_VERSION]\n" f"Invalid manual version: '{manual_version}'"
f"[INVALID_MANUAL_VERSION]\nInvalid manual version: '{manual_version}'"
)
assert expected_error_message in str(excinfo.value)

Expand Down Expand Up @@ -1425,7 +1425,7 @@ def test_bump_changelog_contains_increment_only(mocker, tmp_commitizen_project,
project_root = Path(tmp_commitizen_project)
tmp_commitizen_cfg_file = project_root / "pyproject.toml"
tmp_commitizen_cfg_file.write_text(
"[tool.commitizen]\n" 'version="1.0.0"\n' "update_changelog_on_bump = true\n"
'[tool.commitizen]\nversion="1.0.0"\nupdate_changelog_on_bump = true\n'
)
tmp_changelog_file = project_root / "CHANGELOG.md"
tmp_changelog_file.write_text("## v1.0.0")
Expand Down
2 changes: 1 addition & 1 deletion tests/commands/test_changelog_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ def test_changelog_prerelease_rev_with_use_scheme_semver(
mocker.patch("commitizen.git.GitTag.date", "2022-02-13")

with open(config_path, "a") as f:
f.write('tag_format = "$version"\n' 'version_scheme = "semver"')
f.write('tag_format = "$version"\nversion_scheme = "semver"')

# create commit and tag
create_file_and_commit("feat: new file")
Expand Down
2 changes: 1 addition & 1 deletion tests/commands/test_check_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def test_check_a_range_of_failed_git_commits(config, mocker: MockFixture):
ill_formated_commits_msgs = [
"First commit does not follow rule",
"Second commit does not follow rule",
("Third commit does not follow rule\n" "Ill-formatted commit with body"),
("Third commit does not follow rule\nIll-formatted commit with body"),
]
mocker.patch(
"commitizen.git.get_commits",
Expand Down
2 changes: 1 addition & 1 deletion tests/commands/test_version_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_version_for_showing_both_versions(config, capsys):
)()
captured = capsys.readouterr()
expected_out = (
f"Installed Commitizen Version: {__version__}\n" f"Project Version: v0.0.1"
f"Installed Commitizen Version: {__version__}\nProject Version: v0.0.1"
)
assert expected_out in captured.out

Expand Down
8 changes: 3 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def tmp_git_project(tmpdir):
@pytest.fixture(scope="function")
def tmp_commitizen_project(tmp_git_project):
tmp_commitizen_cfg_file = tmp_git_project.join("pyproject.toml")
tmp_commitizen_cfg_file.write("[tool.commitizen]\n" 'version="0.1.0"\n')
tmp_commitizen_cfg_file.write('[tool.commitizen]\nversion="0.1.0"\n')

yield tmp_git_project

Expand All @@ -83,9 +83,7 @@ def _initial(
):
with tmp_git_project.as_cwd():
tmp_commitizen_cfg_file = tmp_git_project.join("pyproject.toml")
tmp_commitizen_cfg_file.write(
f"[tool.commitizen]\n" f'version="{version}"\n'
)
tmp_commitizen_cfg_file.write(f'[tool.commitizen]\nversion="{version}"\n')
tmp_version_file = tmp_git_project.join("__version__.py")
tmp_version_file.write(version)
tmp_commitizen_cfg_file = tmp_git_project.join("pyproject.toml")
Expand Down Expand Up @@ -251,7 +249,7 @@ def changelog_format(
if "tmp_commitizen_project" in request.fixturenames:
tmp_commitizen_project = request.getfixturevalue("tmp_commitizen_project")
pyproject = tmp_commitizen_project / "pyproject.toml"
pyproject.write(f"{pyproject.read()}\n" f'changelog_format = "{format}"\n')
pyproject.write(f'{pyproject.read()}\nchangelog_format = "{format}"\n')
return get_changelog_format(config)


Expand Down
6 changes: 3 additions & 3 deletions tests/test_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,9 +1413,9 @@ def changelog_message_builder_hook(message: dict, commit: git.GitCommit):
for no, line in enumerate(result.splitlines()):
if (line := line.strip()) and (match := RE_HEADER.match(line)):
change_type = match.group("type")
assert (
change_type == "overridden"
), f"Line {no}: type {change_type} should have been overridden"
assert change_type == "overridden", (
f"Line {no}: type {change_type} should have been overridden"
)


def test_render_changelog_with_changelog_release_hook(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def test_init_empty_config_content(self, tmpdir, config_file, exception_string):
def test_init_empty_config_content_with_existing_content(
self, tmpdir, config_file, exception_string
):
existing_content = "[tool.black]\n" "line-length = 88\n"
existing_content = "[tool.black]\nline-length = 88\n"

path = tmpdir.mkdir("commitizen").join(config_file)
path.write(existing_content)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cz_conventional_commits.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
)
from commitizen.cz.exceptions import AnswerRequiredError

valid_scopes = ["", "simple", "dash-separated", "camelCase" "UPPERCASE"]
valid_scopes = ["", "simple", "dash-separated", "camelCaseUPPERCASE"]

scopes_transformations = [["with spaces", "with-spaces"], [None, ""]]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_get_reachable_tags_with_commits(


def test_get_tag_names(mocker: MockFixture):
tag_str = "v1.0.0\n" "v0.5.0\n" "v0.0.1\n"
tag_str = "v1.0.0\nv0.5.0\nv0.0.1\n"
mocker.patch("commitizen.cmd.run", return_value=FakeCommand(out=tag_str))

assert git.get_tag_names() == ["v1.0.0", "v0.5.0", "v0.0.1"]
Expand Down
Loading