Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

step-03c-subagent-maintainability.md 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. ---
  2. name: 'step-03c-subagent-maintainability'
  3. description: 'Subagent: Check test maintainability (readability, structure, DRY)'
  4. subagent: true
  5. outputFile: '/tmp/tea-test-review-maintainability-{{timestamp}}.json'
  6. ---
  7. # Subagent 3C: Maintainability Quality Check
  8. ## SUBAGENT CONTEXT
  9. This is an **isolated subagent** running in parallel with other quality dimension checks.
  10. **Your task:** Analyze test files for MAINTAINABILITY violations only.
  11. ---
  12. ## MANDATORY EXECUTION RULES
  13. - ✅ Check MAINTAINABILITY only (not other quality dimensions)
  14. - ✅ Output structured JSON to temp file
  15. - ❌ Do NOT check determinism, isolation, coverage, or performance
  16. ---
  17. ## SUBAGENT TASK
  18. ### 1. Identify Maintainability Violations
  19. **HIGH SEVERITY Violations**:
  20. - Tests >100 lines (too complex)
  21. - No test.describe grouping
  22. - Duplicate test logic (copy-paste)
  23. - Unclear test names (no Given/When/Then structure)
  24. - Magic numbers/strings without constants
  25. **MEDIUM SEVERITY Violations**:
  26. - Tests missing comments for complex logic
  27. - Inconsistent naming conventions
  28. - Excessive nesting (>3 levels)
  29. - Large setup/teardown blocks
  30. **LOW SEVERITY Violations**:
  31. - Minor code style issues
  32. - Could benefit from helper functions
  33. - Inconsistent assertion styles
  34. ### 2. Calculate Maintainability Score
  35. ```javascript
  36. const severityWeights = { HIGH: 10, MEDIUM: 5, LOW: 2 };
  37. const totalPenalty = violations.reduce((sum, v) => sum + severityWeights[v.severity], 0);
  38. const score = Math.max(0, 100 - totalPenalty);
  39. ```
  40. ---
  41. ## OUTPUT FORMAT
  42. ```json
  43. {
  44. "dimension": "maintainability",
  45. "score": 75,
  46. "max_score": 100,
  47. "grade": "C",
  48. "violations": [
  49. {
  50. "file": "tests/e2e/complex-flow.spec.ts",
  51. "line": 1,
  52. "severity": "HIGH",
  53. "category": "test-too-long",
  54. "description": "Test file is 250 lines - too complex to maintain",
  55. "suggestion": "Split into multiple smaller test files by feature area",
  56. "code_snippet": "test.describe('Complex flow', () => { /* 250 lines */ });"
  57. }
  58. ],
  59. "passed_checks": 10,
  60. "failed_checks": 5,
  61. "violation_summary": {
  62. "HIGH": 2,
  63. "MEDIUM": 2,
  64. "LOW": 1
  65. },
  66. "recommendations": [
  67. "Split large test files into smaller, focused files (<100 lines each)",
  68. "Add test.describe grouping for related tests",
  69. "Extract duplicate logic into helper functions"
  70. ],
  71. "summary": "Tests have maintainability issues - 5 violations (2 HIGH)"
  72. }
  73. ```
  74. ---
  75. ## EXIT CONDITION
  76. Subagent completes when JSON output written to temp file.
  77. **Subagent terminates here.**