-
Notifications
You must be signed in to change notification settings - Fork 32
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
Keep text on edges in resulting draw.io output #59
Conversation
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 3.93%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Thanks very much @jdputsch ! |
WalkthroughThis update mainly involves the enhancement and correction of label handling in the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- .gitignore (2 hunks)
- graphviz2drawio/mx/Edge.py (2 hunks)
- graphviz2drawio/mx/EdgeFactory.py (2 hunks)
- graphviz2drawio/mx/MxGraph.py (1 hunks)
Files skipped from review due to trivial changes (1)
- .gitignore
Additional context used
Ruff
graphviz2drawio/mx/EdgeFactory.py
14-14: First argument of a method should be named
self
Rename
g
toself
(N805)
38-38: Undefined name
_get_labels
(F821)
Additional comments not posted (4)
graphviz2drawio/mx/Edge.py (2)
16-16
: LGTM!The
__init__
method correctly initializes thelabels
parameter.Also applies to: 25-25
32-40
: LGTM!The
text_to_mx_value
method correctly processes and formats multiple text labels.graphviz2drawio/mx/EdgeFactory.py (1)
14-28
: LGTM!The
_get_labels
method correctly extracts and processes text labels from SVG elements.Tools
Ruff
14-14: First argument of a method should be named
self
Rename
g
toself
(N805)
graphviz2drawio/mx/MxGraph.py (1)
40-40
: LGTM!The
add_edge
method correctly adds the new key "value" with the formatted text labels.
@@ -18,8 +35,8 @@ def from_svg(self, g) -> Edge: | |||
fr = fr.split(":")[0] | |||
to = to.split(":")[0] | |||
curve = None | |||
label = SVG.get_text(g) or "" | |||
labels = _get_labels(g) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the undefined name _get_labels
.
The _get_labels
method is used but not defined in the current scope.
- labels = _get_labels(g)
+ labels = self._get_labels(g)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
labels = _get_labels(g) | |
labels = self._get_labels(g) |
Tools
Ruff
38-38: Undefined name
_get_labels
(F821)
With this simple graph:
digraph "" {
g [label=Group];
g -> u [label=HAS_USER];
u [label=User];
}
graphviz2drawio 0.2.0 does not include the text "HAS_USER" as a label on the edge between Group and User.
This PR keeps texts associated with edges in the resulting draw.io diagram.
Summary by CodeRabbit
New Features
Chores
.gitignore
to includePipfile.lock
and fixed formatting issues.