-
Notifications
You must be signed in to change notification settings - Fork 25
проверка родителя на null #543
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
Conversation
WalkthroughA null-safety check was strengthened in the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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 |
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/com/github/_1c_syntax/bsl/mdclasses/MDClasses.java (1)
277-277: Consider similar null-safety check for consistency.Line 277 calls
path.getParent().getFileName().toString()without checking ifgetFileName()returns null. While this is unlikely to be an issue in practice (source files are rarely directly under the filesystem root), for complete null-safety and consistency with the fix on line 279, you might consider adding a similar check here.If you decide to add this check, the code could be:
- var parentName = path.getParent().getFileName().toString(); + var parent = path.getParent(); + if (parent == null || parent.getFileName() == null) { + return false; + } + var parentName = parent.getFileName().toString();
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/com/github/_1c_syntax/bsl/mdclasses/MDClasses.java(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: theshadowco
Repo: 1c-syntax/mdclasses PR: 524
File: src/main/java/com/github/_1c_syntax/bsl/mdo/support/UsePurposes.java:61-69
Timestamp: 2025-10-06T14:38:27.354Z
Learning: В проекте mdclasses используются JSR-305 аннотации (ParametersAreNonnullByDefault) на уровне пакетов для обеспечения null-safety через статический анализ, что является приемлемым подходом вместо явных runtime проверок.
📚 Learning: 2025-10-06T14:38:27.354Z
Learnt from: theshadowco
Repo: 1c-syntax/mdclasses PR: 524
File: src/main/java/com/github/_1c_syntax/bsl/mdo/support/UsePurposes.java:61-69
Timestamp: 2025-10-06T14:38:27.354Z
Learning: В проекте mdclasses используются JSR-305 аннотации (ParametersAreNonnullByDefault) на уровне пакетов для обеспечения null-safety через статический анализ, что является приемлемым подходом вместо явных runtime проверок.
Applied to files:
src/main/java/com/github/_1c_syntax/bsl/mdclasses/MDClasses.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
- GitHub Check: build (21, ubuntu-latest)
- GitHub Check: build (23, ubuntu-latest)
- GitHub Check: build (17, windows-latest)
- GitHub Check: build (17, macOS-latest)
- GitHub Check: build (21, windows-latest)
- GitHub Check: QA
- GitHub Check: build (17, ubuntu-latest)
- GitHub Check: build (17, macOS-latest)
- GitHub Check: build (23, macOS-latest)
- GitHub Check: build (21, ubuntu-latest)
- GitHub Check: build (23, windows-latest)
- GitHub Check: build (17, ubuntu-latest)
- GitHub Check: build (21, macOS-latest)
- GitHub Check: build (23, ubuntu-latest)
- GitHub Check: build (21, windows-latest)
- GitHub Check: build (17, windows-latest)
🔇 Additional comments (1)
src/main/java/com/github/_1c_syntax/bsl/mdclasses/MDClasses.java (1)
279-281: LGTM! Proper null-safety check added.The additional null check for
getFileName()correctly prevents potential NPE when the grandparent is a root path. This is a valid defensive programming improvement. Based on learnings.However, please ensure this change is covered by tests, as the PR checklist indicates test coverage is incomplete. Consider adding a test case that exercises this code path with a directory structure where the parent is close to the root.
|



Описание
Корректирована проверка родительского каталога
Связанные задачи
Closes
Чеклист
Общие
gradlew precommit)Дополнительно
Summary by CodeRabbit