Documentation
¶
Overview ¶
Package sources provides a modular framework for fetching metrics from external systems.
Index ¶
- Variables
- func DeriveTitleFromPath(path, explicitTitle string) string
- func GetExtra(opts Options, key, defaultValue string) string
- func Names() []string
- func Register(s Source)
- func ResolveCommand(opts Options, extraKey, envVar string) string
- func ResolveTitle(values ...string) string
- type ConfigResolver
- type Options
- type ResolvedConfig
- type Source
Constants ¶
This section is empty.
Variables ¶
var Registry = make(map[string]Source)
Registry holds available sources by name.
Functions ¶
func DeriveTitleFromPath ¶ added in v1.1.2
DeriveTitleFromPath returns a friendly title from a file path. If an explicit title is provided, it returns that. Otherwise, resolves the path to an absolute path and returns the base name.
func GetExtra ¶ added in v1.1.2
GetExtra retrieves a value from opts.Extra, returning defaultValue if not found or empty.
func Register ¶
func Register(s Source)
Register adds a source to the registry. Panics if a source with the same name already exists.
func ResolveCommand ¶ added in v1.1.1
ResolveCommand resolves a command path from Extra options or an environment variable.
func ResolveTitle ¶ added in v1.1.2
ResolveTitle returns the first non-empty string from the provided values. Typically used as ResolveTitle(opts.Title, derivedTitle, fallback).
Types ¶
type ConfigResolver ¶
type ConfigResolver struct {
SourceName string
TokenEnvVar string
URLEnvVar string
TokenRequired bool
URLRequired bool
DefaultTimeout time.Duration
}
ConfigResolver provides methods for resolving source configuration.
func (*ConfigResolver) Resolve ¶
func (r *ConfigResolver) Resolve(opts Options) (*ResolvedConfig, error)
Resolve resolves token and URL from options or environment variables.
type Options ¶
type Options struct {
// Common options
URL string
Project string
Token string
Branch string
Title string
Threshold int
Timeout int // seconds
// Source-specific options stored by key
Extra map[string]string
}
Options holds configuration for fetching from a source.
type ResolvedConfig ¶
ResolvedConfig holds resolved configuration for a source.
type Source ¶
type Source interface {
// Name returns the unique identifier for this source (e.g., "sonarqube").
Name() string
// Fetch retrieves metrics and converts them to a confidence report.
// The opts map contains source-specific configuration (URL, project, token, etc.).
Fetch(ctx context.Context, opts Options) (*confidence.Report, error)
}
Source fetches metrics from an external system and produces a confidence report.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cmdrun provides utilities for running CLI commands.
|
Package cmdrun provides utilities for running CLI commands. |
|
Package codecov provides a source for fetching coverage metrics from Codecov.
|
Package codecov provides a source for fetching coverage metrics from Codecov. |
|
Package codeql provides a source for fetching code scanning alerts from GitHub CodeQL.
|
Package codeql provides a source for fetching code scanning alerts from GitHub CodeQL. |
|
Package coverage provides shared infrastructure for coverage source providers.
|
Package coverage provides shared infrastructure for coverage source providers. |
|
Package coveralls provides a source for fetching coverage metrics from Coveralls.
|
Package coveralls provides a source for fetching coverage metrics from Coveralls. |
|
Package dependabot provides a source for fetching vulnerability alerts from GitHub Dependabot.
|
Package dependabot provides a source for fetching vulnerability alerts from GitHub Dependabot. |
|
Package ghactions provides a source for fetching CI/CD metrics from GitHub Actions.
|
Package ghactions provides a source for fetching CI/CD metrics from GitHub Actions. |
|
Package githubalerts provides shared infrastructure for GitHub security alerts sources.
|
Package githubalerts provides shared infrastructure for GitHub security alerts sources. |
|
Package gitleaks provides a source for detecting secrets using GitLeaks.
|
Package gitleaks provides a source for detecting secrets using GitLeaks. |
|
Package gosec provides a source for fetching security findings from Gosec.
|
Package gosec provides a source for fetching security findings from Gosec. |
|
Package grype provides a source for fetching vulnerability metrics from Grype.
|
Package grype provides a source for fetching vulnerability metrics from Grype. |
|
Package httpclient provides a common HTTP client for API sources.
|
Package httpclient provides a common HTTP client for API sources. |
|
Package repoparse provides utilities for parsing repository identifiers.
|
Package repoparse provides utilities for parsing repository identifiers. |
|
Package scoring provides shared scoring utilities for vulnerability sources.
|
Package scoring provides shared scoring utilities for vulnerability sources. |
|
Package semgrep provides a source for fetching security findings from Semgrep.
|
Package semgrep provides a source for fetching security findings from Semgrep. |
|
Package snyk provides a source for fetching vulnerability metrics from Snyk.
|
Package snyk provides a source for fetching vulnerability metrics from Snyk. |
|
Package sonarqube provides a source for fetching metrics from SonarQube.
|
Package sonarqube provides a source for fetching metrics from SonarQube. |
|
Package trivy provides a source for fetching vulnerability metrics from Trivy.
|
Package trivy provides a source for fetching vulnerability metrics from Trivy. |
|
Package trufflehog provides a source for detecting secrets using TruffleHog.
|
Package trufflehog provides a source for detecting secrets using TruffleHog. |