| name | code-quality |
| description | Code quality inspection and linting commands for web audio apps. Includes detection of dead code, magic numbers, type safety issues, and naming inconsistencies. |
๐ Code Quality Skill
์ฝ๋ ํ์ง ๊ฒ์ฌ๋ฅผ ์ํ ๋ช
๋ น์ด ๋ฐ ์ฒดํฌ๋ฆฌ์คํธ.
๐ฏ ์ฉ๋
- ์ฌ์ฉ๋์ง ์๋ ์ฝ๋ ํ์ง
- ํ์
์์ ์ฑ ํ์ธ
- ์ฝ๋ฉ ์ปจ๋ฒค์
๊ฒ์ฆ
- ๋ฆฌํฉํ ๋ง ์ฐ์ ์์ ๊ฒฐ์
๐ ๋น ๋ฅธ ๊ฒ์ฌ ๋ช
๋ น์ด
1. ํ์
์์ ์ฑ
grep -rn ": any" --include="*.ts" --include="*.tsx" src/
npx tsc --noEmit
2. ์ฌ์ฉ๋์ง ์๋ ์ฝ๋
grep -rn "TODO\|FIXME\|XXX" --include="*.ts" --include="*.tsx" src/
npx ts-unused-exports tsconfig.json --silent
3. ์ฝ๋ฉ ์ปจ๋ฒค์
grep -rn "bg-\[#" --include="*.tsx" src/
grep -rn "text-\[#" --include="*.tsx" src/
grep -rn "border-\[#" --include="*.tsx" src/
grep -rn "[^0-9a-zA-Z][0-9]\{2,\}[^0-9]" --include="*.ts" --include="*.tsx" src/ | grep -v "//"
grep -rn "\b[a-z]\{1,2\}\b\s*=" --include="*.ts" --include="*.tsx" src/
4. ์ค๋ณต ์ฝ๋
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์ผ ์ด์
๐ ๊ด๋ จ ๋๊ตฌ
๊ถ์ฅ ์ค์น
npm install -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
npm install -g jscpd
npm install -g ts-unused-exports
npm install -g es6-plato
VS Code ํ์ฅ
- SonarLint: ์ค์๊ฐ ์ฝ๋ ํ์ง ์ฒดํฌ
- Code Metrics: ๋ณต์ก๋ ํ์
- TODO Highlight: TODO/FIXME ๊ฐ์กฐ
- Better Comments: ์ฃผ์ ๋ถ๋ฅ