From 7b0e814a0c2e69ffb8ce788b00e4f8c43bd08023 Mon Sep 17 00:00:00 2001 From: Vadim Geraskin Date: Tue, 31 May 2022 22:10:07 +0700 Subject: [PATCH 1/2] =?UTF-8?q?1037:=20=D0=98=D1=81=D0=BA=D0=BB=D1=8E?= =?UTF-8?q?=D1=87=D0=B8=D1=82=D1=8C=20BaseForm=20=D0=B8=D0=B7=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BE=D0=BA=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=84=D0=BE=D1=80=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../META-INF/MANIFEST.MF | 1 + bundles/com.e1c.v8codestyle.form/plugin.xml | 2 +- ...FormListRefUseAlwaysFlagDisabledCheck.java | 5 +-- .../form/check/InputFieldListChoiceMode.java | 5 +-- .../form/check/SkipBaseFormExtension.java | 37 +++++++++++++++++++ 5 files changed, 43 insertions(+), 7 deletions(-) create mode 100644 bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/SkipBaseFormExtension.java diff --git a/bundles/com.e1c.v8codestyle.form/META-INF/MANIFEST.MF b/bundles/com.e1c.v8codestyle.form/META-INF/MANIFEST.MF index 2ff253a0..66d1e4e7 100644 --- a/bundles/com.e1c.v8codestyle.form/META-INF/MANIFEST.MF +++ b/bundles/com.e1c.v8codestyle.form/META-INF/MANIFEST.MF @@ -23,6 +23,7 @@ Import-Package: com._1c.g5.v8.bm.core;version="[7.5.0,8.0.0)", com._1c.g5.wiring.binder;version="[1.1.0,2.0.0)", com.e1c.g5.v8.dt.check;version="[2.0.0,3.0.0)", com.e1c.g5.v8.dt.check.components;version="[2.0.0,3.0.0)", + com.e1c.g5.v8.dt.check.ext;version="[1.0.0,2.0.0)", com.e1c.g5.v8.dt.check.settings;version="[3.0.0,4.0.0)", com.e1c.v8codestyle.check;version="[0.3.0,0.4.0)", com.google.common.base;version="[30.1.0,31.0.0)", diff --git a/bundles/com.e1c.v8codestyle.form/plugin.xml b/bundles/com.e1c.v8codestyle.form/plugin.xml index 0d6e3ccb..5e10fbea 100644 --- a/bundles/com.e1c.v8codestyle.form/plugin.xml +++ b/bundles/com.e1c.v8codestyle.form/plugin.xml @@ -28,7 +28,7 @@ + class="com.e1c.v8codestyle.internal.form.ExecutableExtensionFactory:com.e1c.v8codestyle.form.check.FormListRefUseAlwaysFlagDisabledCheck"> diff --git a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java index 63348bda..52151e3c 100644 --- a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java +++ b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/FormListRefUseAlwaysFlagDisabledCheck.java @@ -41,7 +41,6 @@ import com.e1c.v8codestyle.internal.form.CorePlugin; public class FormListRefUseAlwaysFlagDisabledCheck extends BasicCheck { - private static final String CHECK_ID = "form-list-ref-use-always-flag-disabled"; //$NON-NLS-1$ private static final List REF_ABSTRACT_DATA_PATH = List.of("List", "Ref"); //$NON-NLS-1$ //$NON-NLS-2$ private static final List REF_ABSTRACT_DATA_PATH_RU = List.of("Список", "Ссылка"); //$NON-NLS-1$ //$NON-NLS-2$ @@ -55,7 +54,8 @@ public class FormListRefUseAlwaysFlagDisabledCheck @Override protected void configureCheck(CheckConfigurer builder) { - builder.title(Messages.FormListRefUseAlwaysFlagDisabledCheck_title) + builder.extension(new SkipBaseFormExtension()) + .title(Messages.FormListRefUseAlwaysFlagDisabledCheck_title) .description(Messages.FormListRefUseAlwaysFlagDisabledCheck_description) .complexity(CheckComplexity.NORMAL) .severity(IssueSeverity.MAJOR) @@ -70,7 +70,6 @@ public class FormListRefUseAlwaysFlagDisabledCheck protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters, IProgressMonitor monitor) { - if (monitor.isCanceled() || !(object instanceof FormAttribute)) { return; diff --git a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/InputFieldListChoiceMode.java b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/InputFieldListChoiceMode.java index cfb9c69d..df893975 100644 --- a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/InputFieldListChoiceMode.java +++ b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/InputFieldListChoiceMode.java @@ -36,7 +36,6 @@ import com.e1c.v8codestyle.internal.form.CorePlugin; public final class InputFieldListChoiceMode extends BasicCheck { - private static final String CHECK_ID = "input-field-list-choice-mode"; //$NON-NLS-1$ @Override @@ -48,7 +47,8 @@ public final class InputFieldListChoiceMode @Override protected void configureCheck(CheckConfigurer builder) { - builder.title(Messages.InputFieldListChoiceMode_title) + builder.extension(new SkipBaseFormExtension()) + .title(Messages.InputFieldListChoiceMode_title) .description(Messages.InputFieldListChoiceMode_description) .complexity(CheckComplexity.NORMAL) .severity(IssueSeverity.MINOR) @@ -71,5 +71,4 @@ public final class InputFieldListChoiceMode INPUT_FIELD_EXT_INFO__LIST_CHOICE_MODE); } } - } diff --git a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/SkipBaseFormExtension.java b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/SkipBaseFormExtension.java new file mode 100644 index 00000000..cb7e53f9 --- /dev/null +++ b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/SkipBaseFormExtension.java @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2022, 1C + */ +package com.e1c.v8codestyle.form.check; + +import com._1c.g5.v8.bm.core.IBmObject; +import com._1c.g5.v8.dt.form.model.Form; +import com._1c.g5.v8.dt.metadata.mdclass.ObjectBelonging; +import com.e1c.g5.v8.dt.check.ICheckParameters; +import com.e1c.g5.v8.dt.check.components.IBasicCheckExtension; +import com.e1c.g5.v8.dt.check.ext.ITopObjectFilter; + +/** + * Check extension to avoid checking inside of a BaseForm + * + * @author Vadim Geraskin + */ +public class SkipBaseFormExtension + implements IBasicCheckExtension +{ + @Override + public ITopObjectFilter contributeTopObjectFilter() + { + return (IBmObject object, ICheckParameters parameters) -> !isBaseForm((Form)object); + } + + private static boolean isBaseForm(Form form) + { + if (form != null && form.getMdForm().getObjectBelonging() == ObjectBelonging.ADOPTED + && form.getExtensionForm() != null && !form.getExtensionForm().eIsProxy() + && (form.getBaseForm() == null || form.getBaseForm().eIsProxy())) + { + return true; + } + return false; + } +} From 609b0ddfbcd6807762810976f079820ceb59a08d Mon Sep 17 00:00:00 2001 From: Vadim Geraskin Date: Fri, 3 Jun 2022 14:45:40 +0700 Subject: [PATCH 2/2] =?UTF-8?q?1037:=20=D0=98=D1=81=D0=BA=D0=BB=D1=8E?= =?UTF-8?q?=D1=87=D0=B8=D1=82=D1=8C=20BaseForm=20=D0=B8=D0=B7=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BE=D0=BA=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=84=D0=BE=D1=80=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/check/SkipBaseFormExtension.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/SkipBaseFormExtension.java b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/SkipBaseFormExtension.java index cb7e53f9..99d7c319 100644 --- a/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/SkipBaseFormExtension.java +++ b/bundles/com.e1c.v8codestyle.form/src/com/e1c/v8codestyle/form/check/SkipBaseFormExtension.java @@ -1,6 +1,15 @@ -/** - * Copyright (C) 2022, 1C - */ +/******************************************************************************* + * 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.form.check; import com._1c.g5.v8.bm.core.IBmObject; @@ -26,12 +35,8 @@ public class SkipBaseFormExtension private static boolean isBaseForm(Form form) { - if (form != null && form.getMdForm().getObjectBelonging() == ObjectBelonging.ADOPTED + return form != null && form.getMdForm().getObjectBelonging() == ObjectBelonging.ADOPTED && form.getExtensionForm() != null && !form.getExtensionForm().eIsProxy() - && (form.getBaseForm() == null || form.getBaseForm().eIsProxy())) - { - return true; - } - return false; + && (form.getBaseForm() == null || form.getBaseForm().eIsProxy()); } }