Skip to content
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

refactor suggestion #382

Open
hannesdelbeke opened this issue Jan 16, 2022 · 1 comment
Open

refactor suggestion #382

hannesdelbeke opened this issue Jan 16, 2022 · 1 comment

Comments

@hannesdelbeke
Copy link
Contributor

PS: while working on #380, i noticed discover and registering a plugin directly have a lot of overlapping code.

both

  • def plugins_from_module(module)
  • def register_plugin(plugin)

contain

  • host_is_compatible()
  • version_is_compatible
  • plugin_is_valid

But there are differences:

  • register_plugin checks if if not hasattr(plugin, "__call__"):
  • plugins_from_module doesn't

since all of these functions check if a plugin is valid, is it a bad suggestion to move them to the plugin_is_valid function?
will create a PR with a suggestion once 380 is merged in

@hannesdelbeke
Copy link
Contributor Author

see PR #386 with suggested changes
would also give a more accurate overview of coverage.
several if statements in discover are not triggered, yet since the function has a test it is 100% covered...

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

No branches or pull requests

1 participant