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

Dot output contains the full path #59

Open
ufrshubham opened this issue Sep 17, 2022 · 3 comments
Open

Dot output contains the full path #59

ufrshubham opened this issue Sep 17, 2022 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ufrshubham
Copy link

Problem

I am trying to use this package to generate dot output for some class in flame engine's repo. This is the command that I am using,

dart pub global run dcdg -b dot > dot.dot

It executes without any errors, but the output is something like this,

"flame/src/collisions/hitboxes/circle_hitbox.dartCircleHitbox" -> "flame/src/geometry/circle_component.dartCircleComponent"
"flame/src/collisions/hitboxes/circle_hitbox.dartCircleHitbox" -> "flame/src/collisions/hitboxes/shape_hitbox.dartShapeHitbox"
"flame/src/collisions/hitboxes/composite_hitbox.dartCompositeHitbox" -> "flame/src/components/position_component.dartPositionComponent"
"flame/src/collisions/hitboxes/composite_hitbox.dartCompositeHitbox" -> "flame/src/collisions/collision_callbacks.dartCollisionCallbacks"

The class name and file path are getting combined into a single string and as a result of this the image generated from dot executable looks like this,
image

Expected behavior

I'd like the dot output to be just the class names so that the generated image also contains only the class names.

@glesica glesica added help wanted Extra attention is needed good first issue Good for newcomers labels Sep 20, 2022
@glesica
Copy link
Owner

glesica commented Sep 20, 2022

The purpose of that is to ensure class names are unique by name spacing them. For example, you could have two classes named Foo, one in lib/src/foo_web.dart and the other in lib/src/foo_mobile.dart. Without name spacing them, they would appear as the same class in the diagram.

I would consider adding a flag, maybe --no-namespace, to suppress namespaces for situations where you know there won't be any name collisions. The flag would apply to the DOT and PlantUML builders, as those are the ones that support namespaces (the Mermaid format doesn't allow namespaces).

@glesica glesica added the enhancement New feature or request label Sep 20, 2022
@ufrshubham
Copy link
Author

ufrshubham commented Sep 20, 2022

Okay that makes sense. It's just that the name spacing is added without any / or _ separating path and class name. This lead me to believe that it was a bug. Not sure if that is the expected format for dot. But the flag sounds like a good idea👍🏼

@glesica
Copy link
Owner

glesica commented Sep 20, 2022

Oh I see what you mean about the separators being missing. That may be a bug that was introduced when I added the Mermaid format. I'll fix that bit, at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants