Code quality and technical debt

Data-flow analysis

Also known as Data-flow analysis, Data-flow analysis in software engineering

By WeavePublished 1 min read

Definition

A static-analysis technique that tracks how values move through a program.

What it means

Data-flow analysis follows facts about variables across assignments, branches, and procedure boundaries. Depending on the analysis, the fact may be whether a value is initialized, where a definition reaches a use, or whether sensitive input reaches an output. The technique helps identify defects and supports refactoring by making value dependencies explicit.

Example

Imagine a request parameter that reaches a database query through three helper functions. A taint-oriented data-flow analysis can trace that path and flag it for review. A developer can then use a parameterized query or establish a validated boundary.

Limitations

Results depend on the facts being tracked and on the analyzer’s models of libraries and dynamic behavior. Conservative assumptions create false positives, while incomplete interprocedural analysis can miss flows. A warning is not a substitute for threat modeling or tests.

How to use the signal

Weave can connect data-flow rule changes with code review outcomes and later rework. This gives teams a way to evaluate whether analysis is improving change quality, while the specialized data-flow engine remains the source of the finding.

How this relates to Weave

Weave can connect data-flow rule changes with code review outcomes and later rework. This gives teams a way to evaluate whether analysis is improving change quality, while the specialized data-flow engine remains the source of the finding.

Explore Engineering intelligence

Sources and further reading

  1. SonarSource code metrics and analysis documentation