Documentation
¶
Index ¶
- func GetTranslations() map[string]string
- type AngularAssemblyViewModel
- type AngularClassDetailViewModel
- type AngularClassViewModel
- type AngularCodeElementViewModel
- type AngularCodeFileViewModel
- type AngularHistoricCoverageViewModel
- type AngularLineAnalysisViewModel
- type AngularMethodMetricsViewModel
- type AngularMetricDefinitionViewModel
- type AngularMetricViewModel
- type AngularRiskHotspotMetricHeaderViewModel
- type AngularRiskHotspotStatusMetricViewModel
- type AngularRiskHotspotViewModel
- type Assembly
- type CardRowViewModel
- type CardViewModel
- type Class
- type ClassDetailData
- type ClassViewModelForDetail
- type CodeElement
- type CodeElementType
- type CodeFile
- type FileViewModelForDetail
- type HistoricCoverage
- type HistoryChartDataViewModel
- type HtmlReportBuilder
- type Line
- type LineViewModelForDetail
- type LineVisitStatus
- type Method
- type MethodMetric
- type Metric
- type MetricStatus
- type MetricsTableViewModel
- type SidebarElementViewModel
- type SummaryPageData
- type SummaryResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTranslations ¶
GetTranslations returns a map of localized strings. Values are taken from ReportGenerator.Core/Properties/ReportResources.resx
Types ¶
type AngularAssemblyViewModel ¶
type AngularAssemblyViewModel struct { Name string `json:"name"` Classes []AngularClassViewModel `json:"classes"` }
AngularAssemblyViewModel corresponds to the data structure for window.assemblies.
type AngularClassDetailViewModel ¶
type AngularClassDetailViewModel struct { Class AngularClassViewModel `json:"class"` // Contains overall class stats Files []AngularCodeFileViewModel `json:"files"` // Contains per-file line data, method metrics, code elements }
AngularClassDetailViewModel represents the detailed data for a single class page for Angular.
type AngularClassViewModel ¶
type AngularClassViewModel struct { Name string `json:"name"` ReportPath string `json:"rp"` CoveredLines int `json:"cl"` UncoveredLines int `json:"ucl"` CoverableLines int `json:"cal"` TotalLines int `json:"tl"` CoveredBranches int `json:"cb"` TotalBranches int `json:"tb"` CoveredMethods int `json:"cm"` FullyCoveredMethods int `json:"fcm"` TotalMethods int `json:"tm"` LineCoverageHistory []float64 `json:"lch"` BranchCoverageHistory []float64 `json:"bch"` MethodCoverageHistory []float64 `json:"mch"` FullMethodCoverageHistory []float64 `json:"mfch"` HistoricCoverages []AngularHistoricCoverageViewModel `json:"hc"` Metrics map[string]float64 `json:"metrics,omitempty"` }
AngularClassViewModel corresponds to the data structure for classes within window.assemblies.
type AngularCodeElementViewModel ¶
type AngularCodeElementViewModel struct { Name string `json:"name"` // Display name (e.g., MyMethod(...)) FullName string `json:"fname"` // Full unique name Type string `json:"type"` // "Method" or "Property" FileIndex int `json:"fidx"` // Index of the file this element belongs to Line int `json:"line"` // First line Coverage *float64 `json:"cov"` // Coverage quota (nullable percentage) }
AngularCodeElementViewModel represents an item in the "Methods/Properties" sidebar
type AngularCodeFileViewModel ¶
type AngularCodeFileViewModel struct { Path string `json:"p"` Lines []AngularLineAnalysisViewModel `json:"ls"` CoveredLines int `json:"cl"` // File-specific line coverage CoverableLines int `json:"cal"` // File-specific TotalLines int `json:"tl"` // File-specific MetricsTableHeaders []AngularMetricDefinitionViewModel `json:"mmh"` // Headers for this file's metrics table MetricsTableRows []AngularMethodMetricsViewModel `json:"mmr"` // Rows for this file's metrics table CodeElements []AngularCodeElementViewModel `json:"ce"` // For the "Methods/Properties" sidebar }
AngularCodeFileViewModel represents a code file within a class for Angular.
type AngularHistoricCoverageViewModel ¶
type AngularHistoricCoverageViewModel struct { ExecutionTime string `json:"et"` CoveredLines int `json:"cl"` UncoveredLines int `json:"ucl"` CoverableLines int `json:"cal"` TotalLines int `json:"tl"` LineCoverageQuota float64 `json:"lcq"` CoveredBranches int `json:"cb"` TotalBranches int `json:"tb"` BranchCoverageQuota float64 `json:"bcq"` CoveredMethods int `json:"cm"` FullyCoveredMethods int `json:"fcm"` TotalMethods int `json:"tm"` MethodCoverageQuota float64 `json:"mcq"` FullMethodCoverageQuota float64 `json:"mfcq"` }
AngularHistoricCoverageViewModel corresponds to individual historic coverage data points.
type AngularLineAnalysisViewModel ¶
type AngularLineAnalysisViewModel struct { LineNumber int `json:"ln"` LineContent string `json:"lc"` // Will be empty for now (Phase 2.3) Hits int `json:"h"` LineVisitStatus string `json:"lvs"` // e.g., "covered", "uncovered", "partiallycovered" CoveredBranches int `json:"cb"` TotalBranches int `json:"tb"` }
AngularLineAnalysisViewModel represents the analysis of a single line of code for Angular.
type AngularMethodMetricsViewModel ¶
type AngularMethodMetricsViewModel struct { Name string `json:"name"` // Display name of the method/property FullName string `json:"fullName"` // NEW: Full unique name (for title attributes, etc.) FileIndex int `json:"fileIndex"` // Index of the file (for linking) FileIndexPlus1 int `json:"fileIndexPlus1,omitempty"` // NEW: 1-based index for display FileShortPath string `json:"fileShortPath,omitempty"` // NEW: Sanitized file path for href ID Line int `json:"line"` // First line of the method (for linking) MetricValues []string `json:"metricValues"` // Metric values as strings, in order of headers IsProperty bool `json:"isProperty"` // To choose icon (wrench vs cube) CoverageQuota *float64 `json:"coverageQuota"` // Method's own line coverage quota }
AngularMethodMetricsViewModel represents a single method's row in the metrics table
type AngularMetricDefinitionViewModel ¶
type AngularMetricDefinitionViewModel struct { Name string `json:"name"` // e.g., "Cyclomatic Complexity" ExplanationURL string `json:"explanationUrl"` // URL for the info icon }
AngularMetricDefinitionViewModel describes a metric type for table headers
type AngularMetricViewModel ¶
type AngularMetricViewModel struct { Name string `json:"name"` Abbreviation string `json:"abbreviation"` // Corrected from C# model (abbreviation, not abbr) ExplanationURL string `json:"explanationUrl"` }
AngularMetricViewModel corresponds to the data structure for window.metrics.
type AngularRiskHotspotMetricHeaderViewModel ¶
type AngularRiskHotspotMetricHeaderViewModel struct { Name string `json:"name"` Abbreviation string `json:"abbreviation,omitempty"` // Make consistent with Angular model ExplanationURL string `json:"explanationUrl"` }
AngularRiskHotspotMetricHeaderViewModel corresponds to the data structure for window.riskHotspotMetrics (headers).
type AngularRiskHotspotStatusMetricViewModel ¶
type AngularRiskHotspotStatusMetricViewModel struct { Value float64 `json:"value"` // C# has this as decimal?, let's use float64 in Go Exceeded bool `json:"exceeded"` }
AngularRiskHotspotStatusMetricViewModel represents a single metric's status for a risk hotspot.
type AngularRiskHotspotViewModel ¶
type AngularRiskHotspotViewModel struct { Assembly string `json:"assembly"` // Corrected from C# (assembly, not ass) Class string `json:"class"` // Corrected from C# (class, not cls) ReportPath string `json:"reportPath"` // Corrected from C# (reportPath, not rp) MethodName string `json:"methodName"` // Corrected from C# (methodName, not meth) MethodShortName string `json:"methodShortName"` // Corrected from C# (methodShortName, not methsn) FileIndex int `json:"fileIndex"` // Corrected from C# (fileIndex, not fi) Line int `json:"line"` Metrics []AngularRiskHotspotStatusMetricViewModel `json:"metrics"` }
AngularRiskHotspotViewModel corresponds to the data structure for window.riskHotspots.
type Assembly ¶
type Assembly struct { Name string Classes []Class LinesCovered int LinesValid int BranchesCovered *int // Pointer BranchesValid *int // Pointer TotalLines int // Sum of unique file TotalLines in this assembly }
Assembly represents a logical grouping of classes.
type CardRowViewModel ¶
type CardRowViewModel struct { Header string Text string Tooltip string Alignment string // "left" or "right" (or empty for default) }
CardRowViewModel represents a row in a summary card
type CardViewModel ¶
type CardViewModel struct { Title string SubTitle string // e.g., "72%" SubTitlePercentageBarValue int // e.g., 27 for 72% coverage (100-72) Rows []CardRowViewModel ProRequired bool }
CardViewModel represents a summary card for the Go template
type Class ¶
type Class struct { Name string DisplayName string Files []CodeFile Methods []Method LinesCovered int LinesValid int BranchesCovered *int BranchesValid *int TotalLines int CoveredMethods int FullyCoveredMethods int TotalMethods int Metrics map[string]float64 // Aggregated metrics (e.g., sum of complexities) HistoricCoverages []HistoricCoverage // Historical coverage data for this class }
Class represents a single class or a logical group of methods.
type ClassDetailData ¶
type ClassDetailData struct { ReportTitle string AppVersion string CurrentDateTime string Class ClassViewModelForDetail BranchCoverageAvailable bool MethodCoverageAvailable bool Tag string Translations map[string]string MaximumDecimalPlacesForCoverageQuotas int AngularCssFile string CombinedAngularJsFile string // Only the combined file is needed now AssembliesJSON template.JS RiskHotspotsJSON template.JS MetricsJSON template.JS RiskHotspotMetricsJSON template.JS HistoricCoverageExecutionTimesJSON template.JS TranslationsJSON template.JS ClassDetailJSON template.JS }
ClassDetailData is the top-level struct for the class_detail_layout.gohtml template
type ClassViewModelForDetail ¶
type ClassViewModelForDetail struct { Name string AssemblyName string Files []FileViewModelForDetail IsMultiFile bool CoveragePercentageForDisplay string CoveragePercentageBarValue int CoveredLines int UncoveredLines int CoverableLines int TotalLines int CoverageRatioTextForDisplay string BranchCoveragePercentageForDisplay string BranchCoveragePercentageBarValue int CoveredBranches int TotalBranches int BranchCoverageRatioTextForDisplay string MethodCoveragePercentageForDisplay string MethodCoveragePercentageBarValue int FullMethodCoveragePercentageForDisplay string CoveredMethods int FullyCoveredMethods int TotalMethods int MethodCoverageRatioTextForDisplay string FullMethodCoverageRatioTextForDisplay string MetricsTable MetricsTableViewModel FilesWithMetrics bool SidebarElements []SidebarElementViewModel // Fields for JS data, if needed by Angular components directly via this struct (less likely with server-side template) HistoricCoverages []AngularHistoricCoverageViewModel `json:"hc,omitempty"` LineCoverageHistory []float64 `json:"lch,omitempty"` BranchCoverageHistory []float64 `json:"bch,omitempty"` MethodCoverageHistory []float64 `json:"mch,omitempty"` FullMethodCoverageHistory []float64 `json:"mfch,omitempty"` Metrics map[string]float64 `json:"metrics,omitempty"` // Class-level aggregated metrics }
ClassViewModelForDetail holds data for the main class being displayed
type CodeElement ¶
type CodeElement struct { Name string FullName string // For uniqueness, e.g., with signature Type CodeElementType FirstLine int LastLine int CoverageQuota *float64 // Nullable (percentage 0-100) }
CodeElement represents a method or property.
type CodeElementType ¶
type CodeElementType int
const ( PropertyElementType CodeElementType = iota MethodElementType )
type CodeFile ¶
type CodeFile struct { Path string Lines []Line CoveredLines int CoverableLines int TotalLines int MethodMetrics []MethodMetric // Metrics for methods within this file CodeElements []CodeElement // Code elements (methods/properties) in this file }
CodeFile represents a single source file's coverage data.
type FileViewModelForDetail ¶
type FileViewModelForDetail struct { Path string ShortPath string // For use in href IDs (sanitized) Lines []LineViewModelForDetail }
FileViewModelForDetail represents a source file within a class for server-side rendering
type HistoricCoverage ¶
type HistoryChartDataViewModel ¶
type HistoryChartDataViewModel struct { Series bool // True if there's data to render the chart SVGContent string // Pre-rendered SVG string JSONData template.JS // JSON data for chart interactivity (if custom.js uses it) }
HistoryChartDataViewModel holds data for rendering a history chart with Go templates
type HtmlReportBuilder ¶
type HtmlReportBuilder struct { OutputDir string ReportContext reporter.IBuilderContext // contains filtered or unexported fields }
func NewHtmlReportBuilder ¶
func NewHtmlReportBuilder(outputDir string, reportCtx reporter.IBuilderContext, fileReader filereader.Reader) *HtmlReportBuilder
func (*HtmlReportBuilder) CreateReport ¶
func (b *HtmlReportBuilder) CreateReport(tree *model.SummaryTree) error
func (*HtmlReportBuilder) ReportType ¶
func (b *HtmlReportBuilder) ReportType() string
type Line ¶
type Line struct { Number int Hits int IsBranchPoint bool CoveredBranches int TotalBranches int LineVisitStatus LineVisitStatus Content string }
Line represents a single line of code.
type LineViewModelForDetail ¶
type LineViewModelForDetail struct { LineNumber int LineContent string // Raw content, template will escape and handle spaces LineVisitStatus string // CSS class: "green", "red", "orange", "gray" Hits string // Formatted hits, or empty for not coverable IsBranch bool BranchBarValue int // For percentagebar CSS class (0-100 for uncovered part) Tooltip string DataCoverage template.JS // JSON string for data-coverage attribute }
LineViewModelForDetail represents a single line of code for server-side rendering
type LineVisitStatus ¶
type LineVisitStatus int
LineVisitStatus indicates the coverage status of a line.
const ( NotCoverable LineVisitStatus = iota NotCovered PartiallyCovered Covered )
type Method ¶
type Method struct { Name string Signature string DisplayName string LineRate float64 BranchRate *float64 Complexity float64 Lines []Line FirstLine int LastLine int MethodMetrics []MethodMetric LinesCovered int LinesValid int BranchesCovered int BranchesValid int }
Method represents a function or method.
type MethodMetric ¶
type MethodMetric struct { Name string // Typically the method's name or a specific metric name for that method Line int // The line number where the method is defined or this metric applies Metrics []Metric // A slice of Metric structs associated with this method/entry }
MethodMetric represents metrics associated with a specific method or code line.
type Metric ¶
type Metric struct { Name string Value interface{} // To allow for different types of metric values (int, float, string) Status MetricStatus }
Metric represents a single metric with a name, value, and status.
type MetricStatus ¶
type MetricStatus int
MetricStatus represents the status of a metric.
const ( // StatusOk indicates a normal/good status. StatusOk MetricStatus = iota // StatusWarning indicates a warning status. StatusWarning // StatusError indicates an error/critical status. StatusError )
type MetricsTableViewModel ¶
type MetricsTableViewModel struct { Headers []AngularMetricDefinitionViewModel // Re-use from existing viewmodels.go if it fits Rows []AngularMethodMetricsViewModel // Re-use from existing viewmodels.go if it fits }
MetricsTableViewModel holds data for the "Metrics" table
type SidebarElementViewModel ¶
type SidebarElementViewModel struct { Name string // Display name for the link (short, e.g., Method()) FullName string // Full cleaned name (e.g., Namespace.MyClass.Method(Params)) for title FileShortPath string // Sanitized file path for href ID FileIndexPlus1 int // 1-based index of the file if class is multi-file Line int // First line of the method/property Icon string // "cube" for method, "wrench" for property CoverageBarValue int // For percentagebar CSS (0-100 for uncovered part) CoverageTitle string // e.g., "Line coverage: 50% - Namespace.MyClass.Method(Params)" }
SidebarElementViewModel holds data for the "Methods/Properties" sidebar links
type SummaryPageData ¶
type SummaryPageData struct { ReportTitle string AppVersion string CurrentDateTime string Translations map[string]string SummaryCards []CardViewModel OverallHistoryChartData HistoryChartDataViewModel AngularCssFile string CombinedAngularJsFile string // Only the combined file is needed now AssembliesJSON template.JS RiskHotspotsJSON template.JS MetricsJSON template.JS RiskHotspotMetricsJSON template.JS HistoricCoverageExecutionTimesJSON template.JS TranslationsJSON template.JS BranchCoverageAvailable bool MethodCoverageAvailable bool MaximumDecimalPlacesForCoverageQuotas int HasRiskHotspots bool HasAssemblies bool }
SummaryPageData is the top-level struct for the summaryPageLayoutTemplate
type SummaryResult ¶
type SummaryResult struct { ParserName string Timestamp int64 Assemblies []Assembly LinesCovered int LinesValid int BranchesCovered *int BranchesValid *int TotalLines int }
SummaryResult is the top-level analyzed report.
func ToLegacySummaryResult ¶
func ToLegacySummaryResult(tree *model.SummaryTree, fileReader filereader.Reader, logger *slog.Logger) *SummaryResult
ToLegacySummaryResult converts the new file-system-tree-based model into the old Assembly/Class-based model for the legacy HTML reporter.