Documentation
¶
Overview ¶
Package similarity-go provides a high-performance Go code similarity detection CLI tool that uses multi-factor AST analysis to identify duplicate and similar code patterns.
The tool employs sophisticated algorithms combining AST tree edit distance, token sequence analysis, structural signatures, and signature matching with weighted scoring to provide accurate similarity detection for Go projects of all sizes.
Key Features:
- Multi-factor similarity detection with configurable thresholds
- High-performance parallel processing with thread-safe operations
- Intelligent directory scanning with smart filtering
- JSON/YAML structured output formats
- Comprehensive configuration management
- Production-ready with 78-88% test coverage
Basic Usage:
// Analyze entire directory similarity-go ./internal // Analyze specific files similarity-go file1.go file2.go // Custom threshold and output format similarity-go --threshold 0.7 --format yaml ./project
The tool is designed for large-scale refactoring, code review, and quality metrics, providing actionable insights for code maintainability and duplication reduction.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
similarity-go
command
|
|
|
weight-benchmark
command
|
|
|
internal
|
|
|
ast
Package ast provides Go abstract syntax tree (AST) parsing and function extraction capabilities for the similarity detection tool.
|
Package ast provides Go abstract syntax tree (AST) parsing and function extraction capabilities for the similarity detection tool. |
|
config
Package config provides comprehensive configuration management for the similarity-go tool with YAML-based configuration and validation.
|
Package config provides comprehensive configuration management for the similarity-go tool with YAML-based configuration and validation. |
|
similarity
Package similarity implements multi-factor similarity detection algorithms for Go code analysis and duplicate code identification.
|
Package similarity implements multi-factor similarity detection algorithms for Go code analysis and duplicate code identification. |
|
pkg
|
|
|
mathutil
Package mathutil provides type-safe generic mathematical utility functions using Go 1.21+ generics for zero-cost abstractions.
|
Package mathutil provides type-safe generic mathematical utility functions using Go 1.21+ generics for zero-cost abstractions. |
|
types
Package types provides Rust-inspired utility types for robust error handling and null safety in Go applications.
|
Package types provides Rust-inspired utility types for robust error handling and null safety in Go applications. |
Click to show internal directories.
Click to hide internal directories.