feat(description): тип может быть уточнён ссылкой - #406
Conversation
Запись «СтрокаТабличнойЧасти: См. Справочник.Товары.ЕдиницыИзмерения» ломала разбор: после типа с двоеточием грамматика ссылку не допускала, правило параметра не срабатывало целиком, и строка разбиралась по запасным альтернативам — имя параметра подменялось ссылкой, а сам параметр терялся. За простым типом разрешена ссылка, и она доезжает до описания отдельным свойством: голова говорит, чем значение является, ссылка — откуда взять его состав. Потребитель решает сам, как их сложить. Closes #405 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MnWpDdNSEFohPZHG6voe6y
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
WalkthroughИзменённая грамматика разбирает ссылку после простого типа. ChangesСсылка уточнения простого типа
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant BSLDescriptionParser
participant MethodDescriptionReader
participant SimpleTypeDescription
BSLDescriptionParser->>MethodDescriptionReader: разбирает simpleType и hyperlink
MethodDescriptionReader->>SimpleTypeDescription: передаёт Hyperlink в create
SimpleTypeDescription-->>MethodDescriptionReader: возвращает TypeDescription с hyperlink()
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/test/java/com/github/_1c_syntax/bsl/parser/description/reader/TypeWithReferenceTest.java (1)
49-71: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winДобавьте проверку параметров ссылки.
MethodDescriptionReaderсохраняетreferenceParamsToken, но тест не проверяет это значение. Добавьте пример со ссылкой видаСм. Справочник.Товары.ЕдиницыИзмерения(Параметр)и проверьтеreference.params().🤖 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 `@src/test/java/com/github/_1c_syntax/bsl/parser/description/reader/TypeWithReferenceTest.java` around lines 49 - 71, Расширьте тест typeRefinedByReferenceKeepsBothParts и входную строку ссылкой с параметром: «См. Справочник.Товары.ЕдиницыИзмерения(Параметр)». Сохраните проверки имени и типа, а в проверке type.reference() дополнительно проверьте reference.params() и убедитесь, что параметр ссылки сохранён как «Параметр».
🤖 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 `@src/main/antlr/BSLDescriptionParser.g4`:
- Line 148: Update the simpleType rule so the optional hyperlink reference is
allowed only when preceded by a colon; require COLON before reference=hyperlink
while preserving simple types without any reference.
---
Nitpick comments:
In
`@src/test/java/com/github/_1c_syntax/bsl/parser/description/reader/TypeWithReferenceTest.java`:
- Around line 49-71: Расширьте тест typeRefinedByReferenceKeepsBothParts и
входную строку ссылкой с параметром: «См.
Справочник.Товары.ЕдиницыИзмерения(Параметр)». Сохраните проверки имени и типа,
а в проверке type.reference() дополнительно проверьте reference.params() и
убедитесь, что параметр ссылки сохранён как «Параметр».
🪄 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 Plus
Run ID: b096afb0-ac42-45a3-9de1-46d7fa66e020
📒 Files selected for processing (5)
src/main/antlr/BSLDescriptionParser.g4src/main/java/com/github/_1c_syntax/bsl/parser/description/SimpleTypeDescription.javasrc/main/java/com/github/_1c_syntax/bsl/parser/description/TypeDescription.javasrc/main/java/com/github/_1c_syntax/bsl/parser/description/reader/MethodDescriptionReader.javasrc/test/java/com/github/_1c_syntax/bsl/parser/description/reader/TypeWithReferenceTest.java
Без разделителя запись «Тип См. Ссылка» рекомендацией не предусмотрена, а грамматика принимала её наравне с «Тип: См. Ссылка». Заодно аннотация обнуляемости приведена к той, что используется в проекте. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MnWpDdNSEFohPZHG6voe6y
Отдельного имени для уточняющей ссылки заводить незачем: это та же ссылка, что и у гиперссылочного типа, поэтому у описания типа один аксессор на оба случая. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MnWpDdNSEFohPZHG6voe6y
Параметр помечен обнуляемым, сборка ссылки вынесена из вложенного тернарника, в тесте нет ни устаревшего сборщика списка, ни утверждения, истинного на пустом списке. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MnWpDdNSEFohPZHG6voe6y
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
`@src/test/java/com/github/_1c_syntax/bsl/parser/description/reader/TypeWithHyperlinkTest.java`:
- Around line 82-85: Усилить проверку в TypeWithHyperlinkTest: явно убедиться,
что types содержит отдельный элемент с Variant.HYPERLINK, а его hyperlink() не
пуст и соответствует ожидаемому значению ссылки. Не полагаться только на
filteredOn(...).allSatisfy(...), поскольку пустой результат не проверяется.
🪄 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 Plus
Run ID: 1fde0014-bb73-4912-baa8-a755786515f6
📒 Files selected for processing (5)
src/main/antlr/BSLDescriptionParser.g4src/main/java/com/github/_1c_syntax/bsl/parser/description/SimpleTypeDescription.javasrc/main/java/com/github/_1c_syntax/bsl/parser/description/TypeDescription.javasrc/main/java/com/github/_1c_syntax/bsl/parser/description/reader/MethodDescriptionReader.javasrc/test/java/com/github/_1c_syntax/bsl/parser/description/reader/TypeWithHyperlinkTest.java
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/antlr/BSLDescriptionParser.g4
- src/main/java/com/github/_1c_syntax/bsl/parser/description/reader/MethodDescriptionReader.java
Прежняя проверка проходила и на пустом наборе — то есть и в случае, если бы ссылка потерялась вовсе. Теперь ожидается ровно один гиперссылочный тип со своей ссылкой, а простые типы остаются без неё. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MnWpDdNSEFohPZHG6voe6y
|



Closes #405
Что было
Читатель отдавал один параметр с именем
Справочник.Товары.ЕдиницыИзмерения, а параметрОбъекттерялся. Обе половины по отдельности разбирались верно — ломалось именно сочетание: за простым типом грамматика допускала двоеточие, но не ссылку, поэтому правилоparameterне срабатывало целиком и строка уходила в запасные альтернативыparameterString.Что стало
Ссылка доезжает до описания отдельным свойством —
TypeDescription.reference(), необязательное и пустое у всех прочих типов. Голова описания говорит, чем значение является (строка табличной части, а не сама часть), ссылка — откуда взять его состав; как их сложить, решает потребитель.Запись предписана методической рекомендацией «Типизация кода» для строки табличной части, с оговоркой, что 1C:EDT её пока не поддерживает.
Проверка
Новый
TypeWithReferenceTest: обе половины сохраняются, у типа без ссылкиreference()пуст. Полный прогон — 536 тестов, падений нет.🤖 Generated with Claude Code
https://claude.ai/code/session_01MnWpDdNSEFohPZHG6voe6y