code-quality
Code quality inspection and linting commands for web audio apps. Includes detection of dead code, magic numbers, type safety issues, and naming inconsistencies.
SKILL.mdskills/code-quality
GitHubπ Code Quality Skill
μ½λ νμ§ κ²μ¬λ₯Ό μν λͺ λ Ήμ΄ λ° μ²΄ν¬λ¦¬μ€νΈ.
π― μ©λ
- μ¬μ©λμ§ μλ μ½λ νμ§
- νμ μμ μ± νμΈ
- μ½λ© 컨벀μ κ²μ¦
- 리ν©ν λ§ μ°μ μμ κ²°μ
π λΉ λ₯Έ κ²μ¬ λͺ λ Ήμ΄
1. νμ μμ μ±
# any νμ
μ¬μ© νμΈ
grep -rn ": any" --include="*.ts" --include="*.tsx" src/
# νμ
μλ¬ μ²΄ν¬ (TypeScript)
npx tsc --noEmit
2. μ¬μ©λμ§ μλ μ½λ
# TODO/FIXME μ£Όμ μ°ΎκΈ°
grep -rn "TODO\|FIXME\|XXX" --include="*.ts" --include="*.tsx" src/
# μ¬μ©λμ§ μλ exports (μ€μΉ νμ)
npx ts-unused-exports tsconfig.json --silent
3. μ½λ© 컨벀μ
# νλμ½λ©λ μμ (Tailwind νλ‘μ νΈ)
grep -rn "bg-\[#" --include="*.tsx" src/
grep -rn "text-\[#" --include="*.tsx" src/
grep -rn "border-\[#" --include="*.tsx" src/
# λ§€μ§ λλ² (2μ리 μ΄μ)
grep -rn "[^0-9a-zA-Z][0-9]\{2,\}[^0-9]" --include="*.ts" --include="*.tsx" src/ | grep -v "//"
# μ§§μ λ³μλͺ
(1-2κΈμ)
grep -rn "\b[a-z]\{1,2\}\b\s*=" --include="*.ts" --include="*.tsx" src/
4. μ€λ³΅ μ½λ
# Copy-Paste Detector (μ€μΉ νμ)
npx jscpd --min-lines 5 --min-tokens 50 src/
π νμ§ μ§ν
νμΌ ν¬κΈ° λΆμ
# ν° νμΌ μμΌλ‘ μ λ ¬
find src -name "*.tsx" -o -name "*.ts" | xargs wc -l | sort -rn | head -20
κΆμ₯ κΈ°μ€
| μ§ν | μνΈ | μ£Όμ | μν |
|---|---|---|---|
| νμΌ λΌμΈ μ | < 200 | 200-500 | > 500 |
| ν¨μ νλΌλ―Έν° | < 3 | 3-5 | > 5 |
| useEffect κ°μ | < 3 | 3-5 | > 5 |
| μ€μ²© κΉμ΄ | < 3 | 3-4 | > 4 |
π οΈ μλν μ€ν¬λ¦½νΈ
quick-check.sh
#!/bin/bash
# λΉ λ₯Έ μ½λ νμ§ μ²΄ν¬
echo "=== Code Quality Check ==="
echo -e "\nπ TODO/FIXME count:"
grep -rn "TODO\|FIXME" --include="*.ts" --include="*.tsx" src/ | wc -l
echo -e "\nπ any type usage:"
grep -rn ": any" --include="*.ts" --include="*.tsx" src/ | wc -l
echo -e "\nπ Hardcoded colors:"
grep -rn "bg-\[#\|text-\[#" --include="*.tsx" src/ | wc -l
echo -e "\nπ Large files (>300 lines):"
find src -name "*.tsx" -o -name "*.ts" | xargs wc -l | sort -rn | awk '$1 > 300 {print}'
echo -e "\nπ Type check:"
npx tsc --noEmit 2>&1 | tail -5
echo -e "\n=== Done ==="
π 리ν©ν λ§ μ°μ μμ κ³μ°
μ μ 곡μ
μ°μ μμ = (μν₯λ Γ 5) + (λΉλ Γ 3) + (λμ΄λ Γ -2)
μν₯λ (1-5)
- μ½λ μ€νμΌλ§ μν₯
- νΉμ νμΌλ§ μν₯
- λͺ¨λ μ 체 μν₯
- μ¬λ¬ λͺ¨λ μν₯
- μμ€ν μ 체 μν₯
λΉλ (1-5)
- 1λ²λ§ λ°μ
- 2-3κ³³
- 4-10κ³³
- 10-50κ³³
- 50κ³³ μ΄μ
λμ΄λ (1-5)
- 5λΆ μ΄λ΄
- 30λΆ μ΄λ΄
- 2μκ° μ΄λ΄
- 1μΌ μ΄λ΄
- 1μΌ μ΄μ
π κ΄λ ¨ λꡬ
κΆμ₯ μ€μΉ
# ESLint + TypeScript
npm install -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
# μ€λ³΅ μ½λ νμ§
npm install -g jscpd
# μ¬μ©λμ§ μλ exports
npm install -g ts-unused-exports
# 볡μ‘λ λΆμ
npm install -g es6-plato
VS Code νμ₯
- SonarLint: μ€μκ° μ½λ νμ§ μ²΄ν¬
- Code Metrics: 볡μ‘λ νμ
- TODO Highlight: TODO/FIXME κ°μ‘°
- Better Comments: μ£Όμ λΆλ₯