-
Notifications
You must be signed in to change notification settings - Fork 11
Refactor duplicated node creation logic to follow DRY principles #87
Copy link
Copy link
Open
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.priority/backlogHigher priority than priority/awaiting-more-evidence.Higher priority than priority/awaiting-more-evidence.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Metadata
Metadata
Assignees
Labels
kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.kind/featureCategorizes issue or PR as related to a new feature.Categorizes issue or PR as related to a new feature.priority/backlogHigher priority than priority/awaiting-more-evidence.Higher priority than priority/awaiting-more-evidence.triage/acceptedIndicates an issue or PR is ready to be actively worked on.Indicates an issue or PR is ready to be actively worked on.
Overview
As identified in PR #86, there is significant code duplication in the codebase that should be refactored to follow the DRY (Don't Repeat Yourself) principle.
Specific Issue in dependency_xml_analyzer.rs
In
src/c_sharp_graph/dependency_xml_analyzer.rs(lines ~119-285), namespace node creation logic is repeated three times and type node creation logic is repeated twice. This duplication:Suggested approach:
Extract helper functions like:
get_or_create_namespace_node(...)get_or_create_type_node(...)These helpers should encapsulate the shared logic for node creation, syntax type assignment, tracking increments, and edge creation.
Broader Scope
There are other places throughout the codebase where similar duplication exists and should be addressed as part of a broader refactoring effort to improve code maintainability.
References