Skip to content

refactor: fix typos #1407

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion commitizen/commands/bump.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(self, config: BaseConfig, arguments: dict):
if arguments[key] is not None
},
}
self.cz = factory.commiter_factory(self.config)
self.cz = factory.committer_factory(self.config)
self.changelog_flag = arguments["changelog"]
self.changelog_config = self.config.settings.get("update_changelog_on_bump")
self.changelog_to_stdout = arguments["changelog_to_stdout"]
Expand Down
2 changes: 1 addition & 1 deletion commitizen/commands/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, config: BaseConfig, args):
)

self.encoding = self.config.settings["encoding"]
self.cz = factory.commiter_factory(self.config)
self.cz = factory.committer_factory(self.config)

self.start_rev = args.get("start_rev") or self.config.settings.get(
"changelog_start_rev"
Expand Down
6 changes: 3 additions & 3 deletions commitizen/commands/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self, config: BaseConfig, arguments: dict[str, Any], cwd=os.getcwd(

self.config: BaseConfig = config
self.encoding = config.settings["encoding"]
self.cz = factory.commiter_factory(self.config)
self.cz = factory.committer_factory(self.config)

def _valid_command_argument(self):
num_exclusive_args_provided = sum(
Expand All @@ -72,15 +72,15 @@ def __call__(self):
raise NoCommitsFoundError(f"No commit found with range: '{self.rev_range}'")

pattern = self.cz.schema_pattern()
ill_formated_commits = [
ill_formatted_commits = [
commit
for commit in commits
if not self.validate_commit_message(commit.message, pattern)
]
displayed_msgs_content = "\n".join(
[
f'commit "{commit.rev}": "{commit.message}"'
for commit in ill_formated_commits
for commit in ill_formatted_commits
]
)
if displayed_msgs_content:
Expand Down
2 changes: 1 addition & 1 deletion commitizen/commands/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, config: BaseConfig, arguments: dict):

self.config: BaseConfig = config
self.encoding = config.settings["encoding"]
self.cz = factory.commiter_factory(self.config)
self.cz = factory.committer_factory(self.config)
self.arguments = arguments
self.temp_file: str = get_backup_file_path()

Expand Down
2 changes: 1 addition & 1 deletion commitizen/commands/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Example:

def __init__(self, config: BaseConfig, *args):
self.config: BaseConfig = config
self.cz = factory.commiter_factory(self.config)
self.cz = factory.committer_factory(self.config)

def __call__(self):
out.write(self.cz.example())
2 changes: 1 addition & 1 deletion commitizen/commands/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Info:

def __init__(self, config: BaseConfig, *args):
self.config: BaseConfig = config
self.cz = factory.commiter_factory(self.config)
self.cz = factory.committer_factory(self.config)

def __call__(self):
out.write(self.cz.info())
2 changes: 1 addition & 1 deletion commitizen/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Init:
def __init__(self, config: BaseConfig, *args):
self.config: BaseConfig = config
self.encoding = config.settings["encoding"]
self.cz = factory.commiter_factory(self.config)
self.cz = factory.committer_factory(self.config)
self.project_info = ProjectInfo()

def __call__(self):
Expand Down
2 changes: 1 addition & 1 deletion commitizen/commands/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Schema:

def __init__(self, config: BaseConfig, *args):
self.config: BaseConfig = config
self.cz = factory.commiter_factory(self.config)
self.cz = factory.committer_factory(self.config)

def __call__(self):
out.write(self.cz.schema())
2 changes: 1 addition & 1 deletion commitizen/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from commitizen.exceptions import NoCommitizenFoundException


def commiter_factory(config: BaseConfig) -> BaseCommitizen:
def committer_factory(config: BaseConfig) -> BaseCommitizen:
"""Return the correct commitizen existing in the registry."""
name: str = config.settings["name"]
try:
Expand Down
10 changes: 5 additions & 5 deletions 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: Rexpose 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 Expand Up @@ -78,7 +78,7 @@ def is_prerelease(self) -> bool:

@property
def prerelease(self) -> str | None:
"""The prelease potion of the version is this is a prerelease."""
"""The prerelease potion of the version is this is a prerelease."""
raise NotImplementedError("must be implemented")

@property
Expand Down Expand Up @@ -142,7 +142,7 @@ def bump(
prerelease: The type of prerelease, if Any
is_local_version: Whether to increment the local version instead
exact_increment: Treat the increment and prerelease arguments explicitly. Disables logic
that attempts to deduce the correct increment when a prelease suffix is present.
that attempts to deduce the correct increment when a prerelease suffix is present.
"""


Expand Down Expand Up @@ -351,15 +351,15 @@ class SemVer2(SemVer):
See: https://semver.org/spec/v2.0.0.html
"""

_STD_PRELEASES = {
_STD_PRERELEASES = {
"a": "alpha",
"b": "beta",
}

@property
def prerelease(self) -> str | None:
if self.is_prerelease and self.pre:
prerelease_type = self._STD_PRELEASES.get(self.pre[0], self.pre[0])
prerelease_type = self._STD_PRERELEASES.get(self.pre[0], self.pre[0])
return f"{prerelease_type}.{self.pre[1]}"
return None

Expand Down
18 changes: 9 additions & 9 deletions tests/commands/test_bump_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def test_bump_command_increment_option(


@pytest.mark.usefixtures("tmp_commitizen_project")
def test_bump_command_prelease(mocker: MockFixture):
def test_bump_command_prerelease(mocker: MockFixture):
create_file_and_commit("feat: location")

# Create an alpha pre-release.
Expand Down Expand Up @@ -281,7 +281,7 @@ def test_bump_command_prelease(mocker: MockFixture):


@pytest.mark.usefixtures("tmp_commitizen_project")
def test_bump_command_prelease_increment(mocker: MockFixture):
def test_bump_command_prerelease_increment(mocker: MockFixture):
# FINAL RELEASE
create_file_and_commit("fix: location")

Expand Down Expand Up @@ -317,7 +317,7 @@ def test_bump_command_prelease_increment(mocker: MockFixture):


@pytest.mark.usefixtures("tmp_commitizen_project")
def test_bump_command_prelease_exact_mode(mocker: MockFixture):
def test_bump_command_prerelease_exact_mode(mocker: MockFixture):
# PRERELEASE
create_file_and_commit("feat: location")

Expand Down Expand Up @@ -437,7 +437,7 @@ def test_bump_on_git_with_hooks_no_verify_enabled(mocker: MockFixture):


@pytest.mark.usefixtures("tmp_commitizen_project")
def test_bump_when_bumpping_is_not_support(mocker: MockFixture):
def test_bump_when_bumping_is_not_support(mocker: MockFixture):
create_file_and_commit(
"feat: new user interface\n\nBREAKING CHANGE: age is no longer supported"
)
Expand Down Expand Up @@ -1062,7 +1062,7 @@ def test_bump_use_version_provider(mocker: MockFixture):
mock.set_version.assert_called_once_with("0.0.1")


def test_bump_command_prelease_scheme_via_cli(
def test_bump_command_prerelease_scheme_via_cli(
tmp_commitizen_project_initial, mocker: MockFixture
):
tmp_commitizen_project = tmp_commitizen_project_initial()
Expand Down Expand Up @@ -1101,7 +1101,7 @@ def test_bump_command_prelease_scheme_via_cli(
assert "0.2.0" in f.read()


def test_bump_command_prelease_scheme_via_config(
def test_bump_command_prerelease_scheme_via_config(
tmp_commitizen_project_initial, mocker: MockFixture
):
tmp_commitizen_project = tmp_commitizen_project_initial(
Expand Down Expand Up @@ -1145,7 +1145,7 @@ def test_bump_command_prelease_scheme_via_config(
assert "0.2.0" in f.read()


def test_bump_command_prelease_scheme_check_old_tags(
def test_bump_command_prerelease_scheme_check_old_tags(
tmp_commitizen_project_initial, mocker: MockFixture
):
tmp_commitizen_project = tmp_commitizen_project_initial(
Expand Down Expand Up @@ -1285,7 +1285,7 @@ def test_bump_command_version_scheme_priority_over_version_type(mocker: MockFixt
),
),
)
def test_bump_template_option_precedance(
def test_bump_template_option_precedence(
mocker: MockFixture,
tmp_commitizen_project: Path,
any_changelog_format: ChangelogFormat,
Expand Down Expand Up @@ -1327,7 +1327,7 @@ def test_bump_template_option_precedance(
assert out == expected


def test_bump_template_extras_precedance(
def test_bump_template_extras_precedence(
mocker: MockFixture,
tmp_commitizen_project: Path,
any_changelog_format: ChangelogFormat,
Expand Down
4 changes: 2 additions & 2 deletions tests/commands/test_changelog_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ def test_changelog_from_current_version_tag_with_nonversion_tag(
),
),
)
def test_changelog_template_option_precedance(
def test_changelog_template_option_precedence(
mocker: MockFixture,
tmp_commitizen_project: Path,
any_changelog_format: ChangelogFormat,
Expand Down Expand Up @@ -1523,7 +1523,7 @@ def test_changelog_template_option_precedance(
assert out == expected


def test_changelog_template_extras_precedance(
def test_changelog_template_extras_precedence(
mocker: MockFixture,
tmp_commitizen_project: Path,
mock_plugin: BaseCommitizen,
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 @@ -365,7 +365,7 @@ def test_check_command_with_pipe_message_and_failed(mocker: MockFixture):
assert "commit validation: failed!" in str(excinfo.value)


def test_check_command_with_comment_in_messege_file(mocker: MockFixture, capsys):
def test_check_command_with_comment_in_message_file(mocker: MockFixture, capsys):
testargs = ["cz", "check", "--commit-msg-file", "some_file"]
mocker.patch.object(sys, "argv", testargs)
mocker.patch(
Expand Down
2 changes: 1 addition & 1 deletion tests/commands/test_init_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def check_pre_commit_config(expected: list[dict[str, Any]]):

@pytest.mark.usefixtures("pre_commit_installed")
class TestPreCommitCases:
def test_no_existing_pre_commit_conifg(_, default_choice, tmpdir, config):
def test_no_existing_pre_commit_config(_, default_choice, tmpdir, config):
with tmpdir.as_cwd():
commands.Init(config)()
check_cz_config(default_choice)
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def message(self, answers: dict) -> str:
@pytest.fixture
def mock_plugin(mocker: MockerFixture, config: BaseConfig) -> BaseCommitizen:
mock = MockPlugin(config)
mocker.patch("commitizen.factory.commiter_factory", return_value=mock)
mocker.patch("commitizen.factory.committer_factory", return_value=mock)
return mock


Expand Down
4 changes: 2 additions & 2 deletions tests/test_bump_update_version_in_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def test_file_version_inconsistent_error(
assert expected_msg in str(excinfo.value)


def test_multiplt_versions_to_bump(
def test_multiple_versions_to_bump(
multiple_versions_to_update_poetry_lock, file_regression
):
old_version = "1.2.9"
Expand All @@ -216,7 +216,7 @@ def test_update_version_in_globbed_files(commitizen_config_file, file_regression
print(commitizen_config_file, other)
copyfile(commitizen_config_file, other)

# Prepend full ppath as test assume absolute paths or cwd-relative
# Prepend full path as test assume absolute paths or cwd-relative
version_files = [commitizen_config_file.dirpath("*.toml")]

bump.update_version_in_files(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_changelog_format_asciidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def test_parse_title_type_of_line(
pytest.param(CHANGELOG_D, EXPECTED_D, id="D"),
),
)
def test_get_matadata(
def test_get_metadata(
tmp_path: Path, format: AsciiDoc, content: str, expected: Metadata
):
changelog = tmp_path / format.default_changelog_file
Expand Down
2 changes: 1 addition & 1 deletion tests/test_changelog_format_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def test_parse_title_type_of_line(
pytest.param(CHANGELOG_D, EXPECTED_D, id="D"),
),
)
def test_get_matadata(
def test_get_metadata(
tmp_path: Path, format: Markdown, content: str, expected: Metadata
):
changelog = tmp_path / format.default_changelog_file
Expand Down
2 changes: 1 addition & 1 deletion tests/test_changelog_format_restructuredtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def format_with_tags(config: BaseConfig, request) -> RestructuredText:


@pytest.mark.parametrize("content, expected", CASES)
def test_get_matadata(
def test_get_metadata(
tmp_path: Path, format: RestructuredText, content: str, expected: Metadata
):
changelog = tmp_path / format.default_changelog_file
Expand Down
2 changes: 1 addition & 1 deletion tests/test_changelog_format_textile.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_parse_title_type_of_line(
pytest.param(CHANGELOG_D, EXPECTED_D, id="D"),
),
)
def test_get_matadata(
def test_get_metadata(
tmp_path: Path, format: Textile, content: str, expected: Metadata
):
changelog = tmp_path / format.default_changelog_file
Expand Down
6 changes: 3 additions & 3 deletions tests/test_cz_customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,16 +473,16 @@ def test_answer(config):
cz = CustomizeCommitsCz(config)
answers = {
"change_type": "feature",
"message": "this feature enaable customize through config file",
"message": "this feature enable customize through config file",
"show_message": True,
}
message = cz.message(answers)
assert message == "feature: this feature enaable customize through config file"
assert message == "feature: this feature enable customize through config file"

cz = CustomizeCommitsCz(config)
answers = {
"change_type": "feature",
"message": "this feature enaable customize through config file",
"message": "this feature enable customize through config file",
"show_message": False,
}
message = cz.message(answers)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ class OtherPlugin:
def test_factory():
config = BaseConfig()
config.settings.update({"name": defaults.DEFAULT_SETTINGS["name"]})
r = factory.commiter_factory(config)
r = factory.committer_factory(config)
assert isinstance(r, BaseCommitizen)


def test_factory_fails():
config = BaseConfig()
config.settings.update({"name": "Nothing"})
with pytest.raises(NoCommitizenFoundException) as excinfo:
factory.commiter_factory(config)
factory.committer_factory(config)

assert "The committer has not been found in the system." in str(excinfo)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_version_scheme_pep440.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
(("3.1.4a0", "MAJOR", "alpha", 0, None), "4.0.0a0"),
]

excact_cases = [
exact_cases = [
(("1.0.0", "PATCH", None, 0, None), "1.0.1"),
(("1.0.0", "MINOR", None, 0, None), "1.1.0"),
# with exact_increment=False: "1.0.0b0"
Expand Down Expand Up @@ -213,7 +213,7 @@ def test_bump_pep440_version(test_input, expected):
)


@pytest.mark.parametrize("test_input, expected", excact_cases)
@pytest.mark.parametrize("test_input, expected", exact_cases)
def test_bump_pep440_version_force(test_input, expected):
current_version = test_input[0]
increment = test_input[1]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_version_scheme_semver.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
(("1.0.0-alpha1", None, "alpha", 0, None), "1.0.0-a2"),
]

excact_cases = [
exact_cases = [
(("1.0.0", "PATCH", None, 0, None), "1.0.1"),
(("1.0.0", "MINOR", None, 0, None), "1.1.0"),
# with exact_increment=False: "1.0.0-b0"
Expand Down Expand Up @@ -144,7 +144,7 @@ def test_bump_semver_version(test_input, expected):
)


@pytest.mark.parametrize("test_input, expected", excact_cases)
@pytest.mark.parametrize("test_input, expected", exact_cases)
def test_bump_semver_version_force(test_input, expected):
current_version = test_input[0]
increment = test_input[1]
Expand Down