Documentation
¶
Index ¶
- Constants
- func DetectedLanguage(ext string) string
- func ReductionFactor(score int) float64
- func TestComputeOverallScoreHelper(results []QualityResult) int
- func TestCountAllSmellsHelper(results []QualityResult) int
- func TestDetectorStatusHelper(detector string, results []QualityResult) string
- func TestIsBinaryFileHelper(data []byte) bool
- func TestIsGitignoredReportHelper(path, root string, patterns []string) bool
- func TestIsSourceFileReportHelper(path string) bool
- func TestLoadGitignoreSimpleHelper(root string) []string
- func TestScoreEmojiHelper(score int) string
- type CohesionResult
- type DuplicationPair
- type FunctionBloat
- type GitHotspotResult
- type HotspotEntry
- type ModelPricing
- type QualityResult
- type ReportData
- type Smell
- type SourceInput
- type Thresholds
- type TokenEstimator
- func (t *TokenEstimator) CostForModel(modelName string) float64
- func (t *TokenEstimator) CurrentTokens() int
- func (t *TokenEstimator) EstimatedTokensAfterRefactor() int
- func (t *TokenEstimator) FormatEstimateOutput() string
- func (t *TokenEstimator) InteractionCost(model ModelPricing) float64
- func (t *TokenEstimator) IterationReductionSavings(model ModelPricing) float64
- func (t *TokenEstimator) MonthlyEnterpriseSavings(model ModelPricing) float64
- func (t *TokenEstimator) SavingsPerRead(model ModelPricing) float64
- func (t *TokenEstimator) TokenSavingsPerRead() int
Constants ¶
const ( LabelGoAhead = parser.LabelGoAhead LabelProceedWithCare = parser.LabelProceedWithCare LabelNeedsWork = parser.LabelNeedsWork LabelStopRefactor = parser.LabelStopRefactor )
Variables ¶
This section is empty.
Functions ¶
func DetectedLanguage ¶
func ReductionFactor ¶ added in v0.8.5
ReductionFactor returns the estimated token reduction factor after refactoring to 80+. Based on current quality score:
- 0-36: 50% reduction
- 37-49: 50% reduction
- 50-64: 45% reduction
- 65-79: 40% reduction
- 80+: 10% reduction (already clean)
func TestComputeOverallScoreHelper ¶ added in v0.8.5
func TestComputeOverallScoreHelper(results []QualityResult) int
TestComputeOverallScoreHelper is exported for testing.
func TestCountAllSmellsHelper ¶ added in v0.8.5
func TestCountAllSmellsHelper(results []QualityResult) int
TestCountAllSmellsHelper is exported for testing.
func TestDetectorStatusHelper ¶ added in v0.8.5
func TestDetectorStatusHelper(detector string, results []QualityResult) string
TestDetectorStatusHelper is exported for testing.
func TestIsBinaryFileHelper ¶ added in v0.8.5
TestIsBinaryFileHelper is exported for testing.
func TestIsGitignoredReportHelper ¶ added in v0.8.5
TestIsGitignoredReportHelper is exported for testing.
func TestIsSourceFileReportHelper ¶ added in v0.8.5
TestIsSourceFileReportHelper is exported for testing.
func TestLoadGitignoreSimpleHelper ¶ added in v0.8.5
TestLoadGitignoreSimpleHelper is exported for testing.
func TestScoreEmojiHelper ¶ added in v0.8.5
TestScoreEmojiHelper is exported for testing.
Types ¶
type CohesionResult ¶
type CohesionResult = parser.CohesionResult
Re-export parser types for backward compatibility.
type DuplicationPair ¶
type DuplicationPair = parser.DuplicationPair
Re-export parser types for backward compatibility.
type FunctionBloat ¶
type FunctionBloat = parser.FunctionBloat
Re-export parser types for backward compatibility.
type GitHotspotResult ¶
type GitHotspotResult = parser.GitHotspotResult
Re-export parser types for backward compatibility.
func AnalyzeGitHotspots ¶
func AnalyzeGitHotspots(repoPath string, maxDepth int) GitHotspotResult
type HotspotEntry ¶
type HotspotEntry = parser.HotspotEntry
Re-export parser types for backward compatibility.
type ModelPricing ¶ added in v0.8.5
ModelPricing holds pricing info for an AI model.
type QualityResult ¶
type QualityResult = parser.QualityResult
Re-export parser types for backward compatibility.
func Analyze ¶
func Analyze(src SourceInput, t Thresholds) QualityResult
Analyze runs all detectors on source and returns a QualityResult. Score is 0-100.
type ReportData ¶ added in v0.8.5
type ReportData struct {
Target string
Timestamp string
Results []QualityResult
Secrets []secrets.SecretFinding
Vulns []vulnerability.Finding
OverallScore int
OverallLabel string
}
ReportData holds all the data needed to render a markdown quality report.
func GenerateReport ¶ added in v0.8.5
func GenerateReport(target string, respectGitignore bool) (*ReportData, error)
GenerateReport runs a full scan and returns rendered markdown.
func (*ReportData) RenderMarkdown ¶ added in v0.8.5
func (rd *ReportData) RenderMarkdown() string
RenderMarkdown generates the full markdown report string.
type SourceInput ¶ added in v0.8.5
SourceInput bundles the source file identity for analysis.
type Thresholds ¶
type Thresholds = parser.Thresholds
Re-export parser types for backward compatibility.
func DefaultThresholds ¶
func DefaultThresholds(lang string) Thresholds
type TokenEstimator ¶ added in v0.8.5
TokenEstimator estimates token counts and cost savings for AI interactions.
func NewTokenEstimator ¶ added in v0.8.5
func NewTokenEstimator(filePath string, currentScore int) *TokenEstimator
NewTokenEstimator creates an estimator for a given file.
func (*TokenEstimator) CostForModel ¶ added in v0.8.5
func (t *TokenEstimator) CostForModel(modelName string) float64
CostForModel returns the per-interaction cost for a specific model.
func (*TokenEstimator) CurrentTokens ¶ added in v0.8.5
func (t *TokenEstimator) CurrentTokens() int
CurrentTokens estimates the number of tokens in the current file. Approx 1 token per 4 characters (standard LLM approximation).
func (*TokenEstimator) EstimatedTokensAfterRefactor ¶ added in v0.8.5
func (t *TokenEstimator) EstimatedTokensAfterRefactor() int
EstimatedTokensAfterRefactor estimates tokens after refactoring to score 80+.
func (*TokenEstimator) FormatEstimateOutput ¶ added in v0.8.5
func (t *TokenEstimator) FormatEstimateOutput() string
FormatEstimateOutput returns the formatted token estimate string.
func (*TokenEstimator) InteractionCost ¶ added in v0.8.5
func (t *TokenEstimator) InteractionCost(model ModelPricing) float64
InteractionCost returns the cost of reading the file once with a given model.
func (*TokenEstimator) IterationReductionSavings ¶ added in v0.8.5
func (t *TokenEstimator) IterationReductionSavings(model ModelPricing) float64
IterationReductionSavings calculates total savings including ~40% fewer iterations from clean code.
func (*TokenEstimator) MonthlyEnterpriseSavings ¶ added in v0.8.5
func (t *TokenEstimator) MonthlyEnterpriseSavings(model ModelPricing) float64
MonthlyEnterpriseSavings calculates monthly savings for 20 devs, 50 AI calls/day, 6 files read per call.
func (*TokenEstimator) SavingsPerRead ¶ added in v0.8.5
func (t *TokenEstimator) SavingsPerRead(model ModelPricing) float64
SavingsPerRead returns per-interaction savings for a given model.
func (*TokenEstimator) TokenSavingsPerRead ¶ added in v0.8.5
func (t *TokenEstimator) TokenSavingsPerRead() int
TokenSavingsPerRead returns the number of tokens saved per single read of the file.