-
Notifications
You must be signed in to change notification settings - Fork 26
Refactor: Make BuildGraph a Static Method #747
Copy link
Copy link
Labels
C#C# related codeC# related codeMaintainabilitybugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
What version of FlowSynx?
1.2.4
Describe the bug
Because BuildGraph does not use any instance-level state and operates entirely on its input parameters, it should be refactored into a static method.
File: src/FlowSynx.Infrastructure/Workflow/WorkflowValidator.cs
Method: BuildGraph
Why This Matters
- Improves code clarity — the method clearly does not depend on instance data.
- Enables easier unit testing without requiring an instance of the class.
- Communicates immutability and pure-function behavior to maintainers.
- May improve performance in some scenarios.
Proposed Fix
private static Dictionary<string, List<string>> BuildGraph(IEnumerable<WorkflowTask> tasks, out Dictionary<string, int> inDegree)Ensure dependent methods (EnsureNodeExists, AddDependencies, AddConditionalBranches) are also static or otherwise accessible.
Acceptance Criteria
- BuildGraph is made static.
- All callees either become static or are adjusted accordingly.
- Code compiles successfully.
- Unit tests (if present) are updated and passing.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C#C# related codeC# related codeMaintainabilitybugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed