Skip to content

Refactor: Make BuildGraph a Static Method #747

@ziagham

Description

@ziagham

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions