cmd

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute() error

Types

type AnalyzerConfig

type AnalyzerConfig struct {
	Enabled  bool     `yaml:"enabled" json:"enabled"`
	Severity string   `yaml:"severity,omitempty" json:"severity,omitempty"` // Override default severity
	Exclude  []string `yaml:"exclude,omitempty" json:"exclude,omitempty"`   // Exclude patterns
}

AnalyzerConfig represents configuration for a single analyzer

type Config

type Config struct {
	// Analyzer configuration
	Analyzers struct {
		Loop                AnalyzerConfig `yaml:"loop" json:"loop"`
		DeferOptimization   AnalyzerConfig `yaml:"defer_optimization" json:"defer_optimization"`
		Slice               AnalyzerConfig `yaml:"slice" json:"slice"`
		Map                 AnalyzerConfig `yaml:"map" json:"map"`
		Reflection          AnalyzerConfig `yaml:"reflection" json:"reflection"`
		Goroutine           AnalyzerConfig `yaml:"goroutine" json:"goroutine"`
		Interface           AnalyzerConfig `yaml:"interface" json:"interface"`
		Regex               AnalyzerConfig `yaml:"regex" json:"regex"`
		Time                AnalyzerConfig `yaml:"time" json:"time"`
		MemoryLeak          AnalyzerConfig `yaml:"memory_leak" json:"memory_leak"`
		Database            AnalyzerConfig `yaml:"database" json:"database"`
		APIMisuse           AnalyzerConfig `yaml:"api_misuse" json:"api_misuse"`
		AIBullshit          AnalyzerConfig `yaml:"ai_bullshit" json:"ai_bullshit"`
		Channel             AnalyzerConfig `yaml:"channel" json:"channel"`
		HTTPClient          AnalyzerConfig `yaml:"http_client" json:"http_client"`
		Privacy             AnalyzerConfig `yaml:"privacy" json:"privacy"`
		Context             AnalyzerConfig `yaml:"context" json:"context"`
		RaceCondition       AnalyzerConfig `yaml:"race_condition" json:"race_condition"`
		ErrorHandling       AnalyzerConfig `yaml:"error_handling" json:"error_handling"`
		GCPressure          AnalyzerConfig `yaml:"gc_pressure" json:"gc_pressure"`
		ConcurrencyPatterns AnalyzerConfig `yaml:"concurrency_patterns" json:"concurrency_patterns"`
		CPUOptimization     AnalyzerConfig `yaml:"cpu_optimization" json:"cpu_optimization"`
		NetworkPatterns     AnalyzerConfig `yaml:"network_patterns" json:"network_patterns"`
		SyncPool            AnalyzerConfig `yaml:"sync_pool" json:"sync_pool"`
		TestCoverage        AnalyzerConfig `yaml:"test_coverage" json:"test_coverage"`
		Crypto              AnalyzerConfig `yaml:"crypto" json:"crypto"`
		Serialization       AnalyzerConfig `yaml:"serialization" json:"serialization"`
		IOBuffer            AnalyzerConfig `yaml:"io_buffer" json:"io_buffer"`
		HTTPReuse           AnalyzerConfig `yaml:"http_reuse" json:"http_reuse"`
		CGO                 AnalyzerConfig `yaml:"cgo" json:"cgo"`
		String              AnalyzerConfig `yaml:"string" json:"string"`
		Dependency          AnalyzerConfig `yaml:"dependency" json:"dependency"`
		StructLayout        AnalyzerConfig `yaml:"struct_layout" json:"struct_layout"`
		CPUCache            AnalyzerConfig `yaml:"cpu_cache" json:"cpu_cache"`
	} `yaml:"analyzers" json:"analyzers"`

	// Thresholds for various checks
	Thresholds struct {
		MaxLoopDepth      int `yaml:"max_loop_depth" json:"max_loop_depth"`
		MaxComplexity     int `yaml:"max_complexity" json:"max_complexity"`
		MaxFunctionLength int `yaml:"max_function_length" json:"max_function_length"`
		MaxParameters     int `yaml:"max_parameters" json:"max_parameters"`
		MaxReturnValues   int `yaml:"max_return_values" json:"max_return_values"`
	} `yaml:"thresholds" json:"thresholds"`

	// Path configuration
	Paths struct {
		Exclude []string `yaml:"exclude" json:"exclude"` // Paths to exclude from analysis
		Include []string `yaml:"include" json:"include"` // Specific paths to include (if empty, all non-excluded paths)
	} `yaml:"paths" json:"paths"`

	// Output configuration
	Output struct {
		Format      string `yaml:"format" json:"format"`             // "text" or "json"
		ShowContext bool   `yaml:"show_context" json:"show_context"` // Show code context
		MaxIssues   int    `yaml:"max_issues" json:"max_issues"`     // Maximum issues to report (0 = unlimited)
	} `yaml:"output" json:"output"`
}

Config represents the configuration for the analyzer

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig loads configuration from a file or returns default

func (*Config) GetAnalyzerConfig

func (c *Config) GetAnalyzerConfig(analyzerName string) AnalyzerConfig

GetAnalyzerConfig returns config for a specific analyzer

type JSONOutput

type JSONOutput struct {
	Target    string          `json:"target"`
	Summary   Summary         `json:"summary"`
	Issues    []*models.Issue `json:"issues"`
	FileStats []fileStat      `json:"file_stats"`
}

JSONOutput represents the JSON structure for results

type Summary

type Summary struct {
	TotalIssues int `json:"total_issues"`
	High        int `json:"high"`
	Medium      int `json:"medium"`
	Low         int `json:"low"`
}

Summary contains overall statistics

Jump to

Keyboard shortcuts

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