Documentation
¶
Index ¶
- func ResolveFilePaths(fileHelper *FileHelper, paths []string, recursive bool, ...) ([]string, error)
- type AnalyzeConfig
- type AnalyzeResult
- type AnalyzeUseCase
- type AnalyzeUseCaseBuilder
- func (b *AnalyzeUseCaseBuilder) Build() (*AnalyzeUseCase, error)
- func (b *AnalyzeUseCaseBuilder) WithComplexityUseCase(uc *ComplexityUseCase) *AnalyzeUseCaseBuilder
- func (b *AnalyzeUseCaseBuilder) WithDeadCodeUseCase(uc *DeadCodeUseCase) *AnalyzeUseCaseBuilder
- func (b *AnalyzeUseCaseBuilder) WithFileHelper(fh *FileHelper) *AnalyzeUseCaseBuilder
- type ComplexityUseCase
- type ComplexityUseCaseBuilder
- type DeadCodeUseCase
- type DeadCodeUseCaseBuilder
- type FileHelper
- func (h *FileHelper) CollectJSFiles(paths []string, recursive bool, includePatterns, excludePatterns []string) ([]string, error)
- func (h *FileHelper) CollectPythonFiles(paths []string, recursive bool, includePatterns, excludePatterns []string) ([]string, error)
- func (h *FileHelper) FileExists(path string) (bool, error)
- func (h *FileHelper) IsValidJSFile(path string) bool
- func (h *FileHelper) IsValidPythonFile(path string) bool
- func (h *FileHelper) ReadFile(path string) ([]byte, error)
- type UseCaseOptions
- type WriteOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveFilePaths ¶
func ResolveFilePaths( fileHelper *FileHelper, paths []string, recursive bool, includePatterns []string, excludePatterns []string, ) ([]string, error)
ResolveFilePaths resolves file paths, returning existing files directly or collecting files from directories
Types ¶
type AnalyzeConfig ¶
type AnalyzeConfig struct {
EnableComplexity bool
EnableDeadCode bool
// Complexity options
MinComplexity int
MaxComplexity int
LowThreshold int
MediumThreshold int
// Dead code options
MinSeverity domain.DeadCodeSeverity
// Output options
OutputFormat domain.OutputFormat
OutputWriter io.Writer
OutputPath string
NoOpen bool
// File options
Recursive bool
IncludePatterns []string
ExcludePatterns []string
}
AnalyzeConfig holds configuration for the analyze use case
func DefaultAnalyzeConfig ¶
func DefaultAnalyzeConfig() AnalyzeConfig
DefaultAnalyzeConfig returns default configuration
type AnalyzeResult ¶
type AnalyzeResult struct {
Complexity *domain.ComplexityResponse
DeadCode *domain.DeadCodeResponse
Summary *domain.AnalyzeSummary
Duration time.Duration
}
AnalyzeResult holds the results of comprehensive analysis
func (*AnalyzeResult) ToAnalyzeResponse ¶
func (r *AnalyzeResult) ToAnalyzeResponse() *domain.AnalyzeResponse
ToAnalyzeResponse converts AnalyzeResult to domain.AnalyzeResponse
type AnalyzeUseCase ¶
type AnalyzeUseCase struct {
// contains filtered or unexported fields
}
AnalyzeUseCase orchestrates comprehensive analysis
func NewAnalyzeUseCase ¶
func NewAnalyzeUseCase( complexityUseCase *ComplexityUseCase, deadCodeUseCase *DeadCodeUseCase, ) *AnalyzeUseCase
NewAnalyzeUseCase creates a new analyze use case
func (*AnalyzeUseCase) Execute ¶
func (uc *AnalyzeUseCase) Execute(ctx context.Context, config AnalyzeConfig, paths []string) (*AnalyzeResult, error)
Execute performs comprehensive analysis
type AnalyzeUseCaseBuilder ¶
type AnalyzeUseCaseBuilder struct {
// contains filtered or unexported fields
}
AnalyzeUseCaseBuilder builds an AnalyzeUseCase
func NewAnalyzeUseCaseBuilder ¶
func NewAnalyzeUseCaseBuilder() *AnalyzeUseCaseBuilder
NewAnalyzeUseCaseBuilder creates a new builder
func (*AnalyzeUseCaseBuilder) Build ¶
func (b *AnalyzeUseCaseBuilder) Build() (*AnalyzeUseCase, error)
Build creates the AnalyzeUseCase
func (*AnalyzeUseCaseBuilder) WithComplexityUseCase ¶
func (b *AnalyzeUseCaseBuilder) WithComplexityUseCase(uc *ComplexityUseCase) *AnalyzeUseCaseBuilder
WithComplexityUseCase sets the complexity use case
func (*AnalyzeUseCaseBuilder) WithDeadCodeUseCase ¶
func (b *AnalyzeUseCaseBuilder) WithDeadCodeUseCase(uc *DeadCodeUseCase) *AnalyzeUseCaseBuilder
WithDeadCodeUseCase sets the dead code use case
func (*AnalyzeUseCaseBuilder) WithFileHelper ¶
func (b *AnalyzeUseCaseBuilder) WithFileHelper(fh *FileHelper) *AnalyzeUseCaseBuilder
WithFileHelper sets the file helper
type ComplexityUseCase ¶
type ComplexityUseCase struct {
// contains filtered or unexported fields
}
ComplexityUseCase orchestrates the complexity analysis workflow
func NewComplexityUseCase ¶
func NewComplexityUseCase(service domain.ComplexityService) *ComplexityUseCase
NewComplexityUseCase creates a new complexity use case
func (*ComplexityUseCase) AnalyzeFile ¶
func (uc *ComplexityUseCase) AnalyzeFile(ctx context.Context, filePath string, req domain.ComplexityRequest) (*domain.ComplexityResponse, error)
AnalyzeFile analyzes a single file
func (*ComplexityUseCase) Execute ¶
func (uc *ComplexityUseCase) Execute(ctx context.Context, req domain.ComplexityRequest) (*domain.ComplexityResponse, error)
Execute performs the complete complexity analysis workflow
type ComplexityUseCaseBuilder ¶
type ComplexityUseCaseBuilder struct {
// contains filtered or unexported fields
}
ComplexityUseCaseBuilder provides a builder pattern for creating ComplexityUseCase
func NewComplexityUseCaseBuilder ¶
func NewComplexityUseCaseBuilder() *ComplexityUseCaseBuilder
NewComplexityUseCaseBuilder creates a new builder
func (*ComplexityUseCaseBuilder) Build ¶
func (b *ComplexityUseCaseBuilder) Build() (*ComplexityUseCase, error)
Build creates the ComplexityUseCase with the configured dependencies
func (*ComplexityUseCaseBuilder) WithFileHelper ¶
func (b *ComplexityUseCaseBuilder) WithFileHelper(fileHelper *FileHelper) *ComplexityUseCaseBuilder
WithFileHelper sets the file helper
func (*ComplexityUseCaseBuilder) WithService ¶
func (b *ComplexityUseCaseBuilder) WithService(service domain.ComplexityService) *ComplexityUseCaseBuilder
WithService sets the complexity service
type DeadCodeUseCase ¶
type DeadCodeUseCase struct {
// contains filtered or unexported fields
}
DeadCodeUseCase orchestrates the dead code analysis workflow.
func NewDeadCodeUseCase ¶
func NewDeadCodeUseCase() *DeadCodeUseCase
NewDeadCodeUseCase creates a new dead code use case.
func (*DeadCodeUseCase) AnalyzeFile ¶
func (uc *DeadCodeUseCase) AnalyzeFile(ctx context.Context, filePath string, req domain.DeadCodeRequest) (*domain.FileDeadCode, error)
AnalyzeFile analyzes a single file for dead code.
func (*DeadCodeUseCase) Execute ¶
func (uc *DeadCodeUseCase) Execute(ctx context.Context, req domain.DeadCodeRequest) (*domain.DeadCodeResponse, error)
Execute performs the complete dead code analysis workflow.
type DeadCodeUseCaseBuilder ¶
type DeadCodeUseCaseBuilder struct {
// contains filtered or unexported fields
}
DeadCodeUseCaseBuilder provides a builder pattern for creating DeadCodeUseCase.
func NewDeadCodeUseCaseBuilder ¶
func NewDeadCodeUseCaseBuilder() *DeadCodeUseCaseBuilder
NewDeadCodeUseCaseBuilder creates a new builder.
func (*DeadCodeUseCaseBuilder) Build ¶
func (b *DeadCodeUseCaseBuilder) Build() (*DeadCodeUseCase, error)
Build creates the DeadCodeUseCase with the configured dependencies.
func (*DeadCodeUseCaseBuilder) WithFileHelper ¶
func (b *DeadCodeUseCaseBuilder) WithFileHelper(fileHelper *FileHelper) *DeadCodeUseCaseBuilder
WithFileHelper sets the file helper.
func (*DeadCodeUseCaseBuilder) WithService ¶ added in v0.4.0
func (b *DeadCodeUseCaseBuilder) WithService(service domain.DeadCodeService) *DeadCodeUseCaseBuilder
WithService sets the dead code service.
type FileHelper ¶
type FileHelper struct{}
FileHelper provides file operation utilities
func (*FileHelper) CollectJSFiles ¶
func (h *FileHelper) CollectJSFiles(paths []string, recursive bool, includePatterns, excludePatterns []string) ([]string, error)
CollectJSFiles collects JavaScript/TypeScript files from paths
func (*FileHelper) CollectPythonFiles ¶ added in v0.4.0
func (h *FileHelper) CollectPythonFiles(paths []string, recursive bool, includePatterns, excludePatterns []string) ([]string, error)
CollectPythonFiles is a compatibility wrapper for legacy domain.FileReader.
func (*FileHelper) FileExists ¶
func (h *FileHelper) FileExists(path string) (bool, error)
FileExists checks if a file exists
func (*FileHelper) IsValidJSFile ¶
func (h *FileHelper) IsValidJSFile(path string) bool
IsValidJSFile checks if a file is a valid JavaScript/TypeScript file
func (*FileHelper) IsValidPythonFile ¶ added in v0.4.0
func (h *FileHelper) IsValidPythonFile(path string) bool
IsValidPythonFile is a compatibility wrapper for legacy domain.FileReader.
type UseCaseOptions ¶
type UseCaseOptions struct {
EnableProgress bool
ProgressInterval time.Duration
MaxConcurrency int
TimeoutPerFile time.Duration
}
UseCaseOptions provides configuration options for the use case
func DefaultUseCaseOptions ¶
func DefaultUseCaseOptions() UseCaseOptions
DefaultUseCaseOptions returns default options
type WriteOutput ¶
type WriteOutput interface {
Write(writer io.Writer, response *domain.ComplexityResponse, format domain.OutputFormat) error
}
WriteOutput is a helper interface for writing output