Skip to content

feat(go): expand Go slop pattern coverage#24

Merged
avifenesh merged 7 commits intomainfrom
feature/go-slop-patterns-4
Feb 26, 2026
Merged

feat(go): expand Go slop pattern coverage#24
avifenesh merged 7 commits intomainfrom
feature/go-slop-patterns-4

Conversation

@avifenesh
Copy link
Contributor

Summary

  • Add 8 new Go-specific slop detection patterns (9 total with existing placeholder_panic_go)
  • Add runGolangciLint() CLI enhancer for Phase 2 pipeline integration
  • Add comprehensive test suite with 82 Go-specific tests (671 total passing)

New Go Patterns

Pattern Severity Description
go_fmt_debugging medium fmt.Print/Println/Printf debug statements
go_log_debugging low log.Print/Fatal/Panic debug logging
go_spew_debugging medium spew.Dump/pp.Println debug printers
go_empty_error_check high Empty if err != nil {} blocks
go_discarded_error medium _ = someFunc() discarded errors
go_bare_os_exit medium os.Exit() outside main/cmd
go_empty_interface_param low interface{} parameter overuse
go_todo_empty_func high TODO/FIXME in empty function body

Also includes

  • Regex backtracking hardening with quantifier limits
  • golangci-lint JSON output parsing with targetFiles filtering
  • Updated CHANGELOG and slop-categories reference docs

Test Plan

  • All 671 tests pass (npm test)
  • Go test suite: 82 tests with true positive, false positive, and exclusion coverage
  • No regressions in existing Rust/Python/Shell/C/Java/Kotlin test suites

Closes #4

Add comprehensive Go-specific pattern coverage:
- go_fmt_debugging: fmt.Print/Println/Printf in production code
- go_log_debugging: log.Print/Fatal/Panic standard library calls
- go_spew_debugging: spew/pp debug dumping libraries
- go_empty_error_check: silently swallowed errors (if err != nil {})
- go_discarded_error: errors discarded via blank identifier
- go_bare_os_exit: os.Exit() in non-main code
- go_empty_interface_param: empty interface{} parameters
- go_todo_empty_func: functions with only TODO/FIXME comments

Total Go patterns: 9 (1 existing + 8 new)
Add golangci-lint integration for Phase 2 deep analysis:
- Runs golangci-lint with JSON output and arg array (no shell)
- Maps severity levels (error->high, warning->medium, info->low)
- Returns null if tool unavailable, [] on parse failure
- 120s timeout for large codebases
Wire up runGolangciLint() in runPhase2() after the escomplex block.
Findings use patternName 'golangci_lint_issue' with LOW certainty.
Coverage for all 9 Go patterns with:
- Integration tests: hasLanguage, getPatternsForLanguageOnly count,
  pattern name presence, required fields validation
- Per-pattern blocks with true positives, false positives, and
  file exclusion tests
- Key false positive guards: go_discarded_error vs range iteration,
  go_fmt_debugging vs test files
The **/cmd/** glob requires a directory prefix and does not match
cmd/ at the repository root. Add cmd/** alongside **/cmd/** for
go_fmt_debugging, go_log_debugging, and go_bare_os_exit patterns.
- Limit [^)]* to {0,200} in go_todo_empty_func and go_empty_interface_param
- Limit (?:\.\w+)* to {0,10} in go_discarded_error
- Add targetFiles filtering to runGolangciLint
- Add edge case tests for named returns and variadic params
@avifenesh avifenesh force-pushed the feature/go-slop-patterns-4 branch from 70b7b7b to 09d1ce6 Compare February 26, 2026 00:21
@avifenesh avifenesh merged commit 984be2a into main Feb 26, 2026
2 checks passed
@avifenesh avifenesh deleted the feature/go-slop-patterns-4 branch February 26, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expand Go slop pattern coverage

1 participant