detector

package
v0.1.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: MIT Imports: 11 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetectLanguageForFile

func DetectLanguageForFile(filePath string) (string, error)

func DetectLanguages

func DetectLanguages(rootPath string) (map[string]string, error)

DetectLanguages scans a directory and detects the primary programming language of each subdirectory

Types

type Analysis

type Analysis struct {
	RootPath          string                        `json:"root_path"`
	DirectoryAnalyses map[string]*DirectoryAnalysis `json:"directory_analyses"`
}

Analysis contains the results of language detection and library discovery

type CodebaseAnalyzer

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

CodebaseAnalyzer coordinates the detection process

func NewCodebaseAnalyzer

func NewCodebaseAnalyzer(detectors []IssueDetector, languages map[string]Language, storageClient *storage.Storage, logger logger.Logger) *CodebaseAnalyzer

NewCodebaseAnalyzer creates a new analysis engine

func (*CodebaseAnalyzer) AnalyzeCodebase

func (ca *CodebaseAnalyzer) AnalyzeCodebase(ctx context.Context, rootPath string) (*Analysis, error)

AnalyzeCodebase performs the full analysis

type DirectoryAnalysis

type DirectoryAnalysis struct {
	Directory                 string                       `json:"directory"`
	FullPath                  string                       `json:"full_path"`
	Language                  string                       `json:"language"`
	Libraries                 []domain.Library             `json:"libraries"`
	Packages                  []domain.Package             `json:"packages"`
	AvailableInstrumentations []domain.InstrumentationInfo `json:"available_instrumentations"`
	Issues                    []domain.Issue               `json:"issues"`
}

DirectoryAnalysis contains analysis results for a specific directory

type IssueDetector

type IssueDetector interface {
	// ID returns a unique identifier for this detector
	ID() string
	// Name returns a human-readable name
	Name() string
	// Description returns what this detector looks for
	Description() string
	// Category returns the issue category
	Category() domain.Category
	// Languages returns which languages this detector applies to (empty = all)
	Languages() []string
	// Detect finds issues in the given context
	Detect(ctx context.Context, analysis *DirectoryAnalysis) ([]domain.Issue, error)
}

IssueDetector defines how to detect specific issues

type KnowledgeBasedInstrumentationService

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

KnowledgeBasedInstrumentationService integrates the new knowledge base with the detector system

func NewKnowledgeBasedInstrumentationService

func NewKnowledgeBasedInstrumentationService(storageClient *storage.Storage, logger logger.Logger) *KnowledgeBasedInstrumentationService

NewKnowledgeBasedInstrumentationService creates a new knowledge-based instrumentation service

func (*KnowledgeBasedInstrumentationService) Close

Close closes the underlying storage connection

func (*KnowledgeBasedInstrumentationService) GetBreakingChanges

GetBreakingChanges returns breaking changes for a given package

func (*KnowledgeBasedInstrumentationService) GetCompatibleVersions

GetCompatibleVersions returns compatible versions for a given package

func (*KnowledgeBasedInstrumentationService) GetInstrumentation

GetInstrumentation finds instrumentation information using the knowledge base

func (*KnowledgeBasedInstrumentationService) GetLatestVersion

GetLatestVersion returns the latest stable version of a package

func (*KnowledgeBasedInstrumentationService) GetRecommendedInstrumentations

func (s *KnowledgeBasedInstrumentationService) GetRecommendedInstrumentations(ctx context.Context, pkg domain.Package) ([]domain.InstrumentationInfo, error)

GetRecommendedInstrumentations returns recommended instrumentations for a given package

type Language

type Language interface {
	// Name returns the language name
	Name() string
	// GetOTelLibraries finds OpenTelemetry libraries used in the codebase
	GetOTelLibraries(ctx context.Context, rootPath string) ([]domain.Library, error)
	// GetAllPackages finds all packages/dependencies used in the codebase
	GetAllPackages(ctx context.Context, rootPath string) ([]domain.Package, error)
	// GetFilePatterns returns file patterns this language detector should scan
	GetFilePatterns() []string
}

Language represents a programming language detector

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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