-
-
Notifications
You must be signed in to change notification settings - Fork 281
refactor(provider): split provider code and related tests into individual files for maintainability #830
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
Lee-W
merged 39 commits into
commitizen-tools:master
from
davidlday:chore/provider-refactor
Sep 9, 2023
Merged
refactor(provider): split provider code and related tests into individual files for maintainability #830
Changes from 2 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
38c1a33
refactor(provider): split providers into separate files for maintaina…
davidlday b46328e
refactor(tests): split provider tests into separate files for maintai…
davidlday 41f77d9
Merge branch 'master' into chore/provider-refactor
davidlday 4ea8c62
refactor(provider): fully qualify import of commitizen.providers.base…
davidlday 7ac3a98
refactor(provider): move chdir to providers/conftest.py
davidlday 68b5666
refactor(provider): remove unnecessary TYPE_CHECKING from provider tests
davidlday 5514737
refactor(provider): import all providers to providers/__init__.py to …
davidlday d20ddb9
Merge branch 'master' into chore/provider-refactor
davidlday a996237
refactor(provider): split providers into separate files for maintaina…
davidlday 892112e
refactor(tests): split provider tests into separate files for maintai…
davidlday 5786ed0
refactor(provider): fully qualify import of commitizen.providers.base…
davidlday 0f5e54c
refactor(provider): move chdir to providers/conftest.py
davidlday 14be208
refactor(provider): remove unnecessary TYPE_CHECKING from provider tests
davidlday 346919e
refactor(provider): import all providers to providers/__init__.py to …
davidlday 775d5a8
Merge branch 'chore/provider-refactor' of github.com:davidlday/commit…
davidlday ebd1e71
refactor(provider): split providers into separate files for maintaina…
davidlday 3eecbbe
refactor(tests): split provider tests into separate files for maintai…
davidlday 2c1b4ec
refactor(provider): fully qualify import of commitizen.providers.base…
davidlday 4b5becf
refactor(provider): move chdir to providers/conftest.py
davidlday 765d3f4
refactor(provider): remove unnecessary TYPE_CHECKING from provider tests
davidlday 0233334
refactor(provider): import all providers to providers/__init__.py to …
davidlday 5ea3f1e
Merge branch 'chore/provider-refactor' of github.com:davidlday/commit…
davidlday 0c52b09
chore: removed chdir from tests/providers/test_base_provider.py
davidlday ba73dcb
refactor: revert unintentionally reformatting
davidlday 580da4a
refactor: remove unused imports
davidlday 2eb75c6
refactor: use __all__ to name exports
davidlday 27df278
Merge branch 'master' into chore/provider-refactor
Lee-W e5cf494
refactor(provider): split providers into separate files for maintaina…
davidlday 0b0597e
refactor(tests): split provider tests into separate files for maintai…
davidlday d7d1561
refactor(provider): fully qualify import of commitizen.providers.base…
davidlday 96a8bff
refactor(provider): move chdir to providers/conftest.py
davidlday 11f0240
refactor(provider): remove unnecessary TYPE_CHECKING from provider tests
davidlday e6e079d
refactor(provider): import all providers to providers/__init__.py to …
davidlday 0720277
chore: removed chdir from tests/providers/test_base_provider.py
davidlday d0a0bfe
refactor: revert unintentionally reformatting
davidlday 3e49c2a
refactor: remove unused imports
davidlday bcb108d
refactor: use __all__ to name exports
davidlday 2ddca6d
Merge branch 'chore/provider-refactor' of github.com:davidlday/commit…
davidlday b02410b
Merge branch 'master' into chore/provider-refactor
Lee-W File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from __future__ import annotations | ||
|
||
from typing import cast | ||
|
||
import importlib_metadata as metadata | ||
|
||
from commitizen.config.base_config import BaseConfig | ||
from commitizen.exceptions import VersionProviderUnknown | ||
|
||
from .base_provider import VersionProvider | ||
|
||
PROVIDER_ENTRYPOINT = "commitizen.provider" | ||
DEFAULT_PROVIDER = "commitizen" | ||
|
||
|
||
def get_provider(config: BaseConfig) -> VersionProvider: | ||
""" | ||
Get the version provider as defined in the configuration | ||
|
||
:raises VersionProviderUnknown: if the provider named by `version_provider` is not found. | ||
""" | ||
provider_name = config.settings["version_provider"] or DEFAULT_PROVIDER | ||
try: | ||
(ep,) = metadata.entry_points(name=provider_name, group=PROVIDER_ENTRYPOINT) | ||
except ValueError: | ||
raise VersionProviderUnknown(f'Version Provider "{provider_name}" unknown.') | ||
provider_cls = ep.load() | ||
return cast(VersionProvider, provider_cls(config)) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.