Skip to content

fix: Ignore packages that are not plugins #1

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 3 commits into from
Jan 28, 2022

Conversation

mmartinortiz
Copy link
Owner

@mmartinortiz mmartinortiz commented Jan 28, 2022

When a package starting with a plugin name is found, but it is not a plugin, it becomes safely ignored.

Description

When a packages has a name that matches a plugin, but it is not a plugin, it is safely ignored and reported to the user.

Background: The company where I work, and where I use commitizen for releasing package versions, is called CZ. And because we are not very imaginative, we use to call the packages that we develop for internal use something like cz_.

This collides with the way that commitizen discover plugins, and the discovery process raises an exception when a package starts with the name cz_ is found but is not implemented as a plugin.

This MR proposes a way to ignore those packages that collide in name but are not plugins. This proposal tries to be as agnostic as possible, not very Pythonic, but I am open to suggestions.

Checklist

  • Add test cases to all the changes you introduce
  • Run ./script/format and ./script/test locally to ensure this change passes linter check and test
  • Test the changes on the local machine manually
  • Update the documentation for the changes

Expected behavior

When the CLI searches for plugins, those packages that have a name cz_ but lack the discover_this attribute, will be ignored and the user will get a warning

Steps to Test This Pull Request

  1. Create a package with a name starting with cz_. It can be located under a src folder
  2. Install commitizen
  3. Run commitizen changelog --help. Without this patch, an exception will be risen.

Additional context

When a package starting with a plugin name is found, but it is not a plugin, it becomes safely ignored.
@mmartinortiz mmartinortiz marked this pull request as ready for review January 28, 2022 17:35
@mmartinortiz mmartinortiz merged commit 55841d6 into master Jan 28, 2022
@mmartinortiz mmartinortiz deleted the fix-ignore-packages-that-are-not-plugins branch January 28, 2022 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant