service

package
v1.19.3 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderWidth    = 40
	LabelWidth     = 25
	SectionPadding = 2
	ItemPadding    = 4
)

Standard formatting constants

View Source
const (
	ColorReset  = "\x1b[0m"
	ColorRed    = "\x1b[31m"
	ColorYellow = "\x1b[33m"
	ColorGreen  = "\x1b[32m"
	ColorCyan   = "\x1b[36m"
	ColorBold   = "\x1b[1m"
)

ANSI color codes for consistent color usage

Variables

View Source
var ExampleSystemAnalysisConfig = `` /* 394-byte string literal not displayed */

Example configuration file content for documentation

Functions

func EncodeJSON

func EncodeJSON(v interface{}) (string, error)

EncodeJSON returns an indented JSON string for the given value.

func EncodeYAML

func EncodeYAML(v interface{}) (string, error)

EncodeYAML returns a YAML string for the given value.

func GenerateHTMLFooter

func GenerateHTMLFooter() string

GenerateHTMLFooter generates the standard HTML footer

func GenerateMetricCard

func GenerateMetricCard(value, label string) string

GenerateMetricCard generates a metric card HTML

func GenerateSectionHeader

func GenerateSectionHeader(title string) string

GenerateSectionHeader generates a section header

func GenerateSinglePageContent

func GenerateSinglePageContent(content string) string

GenerateSinglePageContent generates a single page content wrapper (no tabs)

func GenerateStatusBadge

func GenerateStatusBadge(text, severity string) string

GenerateStatusBadge generates a status badge based on severity

func GenerateTabButton

func GenerateTabButton(id, label string, active bool) string

GenerateTabButton generates a tab button

func GenerateTabContent

func GenerateTabContent(id string, active bool, content string) string

GenerateTabContent generates a tab content wrapper

func GenerateTabScript

func GenerateTabScript() string

GenerateTabScript generates the JavaScript for tab switching

func GenerateTabsEnd

func GenerateTabsEnd() string

GenerateTabsEnd generates the end of a tabbed interface

func GenerateTabsMiddle

func GenerateTabsMiddle() string

GenerateTabsMiddle generates the middle section between tab buttons and content

func GenerateTabsStart

func GenerateTabsStart() string

GenerateTabsStart generates the start of a tabbed interface

func IsInteractiveEnvironment added in v1.1.0

func IsInteractiveEnvironment() bool

IsInteractiveEnvironment returns true if the environment appears to be an interactive TTY session (and not CI)

func IsSSH added in v1.1.0

func IsSSH() bool

IsSSH returns true if the session is running over SSH

func NewErrorCategorizer

func NewErrorCategorizer() domain.ErrorCategorizer

NewErrorCategorizer creates a new error categorizer

func NewParallelExecutor

func NewParallelExecutor() domain.ParallelExecutor

NewParallelExecutor creates a new parallel executor

func NewProgressManager

func NewProgressManager() domain.ProgressManager

NewProgressManager creates a new progress manager

func NewSimpleTask

func NewSimpleTask(name string, enabled bool, execute func(context.Context) (interface{}, error)) domain.ExecutableTask

NewSimpleTask creates a new simple task

func OpenBrowser

func OpenBrowser(url string) error

OpenBrowser opens the specified URL in the default browser

func WriteJSON

func WriteJSON(w io.Writer, v interface{}) error

WriteJSON writes indented JSON for the given value to the writer.

func WriteYAML

func WriteYAML(w io.Writer, v interface{}) error

WriteYAML writes YAML for the given value to the writer.

Types

type AnalyzeConfigurationLoaderImpl added in v1.16.0

type AnalyzeConfigurationLoaderImpl struct{}

AnalyzeConfigurationLoaderImpl resolves and loads config for AnalyzeUseCase.

func NewAnalyzeConfigurationLoader added in v1.16.0

func NewAnalyzeConfigurationLoader() *AnalyzeConfigurationLoaderImpl

NewAnalyzeConfigurationLoader creates a new analyze configuration loader.

func (*AnalyzeConfigurationLoaderImpl) LoadAnalyzeExecutionConfig added in v1.16.0

func (l *AnalyzeConfigurationLoaderImpl) LoadAnalyzeExecutionConfig(configPath string, targetPath string) (domain.AnalyzeExecutionConfig, error)

LoadAnalyzeExecutionConfig resolves the effective config path and loads the AnalyzeUseCase-specific settings it needs.

type AnalyzeFormatter

type AnalyzeFormatter struct {
	// contains filtered or unexported fields
}

AnalyzeFormatter handles formatting of unified analysis reports

func NewAnalyzeFormatter

func NewAnalyzeFormatter() *AnalyzeFormatter

NewAnalyzeFormatter creates a new analyze formatter

func (*AnalyzeFormatter) Write

func (f *AnalyzeFormatter) Write(response *domain.AnalyzeResponse, format domain.OutputFormat, writer io.Writer) error

Write formats and writes the unified analysis response

type CBOConfigurationLoaderImpl added in v1.4.0

type CBOConfigurationLoaderImpl struct{}

CBOConfigurationLoaderImpl implements the CBOConfigurationLoader interface

func NewCBOConfigurationLoader added in v1.4.0

func NewCBOConfigurationLoader() *CBOConfigurationLoaderImpl

NewCBOConfigurationLoader creates a new CBO configuration loader service

func (*CBOConfigurationLoaderImpl) FindDefaultConfigFile added in v1.4.0

func (cl *CBOConfigurationLoaderImpl) FindDefaultConfigFile() string

FindDefaultConfigFile looks for TOML config files from the current directory upward.

func (*CBOConfigurationLoaderImpl) LoadConfig added in v1.4.0

func (cl *CBOConfigurationLoaderImpl) LoadConfig(path string) (*domain.CBORequest, error)

LoadConfig loads CBO configuration from the specified path using TOML-only strategy

func (*CBOConfigurationLoaderImpl) LoadDefaultConfig added in v1.4.0

func (cl *CBOConfigurationLoaderImpl) LoadDefaultConfig() *domain.CBORequest

LoadDefaultConfig loads the default CBO configuration, first checking for .pyscn.toml

func (*CBOConfigurationLoaderImpl) MergeConfig added in v1.4.0

func (cl *CBOConfigurationLoaderImpl) MergeConfig(base *domain.CBORequest, override *domain.CBORequest) *domain.CBORequest

MergeConfig merges CLI flags with configuration file

type CBOFormatterImpl

type CBOFormatterImpl struct{}

CBOFormatterImpl implements CBOOutputFormatter interface

func NewCBOFormatter

func NewCBOFormatter() *CBOFormatterImpl

NewCBOFormatter creates a new CBO output formatter

func (*CBOFormatterImpl) Format

func (f *CBOFormatterImpl) Format(response *domain.CBOResponse, format domain.OutputFormat) (string, error)

Format formats the CBO analysis response according to the specified format

func (*CBOFormatterImpl) Write

func (f *CBOFormatterImpl) Write(response *domain.CBOResponse, format domain.OutputFormat, writer io.Writer) error

Write writes the formatted output to the writer

type CBOServiceImpl

type CBOServiceImpl struct {
	// contains filtered or unexported fields
}

CBOServiceImpl implements the CBOService interface

func NewCBOService

func NewCBOService() *CBOServiceImpl

NewCBOService creates a new CBO service implementation

func (*CBOServiceImpl) Analyze

Analyze performs CBO analysis on multiple files

func (*CBOServiceImpl) AnalyzeFile

func (s *CBOServiceImpl) AnalyzeFile(ctx context.Context, filePath string, req domain.CBORequest) (*domain.CBOResponse, error)

AnalyzeFile analyzes a single Python file

type CloneConfigurationLoader

type CloneConfigurationLoader struct{}

CloneConfigurationLoader implements the domain.CloneConfigurationLoader interface

func NewCloneConfigurationLoader

func NewCloneConfigurationLoader() *CloneConfigurationLoader

NewCloneConfigurationLoader creates a new clone configuration loader

func (*CloneConfigurationLoader) FindDefaultConfigFile

func (c *CloneConfigurationLoader) FindDefaultConfigFile() string

FindDefaultConfigFile looks for TOML config files from the current directory upward.

func (*CloneConfigurationLoader) GetDefaultCloneConfig

func (c *CloneConfigurationLoader) GetDefaultCloneConfig() *domain.CloneRequest

GetDefaultCloneConfig returns default clone detection configuration

func (*CloneConfigurationLoader) LoadCloneConfig

func (c *CloneConfigurationLoader) LoadCloneConfig(configPath string) (*domain.CloneRequest, error)

LoadCloneConfig loads clone detection configuration from file using TOML-only strategy

func (*CloneConfigurationLoader) MergeConfig added in v1.16.0

MergeConfig merges request values over loaded clone configuration. Without explicit flag tracking, values that still match domain defaults are treated as "not overridden" so config-backed values are preserved.

func (*CloneConfigurationLoader) SaveCloneConfig

func (c *CloneConfigurationLoader) SaveCloneConfig(cloneConfig *domain.CloneRequest, configPath string) error

SaveCloneConfig saves clone detection configuration to a TOML file

type CloneConfigurationLoaderWithFlags

type CloneConfigurationLoaderWithFlags struct {
	// contains filtered or unexported fields
}

CloneConfigurationLoaderWithFlags wraps clone configuration loading with explicit flag tracking

func NewCloneConfigurationLoaderWithFlags

func NewCloneConfigurationLoaderWithFlags(explicitFlags map[string]bool) *CloneConfigurationLoaderWithFlags

NewCloneConfigurationLoaderWithFlags creates a new clone configuration loader that tracks explicit flags

func (*CloneConfigurationLoaderWithFlags) FindDefaultConfigFile

func (cl *CloneConfigurationLoaderWithFlags) FindDefaultConfigFile() string

FindDefaultConfigFile looks for .pyscn.toml in the current directory

func (*CloneConfigurationLoaderWithFlags) GetDefaultCloneConfig

func (cl *CloneConfigurationLoaderWithFlags) GetDefaultCloneConfig() *domain.CloneRequest

GetDefaultCloneConfig loads the default clone configuration

func (*CloneConfigurationLoaderWithFlags) LoadCloneConfig

func (cl *CloneConfigurationLoaderWithFlags) LoadCloneConfig(path string) (*domain.CloneRequest, error)

LoadCloneConfig loads clone configuration from the specified path

func (*CloneConfigurationLoaderWithFlags) MergeConfig

MergeConfig merges CLI flags with configuration file, respecting explicit flags

func (*CloneConfigurationLoaderWithFlags) SaveCloneConfig

func (cl *CloneConfigurationLoaderWithFlags) SaveCloneConfig(config *domain.CloneRequest, path string) error

SaveCloneConfig saves clone configuration to the specified path

type CloneHTMLData

type CloneHTMLData struct {
	OverallScore OverallScoreData      `json:"overall_score"`
	Response     *domain.CloneResponse `json:"response"`
	ScoreDetails ScoreData             `json:"score_details"`
}

CloneHTMLData represents clone detection data for HTML template

type CloneOutputFormatter

type CloneOutputFormatter struct{}

CloneOutputFormatter implements the domain.CloneOutputFormatter interface

func NewCloneOutputFormatter

func NewCloneOutputFormatter() *CloneOutputFormatter

NewCloneOutputFormatter creates a new clone output formatter

func (*CloneOutputFormatter) FormatCloneResponse

func (f *CloneOutputFormatter) FormatCloneResponse(response *domain.CloneResponse, format domain.OutputFormat, writer io.Writer) error

FormatCloneResponse formats a clone response according to the specified format

func (*CloneOutputFormatter) FormatCloneStatistics

func (f *CloneOutputFormatter) FormatCloneStatistics(stats *domain.CloneStatistics, format domain.OutputFormat, writer io.Writer) error

FormatCloneStatistics formats clone statistics

type CloneService

type CloneService struct {
}

CloneService implements the domain.CloneService interface

func NewCloneService

func NewCloneService() *CloneService

NewCloneService creates a new clone service

func (*CloneService) ComputeSimilarity

func (s *CloneService) ComputeSimilarity(ctx context.Context, fragment1, fragment2 string) (float64, error)

ComputeSimilarity computes similarity between two code fragments

func (*CloneService) DetectClones

func (s *CloneService) DetectClones(ctx context.Context, req *domain.CloneRequest) (*domain.CloneResponse, error)

DetectClones performs clone detection on the given request

func (*CloneService) DetectClonesInFiles

func (s *CloneService) DetectClonesInFiles(ctx context.Context, filePaths []string, req *domain.CloneRequest) (*domain.CloneResponse, error)

DetectClonesInFiles performs clone detection on specific files

type ComplexityHTMLData

type ComplexityHTMLData struct {
	OverallScore OverallScoreData           `json:"overall_score"`
	Response     *domain.ComplexityResponse `json:"response"`
	ScoreDetails ScoreData                  `json:"score_details"`
}

ComplexityHTMLData represents complexity analysis data for HTML template

type ComplexityServiceImpl

type ComplexityServiceImpl struct {
	// contains filtered or unexported fields
}

ComplexityServiceImpl implements the ComplexityService interface

func NewComplexityService

func NewComplexityService() *ComplexityServiceImpl

NewComplexityService creates a new complexity service implementation

func (*ComplexityServiceImpl) Analyze

Analyze performs complexity analysis on multiple files

func (*ComplexityServiceImpl) AnalyzeFile

AnalyzeFile analyzes a single Python file

type ConfigurationLoaderImpl

type ConfigurationLoaderImpl struct{}

ConfigurationLoaderImpl implements the ConfigurationLoader interface

func NewConfigurationLoader

func NewConfigurationLoader() *ConfigurationLoaderImpl

NewConfigurationLoader creates a new configuration loader service

func (*ConfigurationLoaderImpl) CreateConfigTemplate

func (c *ConfigurationLoaderImpl) CreateConfigTemplate(path string) error

CreateConfigTemplate creates a template configuration file

func (*ConfigurationLoaderImpl) FindDefaultConfigFile

func (c *ConfigurationLoaderImpl) FindDefaultConfigFile() string

FindDefaultConfigFile looks for TOML config files from the current directory upward.

func (*ConfigurationLoaderImpl) GetDefaultThresholds

func (c *ConfigurationLoaderImpl) GetDefaultThresholds() (low, medium int)

GetDefaultThresholds returns the default complexity thresholds

func (*ConfigurationLoaderImpl) LoadConfig

LoadConfig loads configuration from the specified path

func (*ConfigurationLoaderImpl) LoadDefaultConfig

func (c *ConfigurationLoaderImpl) LoadDefaultConfig() *domain.ComplexityRequest

LoadDefaultConfig loads the default configuration, first checking for .pyscn.toml

func (*ConfigurationLoaderImpl) MergeConfig

MergeConfig merges CLI flags with configuration file

func (*ConfigurationLoaderImpl) ValidateConfig

func (c *ConfigurationLoaderImpl) ValidateConfig(req *domain.ComplexityRequest) error

ValidateConfig validates a configuration request

type ConfigurationLoaderWithFlags

type ConfigurationLoaderWithFlags struct {
	// contains filtered or unexported fields
}

ConfigurationLoaderWithFlags wraps configuration loading with explicit flag tracking

func NewConfigurationLoaderWithFlags

func NewConfigurationLoaderWithFlags(explicitFlags map[string]bool) *ConfigurationLoaderWithFlags

NewConfigurationLoaderWithFlags creates a new configuration loader that tracks explicit flags

func (*ConfigurationLoaderWithFlags) CreateConfigTemplate

func (c *ConfigurationLoaderWithFlags) CreateConfigTemplate(path string) error

CreateConfigTemplate creates a template configuration file

func (*ConfigurationLoaderWithFlags) FindDefaultConfigFile

func (c *ConfigurationLoaderWithFlags) FindDefaultConfigFile() string

FindDefaultConfigFile looks for .pyscn.toml in the current directory

func (*ConfigurationLoaderWithFlags) GetDefaultThresholds

func (c *ConfigurationLoaderWithFlags) GetDefaultThresholds() (low, medium int)

GetDefaultThresholds returns the default complexity thresholds

func (*ConfigurationLoaderWithFlags) LoadConfig

LoadConfig loads configuration from the specified path

func (*ConfigurationLoaderWithFlags) LoadDefaultConfig

func (c *ConfigurationLoaderWithFlags) LoadDefaultConfig() *domain.ComplexityRequest

LoadDefaultConfig loads the default configuration

func (*ConfigurationLoaderWithFlags) MergeConfig

MergeConfig merges CLI flags with configuration file, respecting explicit flags

func (*ConfigurationLoaderWithFlags) ValidateConfig

ValidateConfig validates a configuration request

type DIAntipatternConfigurationLoaderImpl added in v1.16.0

type DIAntipatternConfigurationLoaderImpl struct{}

DIAntipatternConfigurationLoaderImpl implements the DIAntipatternConfigurationLoader interface

func NewDIAntipatternConfigurationLoader added in v1.16.0

func NewDIAntipatternConfigurationLoader() *DIAntipatternConfigurationLoaderImpl

NewDIAntipatternConfigurationLoader creates a new DI anti-pattern configuration loader service

func (*DIAntipatternConfigurationLoaderImpl) FindDefaultConfigFile added in v1.16.0

func (cl *DIAntipatternConfigurationLoaderImpl) FindDefaultConfigFile() string

FindDefaultConfigFile looks for TOML config files from the current directory upward.

func (*DIAntipatternConfigurationLoaderImpl) LoadConfig added in v1.16.0

LoadConfig loads DI anti-pattern configuration from the specified path using TOML-only strategy

func (*DIAntipatternConfigurationLoaderImpl) LoadDefaultConfig added in v1.16.0

LoadDefaultConfig loads the default DI anti-pattern configuration, first checking for .pyscn.toml

func (*DIAntipatternConfigurationLoaderImpl) MergeConfig added in v1.16.0

MergeConfig merges CLI flags with configuration file

type DIAntipatternFormatter added in v1.16.0

type DIAntipatternFormatter struct{}

DIAntipatternFormatter implements the DIAntipatternOutputFormatter interface

func NewDIAntipatternFormatter added in v1.16.0

func NewDIAntipatternFormatter() *DIAntipatternFormatter

NewDIAntipatternFormatter creates a new DI anti-pattern formatter

func (*DIAntipatternFormatter) Format added in v1.16.0

Format formats the analysis response according to the specified format

func (*DIAntipatternFormatter) Write added in v1.16.0

Write writes the formatted output to the writer

type DIAntipatternServiceImpl added in v1.16.0

type DIAntipatternServiceImpl struct {
	// contains filtered or unexported fields
}

DIAntipatternServiceImpl implements the DIAntipatternService interface

func NewDIAntipatternService added in v1.16.0

func NewDIAntipatternService() *DIAntipatternServiceImpl

NewDIAntipatternService creates a new DI anti-pattern service

func (*DIAntipatternServiceImpl) Analyze added in v1.16.0

Analyze performs DI anti-pattern analysis on multiple files

func (*DIAntipatternServiceImpl) AnalyzeFile added in v1.16.0

AnalyzeFile analyzes a single Python file

type DeadCodeConfigurationLoaderImpl

type DeadCodeConfigurationLoaderImpl struct{}

DeadCodeConfigurationLoaderImpl implements the DeadCodeConfigurationLoader interface

func NewDeadCodeConfigurationLoader

func NewDeadCodeConfigurationLoader() *DeadCodeConfigurationLoaderImpl

NewDeadCodeConfigurationLoader creates a new dead code configuration loader service

func (*DeadCodeConfigurationLoaderImpl) FindDefaultConfigFile

func (cl *DeadCodeConfigurationLoaderImpl) FindDefaultConfigFile() string

FindDefaultConfigFile looks for TOML config files from the current directory upward.

func (*DeadCodeConfigurationLoaderImpl) LoadConfig

LoadConfig loads dead code configuration from the specified path using TOML-only strategy

func (*DeadCodeConfigurationLoaderImpl) LoadDefaultConfig

func (cl *DeadCodeConfigurationLoaderImpl) LoadDefaultConfig() *domain.DeadCodeRequest

LoadDefaultConfig loads the default dead code configuration, first checking for .pyscn.toml

func (*DeadCodeConfigurationLoaderImpl) MergeConfig

MergeConfig merges CLI flags with configuration file

func (*DeadCodeConfigurationLoaderImpl) SaveConfig

SaveConfig saves dead code configuration to a TOML file

func (*DeadCodeConfigurationLoaderImpl) ValidateConfig

ValidateConfig validates a dead code configuration

type DeadCodeConfigurationLoaderWithFlags

type DeadCodeConfigurationLoaderWithFlags struct {
	// contains filtered or unexported fields
}

DeadCodeConfigurationLoaderWithFlags wraps dead code configuration loading with explicit flag tracking

func NewDeadCodeConfigurationLoaderWithFlags

func NewDeadCodeConfigurationLoaderWithFlags(explicitFlags map[string]bool) *DeadCodeConfigurationLoaderWithFlags

NewDeadCodeConfigurationLoaderWithFlags creates a new dead code configuration loader that tracks explicit flags

func (*DeadCodeConfigurationLoaderWithFlags) FindDefaultConfigFile

func (cl *DeadCodeConfigurationLoaderWithFlags) FindDefaultConfigFile() string

FindDefaultConfigFile looks for .pyscn.toml in the current directory

func (*DeadCodeConfigurationLoaderWithFlags) LoadConfig

LoadConfig loads dead code configuration from the specified path

func (*DeadCodeConfigurationLoaderWithFlags) LoadDefaultConfig

LoadDefaultConfig loads the default dead code configuration

func (*DeadCodeConfigurationLoaderWithFlags) MergeConfig

MergeConfig merges CLI flags with configuration file, respecting explicit flags

type DeadCodeFormatterImpl

type DeadCodeFormatterImpl struct{}

DeadCodeFormatterImpl implements the DeadCodeFormatter interface

func NewDeadCodeFormatter

func NewDeadCodeFormatter() *DeadCodeFormatterImpl

NewDeadCodeFormatter creates a new dead code formatter service

func (*DeadCodeFormatterImpl) Format

Format formats the dead code analysis response according to the specified format

func (*DeadCodeFormatterImpl) FormatFinding

func (f *DeadCodeFormatterImpl) FormatFinding(finding domain.DeadCodeFinding, format domain.OutputFormat) (string, error)

FormatFinding formats a single dead code finding

func (*DeadCodeFormatterImpl) Write

func (f *DeadCodeFormatterImpl) Write(response *domain.DeadCodeResponse, format domain.OutputFormat, writer io.Writer) error

Write writes the formatted dead code output to the writer

type DeadCodeHTMLData

type DeadCodeHTMLData struct {
	OverallScore OverallScoreData         `json:"overall_score"`
	Response     *domain.DeadCodeResponse `json:"response"`
	ScoreDetails ScoreData                `json:"score_details"`
}

DeadCodeHTMLData represents dead code analysis data for HTML template

type DeadCodeServiceImpl

type DeadCodeServiceImpl struct {
	// contains filtered or unexported fields
}

DeadCodeServiceImpl implements the DeadCodeService interface

func NewDeadCodeService

func NewDeadCodeService() *DeadCodeServiceImpl

NewDeadCodeService creates a new dead code service implementation

func (*DeadCodeServiceImpl) Analyze

Analyze performs dead code analysis on multiple files

func (*DeadCodeServiceImpl) AnalyzeFile

func (s *DeadCodeServiceImpl) AnalyzeFile(ctx context.Context, filePath string, req domain.DeadCodeRequest) (*domain.FileDeadCode, error)

AnalyzeFile analyzes a single Python file for dead code

func (*DeadCodeServiceImpl) AnalyzeFunction

func (s *DeadCodeServiceImpl) AnalyzeFunction(ctx context.Context, functionCFG interface{}, req domain.DeadCodeRequest) (*domain.FunctionDeadCode, error)

AnalyzeFunction analyzes a single function for dead code

type ErrorCategorizerImpl

type ErrorCategorizerImpl struct {
	// contains filtered or unexported fields
}

ErrorCategorizerImpl implements the ErrorCategorizer interface

func (*ErrorCategorizerImpl) Categorize

func (ec *ErrorCategorizerImpl) Categorize(err error) *domain.CategorizedError

Categorize determines the category of an error

func (*ErrorCategorizerImpl) GetRecoverySuggestions

func (ec *ErrorCategorizerImpl) GetRecoverySuggestions(category domain.ErrorCategory) []string

GetRecoverySuggestions returns recovery suggestions for an error category

type FileOutputWriter

type FileOutputWriter struct {
	// contains filtered or unexported fields
}

FileOutputWriter writes reports to files or provided writers and optionally opens HTML in a browser.

func NewFileOutputWriter

func NewFileOutputWriter(status io.Writer) *FileOutputWriter

NewFileOutputWriter creates a new FileOutputWriter.

func (*FileOutputWriter) Write

func (w *FileOutputWriter) Write(writer io.Writer, outputPath string, format domain.OutputFormat, noOpen bool, writeFunc func(io.Writer) error) error

Write implements domain.ReportWriter.

type FileReaderImpl

type FileReaderImpl struct{}

FileReaderImpl implements the FileReader interface

func NewFileReader

func NewFileReader() *FileReaderImpl

NewFileReader creates a new file reader service

func (*FileReaderImpl) CollectPythonFiles

func (f *FileReaderImpl) CollectPythonFiles(paths []string, recursive bool, includePatterns, excludePatterns []string) ([]string, error)

CollectPythonFiles recursively finds all Python files in the given paths

func (*FileReaderImpl) FileExists

func (f *FileReaderImpl) FileExists(path string) (bool, error)

FileExists checks if a file exists

func (*FileReaderImpl) GetFileInfo

func (f *FileReaderImpl) GetFileInfo(path string) (os.FileInfo, error)

GetFileInfo provides additional information about a file

func (*FileReaderImpl) IsValidPythonFile

func (f *FileReaderImpl) IsValidPythonFile(path string) bool

IsValidPythonFile checks if a file is a valid Python file

func (*FileReaderImpl) ReadFile

func (f *FileReaderImpl) ReadFile(path string) ([]byte, error)

ReadFile reads the content of a file

func (*FileReaderImpl) ValidatePaths

func (f *FileReaderImpl) ValidatePaths(paths []string) error

ValidatePaths validates that all provided paths exist and are accessible

type FormatUtils

type FormatUtils struct{}

FormatUtils provides shared formatting utilities

func NewFormatUtils

func NewFormatUtils() *FormatUtils

NewFormatUtils creates a new format utilities instance

func (*FormatUtils) ConvertToStandardRisk

func (f *FormatUtils) ConvertToStandardRisk(risk string) RiskLevel

ConvertToStandardRisk converts various risk representations to standard format

func (*FormatUtils) FormatDuration

func (f *FormatUtils) FormatDuration(durationMs int64) string

FormatDuration formats duration in milliseconds consistently

func (*FormatUtils) FormatFileStats

func (f *FormatUtils) FormatFileStats(analyzed, total, withIssues int) string

FormatFileStats creates standardized file statistics

func (*FormatUtils) FormatLabel

func (f *FormatUtils) FormatLabel(label string, value interface{}) string

FormatLabel creates a consistently formatted label with right alignment

func (*FormatUtils) FormatLabelWithIndent

func (f *FormatUtils) FormatLabelWithIndent(indent int, label string, value interface{}) string

FormatLabelWithIndent creates a formatted label with specific indentation

func (*FormatUtils) FormatMainHeader

func (f *FormatUtils) FormatMainHeader(title string) string

FormatMainHeader creates a standardized main header

func (*FormatUtils) FormatPercentage

func (f *FormatUtils) FormatPercentage(value float64) string

FormatPercentage formats a percentage value consistently

func (*FormatUtils) FormatRiskDistribution

func (f *FormatUtils) FormatRiskDistribution(high, medium, low int) string

FormatRiskDistribution creates a standardized risk distribution section

func (*FormatUtils) FormatRiskWithColor

func (f *FormatUtils) FormatRiskWithColor(risk RiskLevel) string

FormatRiskWithColor formats a risk level with appropriate color

func (*FormatUtils) FormatSectionHeader

func (f *FormatUtils) FormatSectionHeader(title string) string

FormatSectionHeader creates a standardized section header

func (*FormatUtils) FormatSectionSeparator

func (f *FormatUtils) FormatSectionSeparator() string

FormatSectionSeparator creates a section separator

func (*FormatUtils) FormatSummaryStats

func (f *FormatUtils) FormatSummaryStats(stats map[string]interface{}) string

FormatSummaryStats creates a standardized summary statistics section

func (*FormatUtils) FormatTableHeader

func (f *FormatUtils) FormatTableHeader(columns ...string) string

FormatTableHeader creates a table header with consistent formatting

func (*FormatUtils) FormatWarningsSection

func (f *FormatUtils) FormatWarningsSection(warnings []string) string

FormatWarningsSection creates a standardized warnings section

func (*FormatUtils) GetRiskColor

func (f *FormatUtils) GetRiskColor(risk RiskLevel) string

GetRiskColor returns the appropriate color for a risk level

type HTMLFormatterImpl

type HTMLFormatterImpl struct{}

HTMLFormatterImpl provides common HTML formatting functionality with Lighthouse-style scoring

func NewHTMLFormatter

func NewHTMLFormatter() *HTMLFormatterImpl

NewHTMLFormatter creates a new HTML formatter service

func (*HTMLFormatterImpl) CalculateCloneScore

func (f *HTMLFormatterImpl) CalculateCloneScore(response *domain.CloneResponse) ScoreData

CalculateCloneScore calculates a Lighthouse-style score for clone detection

func (*HTMLFormatterImpl) CalculateComplexityScore

func (f *HTMLFormatterImpl) CalculateComplexityScore(response *domain.ComplexityResponse) ScoreData

CalculateComplexityScore calculates a Lighthouse-style score (0-100) for complexity

func (*HTMLFormatterImpl) CalculateDeadCodeScore

func (f *HTMLFormatterImpl) CalculateDeadCodeScore(response *domain.DeadCodeResponse) ScoreData

CalculateDeadCodeScore calculates a Lighthouse-style score for dead code detection

func (*HTMLFormatterImpl) CalculateOverallScore

func (f *HTMLFormatterImpl) CalculateOverallScore(scores []ScoreData, projectName string) OverallScoreData

CalculateOverallScore calculates weighted average of all scores

func (*HTMLFormatterImpl) FormatCloneAsHTML

func (f *HTMLFormatterImpl) FormatCloneAsHTML(response *domain.CloneResponse, projectName string) (string, error)

FormatCloneAsHTML formats clone detection as HTML

func (*HTMLFormatterImpl) FormatComplexityAsHTML

func (f *HTMLFormatterImpl) FormatComplexityAsHTML(response *domain.ComplexityResponse, projectName string) (string, error)

FormatComplexityAsHTML formats complexity analysis as HTML

func (*HTMLFormatterImpl) FormatDeadCodeAsHTML

func (f *HTMLFormatterImpl) FormatDeadCodeAsHTML(response *domain.DeadCodeResponse, projectName string) (string, error)

FormatDeadCodeAsHTML formats dead code analysis as HTML

type HTMLTemplate

type HTMLTemplate struct {
	Title       string
	Subtitle    string
	GeneratedAt time.Time
	Version     string
	Duration    int64
	ScoreValue  int
	ScoreGrade  string
	ShowScore   bool
}

HTMLTemplate provides a standard HTML template for all reports

func (*HTMLTemplate) GenerateHTMLHeader

func (t *HTMLTemplate) GenerateHTMLHeader() string

GenerateHTMLHeader generates the standard HTML header with consistent styling

type LCOMConfigurationLoaderImpl added in v1.11.0

type LCOMConfigurationLoaderImpl struct{}

LCOMConfigurationLoaderImpl implements the LCOMConfigurationLoader interface

func NewLCOMConfigurationLoader added in v1.11.0

func NewLCOMConfigurationLoader() *LCOMConfigurationLoaderImpl

NewLCOMConfigurationLoader creates a new LCOM configuration loader service

func (*LCOMConfigurationLoaderImpl) FindDefaultConfigFile added in v1.11.0

func (cl *LCOMConfigurationLoaderImpl) FindDefaultConfigFile() string

FindDefaultConfigFile searches for a config file in the current directory

func (*LCOMConfigurationLoaderImpl) LoadConfig added in v1.11.0

func (cl *LCOMConfigurationLoaderImpl) LoadConfig(path string) (*domain.LCOMRequest, error)

LoadConfig loads LCOM configuration from the specified path using TOML-only strategy

func (*LCOMConfigurationLoaderImpl) LoadDefaultConfig added in v1.11.0

func (cl *LCOMConfigurationLoaderImpl) LoadDefaultConfig() *domain.LCOMRequest

LoadDefaultConfig loads the default LCOM configuration, first checking for .pyscn.toml

func (*LCOMConfigurationLoaderImpl) MergeConfig added in v1.11.0

MergeConfig merges CLI flags with configuration file

type LCOMFormatterImpl added in v1.11.0

type LCOMFormatterImpl struct{}

LCOMFormatterImpl implements LCOMOutputFormatter interface

func NewLCOMFormatter added in v1.11.0

func NewLCOMFormatter() *LCOMFormatterImpl

NewLCOMFormatter creates a new LCOM output formatter

func (*LCOMFormatterImpl) Format added in v1.11.0

func (f *LCOMFormatterImpl) Format(response *domain.LCOMResponse, format domain.OutputFormat) (string, error)

Format formats the LCOM analysis response according to the specified format

func (*LCOMFormatterImpl) Write added in v1.11.0

func (f *LCOMFormatterImpl) Write(response *domain.LCOMResponse, format domain.OutputFormat, writer io.Writer) error

Write writes the formatted output to the writer

type LCOMServiceImpl added in v1.11.0

type LCOMServiceImpl struct {
	// contains filtered or unexported fields
}

LCOMServiceImpl implements the LCOMService interface

func NewLCOMService added in v1.11.0

func NewLCOMService() *LCOMServiceImpl

NewLCOMService creates a new LCOM service implementation

func (*LCOMServiceImpl) Analyze added in v1.11.0

Analyze performs LCOM analysis on multiple files

func (*LCOMServiceImpl) AnalyzeFile added in v1.11.0

func (s *LCOMServiceImpl) AnalyzeFile(ctx context.Context, filePath string, req domain.LCOMRequest) (*domain.LCOMResponse, error)

AnalyzeFile analyzes a single Python file

type MockDataConfigurationLoaderImpl added in v1.7.0

type MockDataConfigurationLoaderImpl struct{}

MockDataConfigurationLoaderImpl implements the MockDataConfigurationLoader interface

func NewMockDataConfigurationLoader added in v1.7.0

func NewMockDataConfigurationLoader() *MockDataConfigurationLoaderImpl

NewMockDataConfigurationLoader creates a new mock data configuration loader service

func (*MockDataConfigurationLoaderImpl) FindDefaultConfigFile added in v1.7.0

func (cl *MockDataConfigurationLoaderImpl) FindDefaultConfigFile() string

FindDefaultConfigFile looks for TOML config files from the current directory upward.

func (*MockDataConfigurationLoaderImpl) LoadConfig added in v1.7.0

LoadConfig loads mock data configuration from the specified path using TOML-only strategy

func (*MockDataConfigurationLoaderImpl) LoadDefaultConfig added in v1.7.0

func (cl *MockDataConfigurationLoaderImpl) LoadDefaultConfig() *domain.MockDataRequest

LoadDefaultConfig loads the default mock data configuration, first checking for .pyscn.toml

func (*MockDataConfigurationLoaderImpl) MergeConfig added in v1.7.0

MergeConfig merges CLI flags with configuration file

type MockDataFormatterImpl added in v1.7.0

type MockDataFormatterImpl struct{}

MockDataFormatterImpl implements the MockDataFormatter interface

func NewMockDataFormatter added in v1.7.0

func NewMockDataFormatter() *MockDataFormatterImpl

NewMockDataFormatter creates a new mock data formatter service

func (*MockDataFormatterImpl) Format added in v1.7.0

Format formats the mock data analysis response according to the specified format

func (*MockDataFormatterImpl) Write added in v1.7.0

func (f *MockDataFormatterImpl) Write(response *domain.MockDataResponse, format domain.OutputFormat, writer io.Writer) error

Write writes the formatted mock data output to the writer

type MockDataServiceImpl added in v1.7.0

type MockDataServiceImpl struct {
	// contains filtered or unexported fields
}

MockDataServiceImpl implements the MockDataService interface

func NewMockDataService added in v1.7.0

func NewMockDataService() *MockDataServiceImpl

NewMockDataService creates a new mock data service implementation

func NewMockDataServiceWithConfig added in v1.7.0

func NewMockDataServiceWithConfig(keywords, domains []string) *MockDataServiceImpl

NewMockDataServiceWithConfig creates a mock data service with custom configuration

func (*MockDataServiceImpl) Analyze added in v1.7.0

Analyze performs mock data analysis on multiple files

func (*MockDataServiceImpl) AnalyzeFile added in v1.7.0

func (s *MockDataServiceImpl) AnalyzeFile(ctx context.Context, filePath string, req domain.MockDataRequest) (*domain.FileMockData, error)

AnalyzeFile analyzes a single Python file for mock data

type OutputFormatResolver

type OutputFormatResolver struct{}

OutputFormatResolver resolves output format and file extension from flags.

func NewOutputFormatResolver

func NewOutputFormatResolver() *OutputFormatResolver

func (*OutputFormatResolver) Determine

func (r *OutputFormatResolver) Determine(html, json, csv, yaml bool) (domain.OutputFormat, string, error)

Determine evaluates format flags and returns the selected format and extension. Exactly one of html/json/csv/yaml may be true; if none are true, defaults to text.

type OutputFormatterImpl

type OutputFormatterImpl struct{}

OutputFormatterImpl implements the OutputFormatter interface

func NewOutputFormatter

func NewOutputFormatter() *OutputFormatterImpl

NewOutputFormatter creates a new output formatter service

func (*OutputFormatterImpl) Format

Format formats the analysis response according to the specified format

func (*OutputFormatterImpl) FormatSummaryOnly

func (f *OutputFormatterImpl) FormatSummaryOnly(response *domain.ComplexityResponse, format domain.OutputFormat) (string, error)

FormatSummaryOnly formats only the summary information

func (*OutputFormatterImpl) Write

func (f *OutputFormatterImpl) Write(response *domain.ComplexityResponse, format domain.OutputFormat, writer io.Writer) error

Write writes the formatted output to the writer

type OverallScoreData

type OverallScoreData struct {
	Score       int         `json:"score"`
	Color       string      `json:"color"`
	Status      string      `json:"status"`
	Breakdown   []ScoreData `json:"breakdown"`
	ProjectName string      `json:"project_name"`
	Timestamp   string      `json:"timestamp"`
}

OverallScoreData represents the combined score information

type ParallelExecutorImpl

type ParallelExecutorImpl struct {
	// contains filtered or unexported fields
}

ParallelExecutorImpl implements the ParallelExecutor interface

func (*ParallelExecutorImpl) Execute

func (pe *ParallelExecutorImpl) Execute(ctx context.Context, tasks []domain.ExecutableTask) error

Execute runs tasks in parallel with the given configuration

func (*ParallelExecutorImpl) SetMaxConcurrency

func (pe *ParallelExecutorImpl) SetMaxConcurrency(max int)

SetMaxConcurrency sets the maximum number of concurrent tasks

func (*ParallelExecutorImpl) SetTimeout

func (pe *ParallelExecutorImpl) SetTimeout(timeout time.Duration)

SetTimeout sets the timeout for all tasks

type ProgressManagerImpl

type ProgressManagerImpl struct {
	// contains filtered or unexported fields
}

ProgressManagerImpl implements the ProgressManager interface

func (*ProgressManagerImpl) Close

func (pm *ProgressManagerImpl) Close()

Close cleans up any resources

func (*ProgressManagerImpl) Complete

func (pm *ProgressManagerImpl) Complete(success bool)

Complete marks the progress as completed (finishes the progress bar)

func (*ProgressManagerImpl) Initialize

func (pm *ProgressManagerImpl) Initialize(maxValue int)

Initialize sets up progress tracking with the maximum value

func (*ProgressManagerImpl) IsInteractive

func (pm *ProgressManagerImpl) IsInteractive() bool

IsInteractive returns true if progress bars should be shown

func (*ProgressManagerImpl) SetWriter

func (pm *ProgressManagerImpl) SetWriter(writer io.Writer)

SetWriter sets the output writer for progress bars

func (*ProgressManagerImpl) Start

func (pm *ProgressManagerImpl) Start()

Start starts the progress bar

func (*ProgressManagerImpl) Update

func (pm *ProgressManagerImpl) Update(processed, total int)

Update updates the progress

type RiskLevel

type RiskLevel string

RiskLevel represents the standard risk levels across all tools

const (
	RiskHigh   RiskLevel = "High"
	RiskMedium RiskLevel = "Medium"
	RiskLow    RiskLevel = "Low"
)

type ScoreData

type ScoreData struct {
	Score    int    `json:"score"`
	Label    string `json:"label"`
	Color    string `json:"color"`
	Status   string `json:"status"`
	Category string `json:"category"`
}

ScoreData represents scoring information for HTML output

type SimpleTask

type SimpleTask struct {
	// contains filtered or unexported fields
}

SimpleTask is a basic implementation of ExecutableTask

func (*SimpleTask) Execute

func (t *SimpleTask) Execute(ctx context.Context) (interface{}, error)

Execute runs the task and returns the result

func (*SimpleTask) IsEnabled

func (t *SimpleTask) IsEnabled() bool

IsEnabled returns whether the task should be executed

func (*SimpleTask) Name

func (t *SimpleTask) Name() string

Name returns the name of the task

type SystemAnalysisConfigurationLoaderImpl

type SystemAnalysisConfigurationLoaderImpl struct{}

SystemAnalysisConfigurationLoaderImpl implements the SystemAnalysisConfigurationLoader interface

func NewSystemAnalysisConfigurationLoader

func NewSystemAnalysisConfigurationLoader() *SystemAnalysisConfigurationLoaderImpl

NewSystemAnalysisConfigurationLoader creates a new system analysis configuration loader

func (*SystemAnalysisConfigurationLoaderImpl) LoadConfig

LoadConfig loads configuration from the specified path using the shared TomlConfigLoader

func (*SystemAnalysisConfigurationLoaderImpl) LoadDefaultConfig

LoadDefaultConfig loads the default configuration

func (*SystemAnalysisConfigurationLoaderImpl) MergeConfig

MergeConfig merges CLI flags with configuration file

type SystemAnalysisConfigurationLoaderWithFlags

type SystemAnalysisConfigurationLoaderWithFlags struct {
	*SystemAnalysisConfigurationLoaderImpl
}

SystemAnalysisConfigurationLoaderWithFlags extends the base loader with CLI flag integration

func NewSystemAnalysisConfigurationLoaderWithFlags

func NewSystemAnalysisConfigurationLoaderWithFlags() *SystemAnalysisConfigurationLoaderWithFlags

NewSystemAnalysisConfigurationLoaderWithFlags creates a configuration loader that integrates CLI flags

func (*SystemAnalysisConfigurationLoaderWithFlags) LoadConfigWithFlags

LoadConfigWithFlags loads configuration and merges with CLI flags

type SystemAnalysisFormatterImpl

type SystemAnalysisFormatterImpl struct{}

SystemAnalysisFormatterImpl implements the SystemAnalysisOutputFormatter interface

func NewSystemAnalysisFormatter

func NewSystemAnalysisFormatter() *SystemAnalysisFormatterImpl

NewSystemAnalysisFormatter creates a new system analysis output formatter

func (*SystemAnalysisFormatterImpl) Format

Format formats the system analysis response according to the specified format

func (*SystemAnalysisFormatterImpl) Write

Write writes the formatted output to the writer

type SystemAnalysisServiceImpl

type SystemAnalysisServiceImpl struct {
	// contains filtered or unexported fields
}

SystemAnalysisServiceImpl implements the SystemAnalysisService interface

func NewSystemAnalysisService

func NewSystemAnalysisService() *SystemAnalysisServiceImpl

NewSystemAnalysisService creates a new system analysis service implementation

func (*SystemAnalysisServiceImpl) Analyze

Analyze performs comprehensive system analysis including dependencies, architecture, and quality metrics

func (*SystemAnalysisServiceImpl) AnalyzeArchitecture

AnalyzeArchitecture performs architecture validation only

func (*SystemAnalysisServiceImpl) AnalyzeDependencies

AnalyzeDependencies performs dependency analysis only

Jump to

Keyboard shortcuts

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