From 2232919a08de65568b88e56e59cee091257faca6 Mon Sep 17 00:00:00 2001
From: Artem Iliukhin <20300020+iArtemv@users.noreply.github.com>
Date: Sat, 30 Jul 2022 00:09:29 +0300
Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?=
=?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0?=
=?UTF-8?q?=20=D0=BE=D0=B1=D0=BB=D0=B0=D1=81=D1=82=D0=B8=20=D1=81=D0=BE?=
=?UTF-8?q?=D0=B1=D1=8B=D1=82=D0=B8=D0=B9=20(#1081)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* Добавлена проверка области событий #773 #330
---
CHANGELOG.md | 1 +
.../module-structure-event-regions.md | 37 ++++++
.../ru/module-structure-event-regions.md | 34 +++++
bundles/com.e1c.v8codestyle.bsl/plugin.xml | 4 +
.../check/AbstractModuleStructureCheck.java | 37 +++++-
.../e1c/v8codestyle/bsl/check/Messages.java | 8 ++
.../ModuleStructureEventRegionsCheck.java | 117 ++++++++++++++++++
.../check/ModuleStructureTopRegionCheck.java | 2 +-
.../v8codestyle/bsl/check/messages.properties | 8 ++
.../bsl/check/messages_ru.properties | 8 ++
.../ModuleStructureEventRegionsCheckTest.java | 99 +++++++++++++++
.../workspace/StructureModule/.project | 18 +++
.../org.eclipse.core.resources.prefs | 2 +
.../StructureModule/DT-INF/PROJECT.PMF | 2 +
.../CatalogInRegion/CatalogInRegion.mdo | 33 +++++
.../CatalogInRegion/ManagerModule.bsl | 21 ++++
.../Catalogs/CatalogInRegion/ObjectModule.bsl | 0
.../CatalogInRegionWrongMethod.mdo | 33 +++++
.../ManagerModule.bsl | 21 ++++
.../ObjectModule.bsl | 0
.../CatalogInWrongRegion.mdo | 33 +++++
.../CatalogInWrongRegion/ManagerModule.bsl | 21 ++++
.../CatalogInWrongRegion/ObjectModule.bsl | 0
.../src/Configuration/CommandInterface.cmi | 2 +
.../src/Configuration/Configuration.mdo | 44 +++++++
.../MainSectionCommandInterface.cmi | 2 +
26 files changed, 585 insertions(+), 2 deletions(-)
create mode 100644 bundles/com.e1c.v8codestyle.bsl/markdown/module-structure-event-regions.md
create mode 100644 bundles/com.e1c.v8codestyle.bsl/markdown/ru/module-structure-event-regions.md
create mode 100644 bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/ModuleStructureEventRegionsCheck.java
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/ModuleStructureEventRegionsCheckTest.java
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/.project
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/.settings/org.eclipse.core.resources.prefs
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/DT-INF/PROJECT.PMF
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegion/CatalogInRegion.mdo
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegion/ManagerModule.bsl
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegion/ObjectModule.bsl
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegionWrongMethod/CatalogInRegionWrongMethod.mdo
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegionWrongMethod/ManagerModule.bsl
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegionWrongMethod/ObjectModule.bsl
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInWrongRegion/CatalogInWrongRegion.mdo
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInWrongRegion/ManagerModule.bsl
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInWrongRegion/ObjectModule.bsl
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Configuration/CommandInterface.cmi
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Configuration/Configuration.mdo
create mode 100644 tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Configuration/MainSectionCommandInterface.cmi
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3f9a89b3..3786e9ad 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -46,6 +46,7 @@
1. Mежду "НачатьТранзакцию()" и "Попытка" есть исполняемый код, который может вызвать исключение
2. Не найден оператор "Попытка" после вызова "НачатьТранзакцию()"
- Отсутствует удаление временного файла после использования.
+- Структура модуля. Добавлена проверка области событий.
- Отсутствует включение безопасного режима перед вызовом метода "Выполнить" или "Вычислить"
diff --git a/bundles/com.e1c.v8codestyle.bsl/markdown/module-structure-event-regions.md b/bundles/com.e1c.v8codestyle.bsl/markdown/module-structure-event-regions.md
new file mode 100644
index 00000000..a2ca9f00
--- /dev/null
+++ b/bundles/com.e1c.v8codestyle.bsl/markdown/module-structure-event-regions.md
@@ -0,0 +1,37 @@
+# The Event handlers section contains the event handlers of the object module (OnWrite, Posting, and so on)
+
+Checks the region of event handlers for methods related only to handlers
+
+## Noncompliant Code Example
+
+```bsl
+
+#Region EventHandlers
+
+Procedure Test()
+ //TODO: Insert the handler content
+EndProcedure
+
+#EndRegion
+
+```bsl
+
+## Compliant Solution
+
+```bsl
+
+#Region EventHandlers
+
+Procedure FormGetProcessing(FormType, Parameters, SelectedForm, AdditionalInformation, StandardProcessing)
+ //TODO: Insert the handler content
+EndProcedure
+
+#EndRegion
+
+```bsl
+
+## See
+
+
+- [Module structure](https://1c-dn.com/library/module_structure/)
+- [Module structure](https://support.1ci.com/hc/en-us/articles/360011002360-Module-structure)
diff --git a/bundles/com.e1c.v8codestyle.bsl/markdown/ru/module-structure-event-regions.md b/bundles/com.e1c.v8codestyle.bsl/markdown/ru/module-structure-event-regions.md
new file mode 100644
index 00000000..9200d9e2
--- /dev/null
+++ b/bundles/com.e1c.v8codestyle.bsl/markdown/ru/module-structure-event-regions.md
@@ -0,0 +1,34 @@
+# Раздел «Обработчики событий» содержит только методы являющиеся обработчиками событий
+
+Проверяет регион обработчиков событий на методов относящихся только к обработчикам
+
+## Неправильно
+
+```bsl
+
+#Область ОбработчикиСобытий
+
+Процедура Тест()
+КонецПроцедуры
+
+#КонецОбласти
+
+```
+
+## Правильно
+
+```bsl
+
+#Область ОбработчикиСобытий
+
+Процедура ОбработкаПолученияФормы(ВидФормы, Параметры, ВыбраннаяФорма, ДополнительнаяИнформация, СтандартнаяОбработка)
+КонецПроцедуры
+
+#КонецОбласти
+
+```
+
+## См.
+
+
+- [Структура модуля](https://its.1c.ru/db/v8std#content:455:hdoc)
diff --git a/bundles/com.e1c.v8codestyle.bsl/plugin.xml b/bundles/com.e1c.v8codestyle.bsl/plugin.xml
index 98a82f0a..6487e86a 100644
--- a/bundles/com.e1c.v8codestyle.bsl/plugin.xml
+++ b/bundles/com.e1c.v8codestyle.bsl/plugin.xml
@@ -251,6 +251,10 @@
category="com.e1c.v8codestyle.bsl"
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.check.FormSelfReferenceOutdatedCheck">
+
+
diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/AbstractModuleStructureCheck.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/AbstractModuleStructureCheck.java
index 97dd689f..9acc1584 100644
--- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/AbstractModuleStructureCheck.java
+++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/AbstractModuleStructureCheck.java
@@ -69,7 +69,7 @@ public abstract class AbstractModuleStructureCheck
* @param object the region to find the parent, cannot be {@code null}.
* @return the parent region, cannot return {@code null}.
*/
- protected Optional getParentRegion(RegionPreprocessor object)
+ protected Optional getFirstParentRegion(RegionPreprocessor object)
{
EObject parent = object.eContainer();
PreprocessorItem lastItem = null;
@@ -97,4 +97,39 @@ public abstract class AbstractModuleStructureCheck
return Optional.empty();
}
+ /**
+ * Gets the top parent region.
+ *
+ * @param object the object, cannot be {@code null}.
+ * @return the top parent region, cannot return {@code null}.
+ */
+ protected Optional getTopParentRegion(EObject object)
+ {
+ EObject parent = object.eContainer();
+ PreprocessorItem lastItem = null;
+ RegionPreprocessor region = null;
+ do
+ {
+ if (parent instanceof RegionPreprocessor)
+ {
+ RegionPreprocessor parentRegion = (RegionPreprocessor)parent;
+ if (lastItem != null && parentRegion.getItem().equals(lastItem))
+ {
+ region = parentRegion;
+ }
+ else
+ {
+ lastItem = null;
+ }
+ }
+ else if (parent instanceof PreprocessorItem)
+ {
+ lastItem = (PreprocessorItem)parent;
+ }
+ parent = parent.eContainer();
+ }
+ while (parent != null);
+
+ return Optional.ofNullable(region);
+ }
}
diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/Messages.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/Messages.java
index 41437fb2..d492bda1 100644
--- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/Messages.java
+++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/Messages.java
@@ -146,6 +146,14 @@ final class Messages
public static String ModuleUnusedLocalVariableCheck_Unused_local_variable__0;
public static String ModuleUnusedLocalVariableCheck_Probably_variable_not_initilized_yet__0;
+ public static String ModuleStructureEventRegionsCheck_Description;
+
+ public static String ModuleStructureEventRegionsCheck_Event_handler__0__not_region__1;
+
+ public static String ModuleStructureEventRegionsCheck_Only_event_methods__0;
+
+ public static String ModuleStructureEventRegionsCheck_Title;
+
public static String QueryInLoop_check_query_in_infinite_loop;
public static String QueryInLoop_description;
public static String QueryInLoop_Loop_has_method_with_query__0;
diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/ModuleStructureEventRegionsCheck.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/ModuleStructureEventRegionsCheck.java
new file mode 100644
index 00000000..86ffeefd
--- /dev/null
+++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/ModuleStructureEventRegionsCheck.java
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (C) 2022, 1C-Soft LLC and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * 1C-Soft LLC - initial API and implementation
+ *******************************************************************************/
+package com.e1c.v8codestyle.bsl.check;
+
+import static com._1c.g5.v8.dt.bsl.model.BslPackage.Literals.METHOD;
+
+import java.text.MessageFormat;
+import java.util.Optional;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+
+import com._1c.g5.v8.dt.bsl.model.Method;
+import com._1c.g5.v8.dt.bsl.model.ModuleType;
+import com._1c.g5.v8.dt.bsl.model.RegionPreprocessor;
+import com._1c.g5.v8.dt.core.platform.IV8Project;
+import com._1c.g5.v8.dt.core.platform.IV8ProjectManager;
+import com._1c.g5.v8.dt.mcore.McorePackage;
+import com._1c.g5.v8.dt.metadata.mdclass.ScriptVariant;
+import com.e1c.g5.v8.dt.check.CheckComplexity;
+import com.e1c.g5.v8.dt.check.ICheckParameters;
+import com.e1c.g5.v8.dt.check.components.ModuleTopObjectNameFilterExtension;
+import com.e1c.g5.v8.dt.check.settings.IssueSeverity;
+import com.e1c.g5.v8.dt.check.settings.IssueType;
+import com.e1c.v8codestyle.bsl.ModuleStructureSection;
+import com.e1c.v8codestyle.check.StandardCheckExtension;
+import com.e1c.v8codestyle.internal.bsl.BslPlugin;
+import com.google.inject.Inject;
+
+/**
+ * Checks the region of event handlers for methods related only to handlers.
+ *
+ * @author Artem Iliukhin
+ *
+ */
+public class ModuleStructureEventRegionsCheck
+ extends AbstractModuleStructureCheck
+{
+ private static final String CHECK_ID = "module-structure-event-regions"; //$NON-NLS-1$
+
+ private final IV8ProjectManager v8ProjectManager;
+
+ @Inject
+ public ModuleStructureEventRegionsCheck(IV8ProjectManager v8ProjectManager)
+ {
+ super();
+ this.v8ProjectManager = v8ProjectManager;
+ }
+
+ @Override
+ public String getCheckId()
+ {
+ return CHECK_ID;
+ }
+
+ @Override
+ protected void configureCheck(CheckConfigurer builder)
+ {
+ builder.title(Messages.ModuleStructureEventRegionsCheck_Title)
+ .description(Messages.ModuleStructureEventRegionsCheck_Description)
+ .complexity(CheckComplexity.NORMAL)
+ .severity(IssueSeverity.MINOR)
+ .issueType(IssueType.CODE_STYLE)
+ .extension(new ModuleTopObjectNameFilterExtension())
+ .extension(new StandardCheckExtension(getCheckId(), BslPlugin.PLUGIN_ID))
+ .module()
+ .checkedObjectType(METHOD);
+ }
+
+ @Override
+ protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
+ IProgressMonitor monitor)
+ {
+ Method method = (Method)object;
+
+ IV8Project project = v8ProjectManager.getProject(method);
+
+ ScriptVariant scriptVariant = project.getScriptVariant();
+
+ ModuleType moduleType = getModuleType(method);
+ if (ModuleType.FORM_MODULE.equals(moduleType))
+ {
+ return;
+ }
+
+ Optional region = getTopParentRegion(method);
+ if (region.isEmpty())
+ {
+ return;
+ }
+
+ String name = region.get().getName();
+ String eventHandlersName = ModuleStructureSection.EVENT_HANDLERS.getName(scriptVariant);
+ if (eventHandlersName.equals(name) && !method.isEvent())
+ {
+ resultAceptor.addIssue(
+ MessageFormat.format(Messages.ModuleStructureEventRegionsCheck_Only_event_methods__0, name),
+ McorePackage.Literals.NAMED_ELEMENT__NAME);
+ }
+ else if (!eventHandlersName.equals(name) && method.isEvent())
+ {
+ resultAceptor.addIssue(
+ MessageFormat.format(Messages.ModuleStructureEventRegionsCheck_Event_handler__0__not_region__1,
+ method.getName(), eventHandlersName), McorePackage.Literals.NAMED_ELEMENT__NAME);
+ }
+ }
+
+}
diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/ModuleStructureTopRegionCheck.java b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/ModuleStructureTopRegionCheck.java
index 141cb37c..0aacafbb 100644
--- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/ModuleStructureTopRegionCheck.java
+++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/ModuleStructureTopRegionCheck.java
@@ -98,7 +98,7 @@ public class ModuleStructureTopRegionCheck
return;
}
- Optional parent = getParentRegion(region);
+ Optional parent = getFirstParentRegion(region);
if (parent.isPresent())
{
resultAceptor.addIssue(Messages.ModuleStructureTopRegionCheck_error_message, NAMED_ELEMENT__NAME);
diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties
index 0d46e2f5..b05b4e53 100644
--- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties
+++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages.properties
@@ -211,6 +211,14 @@ ModuleUnusedMethodCheck_Title = Unused method check
ModuleUnusedMethodCheck_Unused_method__0 = Unused method "{0}"
+ModuleStructureEventRegionsCheck_Description=Checks the region of event handlers for the existence of methods related only to handlers
+
+ModuleStructureEventRegionsCheck_Event_handler__0__not_region__1=The event handler "{0}" should be placed in the "{1}" region
+
+ModuleStructureEventRegionsCheck_Only_event_methods__0=Only event methods can be placed in the "{0}" region
+
+ModuleStructureEventRegionsCheck_Title=Checks the region of event handlers for the existence of methods related only to handlers
+
NewColorCheck_Use_style_elements=To change the design, you should use style elements, and not set specific values directly in the controls
NewColorCheck_Use_style_elements_not_specific_values=To change the design, you should use style elements, and not set specific values directly in the controls. This is required in order for similar controls to look the same in all forms where they occur.
diff --git a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties
index a5232c87..8b3e7e35 100644
--- a/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties
+++ b/bundles/com.e1c.v8codestyle.bsl/src/com/e1c/v8codestyle/bsl/check/messages_ru.properties
@@ -220,6 +220,14 @@ ModuleUnusedMethodCheck_Title = Проверка неиспользуемых м
ModuleUnusedMethodCheck_Unused_method__0 = Неиспользуемый метод "{0}"
+ModuleStructureEventRegionsCheck_Only_event_methods__0 = В области ''{0}'' следует размещать только обработчики событий
+
+ModuleStructureEventRegionsCheck_Description=Проверяет область обработчиков событий на наличие методов относящихся только к обработчикам
+
+ModuleStructureEventRegionsCheck_Event_handler__0__not_region__1=Обработчик событий "{0}" следует разместить в область "{1}"
+
+ModuleStructureEventRegionsCheck_Title=Проверяет область обработчиков событий на наличие методов относящихся только к обработчикам
+
NewColorCheck_Use_style_elements=Для изменения оформления следует использовать элементы стиля, а не задавать конкретные значения непосредственно в элементах управления
NewColorCheck_Use_style_elements_not_specific_values=Для изменения оформления следует использовать элементы стиля, а не задавать конкретные значения непосредственно в элементах управления. Это требуется для того, чтобы аналогичные элементы управления выглядели одинаково во всех формах, где они встречаются.
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/ModuleStructureEventRegionsCheckTest.java b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/ModuleStructureEventRegionsCheckTest.java
new file mode 100644
index 00000000..36e21605
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/ModuleStructureEventRegionsCheckTest.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (C) 2022, 1C-Soft LLC and others.
+ *
+ * This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License 2.0
+ * which is available at https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * 1C-Soft LLC - initial API and implementation
+ *******************************************************************************/
+package com.e1c.v8codestyle.bsl.check.itests;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com._1c.g5.v8.bm.core.IBmObject;
+import com._1c.g5.v8.dt.bsl.model.Module;
+import com._1c.g5.v8.dt.core.platform.IDtProject;
+import com._1c.g5.v8.dt.metadata.mdclass.Catalog;
+import com._1c.g5.v8.dt.validation.marker.Marker;
+import com.e1c.g5.v8.dt.testing.check.SingleProjectReadOnlyCheckTestBase;
+import com.e1c.v8codestyle.bsl.check.ModuleStructureEventRegionsCheck;
+
+/**
+ * Tests for {@link ModuleStructureEventRegionsCheck} check.
+ *
+ * @author Artem Iliukhin
+ */
+public class ModuleStructureEventRegionsCheckTest
+ extends SingleProjectReadOnlyCheckTestBase
+{
+
+ private static final String CHECK_ID = "module-structure-event-regions"; //$NON-NLS-1$
+ private static final String PROJECT_NAME = "StructureModule";
+
+ private static final String FQN_CATALOG_MODULE_MANAGER_EVENT = "Catalog.CatalogInRegion";
+ private static final String FQN_CATALOG_MODULE_MANAGER_EVENT_WRONG_REGION = "Catalog.CatalogInWrongRegion";
+ private static final String FQN_CATALOG_MODULE_MANAGER_EVENT_WRONG_METHOD = "Catalog.CatalogInRegionWrongMethod";
+
+ @Override
+ protected String getTestConfigurationName()
+ {
+ return PROJECT_NAME;
+ }
+
+ @Test
+ public void testEventModuleManagerInWrongRegion() throws Exception
+ {
+ IDtProject dtProject = dtProjectManager.getDtProject(PROJECT_NAME);
+ assertNotNull(dtProject);
+
+ IBmObject mdObject = getTopObjectByFqn(FQN_CATALOG_MODULE_MANAGER_EVENT_WRONG_REGION, dtProject);
+ assertTrue(mdObject instanceof Catalog);
+
+ Module module = ((Catalog)mdObject).getManagerModule();
+ assertNotNull(module);
+
+ Marker marker = getFirstMarker(CHECK_ID, module.eResource().getURI(), getProject());
+ assertNotNull(marker);
+ }
+
+ @Test
+ public void testEventModuleManagerInRegion() throws Exception
+ {
+ IDtProject dtProject = dtProjectManager.getDtProject(PROJECT_NAME);
+ assertNotNull(dtProject);
+
+ IBmObject mdObject = getTopObjectByFqn(FQN_CATALOG_MODULE_MANAGER_EVENT, dtProject);
+ assertTrue(mdObject instanceof Catalog);
+
+ Module module = ((Catalog)mdObject).getManagerModule();
+ assertNotNull(module);
+
+ Marker marker = getFirstMarker(CHECK_ID, module.eResource().getURI(), getProject());
+ assertNull(marker);
+ }
+
+ @Test
+ public void testEventModuleManagerInRegionWrongMethod() throws Exception
+ {
+ IDtProject dtProject = dtProjectManager.getDtProject(PROJECT_NAME);
+ assertNotNull(dtProject);
+
+ IBmObject mdObject = getTopObjectByFqn(FQN_CATALOG_MODULE_MANAGER_EVENT_WRONG_METHOD, dtProject);
+ assertTrue(mdObject instanceof Catalog);
+
+ Module module = ((Catalog)mdObject).getManagerModule();
+ assertNotNull(module);
+
+ Marker marker = getFirstMarker(CHECK_ID, module.eResource().getURI(), getProject());
+ assertNotNull(marker);
+ }
+
+}
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/.project b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/.project
new file mode 100644
index 00000000..a637a5cc
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/.project
@@ -0,0 +1,18 @@
+
+
+ StructureModule
+
+
+
+
+
+ org.eclipse.xtext.ui.shared.xtextBuilder
+
+
+
+
+
+ org.eclipse.xtext.ui.shared.xtextNature
+ com._1c.g5.v8.dt.core.V8ConfigurationNature
+
+
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/.settings/org.eclipse.core.resources.prefs b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000..99f26c02
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/=UTF-8
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/DT-INF/PROJECT.PMF b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/DT-INF/PROJECT.PMF
new file mode 100644
index 00000000..6835f1cd
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/DT-INF/PROJECT.PMF
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Runtime-Version: 8.3.19
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegion/CatalogInRegion.mdo b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegion/CatalogInRegion.mdo
new file mode 100644
index 00000000..4324d7a7
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegion/CatalogInRegion.mdo
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+ CatalogInRegion
+
+ en
+ Catalog in region
+
+ true
+ Catalog.CatalogInRegion.StandardAttribute.Code
+ Catalog.CatalogInRegion.StandardAttribute.Description
+ DontUse
+ Use
+ Managed
+ Use
+ 2
+ true
+ 9
+ 25
+ String
+ Variable
+ true
+ true
+ AsDescription
+ InDialog
+ BothWays
+
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegion/ManagerModule.bsl b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegion/ManagerModule.bsl
new file mode 100644
index 00000000..df3a3c4a
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegion/ManagerModule.bsl
@@ -0,0 +1,21 @@
+
+#Region Public
+// Enter code here.
+#EndRegion
+
+#Region EventHandlers
+
+Procedure FormGetProcessing(FormType, Parameters, SelectedForm, AdditionalInformation, StandardProcessing)
+ //TODO: Insert the handler content
+EndProcedure
+
+#EndRegion
+
+#Region Internal
+// Enter code here.
+#EndRegion
+
+#Region Private
+// Enter code here.
+#EndRegion
+
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegion/ObjectModule.bsl b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegion/ObjectModule.bsl
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegionWrongMethod/CatalogInRegionWrongMethod.mdo b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegionWrongMethod/CatalogInRegionWrongMethod.mdo
new file mode 100644
index 00000000..a75509f7
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegionWrongMethod/CatalogInRegionWrongMethod.mdo
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+ CatalogInRegionWrongMethod
+
+ en
+ Catalog in region wrong method
+
+ true
+ Catalog.CatalogInRegionWrongMethod.StandardAttribute.Code
+ Catalog.CatalogInRegionWrongMethod.StandardAttribute.Description
+ DontUse
+ Use
+ Managed
+ Use
+ 2
+ true
+ 9
+ 25
+ String
+ Variable
+ true
+ true
+ AsDescription
+ InDialog
+ BothWays
+
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegionWrongMethod/ManagerModule.bsl b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegionWrongMethod/ManagerModule.bsl
new file mode 100644
index 00000000..9d1dbc95
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegionWrongMethod/ManagerModule.bsl
@@ -0,0 +1,21 @@
+
+#Region Public
+// Enter code here.
+#EndRegion
+
+#Region EventHandlers
+
+Procedure WrongMethod()
+ //TODO: Insert the handler content
+EndProcedure
+
+#EndRegion
+
+#Region Internal
+// Enter code here.
+#EndRegion
+
+#Region Private
+// Enter code here.
+#EndRegion
+
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegionWrongMethod/ObjectModule.bsl b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInRegionWrongMethod/ObjectModule.bsl
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInWrongRegion/CatalogInWrongRegion.mdo b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInWrongRegion/CatalogInWrongRegion.mdo
new file mode 100644
index 00000000..17d9816c
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInWrongRegion/CatalogInWrongRegion.mdo
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+ CatalogInWrongRegion
+
+ en
+ Catalog in wrong region
+
+ true
+ Catalog.CatalogInWrongRegion.StandardAttribute.Code
+ Catalog.CatalogInWrongRegion.StandardAttribute.Description
+ DontUse
+ Use
+ Managed
+ Use
+ 2
+ true
+ 9
+ 25
+ String
+ Variable
+ true
+ true
+ AsDescription
+ InDialog
+ BothWays
+
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInWrongRegion/ManagerModule.bsl b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInWrongRegion/ManagerModule.bsl
new file mode 100644
index 00000000..7f124ab0
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInWrongRegion/ManagerModule.bsl
@@ -0,0 +1,21 @@
+
+#Region Public
+// Enter code here.
+#EndRegion
+
+#Region EventHandlers
+// Enter code here.
+#EndRegion
+
+#Region Internal
+// Enter code here.
+#EndRegion
+
+#Region Private
+
+Procedure FormGetProcessing(FormType, Parameters, SelectedForm, AdditionalInformation, StandardProcessing)
+ //TODO: Insert the handler content
+EndProcedure
+
+#EndRegion
+
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInWrongRegion/ObjectModule.bsl b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Catalogs/CatalogInWrongRegion/ObjectModule.bsl
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Configuration/CommandInterface.cmi b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Configuration/CommandInterface.cmi
new file mode 100644
index 00000000..0cf6de8a
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Configuration/CommandInterface.cmi
@@ -0,0 +1,2 @@
+
+
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Configuration/Configuration.mdo b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Configuration/Configuration.mdo
new file mode 100644
index 00000000..3e09a679
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Configuration/Configuration.mdo
@@ -0,0 +1,44 @@
+
+
+ StructureModule
+
+ en
+ Structure module
+
+
+
+
+
+
+
+
+ 8.3.20
+ ManagedApplication
+ PersonalComputer
+
+
+
+
+
+ OSBackup
+
+
+
+ Language.English
+ Managed
+ NotAutoFree
+ DontUse
+ DontUse
+ 8.3.20
+
+ English
+
+ en
+ English
+
+ en
+
+ Catalog.CatalogInRegion
+ Catalog.CatalogInRegionWrongMethod
+ Catalog.CatalogInWrongRegion
+
diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Configuration/MainSectionCommandInterface.cmi b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Configuration/MainSectionCommandInterface.cmi
new file mode 100644
index 00000000..0cf6de8a
--- /dev/null
+++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/StructureModule/src/Configuration/MainSectionCommandInterface.cmi
@@ -0,0 +1,2 @@
+
+