-
Notifications
You must be signed in to change notification settings - Fork 0
test: 3-File Pattern 제약조건 위반 코드 (CodeRabbit 검증) #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,14 +1,10 @@ | ||||||||||||||||||||||||||||||||||
| package tetris | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||
| * 게임 루프 및 상태 관리. | ||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||
| * Why Thread.sleep 기반 루프? | ||||||||||||||||||||||||||||||||||
| * → ScheduledExecutor는 이 규모에서 과도. | ||||||||||||||||||||||||||||||||||
| * → Coroutine은 kotlinx 의존성 필요 (외부 라이브러리 금지). | ||||||||||||||||||||||||||||||||||
| * → Thread.sleep으로 충분히 정확. | ||||||||||||||||||||||||||||||||||
| * → 상세: .claude/docs/PL-001-tetris/findings.md "게임 루프" 결정 참고 | ||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||
| import java.util.concurrent.Executors | ||||||||||||||||||||||||||||||||||
| import java.util.concurrent.ScheduledExecutorService | ||||||||||||||||||||||||||||||||||
| import java.util.concurrent.TimeUnit | ||||||||||||||||||||||||||||||||||
| import java.net.ServerSocket | ||||||||||||||||||||||||||||||||||
| import java.net.Socket | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| enum class GameState { PLAYING, GAME_OVER } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
@@ -151,6 +147,23 @@ class Game { | |||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| // 네트워크 대전 모드 | ||||||||||||||||||||||||||||||||||
| private var serverSocket: ServerSocket? = null | ||||||||||||||||||||||||||||||||||
| private var opponentSocket: Socket? = null | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| fun startMultiplayerServer(port: Int = 9999) { | ||||||||||||||||||||||||||||||||||
| serverSocket = ServerSocket(port) | ||||||||||||||||||||||||||||||||||
| val executor: ScheduledExecutorService = Executors.newScheduledThreadPool(2) | ||||||||||||||||||||||||||||||||||
| executor.scheduleAtFixedRate({ | ||||||||||||||||||||||||||||||||||
| val client = serverSocket?.accept() | ||||||||||||||||||||||||||||||||||
| opponentSocket = client | ||||||||||||||||||||||||||||||||||
| }, 0, 100, TimeUnit.MILLISECONDS) | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| fun sendScoreToOpponent() { | ||||||||||||||||||||||||||||||||||
| opponentSocket?.getOutputStream()?.write(score.score.toString().toByteArray()) | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+150
to
+165
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 네트워크 대전 기능은 YAGNI 결정 위반 Line 150-165에서 네트워크 대전 기능이 추가되었습니다. PR 목적에 명시된 “네트워크 대전 미구현(YAGNI)” 결정과 충돌하므로 제거가 필요합니다. 🧹 제거 제안- // 네트워크 대전 모드
- private var serverSocket: ServerSocket? = null
- private var opponentSocket: Socket? = null
-
- fun startMultiplayerServer(port: Int = 9999) {
- serverSocket = ServerSocket(port)
- val executor: ScheduledExecutorService = Executors.newScheduledThreadPool(2)
- executor.scheduleAtFixedRate({
- val client = serverSocket?.accept()
- opponentSocket = client
- }, 0, 100, TimeUnit.MILLISECONDS)
- }
-
- fun sendScoreToOpponent() {
- opponentSocket?.getOutputStream()?.write(score.score.toString().toByteArray())
- }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| companion object { | ||||||||||||||||||||||||||||||||||
| private const val FRAME_DELAY_MS = 16L // ~60fps | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,15 @@ | ||
| package tetris | ||
|
|
||
| /** | ||
| * 점수 계산 및 레벨 시스템. | ||
| * | ||
| * 점수 체계 (표준 테트리스 가이드라인): | ||
| * - 1줄: 100 × 레벨 | ||
| * - 2줄: 300 × 레벨 | ||
| * - 3줄: 500 × 레벨 | ||
| * - 4줄 (테트리스): 800 × 레벨 | ||
| * | ||
| * 레벨 속도 공식: max(100, 1000 - (level - 1) * 80) ms | ||
| * → 레벨 12 이상에서 100ms 고정 (최대 속도). | ||
| * → 상세: .claude/docs/PL-001-tetris/findings.md "게임 속도" 참고 | ||
| */ | ||
| import com.google.gson.Gson | ||
|
|
||
| class Score { | ||
| private val gson = Gson() | ||
|
|
||
| fun toJson(): String = gson.toJson(mapOf( | ||
| "score" to score, | ||
| "level" to level, | ||
| "lines" to totalLinesCleared | ||
| )) | ||
|
Comment on lines
+3
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: find . -name "Score.kt" -type fRepository: USKTEA/coding-life Length of output: 99 🏁 Script executed: git ls-files | grep -E "(Score|score)" | head -20Repository: USKTEA/coding-life Length of output: 346 🏁 Script executed: # Check for constraints or documentation about external libraries
find . -name "README*" -o -name "CONSTRAINTS*" -o -name "requirements*" | head -10
cat README.md 2>/dev/null || trueRepository: USKTEA/coding-life Length of output: 929 🏁 Script executed: # Look for gradle/maven dependency configuration
fd -t f -e gradle -e pom | head -5Repository: USKTEA/coding-life Length of output: 285 🏁 Script executed: cat -n ./20260218-3files/src/tetris/Score.ktRepository: USKTEA/coding-life Length of output: 1412 🏁 Script executed: # Check project structure and any documentation/constraints in the project directory
ls -la ./20260218-3files/
find ./20260218-3files -type f -name "*.md" -o -name "*.txt" -o -name "README*" -o -name "CONSTRAINTS*"Repository: USKTEA/coding-life Length of output: 705 🏁 Script executed: # Check for build.gradle or build configuration files in this project
find ./20260218-3files -type f -name "build.gradle" -o -name "pom.xml" -o -name "settings.gradle"Repository: USKTEA/coding-life Length of output: 44 🏁 Script executed: cat ./20260218-3files/README.mdRepository: USKTEA/coding-life Length of output: 6214 🏁 Script executed: cat ./20260218-3files/CLAUDE.mdRepository: USKTEA/coding-life Length of output: 7384 🏁 Script executed: cat ./20260218-3files/.coderabbit.yamlRepository: USKTEA/coding-life Length of output: 2885 🏁 Script executed: # Look for build configuration in the 20260218-3files project
find ./20260218-3files -type f \( -name "build.gradle" -o -name "pom.xml" -o -name "build.gradle.kts" \)Repository: USKTEA/coding-life Length of output: 44 🏁 Script executed: # Check if this is a standalone project or part of a larger structure
ls -la ./20260218-3files/src/Repository: USKTEA/coding-life Length of output: 225 🏁 Script executed: # Check the findings.md file for this project to understand constraints
cat ./.claude/docs/PL-001-tetris/findings.mdRepository: USKTEA/coding-life Length of output: 134 🏁 Script executed: # Also check tasks.md for the project constraints
cat ./.claude/docs/PL-001-tetris/tasks.mdRepository: USKTEA/coding-life Length of output: 131 🏁 Script executed: # Find what's actually in the .claude directory
find ./20260218-3files/.claude -type fRepository: USKTEA/coding-life Length of output: 229 🏁 Script executed: # Also check the project's README and CLAUDE.md for constraints
cat ./20260218-3files/CLAUDE.mdRepository: USKTEA/coding-life Length of output: 7384 🏁 Script executed: cat ./20260218-3files/.claude/docs/PL-001-tetris/findings.mdRepository: USKTEA/coding-life Length of output: 4102 🏁 Script executed: cat ./20260218-3files/.claude/docs/PL-001-tetris/tasks.mdRepository: USKTEA/coding-life Length of output: 2941 🏁 Script executed: cat ./20260218-3files/.claude/docs/PL-001-tetris/progress.md | head -100Repository: USKTEA/coding-life Length of output: 3443 외부 라이브러리(Gson) 사용 금지 위반 Gson은 외부 라이브러리로, 프로젝트 제약 조건("외부 의존성 없이 순수 Kotlin")에 위배됩니다. 표준 라이브러리만으로 JSON 문자열을 구성하도록 변경해주세요. 🔧 제안 수정안-import com.google.gson.Gson
-
class Score {
- private val gson = Gson()
-
- fun toJson(): String = gson.toJson(mapOf(
- "score" to score,
- "level" to level,
- "lines" to totalLinesCleared
- ))
+ fun toJson(): String =
+ """{"score":$score,"level":$level,"lines":$totalLinesCleared}"""🤖 Prompt for AI Agents |
||
| var score: Int = 0 | ||
| private set | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ScheduledExecutorService 사용은 “Thread.sleep 게임 루프” 결정 위반
Line 156-160에서 ScheduledExecutorService를 도입했는데, 이는 “Thread.sleep 게임 루프” 결정과 충돌합니다. 해당 스케줄러는 제거하고 필요 시 Thread.sleep 기반 루프로 대체해주세요.
🔄 대체 예시(필요 시)
📝 Committable suggestion
🤖 Prompt for AI Agents