You've already forked v8-code-style
mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2025-07-16 20:54:14 +02:00
1037: Исключить BaseForm из проверок для форм
This commit is contained in:
@ -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._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;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.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.g5.v8.dt.check.settings;version="[3.0.0,4.0.0)",
|
||||||
com.e1c.v8codestyle.check;version="[0.3.0,0.4.0)",
|
com.e1c.v8codestyle.check;version="[0.3.0,0.4.0)",
|
||||||
com.google.common.base;version="[30.1.0,31.0.0)",
|
com.google.common.base;version="[30.1.0,31.0.0)",
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
</check>
|
</check>
|
||||||
<check
|
<check
|
||||||
category="com.e1c.v8codestyle.form"
|
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>
|
||||||
</extension>
|
</extension>
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ import com.e1c.v8codestyle.internal.form.CorePlugin;
|
|||||||
public class FormListRefUseAlwaysFlagDisabledCheck
|
public class FormListRefUseAlwaysFlagDisabledCheck
|
||||||
extends BasicCheck
|
extends BasicCheck
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final String CHECK_ID = "form-list-ref-use-always-flag-disabled"; //$NON-NLS-1$
|
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 = 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$
|
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
|
@Override
|
||||||
protected void configureCheck(CheckConfigurer builder)
|
protected void configureCheck(CheckConfigurer builder)
|
||||||
{
|
{
|
||||||
builder.title(Messages.FormListRefUseAlwaysFlagDisabledCheck_title)
|
builder.extension(new SkipBaseFormExtension())
|
||||||
|
.title(Messages.FormListRefUseAlwaysFlagDisabledCheck_title)
|
||||||
.description(Messages.FormListRefUseAlwaysFlagDisabledCheck_description)
|
.description(Messages.FormListRefUseAlwaysFlagDisabledCheck_description)
|
||||||
.complexity(CheckComplexity.NORMAL)
|
.complexity(CheckComplexity.NORMAL)
|
||||||
.severity(IssueSeverity.MAJOR)
|
.severity(IssueSeverity.MAJOR)
|
||||||
@ -70,7 +70,6 @@ public class FormListRefUseAlwaysFlagDisabledCheck
|
|||||||
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
|
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
|
||||||
IProgressMonitor monitor)
|
IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (monitor.isCanceled() || !(object instanceof FormAttribute))
|
if (monitor.isCanceled() || !(object instanceof FormAttribute))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -36,7 +36,6 @@ import com.e1c.v8codestyle.internal.form.CorePlugin;
|
|||||||
public final class InputFieldListChoiceMode
|
public final class InputFieldListChoiceMode
|
||||||
extends BasicCheck
|
extends BasicCheck
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final String CHECK_ID = "input-field-list-choice-mode"; //$NON-NLS-1$
|
private static final String CHECK_ID = "input-field-list-choice-mode"; //$NON-NLS-1$
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,7 +47,8 @@ public final class InputFieldListChoiceMode
|
|||||||
@Override
|
@Override
|
||||||
protected void configureCheck(CheckConfigurer builder)
|
protected void configureCheck(CheckConfigurer builder)
|
||||||
{
|
{
|
||||||
builder.title(Messages.InputFieldListChoiceMode_title)
|
builder.extension(new SkipBaseFormExtension())
|
||||||
|
.title(Messages.InputFieldListChoiceMode_title)
|
||||||
.description(Messages.InputFieldListChoiceMode_description)
|
.description(Messages.InputFieldListChoiceMode_description)
|
||||||
.complexity(CheckComplexity.NORMAL)
|
.complexity(CheckComplexity.NORMAL)
|
||||||
.severity(IssueSeverity.MINOR)
|
.severity(IssueSeverity.MINOR)
|
||||||
@ -71,5 +71,4 @@ public final class InputFieldListChoiceMode
|
|||||||
INPUT_FIELD_EXT_INFO__LIST_CHOICE_MODE);
|
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;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user