Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Upgrade ruff and add RUF022 & RUF100 #1482

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

Merged
merged 4 commits into from
Jun 8, 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
4 changes: 2 additions & 2 deletions commitizen/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

__all__ = (
"Bump",
"Changelog",
"Check",
"Commit",
"Changelog",
"Example",
"Info",
"Init",
"ListCz",
"Schema",
"Version",
"Init",
)
2 changes: 1 addition & 1 deletion commitizen/commands/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def find_increment(self, commits: list[git.GitCommit]) -> Increment | None:
)
return bump.find_increment(commits, regex=bump_pattern, increments_map=bump_map)

def __call__(self) -> None: # noqa: C901
def __call__(self) -> None:
"""Steps executed to bump."""
provider = get_provider(self.config)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ConventionalCommitsCz(BaseCommitizen):
bump_pattern = defaults.BUMP_PATTERN
bump_map = defaults.BUMP_MAP
bump_map_major_version_zero = defaults.BUMP_MAP_MAJOR_VERSION_ZERO
commit_parser = r"^((?P<change_type>feat|fix|refactor|perf|BREAKING CHANGE)(?:\((?P<scope>[^()\r\n]*)\)|\()?(?P<breaking>!)?|\w+!):\s(?P<message>.*)?" # noqa
commit_parser = r"^((?P<change_type>feat|fix|refactor|perf|BREAKING CHANGE)(?:\((?P<scope>[^()\r\n]*)\)|\()?(?P<breaking>!)?|\w+!):\s(?P<message>.*)?"
change_type_map = {
"feat": "Feat",
"fix": "Fix",
Expand Down
2 changes: 1 addition & 1 deletion commitizen/cz/jira/jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def example(self) -> str:
)

def schema(self) -> str:
return "<ignored text> <ISSUE_KEY> <ignored text> #<COMMAND> <optional COMMAND_ARGUMENTS>" # noqa
return "<ignored text> <ISSUE_KEY> <ignored text> #<COMMAND> <optional COMMAND_ARGUMENTS>"

def schema_pattern(self) -> str:
return r".*[A-Z]{2,}\-[0-9]+( #| .* #).+( #.+)*"
Expand Down
2 changes: 1 addition & 1 deletion commitizen/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from commitizen.providers.uv_provider import UvProvider

__all__ = [
"get_provider",
"CargoProvider",
"CommitizenProvider",
"ComposerProvider",
Expand All @@ -30,6 +29,7 @@
"PoetryProvider",
"ScmProvider",
"UvProvider",
"get_provider",
]

PROVIDER_ENTRYPOINT = "commitizen.provider"
Expand Down
2 changes: 1 addition & 1 deletion commitizen/version_schemes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
else:
import importlib_metadata as metadata

from packaging.version import InvalidVersion # noqa: F401: expose the common exception
from packaging.version import InvalidVersion # noqa: F401 (expose the common exception)
from packaging.version import Version as _BaseVersion

from commitizen.defaults import MAJOR, MINOR, PATCH, Settings
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.

7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pytest-xdist = "^3.1.0"
deprecated = "^1.2.13"

[tool.poetry.group.linters.dependencies]
ruff = ">=0.5.0,<0.10.0"
ruff = "^0.11.5"
pre-commit = ">=2.18,<5.0"
mypy = "^1.16.0"
types-deprecated = "^1.2.9.2"
Expand Down Expand Up @@ -181,6 +181,7 @@ commands_pre = [["poetry", "install", "--only", "main,test"]]
commands = [["pytest", { replace = "posargs", extend = true }]]

[tool.ruff]
required-version = ">=0.11.5"
line-length = 88

[tool.ruff.lint]
Expand All @@ -193,6 +194,10 @@ select = [
"UP",
# isort
"I",
# unsorted-dunder-all
"RUF022",
# unused-noqa
"RUF100",
]
ignore = ["E501", "D1", "D415"]

Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class SemverCommitizen(BaseCommitizen):
"patch": "PATCH",
}
changelog_pattern = r"^(patch|minor|major)"
commit_parser = r"^(?P<change_type>patch|minor|major)(?:\((?P<scope>[^()\r\n]*)\)|\()?:?\s(?P<message>.+)" # noqa
commit_parser = r"^(?P<change_type>patch|minor|major)(?:\((?P<scope>[^()\r\n]*)\)|\()?:?\s(?P<message>.+)"
change_type_map = {
"major": "Breaking Changes",
"minor": "Features",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_bump_find_increment.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
MAJOR_INCREMENTS_BREAKING_CHANGE_CC = [
"feat(cli): added version",
"docs(README): motivation",
"BREAKING CHANGE: `extends` key in config file is now used for extending other config files", # noqa
"BREAKING CHANGE: `extends` key in config file is now used for extending other config files",
"fix(setup.py): future is now required for every python version",
]

MAJOR_INCREMENTS_BREAKING_CHANGE_ALT_CC = [
"feat(cli): added version",
"docs(README): motivation",
"BREAKING-CHANGE: `extends` key in config file is now used for extending other config files", # noqa
"BREAKING-CHANGE: `extends` key in config file is now used for extending other config files",
"fix(setup.py): future is now required for every python version",
]

Expand Down
4 changes: 2 additions & 2 deletions tests/test_cz_conventional_commits.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_long_answer(config):
message = conventional_commits.message(answers)
assert (
message
== "fix(users): email pattern corrected\n\ncomplete content\n\ncloses #24" # noqa
== "fix(users): email pattern corrected\n\ncomplete content\n\ncloses #24"
)


Expand All @@ -107,7 +107,7 @@ def test_breaking_change_in_footer(config):
print(message)
assert (
message
== "fix(users): email pattern corrected\n\ncomplete content\n\nBREAKING CHANGE: migrate by renaming user to users" # noqa
== "fix(users): email pattern corrected\n\ncomplete content\n\nBREAKING CHANGE: migrate by renaming user to users"
)


Expand Down