260616_17_서인호#59
Conversation
코드 리뷰 피드백🎯 긍정적인 측면1. 상속(Inheritance) 구현
2. 다형성(Polymorphism) 활용
3. 메서드 설계
|
| Layer / File(s) | Summary |
|---|---|
Wizard 베이스 및 GreatWizard 서브클래스 day02-instance-class/.../Wizard.java, day02-instance-class/.../GreatWizard.java |
Wizard에 hp/mp/name/wand 필드와 검증 포함 게터/세터, heal(MP 비용 10), 빈 fireball을 추가. GreatWizard는 Wizard 상속 후 초기 MP 150, heal 오버라이드(MP 비용 5, HP +25), superHeal(MP 비용 50, HP 100 고정 세트)을 구현. |
Slime 베이스 및 PoisonSlime 서브클래스 day02-instance-class/.../Slime.java, day02-instance-class/.../PoisonSlime.java |
Slime은 suffix/hp 필드와 attack(HP −10)을 구현. PoisonSlime은 Slime 상속 후 poisonCount(초기 5) 잔여 시 super.attack 실행 후 현재 HP의 1/5 추가 독 데미지를 적용하고 카운트를 차감. |
연습문제 스켈레톤 day02-instance-class/.../연습문제_1.java |
구현 없이 연습문제 설명 주석만 포함하는 공개 클래스 스켈레톤 파일 추가. |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 2 | ❌ 3
❌ Failed checks (1 warning, 2 inconclusive)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. | |
| Title check | ❓ Inconclusive | PR 제목이 '260616_17_서인호'로 매우 모호하며, 실제 변경사항을 설명하지 않습니다. | PR 제목을 '상속과 생성자 개념을 적용한 마법사, 슬라임 클래스 구현' 같이 구체적으로 변경하여 주요 변경사항을 명확히 하세요. |
| Description check | ❓ Inconclusive | 필수 섹션이 있지만 실행 결과, 질문/어려웠던 점, 자체 평가 항목이 비어있습니다. | 실행 결과, 질문/어려웠던 점, 자체 평가 섹션을 채워 PR 설명을 완성하세요. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
Warning
There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
🔧 PMD (7.25.0)
day02-instance-class/src/main/java/com/survivalcoding/연습문제_1.java
Invalid value for option '--dir' at index 0 (): cannot convert 'day02-instance-class/src/main/java/com/survivalcoding/????????????_1.java' to interface java.nio.file.Path (java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters: day02-instance-class/src/main/java/com/survivalcoding/????????????_1.java)
Usage: pmd check [-bDh] [--no-cache] [--[no-]fail-on-error] [--[no-]
fail-on-violation] [--[no-]progress] [--show-suppressed]
[--aux-classpath=] [--cache=]
[-f=] [--force-language=]
[--minimum-priority=] [-r=]
[--suppress-marker=] [-t=]
[-P=<String=String>]... [--use-version=]...
-R=[,...]... [-R=[,
...]...]... [[-e=]
[-
... [truncated 14426 characters] ...
--file-list or --uri must be provided.
-z, --relativize-paths-with=[,
...]...
Path relative to which directories are rendered in
the report. This option allows shortening
directories in the report; without it, paths are
rendered as mentioned in the source directory
(option "--dir"). The option can be repeated, in
which case the shortest relative path will be
used. If the root path is mentioned (e.g. "/" or
"C:"), then the paths will be rendered as
absolute.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@day02-instance-class/src/main/java/com/survivalcoding/Wizard.java`:
- Around line 51-60: Add null validation for the hero parameter at the beginning
of each method to prevent NullPointerException. In
day02-instance-class/src/main/java/com/survivalcoding/Wizard.java lines 51-60,
add a null check for the hero parameter at the start of the heal method before
any logic executes. Apply the same null validation pattern to
day02-instance-class/src/main/java/com/survivalcoding/GreatWizard.java lines
9-17 in the heal method override and lines 19-27 in the superHeal method.
Additionally, add null validation in
day02-instance-class/src/main/java/com/survivalcoding/Slime.java lines 15-20 at
the start of the attack method to protect the base method that is called by
subclasses. Each null check should return early or print an appropriate error
message if the hero parameter is null.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 82d49938-db87-4a35-9e1c-004d2a0287f8
📒 Files selected for processing (5)
day02-instance-class/src/main/java/com/survivalcoding/GreatWizard.javaday02-instance-class/src/main/java/com/survivalcoding/PoisonSlime.javaday02-instance-class/src/main/java/com/survivalcoding/Slime.javaday02-instance-class/src/main/java/com/survivalcoding/Wizard.javaday02-instance-class/src/main/java/com/survivalcoding/연습문제_1.java
| public void heal(Hero hero) { | ||
| if (mp < 10) { | ||
| System.out.println("마나가 부족합니다"); | ||
| return; | ||
| } | ||
|
|
||
| hero.setHp(hero.getHp() + 20); | ||
| mp -= 10; | ||
| System.out.println("힐을 시전했습니다. 대상 HP: " + hero.getHp()); | ||
| } |
There was a problem hiding this comment.
공통 원인: 전투/치유 API의 대상 파라미터 null 경계 검증이 빠져 있습니다.
day02-instance-class/src/main/java/com/survivalcoding/Wizard.java#L51-L60:heal(Hero hero)시작 지점에 null 검증을 추가하세요.day02-instance-class/src/main/java/com/survivalcoding/GreatWizard.java#L9-L17:heal(Hero hero)에 동일한 null 검증(또는 공통 헬퍼)을 적용하세요.day02-instance-class/src/main/java/com/survivalcoding/GreatWizard.java#L19-L27:superHeal(Hero hero)에도 동일한 검증을 적용하세요.day02-instance-class/src/main/java/com/survivalcoding/Slime.java#L15-L20:attack(Hero hero)베이스 메서드에서 null 검증을 추가해 하위 클래스 호출 경로까지 보호하세요.
📍 Affects 3 files
day02-instance-class/src/main/java/com/survivalcoding/Wizard.java#L51-L60(this comment)day02-instance-class/src/main/java/com/survivalcoding/GreatWizard.java#L9-L17day02-instance-class/src/main/java/com/survivalcoding/GreatWizard.java#L19-L27day02-instance-class/src/main/java/com/survivalcoding/Slime.java#L15-L20
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@day02-instance-class/src/main/java/com/survivalcoding/Wizard.java` around
lines 51 - 60, Add null validation for the hero parameter at the beginning of
each method to prevent NullPointerException. In
day02-instance-class/src/main/java/com/survivalcoding/Wizard.java lines 51-60,
add a null check for the hero parameter at the start of the heal method before
any logic executes. Apply the same null validation pattern to
day02-instance-class/src/main/java/com/survivalcoding/GreatWizard.java lines
9-17 in the heal method override and lines 19-27 in the superHeal method.
Additionally, add null validation in
day02-instance-class/src/main/java/com/survivalcoding/Slime.java lines 15-20 at
the start of the attack method to protect the base method that is called by
subclasses. Each null check should return early or print an appropriate error
message if the hero parameter is null.
260616_17_서인호
📝 과제 정보
📋 체크리스트
📷 실행 결과 (또는 테스트 결과)
❓질문 및 어려웠던 점
🔄 자체 평가 & 회고