mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2025-03-04 16:15:57 +02:00
1037: Исключить BaseForm из проверок для форм
This commit is contained in:
parent
154c4010d9
commit
7b0e814a0c
@ -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)",
|
||||
|
@ -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>
|
||||
</extension>
|
||||
|
||||
|
@ -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<String> REF_ABSTRACT_DATA_PATH = List.of("List", "Ref"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
private static final List<String> 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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user