Repository navigation
feat: new diagnostic CurrentRowAccess - #4401
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds the ChangesCurrentRow access diagnostic
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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.
Actionable comments posted: 3
🤖 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/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic.java`:
- Around line 10-12: Add Javadoc to the public CurrentRowAccessDiagnostic class
and its visitAccessProperty method, documenting the analyzed input, returned
parse tree, diagnostic-storage side effect, parameters, and result. Describe
relevant invariants without documenting caller order.
- Line 1: Add the repository-standard license header at the beginning of
CurrentRowAccessDiagnostic.java, before the package declaration, matching the
format used by other production Java files so Spotless validation passes.
In
`@src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnosticTest.java`:
- Around line 36-42: Expand CurrentRowAccessDiagnosticTest with separate cases
covering bare CurrentRow, CurrentRow.Call(), and CurrentData. Assert that bare
CurrentRow and CurrentData produce no diagnostics, while preserving the existing
member-access diagnostic assertions and verifying the expected behavior for
CurrentRow.Call().
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 1d4d2cc6-51d8-430a-9c8a-eec29672b00f
⛔ Files ignored due to path filters (1)
src/test/resources/diagnostics/CurrentRowAccessDiagnostic.bslis excluded by!src/test/resources/**
📒 Files selected for processing (6)
docs/diagnostics/CurrentRowAccess.mddocs/en/diagnostics/CurrentRowAccess.mdsrc/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic.javasrc/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic_en.propertiessrc/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic_ru.propertiessrc/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnosticTest.java
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/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic.java`:
- Around line 8-10: Update the class-level documentation in
CurrentRowAccessDiagnostic to qualify the database-read statement: indicate that
.ТекущаяСтрока.Реквизит can trigger a database read specifically when the
dynamic list contains object-backed data, while preserving the recommended
.ТекущиеДанные.Реквизит access.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7563c0d4-345c-41df-8306-0d95289823d6
📒 Files selected for processing (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic.java
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic.java (1)
62-65: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winCheck that
CurrentRowhas a following modifier.Line 63 checks only the total chain length.
Form.List.CurrentRowhas preceding modifiers but no dereference afterCurrentRow. It can satisfy this condition and produce a false diagnostic.
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic.java#L62-L65: verify that the modifier containingCurrentRowis not the final child of the enclosingcomplexIdentifier.src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnosticTest.java#L39-L44: add a no-diagnostic case for a qualified terminalCurrentRowaccess.As per coding guidelines: “Write comprehensive unit tests for each diagnostic including test cases for edge cases.”
🤖 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/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic.java` around lines 62 - 65, Update CurrentRowAccessDiagnostic to verify that the modifier containing CurrentRow is not the final child of the enclosing complexIdentifier, rather than relying only on total chain length. In CurrentRowAccessDiagnosticTest, add coverage for a qualified terminal CurrentRow access such as Form.List.CurrentRow that produces no diagnostic.Source: Coding guidelines
🤖 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.
Outside diff comments:
In
`@src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic.java`:
- Around line 62-65: Update CurrentRowAccessDiagnostic to verify that the
modifier containing CurrentRow is not the final child of the enclosing
complexIdentifier, rather than relying only on total chain length. In
CurrentRowAccessDiagnosticTest, add coverage for a qualified terminal CurrentRow
access such as Form.List.CurrentRow that produces no diagnostic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2a3ac221-3234-4996-979e-137b4104bdd1
⛔ Files ignored due to path filters (1)
src/test/resources/diagnostics/CurrentRowAccessDiagnostic.bslis excluded by!src/test/resources/**
📒 Files selected for processing (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic.javasrc/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnosticTest.java
| @Override public ParseTree visitAccessProperty(AccessPropertyContext ctx) { | ||
| var id = ctx.IDENTIFIER(); | ||
| if (id == null) return ctx; | ||
| if (!"ТекущаяСтрока".equalsIgnoreCase(id.getText()) |
There was a problem hiding this comment.
А мы тут прям на любую текущую строку тригеримся? Кажется для таблицы формы которая показывает табличную часть проверка не должна срабатывать все таки.
У нас же есть типы, ты можешь проверить что у тебя это во первых ТаблицаФормы, а во вторых что к таблице формы подключено Расширение таблицы формы для динамического списка, так можно будет тригерится точечно
Per maintainer review: ТекущаяСтрока exists on any form table, but only tables over a dynamic list trigger DB reads. Resolve receiver type via TypeService.receiverTypesAt and fire only when it is ТаблицаФормы.ДинамическийСписок. Tables over tabular sections, value trees etc. are ignored. Tests mock TypeService with different receiver types.
…ceivers The receiver of X.ТекущаяСтрока is typed either as ТаблицаФормы.ДинамическийСписок (unknown row columns) or as a per-form type ТаблицаФормы.<mdoRef>.<item name> that inherits the data kind through a type extension. qualifiedName contains check missed the per-form type, so the diagnostic silently stopped firing on real forms. - TypeService: expose extensionsOf(TypeRef) as facade over TypeRegistry - CurrentRowAccessDiagnostic: fire when the receiver type equals ТаблицаФормы.ДинамическийСписок or one of its extensions does - dereference check: X.ТекущаяСтрока lives in complexIdentifier (expression) or callStatement (X.ТекущаяСтрока.Записать()); require children after the .ТекущаяСтрока modifier instead of instanceof ComplexIdentifierContext - tests: per-form dynamic list fires, per-form tabular section does not, bare .ТекущаяСтрока without dereference stays silent
Closes #2553. Detects .CurrentRow.DataProperty pattern causing DB reads.
Summary by CodeRabbit