Documentation
¶
Index ¶
- func ApplyPatternLabel(cls domain.CloneClassification, label PatternLabel) domain.CloneClassification
- func ClassifyClone(input domain.ClassificationInput) domain.CloneClassification
- func EvaluateActionability(nodeSeqs [][]*domain.CloneNode) domain.CloneActionability
- func EvaluateActionabilityWithDisabled(nodeSeqs [][]*domain.CloneNode, disabled map[PatternLabel]bool) domain.CloneActionability
- func ListActionabilityPatterns(w io.Writer)
- type PatternLabel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyPatternLabel ¶
func ApplyPatternLabel(cls domain.CloneClassification, label PatternLabel) domain.CloneClassification
ApplyPatternLabel adjusts clone classification based on the AST-detected non-actionable pattern. This upgrades the category and suggestion to reflect the specific reason the clone is non-actionable, rather than relying solely on the first node's type.
func ClassifyClone ¶
func ClassifyClone(input domain.ClassificationInput) domain.CloneClassification
func EvaluateActionability ¶
func EvaluateActionability(nodeSeqs [][]*domain.CloneNode) domain.CloneActionability
EvaluateActionability analyzes a clone group and determines whether it represents actionable duplication or idiomatic boilerplate noise.
A group is actionable when it contains real logic that can be extracted, composed, or otherwise refactored. Non-actionable patterns are standard Go idioms that cannot be eliminated without breaking semantics.
To be non-actionable, EVERY clone in the group must match the same boilerplate pattern. If any clone differs, the group is actionable.
func EvaluateActionabilityWithDisabled ¶
func EvaluateActionabilityWithDisabled( nodeSeqs [][]*domain.CloneNode, disabled map[PatternLabel]bool, ) domain.CloneActionability
EvaluateActionabilityWithDisabled is like EvaluateActionability but skips patterns whose labels are in the disabled set.
func ListActionabilityPatterns ¶
ListActionabilityPatterns writes all pattern labels to the writer, one per line.
Types ¶
type PatternLabel ¶
type PatternLabel string
PatternLabel identifies which non-actionable pattern was detected. Empty string means actionable.
const ( PatternNone PatternLabel = "" PatternTestData PatternLabel = "testdata-pair" PatternTableDrivenTest PatternLabel = "table-driven-test" PatternTestScaffolding PatternLabel = "test-scaffolding" PatternDataDominated PatternLabel = "data-dominated" PatternSignatureOnly PatternLabel = "signature-only" PatternRAIIDefer PatternLabel = "raii-defer" PatternErrorPropagation PatternLabel = "error-propagation" PatternErrorWrapping PatternLabel = "error-wrapping" PatternAssertionChain PatternLabel = "assertion-chain" PatternCobraBoilerplate PatternLabel = "cobra-boilerplate" PatternInterfaceImpl PatternLabel = "interface-implementation" PatternDescribeTable PatternLabel = "describe-table" PatternBuilderCallback PatternLabel = "builder-callback" PatternAssignErrorCheck PatternLabel = "assign-error-check" PatternSingleCallExpr PatternLabel = "single-call-expression" PatternSingleSimpleStmt PatternLabel = "single-simple-statement" PatternSingleDeclaration PatternLabel = "single-declaration" PatternGuardClause PatternLabel = "guard-clause" PatternTestHelperDelegate PatternLabel = "test-helper-delegate" PatternInterfaceMethod PatternLabel = "interface-method" )
func AllActionabilityPatterns ¶
func AllActionabilityPatterns() []PatternLabel
AllActionabilityPatterns returns all registered pattern labels in priority order.
func EvaluateActionabilityWithLabel ¶
func EvaluateActionabilityWithLabel(nodeSeqs [][]*domain.CloneNode) (PatternLabel, domain.CloneActionability)
EvaluateActionabilityWithLabel returns both the actionability and the pattern label that caused it. This allows downstream code to adjust category/suggestion based on which specific pattern was detected.