report

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package report provides functionality to generate various types of reports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateReport

func GenerateReport(issues []Issue, format, outPath string, gitMeta *GitMetadata) error

GenerateReport creates a report in the specified format (json, html).

Types

type GitMetadata added in v0.2.1

type GitMetadata struct {
	RepoRoot    string    `json:"repo_root,omitempty"`
	Branch      string    `json:"branch,omitempty"`
	CommitHash  string    `json:"commit_hash,omitempty"`
	CommitShort string    `json:"commit_short,omitempty"`
	Author      string    `json:"author,omitempty"`
	Email       string    `json:"email,omitempty"`
	Message     string    `json:"message,omitempty"`
	Timestamp   time.Time `json:"timestamp,omitempty"`
	IsDirty     bool      `json:"is_dirty,omitempty"`
}

GitMetadata represents Git repository information.

type Issue

type Issue struct {
	RuleID      string        `json:"rule_id"`
	Title       string        `json:"title"`
	Description string        `json:"description"`
	Severity    SeverityLevel `json:"severity"`
	File        string        `json:"file"`
	Line        int           `json:"line"`
	Code        string        `json:"code"`
	Package     string        `json:"package"`
	Reference   string        `json:"reference,omitempty"`
	Suggestion  string        `json:"suggestion,omitempty"`
}

Issue represents a single security/code issue found during analysis.

type ReportData

type ReportData struct {
	Summary     Summary     `json:"summary"`
	Issues      []Issue     `json:"issues"`
	GeneratedAt string      `json:"generated_at"`
	Git         GitMetadata `json:"git,omitempty"`
}

ReportData represents the full report structure.

type SeverityLevel

type SeverityLevel string

SeverityLevel defines the level of issue severity.

const (
	SeverityCritical SeverityLevel = "CRITICAL"
	SeverityHigh     SeverityLevel = "HIGH"
	SeverityMedium   SeverityLevel = "MEDIUM"
	SeverityLow      SeverityLevel = "LOW"
	SeverityInfo     SeverityLevel = "INFO"
)

type Summary

type Summary struct {
	Total    int `json:"total"`
	Critical int `json:"critical"`
	High     int `json:"high"`
	Medium   int `json:"medium"`
	Low      int `json:"low"`
	Info     int `json:"info"`
	// Category counts for charts
	Security int `json:"security"`
	Style    int `json:"style"`
	Metrics  int `json:"metrics"`
	License  int `json:"license"`
}

Summary aggregates issue counts per severity level.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL