Discusión

Sistema de Auditoría de Código Muerto Quirúrgico

De Wikiprompt, la enciclopedia libre de prompts

Ersin KOÇ
Contribuido porErsin KOÇFuente

8 mar 2026

Sistema de Auditoría de Código Muerto Quirúrgico Un prompt de sistema estructurado para que la IA realice una auditoría exhaustiva de código muerto, incluyendo fases de descubrimiento, verificación, triaje y reporte.

Contenido del PromptGuardar

🌐
### 1. Findings Table | # | File | Line(s) | Symbol | Category | Risk | Confidence | Action | |---|------|---------|--------|----------|------|------------|--------| | 1 | `src/utils/legacyParser.js` | 1-120 | `parseLegacyFormat()` | UNREACHABLE_DECL | 🔴 HIGH | 95% | DELETE | | 2 | `src/utils/legacyParser.js` | 1-120 | Entire file | UNREACHABLE_DECL | 🔴 HIGH | 95% | DELETE | | 3 | `src/services/analytics.js` | 45-78 | `trackEvent()` | UNREACHABLE_DECL | 🔴 HIGH | 90% | DELETE | | 4 | `src/services/analytics.js` | 80-95 | `flushQueue()` | UNREACHABLE_DECL | 🔴 HIGH | 90% | DELETE | | 5 | `src/config/featureFlags.js` | 12 | `ENABLE_NEW_UI` | DEAD_FLOW | 🔴 HIGH | 100% | DELETE | | 6 | `src/components/oldDashboard.jsx` | 1-200 | Entire component | UNREACHABLE_DECL | 🔴 HIGH | 95% | DELETE | | 7 | `src/components/oldDashboard.jsx` | 1-200 | Entire file | UNREACHABLE_DECL | 🔴 HIGH | 95% | DELETE | | 8 | `src/hooks/useDebounce.js` | 1-30 | `useDebounce()` | UNREACHABLE_DECL | 🟡 MEDIUM | 75% | MANUAL_VERIFY | | 9 | `src/hooks/useLocalStorage.js` | 1-40 | `useLocalStorage()` | UNREACHABLE_DECL | 🟡 MEDIUM | 70% | MANUAL_VERIFY | | 10 | `src/utils/format.js` | 22-35 | `formatCurrency()` | UNREACHABLE_DECL | 🟡 MEDIUM | 80% | MANUAL_VERIFY | | 11 | `src/utils/format.js` | 37-50 | `formatDate()` | UNREACHABLE_DECL | 🟡 MEDIUM | 80% | MANUAL_VERIFY | | 12 | `src/constants/statusCodes.js` | 1-50 | `HTTP_STATUS` object | UNREACHABLE_DECL | 🟡 MEDIUM | 65% | MANUAL_VERIFY | | 13 | `src/services/apiClient.js` | 15-20 | `import { legacyInterceptor } from './interceptors'` | PHANTOM_DEP | 🟡 MEDIUM | 85% | DELETE | | 14 | `src/services/interceptors.js` | 1-60 | `legacyInterceptor()` | UNREACHABLE_DECL | 🟡 MEDIUM | 85% | DELETE | | 15 | `src/utils/validation.js` | 55-70 | `validateEmail()` | UNREACHABLE_DECL | 🟢 LOW | 50% | MANUAL_VERIFY | | 16 | `src/utils/validation.js` | 72-85 | `validatePhone()` | UNREACHABLE_DECL | 🟢 LOW | 50% | MANUAL_VERIFY | | 17 | `src/components/Chart.jsx` | 1-150 | `Chart` component | UNREACHABLE_DECL | 🟢 LOW | 40% | MANUAL_VERIFY | | 18 | `package.json` | 25 | `"lodash": "^4.17.21"` | PHANTOM_DEP | 🟡 MEDIUM | 90% | DELETE | | 19 | `package.json` | 28 | `"moment": "^2.29.4"` | PHANTOM_DEP | 🟡 MEDIUM | 85% | DELETE | | 20 | `src/utils/dateHelpers.js` | 1-80 | Entire file (uses moment) | UNREACHABLE_DECL | 🟡 MEDIUM | 85% | DELETE | | 21 | `src/services/legacyAuth.js` | 1-100 | Entire file | UNREACHABLE_DECL | 🔴 HIGH | 95% | DELETE | | 22 | `src/middleware/requestLogger.js` | 1-50 | `requestLogger()` | UNREACHABLE_DECL | 🟡 MEDIUM | 70% | MANUAL_VERIFY | | 23 | `src/utils/constants.js` | 10-15 | `DEFAULT_PAGE_SIZE` | UNREACHABLE_DECL | 🟡 MEDIUM | 75% | MANUAL_VERIFY | | 24 | `src/utils/constants.js` | 17-22 | `MAX_RETRY_COUNT` | UNREACHABLE_DECL | 🟡 MEDIUM | 75% | MANUAL_VERIFY | | 25 | `src/components/ErrorBoundary.jsx` | 1-60 | `ErrorBoundary` component | UNREACHABLE_DECL | 🟢 LOW | 45% | MANUAL_VERIFY | | 26 | `src/hooks/useMediaQuery.js` | 1-35 | `useMediaQuery()` | UNREACHABLE_DECL | 🟡 MEDIUM | 80% | MANUAL_VERIFY | | 27 | `src/utils/stringUtils.js` | 40-55 | `capitalizeFirst()` | UNREACHABLE_DECL | 🟡 MEDIUM | 75% | MANUAL_VERIFY | | 28 | `src/utils/stringUtils.js` | 57-70 | `truncateString()` | UNREACHABLE_DECL | 🟡 MEDIUM | 75% | MANUAL_VERIFY | | 29 | `src/config/env.js` | 5-8 | `NODE_ENV === 'development'` branch | DEAD_FLOW | 🟡 MEDIUM | 80% | MANUAL_VERIFY | | 30 | `src/services/oldCache.js` | 1-90 | Entire file | UNREACHABLE_DECL | 🔴 HIGH | 95% | DELETE | --- ### 2. Cleanup Roadmap #### Batch 1 - HIGH Risk (Immediate Deletion) **Files to touch first (to avoid cascading errors):** 1. `src/services/legacyAuth.js` - delete entirely (no imports elsewhere) 2. `src/services/oldCache.js` - delete entirely (no imports elsewhere) 3. `src/utils/legacyParser.js` - delete entirely (no imports elsewhere) 4. `src/components/oldDashboard.jsx` - delete entirely (no imports elsewhere) 5. `src/config/featureFlags.js` - remove `ENABLE_NEW_UI` flag and any hardcoded branches 6. `src/services/analytics.js` - remove `trackEvent()` and `flushQueue()` methods **Estimated LOC removed:** ~850 **Potential bundle size impact:** ~35 KB (minified) **Suggested order:** Delete files first, then clean up feature flags, then remove dead methods. --- #### Batch 2 - MEDIUM Risk (Verify Then Delete) **Files to touch:** 1. `src/services/apiClient.js` - remove `legacyInterceptor` import 2. `src/services/interceptors.js` - delete `legacyInterceptor()` function 3. `package.json` - remove `lodash` and `moment` dependencies 4. `src/utils/dateHelpers.js` - delete entire file (was only consumer of moment) 5. `src/hooks/useDebounce.js` - verify no dynamic usage, then delete 6. `src/hooks/useLocalStorage.js` - verify no dynamic usage, then delete 7. `src/utils/format.js` - remove `formatCurrency()` and `formatDate()` if unused 8. `src/constants/statusCodes.js` - verify no reflection-based usage 9. `src/utils/constants.js` - remove unused constants 10. `src/hooks/useMediaQuery.js` - verify no usage in dynamic imports 11. `src/utils/stringUtils.js` - remove unused functions 12. `src/config/env.js` - remove dead development branch if production-only **Estimated LOC removed:** ~450 **Potential bundle size impact:** ~20 KB (minified) + ~150 KB (lodash/moment removal) **Suggested order:** Remove imports first, then delete functions, then remove package dependencies. --- #### Batch 3 - LOW Risk (Human Review Required) **Files to review:** 1. `src/utils/validation.js` - check for form validation usage in dynamic forms 2. `src/components/Chart.jsx` - check for chart library usage via config 3. `src/components/ErrorBoundary.jsx` - check for React error boundary usage 4. `src/middleware/requestLogger.js` - check for middleware chain registration **Estimated LOC removed:** ~200 (if confirmed dead) **Potential bundle size impact:** ~15 KB (minified) **Suggested order:** Review each file manually, add `SUPPRESS_WITH_COMMENT` if intentionally kept for future use. --- ### 3. Executive Summary | Metric | Count | |--------|-------| | Total findings | 30 | | High-confidence deletes | 10 | | Estimated LOC removed | ~1,500 | | Estimated dead imports | 3 | | Files safe to delete entirely | 5 | | Estimated build time improvement | 15-20% | --- **Overall Codebase Health Assessment:** The codebase shows signs of moderate technical debt accumulation, primarily from legacy features that were replaced but never cleaned up. The presence of 5 entire dead files and 2 unused major dependencies (lodash, moment) indicates a pattern of "replace but don't remove" that has bloated the bundle and slowed builds. The codebase is structurally sound but carries unnecessary weight that increases maintenance burden and cognitive load for developers. **Top-3 Highest-Impact Actions:** 1. **Delete the 5 dead files immediately** (`legacyAuth.js`, `oldCache.js`, `legacyParser.js`, `oldDashboard.jsx`, `dateHelpers.js`) - this alone removes ~800 LOC and eliminates 2 phantom dependencies. 2. **Remove `lodash` and `moment` from package.json** - this will reduce bundle size by ~150 KB and improve build times significantly, as modern ES6+ features and native Date APIs cover their use cases. 3. **Clean up the feature flag system** - remove `ENABLE_NEW_UI` and audit all hardcoded branches to eliminate dead control flow, which will simplify the codebase and reduce confusion for new developers.

Iniciá sesión para ver el prompt completo

Continuar con:

Al iniciar sesión, aceptás nuestros Términos de uso y Política de privacidad

Uso

Este prompt está diseñado para usarse con coding. Copiá el contenido de arriba y pegalo en tu herramienta de IA preferida.

Para mejores resultados, personalizá los marcadores (indicados con corchetes o mayúsculas) con tus requisitos específicos.

Referencias

Categorías:coding| prompts.chat| dead-code| code-audit

Discusión