Skip to content
Merged
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
9 changes: 8 additions & 1 deletion src/extensions/score_draw_uml_funcs/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,14 @@ def get_module(component: str, all_needs: dict[str, dict[str, str]]) -> str:
need = all_needs.get(component, {})

if need:
module = need.get("includes_back", "")
# includes_back could deliver multiple needs; only return Modules
parents = need.get("includes_back", [])
module = [pid for pid in parents if all_needs.get(pid, {}).get("type") == "mod"]

if len(module) > 1:
logger.warning(
f"{component}: included in multiple modules: {module}. Returning first."
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be fixed in future PR.

Is it somewhere documented why only the first one is returned?
Or what the logic behind it is?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the implicit logic, that a component belongs only to one module. Module is something like a bazel module or a package. And the component should only be in one. Sure, it could be used or integrated in more then one, but the real implementation should only be in one. I'm not sure if there are any circumstances (base libraries ???) for an exception from this rule, therefore I give only the warning. But in general it is only one. If we want to modify the draw function to show also multiple modules, then I guess more have to be changed. But will discuss this with the colleagues.

)

if module:
return module[0]
Expand Down
Loading