Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/acdeveloper-sci/forti4d/llms.txt

Use this file to discover all available pages before exploring further.

The terminal tier of the Forti4D pipeline aggregates everything that every prior step has produced. consolidate.py performs the full join, pulling one row per unit from the inventory and left-joining every metric from every other report into a single 34-column CSV. visual_graph.py renders the call graph as Graphviz DOT files — colored by reachability, shaped by unit type, clustered by source file. prioritization.py distills all metrics into a single 0–100 composite risk score and assigns each unit to a migration priority tier. Finally, html_report.py converts that ranked list into a self-contained HTML file with summary cards and a filterable, sortable unit table that needs no external dependencies to open in any browser.

consolidate.py — Unified Per-Unit Report

consolidate.py is step 16 of the pipeline. It must run after all other analysis scripts.

Inputs

All prior reports: inventory_report.csv, report_sloc.csv, report_complexity.csv, dep_03_impact_matrix.csv, report_density.csv, report_reachability.csv, common_usage.csv, symbol_variables.csv, symbol_signatures.csv, symbol_implicit.csv, type_definitions.csv, equivalences.csv, and the audit/*_DEBUG.csv directory. All sources except the inventory are optional — missing files produce empty values for their columns without stopping the script.

Output: report_consolidated.csv

One row per program unit, sorted alphabetically by File then Unit. The join key is (File, Unit).
ColumnSourceDescription
FileinventorySource file name
UnitinventoryUnit name
TypeinventoryUnit type
ParentinventoryParent unit or GLOBAL
LOCslocPhysical line count
SLOC_physicalslocLOC minus blanks and comments
SLOC_netslocLogical statements only
N_CommentsslocComment line count
N_ContinuationslocContinuation line count
Pct_CommentslocComment density %
CCcomplexityMcCabe cyclomatic complexity
CC_LevelcomplexityLOW / MEDIUM / HIGH / CRITICAL
CC_SLOCderivedCC / SLOC_net — complexity per logical statement
Fan_InimpactNumber of callers
Fan_OutimpactNumber of callees
Pct_Calcdensity% calculation statements
Pct_Controldensity% control-flow statements
Pct_IOdensity% I/O statements
Pct_Legacydensity% legacy statements
N_Common_Blockscommon_usageNumber of distinct COMMON blocks used
Common_Blockscommon_usageSemicolon-separated block names
StatusreachabilityENTRY_POINT / REACHABLE / UNREACHABLE
Via_Entry_PointsreachabilityEntry points that reach this unit
N_Local_Varssymbol_variablesCount of declared variables (non-PARAMETER)
N_Paramssymbol_variablesCount of PARAMETER constants
N_Formal_Argssymbol_signaturesCount of formal arguments (0 for non-callable units)
Implicit_Nonesymbol_implicitYES if unit has IMPLICIT NONE; NO if it has rules; empty if no IMPLICIT statement
N_Derived_Typestype_definitionsCount of derived TYPE definitions hosted in this unit
Has_EquivequivalencesYES if the unit has any EQUIVALENCE aliasing groups, NO otherwise
N_Equiv_GroupsequivalencesNumber of distinct aliasing groups in the unit
N_Data_Stmtsaudit CSVsCount of DATA statements in the unit
N_Entry_Stmtsaudit CSVsCount of ENTRY statements in the unit
Legacy_FlagsinventoryLegacy constructs detected (from inventory)
IO_FlagsinventoryI/O statements detected (from inventory)
CC_SLOC = 0 when SLOC_net = 0 to avoid division by zero. N_Data_Stmts and N_Entry_Stmts are computed by scanning audit/*_DEBUG.csv directly using scope resolution. If the audit/ directory is missing, both columns default to 0.

visual_graph.py — Call Graph Visualization

visual_graph.py is step 17 of the pipeline.

Inputs

  • <FORT_OUT>/dep_02_unit_graph.csv
  • <FORT_OUT>/report_consolidated.csv

Outputs

FileGenerated when
graph_complete.dotNo --entry flag (all nodes, all edges including USE)
graph_simple.dotNo --entry flag (reachable nodes only, CALL + FUNC_CALL only)
graph_<names>.dot--entry specified — one file named after the selected entry points

Visual Conventions

Node Color (Reachability)

Blue (#4472C4) = Entry point · Green (#70AD47) = Reachable · Grey (#A6A6A6) = Dead code · Yellow (#FFD966) = Reachable from multiple selected entry points

Node Shape (Unit Type)

doubleoctagon = PROGRAM / IMPLICIT-MAIN · hexagon = MODULE · ellipse = FUNCTION · diamond = BLOCK_DATA · box = SUBROUTINE (default)

Edge Style (Dep Type)

Solid black = CALL · Solid green = FUNC_CALL · Dashed blue = USE (module import)
Node labels show: unit name, CC=<value>, Fi=<Fan_In> (when available). Nodes are grouped into clusters by source file.

CLI Flags

visual_graph.py accepts command-line arguments that are not yet supported through the forti4d CLI. Run it directly via python -m forti4d.analyzers.visual_graph. CLI integration is planned for a future release.
# List available entry points
python -m forti4d.analyzers.visual_graph --list

# Full corpus graph
python -m forti4d.analyzers.visual_graph

# Subgraph for a single executable
python -m forti4d.analyzers.visual_graph --entry mcdes

# Subgraph for multiple executables (shared nodes highlighted yellow)
python -m forti4d.analyzers.visual_graph --entry util0 util1 util2

# Include USE (module import) edges — omitted by default
python -m forti4d.analyzers.visual_graph --entry mcdes --use

Rendering DOT Files

Rendering .dot files to images requires Graphviz:
dot -Tpng results/graph_mcdes.dot    -o results/graph_mcdes.png
dot -Tsvg results/graph_complete.dot -o results/graph_complete.svg
dot -Tpdf results/graph_simple.dot   -o results/graph_simple.pdf

prioritization.py — Migration Risk Ranking

prioritization.py is step 18 of the pipeline.

Inputs

  • <FORT_OUT>/report_consolidated.csv
  • <FORT_OUT>/report_clones.csv
  • <FORT_OUT>/report_migration_strategy.csv (optional)

Output: report_prioritization.csv

One row per program unit, sorted by priority tier then by score descending. Dead code units appear last.
ColumnDescription
PriorityCRITICAL, HIGH, MEDIUM, LOW, or DEAD_CODE
ScoreComposite score 0–100
FileSource file name
UnitUnit name
TypeUnit type
CCMcCabe cyclomatic complexity
Fan_InNumber of units that call this one
Pct_LegacyPercentage of legacy statements
Reachability_StatusREACHABLE, UNREACHABLE, or ENTRY_POINT
Clone_StatusWorst clone state: DIVERGED, SIMILAR, IDENTICAL, or blank
StrategyMigration strategy recommendation
Implicit_NoneYES / NO / blank
Has_EquivYES / NO — whether the unit has EQUIVALENCE aliasing
Score_CCCC component contribution (0–30)
Score_FanInFan-In component contribution (0–30)
Score_LegacyLegacy component contribution (0–20)
Score_ClonClone component contribution (0–15)
Score_E4E4 Risk component contribution (0–5)

Composite Risk Score

Score = (W_CC × CC_norm + W_FAN_IN × FanIn_norm + W_LEGACY × Legacy_norm + W_CLONE × Clone_norm + W_E4 × E4_norm) × 100
SignalWeightNormalization
Cyclomatic complexity30%min(CC / P95_CC, 1.0) — 95th percentile among reachable units
Fan-In criticality30%min(Fan_In / P95_FanIn, 1.0) — 95th percentile among reachable units
Legacy density20%Pct_Legacy / 100
Clone state15%1.0 if DIVERGED · 0.5 if SIMILAR · 0.25 if IDENTICAL · 0.0 if no clones
E4 scope risk5%0.70 if no IMPLICIT NONE + 0.30 if has EQUIVALENCE (capped at 1.0)
The 95th percentile is used as the normalization reference (instead of the maximum) to prevent a single outlier from compressing the entire scale. Normalization is computed only over reachable units so that dead code does not skew the reference values.

Priority Tiers

LevelScoreMeaning
CRITICAL≥ 40High complexity or criticality, requires early planning
HIGH≥ 25Significant risk in at least one dimension
MEDIUM≥ 12Moderate — plan but not urgent
LOW< 12Low risk, straightforward migration
DEAD_CODEUNREACHABLE — evaluate for deletion before migrating

html_report.py — Self-Contained HTML Report

html_report.py is step 19 of the pipeline — the final step.

Input

  • <FORT_OUT>/report_prioritization.csv

Output: report.html

A single self-contained HTML file with inline CSS and JavaScript. No external dependencies, no internet connection required. Sections:
1

Header

Project title, generation date and time, total unit count.
2

Priority summary cards

One card per tier (CRITICAL / HIGH / MEDIUM / LOW / DEAD_CODE / TOTAL) showing unit count and percentage. Tier colors: CRITICAL = red, HIGH = orange, MEDIUM = yellow, LOW = green, DEAD_CODE = grey.
3

Main table

All units from report_prioritization.csv with color-coded Priority badges, filter buttons to show only one priority tier, and click-to-sort on every column header (numeric-aware, stable sort). Visible columns: Priority, Score, File, Unit, Type, CC, Fan-In, Pct_Legacy, Reachability, Strategy, Impl.None, Equiv.
html_report.py uses the Python standard library only — no third-party packages required. The output file is fully standalone and can be shared or archived without any accompanying assets.

Build docs developers (and LLMs) love