-
Notifications
You must be signed in to change notification settings - Fork 122
Features/bcs metaborders #3830
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
Features/bcs metaborders #3830
Changes from all commits
46b8e09
a737662
1694759
f2472b7
efd1512
74ba1c4
d23c1d5
a97bbda
5b001cb
fc622d9
ec9a423
dbbb344
6c4403d
9fbbed8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # Границы метаданных (MetadataBorders) | ||
|
|
||
| | Тип | Поддерживаются<br>языки | Важность | Включена<br>по умолчанию | Время на<br>исправление (мин) | Теги | | ||
| |:-------------:|:-----------------------------:|:----------------:|:------------------------------:|:-----------------------------------:|:--------:| | ||
| | `Дефект кода` | `BSL`<br>`OS` | `Информационный` | `Нет` | `1` | `design` | | ||
|
|
||
| ## Параметры | ||
|
|
||
|
|
||
| | Имя | Тип | Описание | Значение<br>по умолчанию | | ||
| |:---------------------------:|:--------:|:---------------------------------------------------------------------------------------:|:------------------------------:| | ||
| | `metadataBordersParameters` | `Строка` | `{"регулярное выражение для операторов":"регулярное выражение для имени файла модуля"}` | `` | | ||
| <!-- Блоки выше заполняются автоматически, не трогать --> | ||
| ## Описание диагностики | ||
| Диагностика обращения к метаданным за пределами разрешенных границ. Нужна, если в компании установлены, | ||
| например, правила обращения к каким-то метаданным только из определенного общего модуля. | ||
|
|
||
| ## Примеры | ||
| Получение контактной информации по внутренним правилам должно происходить только через функции | ||
| общего модуля РаботаСКонтактами. Тогда заданные настройки вида | ||
|
|
||
| ```json | ||
| {"Регистры?Сведений.КонтактнаяИнформация":"CommonModules/РаботаСКонтактами"} | ||
| ``` | ||
|
|
||
| вызовут срабатывание диагностики на запросе с текстом | ||
|
|
||
| ``` | ||
| "ВЫБРАТЬ | ||
| ... | ||
| ИЗ | ||
| РегистрСведений.КонтактнаяИнформация КАК КИ" | ||
| ``` | ||
|
|
||
| если этот запрос будет НЕ в общем модуле РаботаСКонтактами. | ||
| Так же эта диагностика с такой настройкой сработает и на оператор | ||
|
|
||
| ```НаборЗаписей = РегистрыСведений.КонтактнаяИнформация.СоздатьНаборЗаписей();``` | ||
|
|
||
| В настройках обе части - это регулярные выражения java. | ||
| Вторая часть настройки сравнивается с путем к файлу выгрузки конфигурации. | ||
|
|
||
| Можно запретить использование нескольких метаданных: | ||
|
|
||
| ```json | ||
| {"Регистры?Сведений.КонтактнаяИнформация|Справочники?.Контакты":"CommonModules/РаботаСКонтактами"} | ||
| ``` | ||
|
|
||
| Настройки задаются в виде json-строки: | ||
| ```json | ||
| { | ||
| "Регистры?Сведений.КонтактнаяИнформация":"CommonModules/РаботаСКонтактами", | ||
| "Справочники?.СтрокиСоединения":"DataProcessors/ВнешниеСоединения|CommonModules/ПодключениеК.*" | ||
| } | ||
| ``` | ||
|
|
||
| ## Источники | ||
|
|
||
| ## Сниппеты | ||
|
|
||
| <!-- Блоки ниже заполняются автоматически, не трогать --> | ||
| ### Экранирование кода | ||
|
|
||
| ```bsl | ||
| // BSLLS:MetadataBorders-off | ||
| // BSLLS:MetadataBorders-on | ||
| ``` | ||
|
|
||
| ### Параметр конфигурационного файла | ||
|
|
||
| ```json | ||
| "MetadataBorders": { | ||
| "metadataBordersParameters": "" | ||
| } | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| # Metadata borders (MetadataBorders) | ||
|
|
||
| | Type | Scope | Severity | Activated<br>by default | Minutes<br>to fix | Tags | | ||
| |:------------:|:-------------------:|:--------:|:-----------------------------:|:-----------------------:|:--------:| | ||
| | `Code smell` | `BSL`<br>`OS` | `Info` | `No` | `1` | `design` | | ||
|
|
||
| ## Parameters | ||
|
|
||
|
|
||
| | Name | Type | Description | Default value | | ||
| |:---------------------------:|:--------:|:---------------------------------------------------:|:-------------:| | ||
| | `metadataBordersParameters` | `String` | `{"regex for statements":"regex for module names"}` | `` | | ||
| <!-- Блоки выше заполняются автоматически, не трогать --> | ||
| ## Description | ||
| <!-- Описание диагностики заполняется вручную. Необходимо понятным языком описать смысл и схему работу --> | ||
|
|
||
| ## Examples | ||
| <!-- В данном разделе приводятся примеры, на которые диагностика срабатывает, а также можно привести пример, как можно исправить ситуацию --> | ||
|
|
||
|
Comment on lines
+14
to
+19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fill in the English Description/Examples sections (currently placeholders). These sections must be real content (including a problematic snippet and fix) to match the RU doc and project guidelines. 🤖 Prompt for AI Agents |
||
| ## Sources | ||
| <!-- Необходимо указывать ссылки на все источники, из которых почерпнута информация для создания диагностики --> | ||
| <!-- Примеры источников | ||
| * Источник: [Стандарт: Тексты модулей](https://its.1c.ru/db/v8std#content:456:hdoc) | ||
| * Полезная информация: [Отказ от использования модальных окон](https://its.1c.ru/db/metod8dev#content:5272:hdoc) | ||
| * Источник: [Cognitive complexity, ver. 1.4](https://www.sonarsource.com/docs/CognitiveComplexity.pdf) --> | ||
|
|
||
| ## Snippets | ||
|
|
||
| <!-- Блоки ниже заполняются автоматически, не трогать --> | ||
| ### Diagnostic ignorance in code | ||
|
|
||
| ```bsl | ||
| // BSLLS:MetadataBorders-off | ||
| // BSLLS:MetadataBorders-on | ||
| ``` | ||
|
|
||
| ### Parameter for config | ||
|
|
||
| ```json | ||
| "MetadataBorders": { | ||
| "metadataBordersParameters": "" | ||
| } | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,109 @@ | ||||||||||||||||||||||||
| /* | ||||||||||||||||||||||||
| * This file is a part of BSL Language Server. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * Copyright (c) 2018-2021 | ||||||||||||||||||||||||
| * Alexey Sosnoviy <labotamy@gmail.com>, Nikita Gryzlov <nixel2007@gmail.com> and contributors | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * SPDX-License-Identifier: LGPL-3.0-or-later | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * BSL Language Server is free software; you can redistribute it and/or | ||||||||||||||||||||||||
| * modify it under the terms of the GNU Lesser General Public | ||||||||||||||||||||||||
| * License as published by the Free Software Foundation; either | ||||||||||||||||||||||||
| * version 3.0 of the License, or (at your option) any later version. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * BSL Language Server is distributed in the hope that it will be useful, | ||||||||||||||||||||||||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||||||||||||||||
| * Lesser General Public License for more details. | ||||||||||||||||||||||||
| * | ||||||||||||||||||||||||
| * You should have received a copy of the GNU Lesser General Public | ||||||||||||||||||||||||
| * License along with BSL Language Server. | ||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||
| package com.github._1c_syntax.bsl.languageserver.diagnostics; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| import com.fasterxml.jackson.core.JsonProcessingException; | ||||||||||||||||||||||||
| import com.fasterxml.jackson.databind.ObjectMapper; | ||||||||||||||||||||||||
| import com.fasterxml.jackson.databind.type.MapType; | ||||||||||||||||||||||||
| import com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticMetadata; | ||||||||||||||||||||||||
| import com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticParameter; | ||||||||||||||||||||||||
| import com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticSeverity; | ||||||||||||||||||||||||
| import com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticTag; | ||||||||||||||||||||||||
| import com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticType; | ||||||||||||||||||||||||
| import com.github._1c_syntax.bsl.parser.BSLParser; | ||||||||||||||||||||||||
| import com.github._1c_syntax.utils.CaseInsensitivePattern; | ||||||||||||||||||||||||
| import org.antlr.v4.runtime.tree.ParseTree; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| import java.util.Collections; | ||||||||||||||||||||||||
| import java.util.HashMap; | ||||||||||||||||||||||||
| import java.util.List; | ||||||||||||||||||||||||
| import java.util.Map; | ||||||||||||||||||||||||
| import java.util.regex.Matcher; | ||||||||||||||||||||||||
| import java.util.regex.Pattern; | ||||||||||||||||||||||||
| import java.util.stream.Collectors; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @DiagnosticMetadata( | ||||||||||||||||||||||||
| type = DiagnosticType.CODE_SMELL, | ||||||||||||||||||||||||
| severity = DiagnosticSeverity.INFO, | ||||||||||||||||||||||||
| minutesToFix = 1, | ||||||||||||||||||||||||
| activatedByDefault = false, | ||||||||||||||||||||||||
| tags = { | ||||||||||||||||||||||||
| DiagnosticTag.DESIGN | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| public class MetadataBordersDiagnostic extends AbstractVisitorDiagnostic { | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Comment on lines
+44
to
+55
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add class-level JavaDoc for the public diagnostic. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| private static final String METADATA_BORDERS_DEFAULT = ""; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @DiagnosticParameter( | ||||||||||||||||||||||||
| type = String.class, | ||||||||||||||||||||||||
| defaultValue = "" | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
| private Map<Pattern, Pattern> metadataBordersParameters = mapFromJSON(METADATA_BORDERS_DEFAULT); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| private List<Pattern> statementPatterns = Collections.emptyList(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| private static Map<Pattern, Pattern> mapFromJSON(String userSettings) { | ||||||||||||||||||||||||
| ObjectMapper mapper = new ObjectMapper(); | ||||||||||||||||||||||||
| MapType mapType = mapper.getTypeFactory().constructMapType(HashMap.class, String.class, String.class); | ||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||
| Map<String, String> stringMap = mapper.readValue(userSettings, mapType); | ||||||||||||||||||||||||
| return stringMap.entrySet().stream() | ||||||||||||||||||||||||
| .filter(entry -> !entry.getKey().isBlank() && !entry.getValue().isBlank()) | ||||||||||||||||||||||||
| .collect(Collectors.toMap( | ||||||||||||||||||||||||
| entry -> CaseInsensitivePattern.compile(entry.getKey()), | ||||||||||||||||||||||||
| entry -> CaseInsensitivePattern.compile(entry.getValue()))); | ||||||||||||||||||||||||
| } catch (JsonProcessingException e) { | ||||||||||||||||||||||||
|
Comment on lines
+66
to
+76
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify how other diagnostics handle invalid regex patterns and whether PatternSyntaxException
# is already handled centrally.
rg -n "CaseInsensitivePattern\.compile|Pattern\.compile" src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics
rg -n "PatternSyntaxException" src/main/java/com/github/_1c_syntax/bsl/languageserverRepository: 1c-syntax/bsl-language-server Length of output: 28434 🏁 Script executed: # Find and examine the CaseInsensitivePattern class to understand its compile method
fd -t f "CaseInsensitivePattern.java" src/Repository: 1c-syntax/bsl-language-server Length of output: 55 🏁 Script executed: # Examine the MetadataBordersDiagnostic.java file to understand the full context
cat -n src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MetadataBordersDiagnostic.java | head -100Repository: 1c-syntax/bsl-language-server Length of output: 4685 🏁 Script executed: fd -t f "CaseInsensitivePattern.java" src/Repository: 1c-syntax/bsl-language-server Length of output: 55 🏁 Script executed: # Also check if there are any tests for mapFromJSON or exception handling
fd -t f "MetadataBordersDiagnosticTest.java" .Repository: 1c-syntax/bsl-language-server Length of output: 176 🏁 Script executed: # Find CaseInsensitivePattern - it might be in a different location
rg -l "class CaseInsensitivePattern" src/Repository: 1c-syntax/bsl-language-server Length of output: 55 🏁 Script executed: # Examine the test file to see how mapFromJSON is tested
cat -n src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MetadataBordersDiagnosticTest.javaRepository: 1c-syntax/bsl-language-server Length of output: 3697 🏁 Script executed: # Search more broadly for CaseInsensitivePattern
rg "class CaseInsensitivePattern|new CaseInsensitivePattern" --max-count 5Repository: 1c-syntax/bsl-language-server Length of output: 55 🏁 Script executed: # Check if CaseInsensitivePattern is imported from an external library
rg "import.*CaseInsensitivePattern" src/Repository: 1c-syntax/bsl-language-server Length of output: 14028 🏁 Script executed: # Let's also check if Pattern.compile is ever wrapped or if PatternSyntaxException is ever caught
rg "catch.*PatternSyntaxException" src/Repository: 1c-syntax/bsl-language-server Length of output: 198 🏁 Script executed: # Check the broader context of error handling in diagnostics with user-supplied patterns
rg -A5 "\.compile\(" src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ | grep -A5 "catch"Repository: 1c-syntax/bsl-language-server Length of output: 655 🏁 Script executed: # Check SymbolProvider.java to see how it handles PatternSyntaxException
sed -n '70,85p' src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SymbolProvider.javaRepository: 1c-syntax/bsl-language-server Length of output: 713 🏁 Script executed: # Check if there are any other diagnostics that accept user configuration for patterns
rg "@DiagnosticParameter.*String" src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ -A5 | grep -B5 "\.compile"Repository: 1c-syntax/bsl-language-server Length of output: 416 🏁 Script executed: # Check ReservedParameterNamesDiagnostic to see if it handles PatternSyntaxException
sed -n '45,70p' src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.javaRepository: 1c-syntax/bsl-language-server Length of output: 771 🏁 Script executed: # Check BadWordsDiagnostic which also compiles user-supplied patterns
sed -n '50,75p' src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/BadWordsDiagnostic.javaRepository: 1c-syntax/bsl-language-server Length of output: 879 🏁 Script executed: # Look for other DiagnosticParameter with String type that compile patterns
rg "@DiagnosticParameter" src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ -A3 | grep -B3 -A3 "String.class"Repository: 1c-syntax/bsl-language-server Length of output: 17642 Add exception handling for invalid regex patterns in user-supplied The 🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| return Collections.emptyMap(); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||
| public void configure(Map<String, Object> configuration) { | ||||||||||||||||||||||||
| metadataBordersParameters = mapFromJSON( | ||||||||||||||||||||||||
| (String) configuration.getOrDefault("metadataBordersParameters", METADATA_BORDERS_DEFAULT)); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||
| public ParseTree visitFile(BSLParser.FileContext ctx) { | ||||||||||||||||||||||||
| statementPatterns = metadataBordersParameters.entrySet().stream() | ||||||||||||||||||||||||
| .filter(entry -> ! entry.getValue().matcher(documentContext.getUri().getPath()).find()) | ||||||||||||||||||||||||
| .map(Map.Entry::getKey) | ||||||||||||||||||||||||
| .collect(Collectors.toList()); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| return super.visitFile(ctx); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||
| public ParseTree visitStatement(BSLParser.StatementContext ctx){ | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| statementPatterns.forEach(pattern -> { | ||||||||||||||||||||||||
| Matcher matcher = pattern.matcher(ctx.getText()); | ||||||||||||||||||||||||
| while (matcher.find()) { | ||||||||||||||||||||||||
| diagnosticStorage.addDiagnostic(ctx); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
Comment on lines
+100
to
+104
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid duplicate diagnostics per statement. The loop adds a diagnostic for every regex hit in the same statement, which can produce duplicates. Consider short‑circuiting after the first match. ✅ Suggested fix- statementPatterns.forEach(pattern -> {
- Matcher matcher = pattern.matcher(ctx.getText());
- while (matcher.find()) {
- diagnosticStorage.addDiagnostic(ctx);
- }
- });
+ for (Pattern pattern : statementPatterns) {
+ if (pattern.matcher(ctx.getText()).find()) {
+ diagnosticStorage.addDiagnostic(ctx);
+ break;
+ }
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| return super.visitStatement(ctx); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| diagnosticMessage=Use metadata outside the borders | ||
| diagnosticName=Metadata borders | ||
| metadataBordersParameters={"regex for statements":"regex for module names"} | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| diagnosticMessage=Обращение к метаданным за пределами разрешенных границ | ||
| diagnosticName=Границы метаданных | ||
| metadataBordersParameters={"регулярное выражение для операторов":"регулярное выражение для имени файла модуля"} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* | ||
| * This file is a part of BSL Language Server. | ||
| * | ||
| * Copyright (c) 2018-2021 | ||
| * Alexey Sosnoviy <labotamy@gmail.com>, Nikita Gryzlov <nixel2007@gmail.com> and contributors | ||
| * | ||
| * SPDX-License-Identifier: LGPL-3.0-or-later | ||
| * | ||
| * BSL Language Server is free software; you can redistribute it and/or | ||
| * modify it under the terms of the GNU Lesser General Public | ||
| * License as published by the Free Software Foundation; either | ||
| * version 3.0 of the License, or (at your option) any later version. | ||
| * | ||
| * BSL Language Server is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with BSL Language Server. | ||
| */ | ||
| package com.github._1c_syntax.bsl.languageserver.diagnostics; | ||
|
|
||
| import org.eclipse.lsp4j.Diagnostic; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| import static com.github._1c_syntax.bsl.languageserver.util.Assertions.assertThat; | ||
|
|
||
| class MetadataBordersDiagnosticTest extends AbstractDiagnosticTest<MetadataBordersDiagnostic> { | ||
| MetadataBordersDiagnosticTest() { | ||
| super(MetadataBordersDiagnostic.class); | ||
| } | ||
|
|
||
| @Test | ||
| void testWithoutSettings() { | ||
| List<Diagnostic> diagnostics = getDiagnostics(); | ||
| assertThat(diagnostics).hasSize(0); | ||
| } | ||
|
|
||
| @Test | ||
| void testMatchesInProperModule() { | ||
|
|
||
| Map<String, Object> configuration = diagnosticInstance.info.getDefaultConfiguration(); | ||
| configuration.put("metadataBordersParameters", | ||
| "{\"Регистры?Сведений.КонтактнаяИнформация|Справочники?.Контакты\":\"fake-uri\"}"); | ||
| diagnosticInstance.configure(configuration); | ||
| List<Diagnostic> diagnostics = getDiagnostics(); | ||
|
|
||
| assertThat(diagnostics).hasSize(0); | ||
| } | ||
|
|
||
| @Test | ||
| void testMatchesInWrongModule() { | ||
|
|
||
| Map<String, Object> configuration = diagnosticInstance.info.getDefaultConfiguration(); | ||
| configuration.put("metadataBordersParameters", | ||
| "{\"Регистры?Сведений.КонтактнаяИнформация|Справочники?.Контакты\":\"MetadataBordersDiagnostic\"}"); | ||
| diagnosticInstance.configure(configuration); | ||
| List<Diagnostic> diagnostics = getDiagnostics(); | ||
|
|
||
| assertThat(diagnostics).hasSize(3); | ||
| assertThat(diagnostics, true) | ||
| .hasRange(3, 0, 6, 49) | ||
| .hasRange(8, 0, 8, 69) | ||
| .hasRange(10, 0, 10, 103); | ||
| } | ||
|
|
||
| @Test | ||
| void testSeveralSettings() { | ||
|
|
||
| Map<String, Object> configuration = diagnosticInstance.info.getDefaultConfiguration(); | ||
| configuration.put("metadataBordersParameters", | ||
| "{\"Регистры?Сведений.КонтактнаяИнформация\":\"fake-uri\"," + | ||
| "\"Справочники?.Контакты\":\"MetadataBordersDiagnostic\"}"); | ||
| diagnosticInstance.configure(configuration); | ||
|
|
||
| List<Diagnostic> diagnostics = getDiagnostics(); | ||
|
|
||
| assertThat(diagnostics).hasSize(1); | ||
| assertThat(diagnostics, true) | ||
| .hasRange(10, 0, 10, 103); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // в комментарии срабатываний быть не должно РегистрыСведений.КонтактнаяИнформация | ||
|
|
||
| Запрос = Новый Запрос; | ||
| Запрос.Текст = "ВЫБРАТЬ | ||
| | КИ.ЗначениеКонтакта КАК Адрес | ||
| |ИЗ | ||
| | РегистрСведений.КонтактнаяИнформация КАК КИ"; //срабатывание | ||
|
|
||
| Адреса = РегистрыСведений.КонтактнаяИнформация.СоздатьНаборЗаписей(); //срабатывание | ||
|
|
||
| АдресИзСправочника = ЗначениеРеквизитаОбъекта(Справочники.Контакты.НайтиПоКоду(1), "ЗначениеКонтакта"); // срабатывание |
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.
Add a language identifier to the fenced query example.
The fenced block is missing a language tag, which triggers MD040 and reduces readability.
🛠️ Suggested fix
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)
[warning] 28-28: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents