Skip to content

Commit

Permalink
only forcibly generate diagram files if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
softScheck committed Apr 29, 2024
1 parent 1e189fd commit 3d11e84
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pkg/report/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package report
import (
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -40,9 +41,22 @@ func (c *GenerateCommands) Defaults() *GenerateCommands {
func Generate(config *common.Config, readResult *model.ReadResult, commands *GenerateCommands, progressReporter progressReporter) error {
generateDataFlowDiagram := commands.DataFlowDiagram
generateDataAssetsDiagram := commands.DataAssetDiagram

if commands.ReportPDF { // as the PDF report includes both diagrams
generateDataFlowDiagram = true
generateDataAssetsDiagram = true
if ! generateDataFlowDiagram {
dataFlowFile := filepath.Join(config.OutputFolder, config.DataFlowDiagramFilenamePNG)
if _, err := os.Stat(dataFlowFile); errors.Is(err, os.ErrNotExist) {
progressReporter.Warn("Forcibly create the needed Data-Flow Diagram file to enable report generation.")
generateDataFlowDiagram = true
}
}
if ! generateDataAssetsDiagram {
dataAssetFile := filepath.Join(config.OutputFolder, config.DataAssetDiagramFilenamePNG)
if _, err := os.Stat(dataAssetFile); errors.Is(err, os.ErrNotExist) {
progressReporter.Warn("Forcibly create the needed Data-Asset Diagram file to enable report generation.")
generateDataAssetsDiagram = true
}
}
}

diagramDPI := config.DiagramDPI
Expand Down

0 comments on commit 3d11e84

Please sign in to comment.