Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 9, 2025

The TransferringParametersBetweenClientAndServer diagnostic flags all server method parameters passed by reference from client methods, even when intentionally used for caching values in client module variables. This creates false positives for common patterns like КэшированныеЗначения in 1C configurations.

Changes

Diagnostic Enhancement

  • Added cachedValueNames configuration parameter accepting comma-separated parameter names
  • Parameters matching configured names are ignored if a module-level variable with &НаКлиенте directive exists
  • Case-insensitive matching to align with BSL language semantics

Implementation

  • Traverses AST to locate module variables with compiler directives (RULE_moduleVar)
  • Validates presence of AT_CLIENT compiler directive on matching variables
  • Maintains existing diagnostic behavior when conditions not met

Documentation & Tests

  • Bilingual parameter documentation with usage examples
  • Test coverage for variable presence, absence, and incorrect directive scenarios

Example

Configuration:

{
  "TransferringParametersBetweenClientAndServer": {
    "cachedValueNames": "КэшированныеЗначения,КэшДанных"
  }
}

Code with module variable:

&НаКлиенте
Перем КэшированныеЗначения; // механизм кэширования

&НаКлиенте
Процедура ПриИзмененииРеквизита()
    ОбновитьКэш(КэшированныеЗначения);
КонецПроцедуры

&НаСервере
Процедура ОбновитьКэш(КэшированныеЗначения)  // No diagnostic
    КэшированныеЗначения = ПолучитьДанныеНаСервере();
КонецПроцедуры

Without the module variable declaration, the diagnostic fires normally.

Original prompt

This section details on the original issue you should resolve

<issue_title>[MOD] Кэшируемые значения на клиенте.</issue_title>
<issue_description>## Диагностика
TransferringParametersBetweenClientAndServer

Описание предлагаемых изменений

Предлагаю в диагностику добавить возможность указывать список имен параметров методов, которые можно игнорировать, например КэшированныеЗначения. Дополнительно надо проверять, что в модуле формы есть соответствующая переменная.

&НаКлиенте
Перем КэшированныеЗначения; // используется механизмом обработки изменения реквизитов ТЧ

Если переменная отсутствует, то диагностировать ошибку, по текущему алгоритму диагностики.

Результат

Снизится количество срабатываний диагностики на тех методах, где действительно надо получать данные переменной с сервера на клиент. Не надо будет экранировать методы с общепринятыми переменными, такой как КэшированныеЗначения (используется в типовых конфигурациях).

Сейчас, чтобы не экранировать такой метод, необходимо его размещать в клиент-серверном общем модуле, с дальнейшим вызовом серверного общего модуля.

Дополнительная информация

Image

Comments on the Issue (you are @copilot in this section)

@nixel2007 Интересное предложение, спасибо! @nixel2007 @copilot попробуй реализовать. Для поиска переменной текущего модуля используй symbolTree

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 9, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

@nixel2007 nixel2007 marked this pull request as ready for review November 9, 2025 05:19
@nixel2007 nixel2007 marked this pull request as draft November 9, 2025 05:19
Copilot AI and others added 2 commits November 9, 2025 05:34
…ntAndServer diagnostic

Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Copilot AI changed the title [WIP] Add parameter ignoring for client-side caching Add cachedValueNames parameter to TransferringParametersBetweenClientAndServer diagnostic Nov 9, 2025
Copilot AI requested a review from nixel2007 November 9, 2025 05:45
Copilot finished work on behalf of nixel2007 November 9, 2025 05:45
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.

[MOD] Кэшируемые значения на клиенте.

2 participants