From 6ff6017734beb1efc09f25941fdd0d1a4b2b863d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 01:25:00 +0000 Subject: [PATCH 1/2] build(deps-dev): bump ruff from 0.8.5 to 0.9.3 Bumps [ruff](https://github.com/astral-sh/ruff) from 0.8.5 to 0.9.3. - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.8.5...0.9.3) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- poetry.lock | 40 ++++++++++++++++++++-------------------- pyproject.toml | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/poetry.lock b/poetry.lock index 956eb75ff..1d9bb57de 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1425,29 +1425,29 @@ jupyter = ["ipywidgets (>=7.5.1,<9)"] [[package]] name = "ruff" -version = "0.8.5" +version = "0.9.3" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.8.5-py3-none-linux_armv6l.whl", hash = "sha256:5ad11a5e3868a73ca1fa4727fe7e33735ea78b416313f4368c504dbeb69c0f88"}, - {file = "ruff-0.8.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:f69ab37771ea7e0715fead8624ec42996d101269a96e31f4d31be6fc33aa19b7"}, - {file = "ruff-0.8.5-py3-none-macosx_11_0_arm64.whl", hash = "sha256:b5462d7804558ccff9c08fe8cbf6c14b7efe67404316696a2dde48297b1925bb"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d56de7220a35607f9fe59f8a6d018e14504f7b71d784d980835e20fc0611cd50"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9d99cf80b0429cbebf31cbbf6f24f05a29706f0437c40413d950e67e2d4faca4"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7b75ac29715ac60d554a049dbb0ef3b55259076181c3369d79466cb130eb5afd"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c9d526a62c9eda211b38463528768fd0ada25dad524cb33c0e99fcff1c67b5dc"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:587c5e95007612c26509f30acc506c874dab4c4abbacd0357400bd1aa799931b"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:622b82bf3429ff0e346835ec213aec0a04d9730480cbffbb6ad9372014e31bbd"}, - {file = "ruff-0.8.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f99be814d77a5dac8a8957104bdd8c359e85c86b0ee0e38dca447cb1095f70fb"}, - {file = "ruff-0.8.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:c01c048f9c3385e0fd7822ad0fd519afb282af9cf1778f3580e540629df89725"}, - {file = "ruff-0.8.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:7512e8cb038db7f5db6aae0e24735ff9ea03bb0ed6ae2ce534e9baa23c1dc9ea"}, - {file = "ruff-0.8.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:762f113232acd5b768d6b875d16aad6b00082add40ec91c927f0673a8ec4ede8"}, - {file = "ruff-0.8.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:03a90200c5dfff49e4c967b405f27fdfa81594cbb7c5ff5609e42d7fe9680da5"}, - {file = "ruff-0.8.5-py3-none-win32.whl", hash = "sha256:8710ffd57bdaa6690cbf6ecff19884b8629ec2a2a2a2f783aa94b1cc795139ed"}, - {file = "ruff-0.8.5-py3-none-win_amd64.whl", hash = "sha256:4020d8bf8d3a32325c77af452a9976a9ad6455773bcb94991cf15bd66b347e47"}, - {file = "ruff-0.8.5-py3-none-win_arm64.whl", hash = "sha256:134ae019ef13e1b060ab7136e7828a6d83ea727ba123381307eb37c6bd5e01cb"}, - {file = "ruff-0.8.5.tar.gz", hash = "sha256:1098d36f69831f7ff2a1da3e6407d5fbd6dfa2559e4f74ff2d260c5588900317"}, + {file = "ruff-0.9.3-py3-none-linux_armv6l.whl", hash = "sha256:7f39b879064c7d9670197d91124a75d118d00b0990586549949aae80cdc16624"}, + {file = "ruff-0.9.3-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:a187171e7c09efa4b4cc30ee5d0d55a8d6c5311b3e1b74ac5cb96cc89bafc43c"}, + {file = "ruff-0.9.3-py3-none-macosx_11_0_arm64.whl", hash = "sha256:c59ab92f8e92d6725b7ded9d4a31be3ef42688a115c6d3da9457a5bda140e2b4"}, + {file = "ruff-0.9.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2dc153c25e715be41bb228bc651c1e9b1a88d5c6e5ed0194fa0dfea02b026439"}, + {file = "ruff-0.9.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:646909a1e25e0dc28fbc529eab8eb7bb583079628e8cbe738192853dbbe43af5"}, + {file = "ruff-0.9.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5a5a46e09355695fbdbb30ed9889d6cf1c61b77b700a9fafc21b41f097bfbba4"}, + {file = "ruff-0.9.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c4bb09d2bbb394e3730d0918c00276e79b2de70ec2a5231cd4ebb51a57df9ba1"}, + {file = "ruff-0.9.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:96a87ec31dc1044d8c2da2ebbed1c456d9b561e7d087734336518181b26b3aa5"}, + {file = "ruff-0.9.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9bb7554aca6f842645022fe2d301c264e6925baa708b392867b7a62645304df4"}, + {file = "ruff-0.9.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cabc332b7075a914ecea912cd1f3d4370489c8018f2c945a30bcc934e3bc06a6"}, + {file = "ruff-0.9.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:33866c3cc2a575cbd546f2cd02bdd466fed65118e4365ee538a3deffd6fcb730"}, + {file = "ruff-0.9.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:006e5de2621304c8810bcd2ee101587712fa93b4f955ed0985907a36c427e0c2"}, + {file = "ruff-0.9.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:ba6eea4459dbd6b1be4e6bfc766079fb9b8dd2e5a35aff6baee4d9b1514ea519"}, + {file = "ruff-0.9.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:90230a6b8055ad47d3325e9ee8f8a9ae7e273078a66401ac66df68943ced029b"}, + {file = "ruff-0.9.3-py3-none-win32.whl", hash = "sha256:eabe5eb2c19a42f4808c03b82bd313fc84d4e395133fb3fc1b1516170a31213c"}, + {file = "ruff-0.9.3-py3-none-win_amd64.whl", hash = "sha256:040ceb7f20791dfa0e78b4230ee9dce23da3b64dd5848e40e3bf3ab76468dcf4"}, + {file = "ruff-0.9.3-py3-none-win_arm64.whl", hash = "sha256:800d773f6d4d33b0a3c60e2c6ae8f4c202ea2de056365acfa519aa48acf28e0b"}, + {file = "ruff-0.9.3.tar.gz", hash = "sha256:8293f89985a090ebc3ed1064df31f3b4b56320cdfcec8b60d3295bddb955c22a"}, ] [[package]] @@ -1772,4 +1772,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = ">=3.9" -content-hash = "36ac305c62f5139da82126a1b3bc71f86320af1abab5c473b3c0d21c81e214bd" +content-hash = "ac79ae58b65962eac836910d2b1359591d1fd53c68afb354b4c549cdcdd4349c" diff --git a/pyproject.toml b/pyproject.toml index e1b884f47..6c318205b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" From 143abaa9fd0c4ac35892abff3cc4351acb494a13 Mon Sep 17 00:00:00 2001 From: "Axel H." Date: Wed, 29 Jan 2025 20:04:12 +0100 Subject: [PATCH 2/2] style: fix formatting for `ruff>=0.9` --- commitizen/cli.py | 3 +-- commitizen/commands/bump.py | 7 +++---- .../conventional_commits.py | 4 +--- tests/commands/test_bump_command.py | 20 +++++++++---------- tests/commands/test_changelog_command.py | 2 +- tests/commands/test_check_command.py | 2 +- tests/commands/test_version_command.py | 2 +- tests/conftest.py | 8 +++----- tests/test_changelog.py | 6 +++--- tests/test_conf.py | 2 +- tests/test_cz_conventional_commits.py | 2 +- tests/test_git.py | 2 +- 12 files changed, 27 insertions(+), 33 deletions(-) diff --git a/commitizen/cli.py b/commitizen/cli.py index 2ee7d41eb..0b411cba6 100644 --- a/commitizen/cli.py +++ b/commitizen/cli.py @@ -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)" ), }, { diff --git a/commitizen/commands/bump.py b/commitizen/commands/bump.py index a3682df8f..cd01da4f8 100644 --- a/commitizen/commands/bump.py +++ b/commitizen/commands/bump.py @@ -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) @@ -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" @@ -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] = [] diff --git a/commitizen/cz/conventional_commits/conventional_commits.py b/commitizen/cz/conventional_commits/conventional_commits.py index dcfd7bab8..c7b88258c 100644 --- a/commitizen/cz/conventional_commits/conventional_commits.py +++ b/commitizen/cz/conventional_commits/conventional_commits.py @@ -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", }, { diff --git a/tests/commands/test_bump_command.py b/tests/commands/test_bump_command.py index 81273764d..c43c1a16f 100644 --- a/tests/commands/test_bump_command.py +++ b/tests/commands/test_bump_command.py @@ -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"] @@ -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) @@ -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 @@ -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 @@ -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 @@ -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) @@ -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) @@ -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" @@ -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) @@ -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") diff --git a/tests/commands/test_changelog_command.py b/tests/commands/test_changelog_command.py index bc0d6c6a2..a6ff7db2d 100644 --- a/tests/commands/test_changelog_command.py +++ b/tests/commands/test_changelog_command.py @@ -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") diff --git a/tests/commands/test_check_command.py b/tests/commands/test_check_command.py index 57bfe3f10..f1db44619 100644 --- a/tests/commands/test_check_command.py +++ b/tests/commands/test_check_command.py @@ -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", diff --git a/tests/commands/test_version_command.py b/tests/commands/test_version_command.py index f7d38c202..927cf55f2 100644 --- a/tests/commands/test_version_command.py +++ b/tests/commands/test_version_command.py @@ -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 diff --git a/tests/conftest.py b/tests/conftest.py index 1e6bc15f0..3d88f19b1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -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 @@ -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") @@ -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) diff --git a/tests/test_changelog.py b/tests/test_changelog.py index 20d59488d..76ee80600 100644 --- a/tests/test_changelog.py +++ b/tests/test_changelog.py @@ -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( diff --git a/tests/test_conf.py b/tests/test_conf.py index 1cbbc57ac..3e0a44c7d 100644 --- a/tests/test_conf.py +++ b/tests/test_conf.py @@ -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) diff --git a/tests/test_cz_conventional_commits.py b/tests/test_cz_conventional_commits.py index 04d052217..6d4e0f743 100644 --- a/tests/test_cz_conventional_commits.py +++ b/tests/test_cz_conventional_commits.py @@ -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, ""]] diff --git a/tests/test_git.py b/tests/test_git.py index 8bf995e8a..f929ba6a4 100644 --- a/tests/test_git.py +++ b/tests/test_git.py @@ -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"]