Skip to content

feat: new diagnostic CurrentRowAccess - #4401

Merged
nixel2007 merged 6 commits into
1c-syntax:developfrom
pravets:feat/new-diagnostic-current-row-access
Sep 27, 2026
Merged

nixel2007 merged 6 commits into
1c-syntax:developfrom
pravets:feat/new-diagnostic-current-row-access

Conversation

@pravets

@pravets pravets commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2553. Detects .CurrentRow.DataProperty pattern causing DB reads.

Summary by CodeRabbit

  • New Features
    • Added a diagnostic for inefficient current-row data access in dynamic lists.
    • Provides localized guidance to use current data access instead, helping avoid unnecessary database reads.
    • Applies only to dynamic-list form tables and ignores unsupported contexts.
  • Documentation
    • Added English and Russian documentation with explanations, code examples, recommendations, and related references.
  • Tests
    • Added coverage for dynamic lists, tabular sections, unknown types, and expected diagnostic results.

@coderabbitai

coderabbitai Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds the CurrentRowAccess diagnostic. It detects dereferenced CurrentRow and ТекущаяСтрока properties on dynamic-list form tables, reports localized messages, tests receiver types, and documents the rule in English and Russian.

Changes

CurrentRow access diagnostic

Layer / File(s) Summary
Diagnostic detection and validation
src/main/java/.../CurrentRowAccessDiagnostic.java, src/main/java/.../types/TypeService.java, src/main/resources/.../CurrentRowAccessDiagnostic_*.properties, src/test/java/.../CurrentRowAccessDiagnosticTest.java
The visitor checks localized current-row properties, dereferencing, and dynamic-list receiver types. TypeService exposes registered extensions for receiver resolution. English and Russian messages are provided. Tests cover dynamic-list, tabular-section, and unknown receiver types.
Diagnostic documentation
docs/diagnostics/CurrentRowAccess.md, docs/en/diagnostics/CurrentRowAccess.md
The documentation describes the diagnostic scope, database-read behavior, replacement property, code examples, and reference links.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: nixel2007

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the addition of the CurrentRowAccess diagnostic.
Linked Issues check ✅ Passed The changes implement detection for dereferenced CurrentRow access on dynamic lists, recommend CurrentData, and include relevant tests and documentation for issue #2553.
Out of Scope Changes check ✅ Passed All changes support the diagnostic, including type extension resolution, localized messages, documentation, and focused tests.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0b45e3b and 011df05.

⛔ Files ignored due to path filters (1)
  • src/test/resources/diagnostics/CurrentRowAccessDiagnostic.bsl is excluded by !src/test/resources/**
📒 Files selected for processing (6)
  • docs/diagnostics/CurrentRowAccess.md
  • docs/en/diagnostics/CurrentRowAccess.md
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic.java
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic_en.properties
  • src/main/resources/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic_ru.properties
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnosticTest.java

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 011df05 and fbf9fd7.

📒 Files selected for processing (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic.java

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Check that CurrentRow has a following modifier.

Line 63 checks only the total chain length. Form.List.CurrentRow has preceding modifiers but no dereference after CurrentRow. 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 containing CurrentRow is not the final child of the enclosing complexIdentifier.
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnosticTest.java#L39-L44: add a no-diagnostic case for a qualified terminal CurrentRow access.

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

📥 Commits

Reviewing files that changed from the base of the PR and between fbf9fd7 and 097e2d1.

⛔ Files ignored due to path filters (1)
  • src/test/resources/diagnostics/CurrentRowAccessDiagnostic.bsl is excluded by !src/test/resources/**
📒 Files selected for processing (2)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CurrentRowAccessDiagnostic.java
  • src/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())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А мы тут прям на любую текущую строку тригеримся? Кажется для таблицы формы которая показывает табличную часть проверка не должна срабатывать все таки.
У нас же есть типы, ты можешь проверить что у тебя это во первых ТаблицаФормы, а во вторых что к таблице формы подключено Расширение таблицы формы для динамического списка, так можно будет тригерится точечно

pravets and others added 3 commits August 5, 2026 07:36
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
@nixel2007
nixel2007 enabled auto-merge September 26, 2026 18:03
@nixel2007
nixel2007 requested a review from sfaqer September 26, 2026 18:04

@sfaqer sfaqer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nixel2007
nixel2007 merged commit 4a39e81 into 1c-syntax:develop Sep 27, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NEW] Обращение к ТекущаяСтрока динамического списка

3 participants