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

🧹 Use element plugin registry to define LibraryType #1427

Merged
merged 3 commits into from
Feb 3, 2024

Conversation

s-weigand
Copy link
Member

By using the plugin registry instead of looking up inheritance we can ensure that only elements that were explicitly added are valid types (e.g. ExtendableElement is not instantiable by itself and should not be part of LibraryType).

Change summary

Checklist

  • ✔️ Passing the tests (mandatory for all PR's)

@s-weigand s-weigand requested review from jsnel, a team and joernweissenborn as code owners February 2, 2024 19:28
Copy link
Contributor

github-actions bot commented Feb 2, 2024

Binder 👈 Launch a binder notebook on branch s-weigand/pyglotaran/use-element-registry

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Type: Refactoring

PR Summary: The pull request focuses on refining the definition of LibraryType by utilizing the element plugin registry, ensuring that only explicitly added elements are considered valid types. This change aims to exclude non-instantiable types like ExtendableElement from being part of LibraryType. Additionally, the PR includes updates to the pre-commit configuration and the removal of an internal mock element used for testing.

Decision: Comment

📝 Type: 'Refactoring' - not supported yet.
  • Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
📝 Complexity: the changes are too large or complex for Sourcery to approve.
  • Unsupported files: the diff contains files that Sourcery does not currently support during reviews.

General suggestions:

  • Consider adding comments next to the type:ignore directives to explain why type checking is being bypassed, which will help future maintainers understand the context.
  • Ensure that the removal of the InternalMockElement and the changes to LibraryType do not have unintended side effects on the existing tests and other parts of the codebase.
  • Verify that all code interacting with the LibraryType is compatible with the new type structure introduced by the use of the plugin registry.

Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨

Share Sourcery

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.


LibraryType: TypeAlias = dict[str, Element.get_annotated_type()] # type:ignore[misc,valid-type]
LibraryType: TypeAlias = dict[ # type:ignore[misc,valid-type]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (llm): The use of type:ignore may be necessary here, but it's generally a good practice to add a comment explaining why type checking is being ignored to aid future maintainers.

Copy link

sonarqubecloud bot commented Feb 2, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Member

@joernweissenborn joernweissenborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,Was just a quick and dirty placeholder anyway.

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (491a7b6) 84.9% compared to head (0834cf1) 84.9%.

Additional details and impacted files
@@            Coverage Diff            @@
##           staging   #1427     +/-   ##
=========================================
- Coverage     84.9%   84.9%   -0.1%     
=========================================
  Files           91      91             
  Lines         3744    3742      -2     
  Branches       728     728             
=========================================
- Hits          3180    3178      -2     
  Misses         450     450             
  Partials       114     114             

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@s-weigand s-weigand merged commit 60f9c7c into glotaran:staging Feb 3, 2024
22 of 34 checks passed
@s-weigand s-weigand deleted the use-element-registry branch February 3, 2024 20:33
jsnel pushed a commit to jsnel/pyglotaran that referenced this pull request Jun 2, 2024
* 🧹 Use element plugin registry to define LibraryType

* 🧹 Remove InternalMockElement

* 🧰⬆️ Update pre-commit config
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.

2 participants