1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2025-11-27 00:10:21 +02:00

Merge pull request #1038 from 1C-Company/1037_NoBaseFormCheck

1037: Исключить BaseForm из проверок для форм
This commit is contained in:
Vadim Geraskin
2022-06-29 20:25:24 +07:00
committed by GitHub
5 changed files with 48 additions and 5 deletions

View File

@@ -24,6 +24,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)",

View File

@@ -28,7 +28,7 @@
</check>
<check
category="com.e1c.v8codestyle.form"
class="com.e1c.v8codestyle.form.check.FormListRefUseAlwaysFlagDisabledCheck">
class="com.e1c.v8codestyle.internal.form.ExecutableExtensionFactory:com.e1c.v8codestyle.form.check.FormListRefUseAlwaysFlagDisabledCheck">
</check>
<check
category="com.e1c.v8codestyle.form"

View File

@@ -70,7 +70,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.MINOR)

View File

@@ -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);
}
}
}

View File

@@ -0,0 +1,42 @@
/*******************************************************************************
* 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;
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)
{
return form != null && form.getMdForm().getObjectBelonging() == ObjectBelonging.ADOPTED
&& form.getExtensionForm() != null && !form.getExtensionForm().eIsProxy()
&& (form.getBaseForm() == null || form.getBaseForm().eIsProxy());
}
}