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.

All path and parallelism settings in Forti4D flow through a single central module — config.py. It defines three configurable values: the Fortran source directory, the output directory, and the worker count for parallel steps. Each value is resolved at runtime using a consistent priority chain: an explicit CLI flag always wins, followed by the corresponding environment variable, and finally a hardcoded default. This means you can configure a project once via environment variables for a whole session, or override everything on a single command line without touching your shell.

Configuration Reference

Environment VariableCLI FlagDefaultDescription
FORT_SRC--project DIRtests/fixtures/Path to the directory containing the Fortran source files to analyze. Resolved to a pathlib.Path at startup.
FORT_OUT--output DIRresults/Root directory where all output files are written — CSVs, audit files, block topology files, DOT graphs, the HTML report, and the run log.
FORT_WORKERS--workers N1Number of parallel worker processes for the steps that support per-file parallelism (inventory, profiler, blocks). Must be a positive integer; non-integer values fall back silently to 1.

Priority Order

Each setting is resolved by config.resolve_paths() and config.resolve_workers() at call time using this fixed precedence:
1

Explicit CLI flag

Values passed directly to --project, --output, or --workers always take highest priority and override everything else.
2

Environment variable

If no CLI flag is provided, Forti4D reads FORT_SRC, FORT_OUT, or FORT_WORKERS from the current environment.
3

Hardcoded default

If neither a CLI flag nor an environment variable is present, the built-in defaults are used: tests/fixtures/ for source, results/ for output, and 1 for workers.
The --project and --output flags are the most explicit and portable way to configure a run. They require no shell setup and work identically across platforms:
# Specify both source and output directories
forti4d --project /path/to/fortran --output /path/to/output/

# Enable parallel processing on top of explicit paths
forti4d --project /path/to/fortran --output /path/to/output/ --workers 4
When the pipeline runs, it mirrors --project and --output into FORT_SRC and FORT_OUT in the process environment, so every analyzer automatically picks up the correct paths without needing separate configuration.

Setting via Environment Variables

Environment variables are useful for one-off runs or when integrating Forti4D into shell scripts and CI pipelines:
# One-off run against a specific project
FORT_SRC=/path/to/fortran FORT_OUT=results/ forti4d

# Set workers alongside path overrides
FORT_SRC=/path/to/fortran FORT_OUT=results/ FORT_WORKERS=8 forti4d

# Export variables for a whole shell session
export FORT_SRC=/home/user/legacy-project
export FORT_OUT=/home/user/analysis-results
forti4d          # uses the exported values
forti4d --list   # also uses them — shows active paths
For individual analyzer scripts invoked outside the pipeline, the same variables apply:
FORT_SRC=/path/to/project FORT_OUT=results/ python3 -m forti4d.analyzers.inventory

Output Directory Creation

FORT_OUT (the results directory) is created automatically by the pipeline before any step runs. You do not need to create it manually. The call is equivalent to Path(results_dir).mkdir(parents=True, exist_ok=True), so nested paths like deep/nested/output/ work without pre-creating intermediate directories. Subdirectories required by individual steps — audit/ and blocks/ — are also created on demand by the steps that write to them.

Output Directory Layout

After a complete pipeline run, the results directory contains the following structure:

audit/

Per-file *_DEBUG.csv files produced by the profiler step. Each file contains a line-by-line statement classification for one source file. Required by the blocks step and several downstream analyzers.

blocks/

Per-file *_blocks.txt block topology reports produced by the blocks step. One file per source file processed during the profiler step.

graph_*.dot

Graphviz DOT files generated by the visual_graph step. Includes a full call graph, a simplified call graph, and one DOT file per entry point. Render with dot -Tsvg graph_full.dot -o graph_full.svg.

report.html

Self-contained HTML report produced by the html_report step. Contains a filterable and sortable unit table with all collected metrics. No external assets required — open directly in a browser.
The root of the results directory also holds all CSV report files (such as report_consolidated.csv, report_prioritization.csv, inventory_report.csv, and others), the executive summary (PROJECT_SUMMARY.md), and the run log (forti4d.log).
PathProduced byDescription
<FORT_OUT>/audit/profilerPer-file DEBUG CSV files, one per source file
<FORT_OUT>/blocks/blocksPer-file block topology text files
<FORT_OUT>/graph_*.dotvisual_graphGraphviz call graph DOT files
<FORT_OUT>/report.htmlhtml_reportSelf-contained HTML report
<FORT_OUT>/forti4d.logPipeline startupFull DEBUG-level run log
When running through the forti4d CLI, FORT_SRC and FORT_OUT are set automatically from --project and --output before any step executes. Individual analyzer scripts invoked outside the pipeline rely on the environment variables or the config.py defaults directly.

Build docs developers (and LLMs) love