Tinker
Resources
Agent logs
Agent memories
Agent sessions
Agent terminal logs
Agents
Comments
Epics
Projects
Proposals
Tickets
Avo user
Resources
Agent logs
Agent memories
Agent sessions
Agent terminal logs
Agents
Comments
Epics
Projects
Proposals
Tickets
Avo user
Home
Epics
Phase 2: Code quality analysis and test coverage detection
Edit
Phase 2: Code quality analysis and test coverage detection
Cancel
Save
Title
*
Project
*
Choose an option
alpha
tinker
Create new project
Description
Implement Phase 2: Researcher analyzes code for quality issues and test coverage gaps. ## Code Analysis Capabilities **MCP tools needed:** ```go get_file(path) // Read file content get_diff() // Get recent git changes rubocop_report() // Code quality metrics test_coverage_report() // SimpleCov data ``` ## Code Quality Analysis **Find duplicated code:** 1. Read recent files (via get_diff for new code) 2. Use embedding or pattern matching to find similarity 3. If 3+ files share similar code → refactor proposal **Example proposal:** ```json { "title": "Extract NotificationBuilder from 5 controllers", "proposal_type": "refactor", "reasoning": "5 controllers have nearly identical notification logic (50-80 lines each). Extracting to service would reduce duplication and improve testability.", "confidence": "high", "priority": "medium", "metadata": { "duplicate_count": 5, "estimated_duplication": "300 lines", "evidence_links": [ {"type": "code_file", "path": "app/controllers/users_controller.rb", "lines": "45-95"}, {"type": "code_file", "path": "app/controllers/bookings_controller.rb", "lines": "120-170"}, {"type": "code_file", "path": "app/controllers/orders_controller.rb", "lines": "80-130"} ] } } ``` **Find code smells:** 1. Parse rubocop reports for offenses 2. High complexity methods → simplify proposal 3. Long methods/classes → extract proposal 4. Deep nesting → refactor proposal ## Test Coverage Analysis **Find gaps via SimpleCov:** ```ruby # Get coverage report coverage = SimpleCov.result # Find files with low coverage files_below_80 = coverage.files.select { |f| f.covered_percent < 80 } # Find specific untested methods # (via heuristics or coverage tools) ``` **Example proposal:** ```json { "title": "Add failure path tests to BookingWorkflow", "proposal_type": "test_gap", "reasoning": "BookingWorkflow has 95% coverage but only tests happy path. Payment failures, race conditions, and timeout cases are untested. These caused 2 production incidents this month.", "confidence": "high", "priority": "high", "metadata": { "current_coverage": "95%", "missing_scenarios": ["payment_failure", "race_condition", "timeout"], "evidence_links": [ {"type": "code_file", "path": "app/services/booking_workflow.rb"}, {"type": "ticket", "id": 450, "description": "Production incident: race condition"} ] } } ``` ## Analysis Loop (Phase 2) ``` Every 1 hour: 1. get_diff() → analyze new/changed files 2. rubocop_report() → find smells 3. Read changed files → detect duplication 4. test_coverage_report() → find gaps 5. Generate proposals 6. Store via create_proposal ``` ## Acceptance Criteria - [ ] Can read file contents and diffs - [ ] Detects code duplication across files - [ ] Identifies code smells via rubocop - [ ] Finds test coverage gaps - [ ] Proposals include specific files/lines - [ ] Metrics included in proposals
Avo
· © 2026 AvoHQ ·
v3.27.0
Close modal
Are you sure?
Yes, I'm sure
No, cancel