sonarinternal

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sonarinternal holds helpers shared by `krci sonar` verbs (validation, enum sets, the gate status color). Importable only from packages below pkg/cmd/sonar/.

Index

Constants

View Source
const MaxPageSize = 500

MaxPageSize is the upper bound on `--page-size` for every paginated sonar verb, mirroring the shared Zod schema cap on portal-side.

Variables

View Source
var (
	IssueTypes      = newEnumSet("BUG", "VULNERABILITY", "CODE_SMELL")
	IssueSeverities = newEnumSet("BLOCKER", "CRITICAL", "MAJOR", "MINOR", "INFO")
	IssueStatuses   = newEnumSet("OPEN", "CONFIRMED", "REOPENED", "RESOLVED", "CLOSED")
)

Canonical SonarQube enum sets. Keep in sync with the Portal's shared SonarQube schema.

Functions

func GateStatusColor added in v0.20.0

func GateStatusColor(status portal.QualityGateStatus) output.Cell

GateStatusColor colors a SonarQube quality-gate status. An unknown value is made printable on one row and left unstyled.

func ValidateEnumCSV

func ValidateEnumCSV(flagName string, values []string, allowed EnumSet) ([]string, error)

ValidateEnumCSV checks every comma-separated/repeated value in values against allowed. flagName is used in error messages. Returns the flattened list of validated items in input order with duplicates collapsed (empty when values is empty).

func ValidateNonEmptyFlag added in v0.9.0

func ValidateNonEmptyFlag(name string, changed bool, value string) error

ValidateNonEmptyFlag rejects a flag that was explicitly supplied with an empty value. changed is true when the flag was set on the command line.

func ValidateProjectCommand

func ValidateProjectCommand(cmd *cobra.Command, outputFormat, project, pullRequest, branch string) error

ValidateProjectCommand validates a project-scoped verb's inputs in order: output format, Kubernetes-name project key, non-empty --pr / --branch when supplied, mutual exclusion of the two scope flags.

func ValidateScopeMutex added in v0.9.0

func ValidateScopeMutex(pullRequest, branch string) error

ValidateScopeMutex rejects commands that set both --pr and --branch, since SonarQube treats the two as mutually exclusive scope selectors.

Types

type EnumSet

type EnumSet struct {
	Values []string
	// contains filtered or unexported fields
}

EnumSet pairs the canonical list and lookup map for a SonarQube enum. Callers treat both fields as read-only.

Jump to

Keyboard shortcuts

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