cli

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCommand

func CheckCommand() *cobra.Command

func GetRefactoringStrategyCommand added in v0.9.0

func GetRefactoringStrategyCommand() *cobra.Command

func InitCommand

func InitCommand() *cobra.Command

func InstallHookCommand added in v0.8.9

func InstallHookCommand() *cobra.Command

InstallHookCommand creates a cobra command that installs the ailinter pre-commit hook into the current git repository.

func IsColorEnabled

func IsColorEnabled() bool

func MCPCommand

func MCPCommand(version string) *cobra.Command

MCPCommand returns the `mcp` subcommand.

func ReportCommand added in v0.8.5

func ReportCommand() *cobra.Command

func RunRefactoringStrategy added in v0.9.0

func RunRefactoringStrategy(smellName string)

RunRefactoringStrategy is a convenience wrapper for programmatic use.

func TerminalWidth

func TerminalWidth() int

func WriteSARIFCombined added in v0.8.9

func WriteSARIFCombined(w io.Writer, qualityResults []analyzer.QualityResult, secretFindings []secrets.SecretFinding, vulnFindings []vulnerability.Finding, mlFindings []metalinter.Finding, scanPath string) error

WriteSARIFCombined collects quality, secret, vulnerability, and meta-lint findings and writes them as a single SARIF v2.1.0 log to w.

qualityResults carry their own FilePath. Secrets and vulns use the provided filePath (customarily the resolved file path for single-file mode, or a directory path for directory mode). // gitleaks:allow

Types

type FormatMode

type FormatMode int
const (
	FormatAuto FormatMode = iota
	FormatHuman
	FormatJSON
	FormatMarkdown
	FormatProblems
	FormatSARIF
)

func DetectFormat

func DetectFormat(flagValue string) FormatMode

func ResolveFormat

func ResolveFormat(flagValue string) FormatMode

func ResolveFormatStrict

func ResolveFormatStrict(flagValue string) (FormatMode, error)

func (FormatMode) String

func (f FormatMode) String() string

type SARIFArtifactLocation added in v0.8.9

type SARIFArtifactLocation struct {
	URI string `json:"uri"`
}

SARIFArtifactLocation identifies a file by URI.

type SARIFDriver added in v0.8.9

type SARIFDriver struct {
	Name           string      `json:"name"`
	Version        string      `json:"version"`
	InformationURI string      `json:"informationUri"`
	Rules          []SARIFRule `json:"rules"`
}

SARIFDriver describes the tool driver (AILINTER itself).

type SARIFHelp added in v0.9.0

type SARIFHelp struct {
	Text     string `json:"text,omitempty"`
	Markdown string `json:"markdown,omitempty"`
}

SARIFHelp provides documentation for a rule. GitHub Code Scanning displays the markdown content when the user clicks "Show more" on a SARIF alert. The text field is a plain-text fallback.

type SARIFLocation added in v0.8.9

type SARIFLocation struct {
	PhysicalLocation SARIFPhysicalLocation `json:"physicalLocation"`
}

SARIFLocation associates a finding with a source location.

type SARIFLog added in v0.8.9

type SARIFLog struct {
	Schema  string     `json:"$schema"`
	Version string     `json:"version"`
	Runs    []SARIFRun `json:"runs"`
}

SARIFLog is the top-level SARIF log file.

type SARIFMessage added in v0.8.9

type SARIFMessage struct {
	Text string `json:"text"`
}

SARIFMessage is a human-readable message.

type SARIFPhysicalLocation added in v0.8.9

type SARIFPhysicalLocation struct {
	ArtifactLocation SARIFArtifactLocation `json:"artifactLocation"`
	Region           SARIFRegion           `json:"region,omitempty"`
}

SARIFPhysicalLocation points to a specific file + region.

type SARIFProperties added in v0.8.9

type SARIFProperties struct {
	Category         string           `json:"category,omitempty"`
	SecuritySeverity SARIFSeverityStr `json:"security-severity,omitempty"`
	Precision        string           `json:"precision,omitempty"`        // "very-high", "high", "medium", "low"
	Tags             []string         `json:"tags,omitempty"`             // e.g. ["maintainability", "complexity"]
	Severity         string           `json:"problem.severity,omitempty"` // "error", "warning", "note"
	SmellType        string           `json:"smell_type,omitempty"`       // e.g. "deep_nesting"
}

SARIFProperties holds optional metadata on a rule.

type SARIFRegion added in v0.8.9

type SARIFRegion struct {
	StartLine   int `json:"startLine"`
	StartColumn int `json:"startColumn,omitempty"`
}

SARIFRegion identifies a specific line/column range.

type SARIFResult added in v0.8.9

type SARIFResult struct {
	RuleID    string          `json:"ruleId"`
	RuleIndex int             `json:"ruleIndex"`
	Level     string          `json:"level"` // "error", "warning", "note"
	Message   SARIFMessage    `json:"message"`
	Locations []SARIFLocation `json:"locations,omitempty"`
}

SARIFResult is a single finding in a SARIF run.

type SARIFRule added in v0.8.9

type SARIFRule struct {
	ID               string          `json:"id"`
	Name             string          `json:"name"`
	ShortDescription SARIFMessage    `json:"shortDescription"`
	HelpURI          string          `json:"helpUri,omitempty"`
	Help             *SARIFHelp      `json:"help,omitempty"`
	Properties       SARIFProperties `json:"properties,omitempty"`
}

SARIFRule describes a single detection rule / check.

type SARIFRun added in v0.8.9

type SARIFRun struct {
	Tool       SARIFTool     `json:"tool"`
	Results    []SARIFResult `json:"results"`
	ColumnKind string        `json:"columnKind,omitempty"`
}

SARIFRun represents a single analysis run.

type SARIFSeverityStr added in v0.9.0

type SARIFSeverityStr float64

SARIFSeverityStr is a float64 that marshals to a JSON string, as required by GitHub Code Scanning's SARIF parser. The SARIF spec says security-severity must be a string (e.g. "9.5"), not a bare number.

func (SARIFSeverityStr) MarshalJSON added in v0.9.0

func (s SARIFSeverityStr) MarshalJSON() ([]byte, error)

func (*SARIFSeverityStr) UnmarshalJSON added in v0.9.0

func (s *SARIFSeverityStr) UnmarshalJSON(b []byte) error

type SARIFTool added in v0.8.9

type SARIFTool struct {
	Driver SARIFDriver `json:"driver"`
}

SARIFTool describes the analysis tool.

Jump to

Keyboard shortcuts

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