mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2024-12-01 02:32:18 +02:00
parent
89d34dd88f
commit
2aa2756e07
@ -62,6 +62,7 @@
|
|||||||
- Стандартная область структуры модуля верхнеуровневая
|
- Стандартная область структуры модуля верхнеуровневая
|
||||||
- Использование директив компиляции модуля формы
|
- Использование директив компиляции модуля формы
|
||||||
- Всегда использовать директивы компиляции в модуле формы
|
- Всегда использовать директивы компиляции в модуле формы
|
||||||
|
- Описание оповещения на серверную процедуру
|
||||||
|
|
||||||
#### Запросы
|
#### Запросы
|
||||||
|
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
# Notify description to Server procedure
|
||||||
|
|
||||||
|
Server procedure specified in parameter of notify description.
|
||||||
|
|
||||||
|
The call of the notify is not support by web-client.
|
||||||
|
|
||||||
|
## Noncompliant Code Example
|
||||||
|
|
||||||
|
```bsl
|
||||||
|
&AtClient
|
||||||
|
Procedure Noncompliant()
|
||||||
|
|
||||||
|
Notify = new NotifyDescription("NoncompliantNotify", ThisObject);
|
||||||
|
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
&AtServer
|
||||||
|
Procedure NoncompliantNotify() Export
|
||||||
|
// Procedure is not avalable at client!
|
||||||
|
|
||||||
|
EndProcedure
|
||||||
|
```
|
||||||
|
|
||||||
|
## Compliant Solution
|
||||||
|
|
||||||
|
```bsl
|
||||||
|
&AtClient
|
||||||
|
Procedure Compliant()
|
||||||
|
|
||||||
|
Notify = new NotifyDescription("CompliantNotify", ThisObject);
|
||||||
|
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
&AtClient
|
||||||
|
Procedure CompliantNotify() Export
|
||||||
|
// Procedure is avalable at client!
|
||||||
|
|
||||||
|
EndProcedure
|
||||||
|
```
|
||||||
|
|
||||||
|
## See
|
||||||
|
|
@ -0,0 +1,42 @@
|
|||||||
|
# Описание оповещения на серверную процедуру
|
||||||
|
|
||||||
|
В качестве параметра обработчика оповещения указана серверная процедура.
|
||||||
|
|
||||||
|
Такой вызов оповещения не поддерживается в веб-клиенте.
|
||||||
|
|
||||||
|
## Неправильно
|
||||||
|
|
||||||
|
```bsl
|
||||||
|
&НаКлиенте
|
||||||
|
Процедура Неправильно()
|
||||||
|
|
||||||
|
Оповещение = Новый ОписаниеОповещения("НеправильноеОповещение", ЭтотОбъект);
|
||||||
|
|
||||||
|
КонецПроцедуры
|
||||||
|
|
||||||
|
&НаСервере
|
||||||
|
Процедура НеправильноеОповещение() Экспорт
|
||||||
|
// Процедура не доступна на клиенте
|
||||||
|
|
||||||
|
КонецПроцедуры
|
||||||
|
```
|
||||||
|
|
||||||
|
## Правильно
|
||||||
|
|
||||||
|
```bsl
|
||||||
|
&НаКлиенте
|
||||||
|
Процедура Правильно()
|
||||||
|
|
||||||
|
Оповещение = Новый ОписаниеОповещения("ПравильноОповещение", ЭтотОбъект);
|
||||||
|
|
||||||
|
КонецПроцедуры
|
||||||
|
|
||||||
|
&НаКлиенте
|
||||||
|
Процедура ПравильноОповещение() Экспорт
|
||||||
|
// Процедура доступна на клиенте!
|
||||||
|
|
||||||
|
КонецПроцедуры
|
||||||
|
```
|
||||||
|
|
||||||
|
## См.
|
||||||
|
|
@ -46,6 +46,10 @@
|
|||||||
category="com.e1c.v8codestyle.bsl"
|
category="com.e1c.v8codestyle.bsl"
|
||||||
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.check.MethodTooManyPramsCheck">
|
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.check.MethodTooManyPramsCheck">
|
||||||
</check>
|
</check>
|
||||||
|
<check
|
||||||
|
category="com.e1c.v8codestyle.bsl"
|
||||||
|
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.check.NotifyDescriptionToServerProcedureCheck">
|
||||||
|
</check>
|
||||||
<check
|
<check
|
||||||
category="com.e1c.v8codestyle.bsl"
|
category="com.e1c.v8codestyle.bsl"
|
||||||
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.check.EventDataExchangeLoadCheck">
|
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.check.EventDataExchangeLoadCheck">
|
||||||
|
@ -123,6 +123,13 @@ final class Messages
|
|||||||
|
|
||||||
public static String FormModulePragmaCheck_title;
|
public static String FormModulePragmaCheck_title;
|
||||||
|
|
||||||
|
public static String NotifyDescriptionToServerProcedureCheck_description;
|
||||||
|
|
||||||
|
public static String NotifyDescriptionToServerProcedureCheck_Notify_description_procedure_should_be_export;
|
||||||
|
|
||||||
|
public static String NotifyDescriptionToServerProcedureCheck_Notify_description_to_Server_procedure;
|
||||||
|
|
||||||
|
public static String NotifyDescriptionToServerProcedureCheck_title;
|
||||||
|
|
||||||
public static String FormModuleMissingPragmaCheck_description;
|
public static String FormModuleMissingPragmaCheck_description;
|
||||||
|
|
||||||
@ -130,7 +137,6 @@ final class Messages
|
|||||||
|
|
||||||
public static String FormModuleMissingPragmaCheck_title;
|
public static String FormModuleMissingPragmaCheck_title;
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
// initialize resource bundle
|
// initialize resource bundle
|
||||||
|
@ -0,0 +1,273 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (C) 2021, 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.OPERATOR_STYLE_CREATOR;
|
||||||
|
import static com._1c.g5.v8.dt.bsl.model.BslPackage.Literals.STRING_LITERAL__LINES;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.emf.common.util.URI;
|
||||||
|
import org.eclipse.emf.ecore.EObject;
|
||||||
|
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||||
|
import org.eclipse.xtext.EcoreUtil2;
|
||||||
|
import org.eclipse.xtext.resource.IResourceServiceProvider;
|
||||||
|
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.DynamicFeatureAccess;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.Expression;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.FeatureEntry;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.Module;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.OperatorStyleCreator;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.StaticFeatureAccess;
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.StringLiteral;
|
||||||
|
import com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer;
|
||||||
|
import com._1c.g5.v8.dt.bsl.resource.ExportMethodProvider;
|
||||||
|
import com._1c.g5.v8.dt.common.StringUtils;
|
||||||
|
import com._1c.g5.v8.dt.mcore.DerivedProperty;
|
||||||
|
import com._1c.g5.v8.dt.mcore.Environmental;
|
||||||
|
import com._1c.g5.v8.dt.mcore.Method;
|
||||||
|
import com._1c.g5.v8.dt.mcore.Property;
|
||||||
|
import com._1c.g5.v8.dt.mcore.util.Environments;
|
||||||
|
import com._1c.g5.v8.dt.mcore.util.McoreUtil;
|
||||||
|
import com._1c.g5.v8.dt.metadata.mdclass.CommonModule;
|
||||||
|
import com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage;
|
||||||
|
import com.e1c.g5.v8.dt.check.CheckComplexity;
|
||||||
|
import com.e1c.g5.v8.dt.check.ICheckParameters;
|
||||||
|
import com.e1c.g5.v8.dt.check.components.BasicCheck;
|
||||||
|
import com.e1c.g5.v8.dt.check.settings.IssueSeverity;
|
||||||
|
import com.e1c.g5.v8.dt.check.settings.IssueType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that notify description procedure is exist and available at the client.
|
||||||
|
*
|
||||||
|
* @author Dmitriy Marmyshev
|
||||||
|
* @author Victor Golubev
|
||||||
|
*/
|
||||||
|
public class NotifyDescriptionToServerProcedureCheck
|
||||||
|
extends BasicCheck
|
||||||
|
{
|
||||||
|
private static final String CD_ROOT = "/0/@contextDef"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final String CHECK_ID = "notify-description-to-server-procedure"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final String BSLCD = "bslcd"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final String THIS_OBJECT = "ThisObject"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final String THIS_OBJECT_RU = "ЭтотОбъект"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private static final String NOTIFICATION = "NotifyDescription"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private final DynamicFeatureAccessComputer dynamicFeatureAccessComputer;
|
||||||
|
|
||||||
|
private final ExportMethodProvider exportMethodProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new notify description to server procedure check.
|
||||||
|
*/
|
||||||
|
public NotifyDescriptionToServerProcedureCheck()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
IResourceServiceProvider rsp =
|
||||||
|
IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(URI.createURI("*.bsl")); //$NON-NLS-1$
|
||||||
|
|
||||||
|
this.dynamicFeatureAccessComputer = rsp.get(DynamicFeatureAccessComputer.class);
|
||||||
|
this.exportMethodProvider = rsp.get(ExportMethodProvider.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCheckId()
|
||||||
|
{
|
||||||
|
return CHECK_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configureCheck(CheckConfigurer builder)
|
||||||
|
{
|
||||||
|
builder.title(Messages.NotifyDescriptionToServerProcedureCheck_title)
|
||||||
|
.description(Messages.NotifyDescriptionToServerProcedureCheck_description)
|
||||||
|
.complexity(CheckComplexity.NORMAL)
|
||||||
|
.severity(IssueSeverity.MAJOR)
|
||||||
|
.issueType(IssueType.ERROR)
|
||||||
|
.module()
|
||||||
|
.checkedObjectType(OPERATOR_STYLE_CREATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
|
||||||
|
IProgressMonitor monitor)
|
||||||
|
{
|
||||||
|
OperatorStyleCreator osc = (OperatorStyleCreator)object;
|
||||||
|
String operatorName = McoreUtil.getTypeName(osc.getType());
|
||||||
|
|
||||||
|
if (!NOTIFICATION.equals(operatorName) || osc.getParams().isEmpty()
|
||||||
|
|| !(osc.getParams().get(0) instanceof StringLiteral))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringLiteral param = (StringLiteral)osc.getParams().get(0);
|
||||||
|
final String methodName = getCalledProcedureName(param);
|
||||||
|
if (monitor.isCanceled() || StringUtils.isBlank(methodName))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String contextDefUri = getBslContexDefUri(osc);
|
||||||
|
|
||||||
|
if (monitor.isCanceled() || contextDefUri == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Collection<Method> methods = exportMethodProvider.getMockMethods(contextDefUri, methodName, osc);
|
||||||
|
if (methods.isEmpty())
|
||||||
|
{
|
||||||
|
resultAceptor.addIssue(
|
||||||
|
Messages.NotifyDescriptionToServerProcedureCheck_Notify_description_procedure_should_be_export, param,
|
||||||
|
STRING_LITERAL__LINES);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (Method method : methods)
|
||||||
|
{
|
||||||
|
Environments calleeEnv = method.environments();
|
||||||
|
if (calleeEnv.containsAny(Environments.MNG_CLIENTS))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resultAceptor.addIssue(
|
||||||
|
Messages.NotifyDescriptionToServerProcedureCheck_Notify_description_to_Server_procedure, param,
|
||||||
|
STRING_LITERAL__LINES);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getCalledProcedureName(Expression param)
|
||||||
|
{
|
||||||
|
if (param instanceof StringLiteral)
|
||||||
|
{
|
||||||
|
StringLiteral literal = (StringLiteral)param;
|
||||||
|
if (literal.getLines().size() == 1)
|
||||||
|
{
|
||||||
|
return literal.lines(true).get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBslContexDefUri(OperatorStyleCreator osc)
|
||||||
|
{
|
||||||
|
List<Expression> params = osc.getParams();
|
||||||
|
|
||||||
|
if (params.size() > 1)
|
||||||
|
{
|
||||||
|
Expression moduleParam = params.get(1);
|
||||||
|
if (moduleParam instanceof StaticFeatureAccess)
|
||||||
|
{
|
||||||
|
return getBslContexDefUri((StaticFeatureAccess)moduleParam);
|
||||||
|
}
|
||||||
|
else if (moduleParam instanceof DynamicFeatureAccess)
|
||||||
|
{
|
||||||
|
return getBslContexDefUri((DynamicFeatureAccess)moduleParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBslContexDefUri(StaticFeatureAccess object)
|
||||||
|
{
|
||||||
|
URI uri = null;
|
||||||
|
if (object.getName().equals(THIS_OBJECT) || object.getName().equals(THIS_OBJECT_RU))
|
||||||
|
{
|
||||||
|
uri = EcoreUtil.getURI(object);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uri = getCommonModuleUri(object);
|
||||||
|
}
|
||||||
|
return constructBslCdUri(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBslContexDefUri(DynamicFeatureAccess object)
|
||||||
|
{
|
||||||
|
URI uri = getCommonModuleUri(object);
|
||||||
|
|
||||||
|
return constructBslCdUri(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String constructBslCdUri(URI uri)
|
||||||
|
{
|
||||||
|
if (uri == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return uri.trimFragment().trimFileExtension().appendFileExtension(BSLCD).appendFragment(CD_ROOT).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private URI getCommonModuleUri(DynamicFeatureAccess object)
|
||||||
|
{
|
||||||
|
Environmental environmental = EcoreUtil2.getContainerOfType(object, Environmental.class);
|
||||||
|
|
||||||
|
List<FeatureEntry> features = dynamicFeatureAccessComputer.getLastObject(object, environmental.environments());
|
||||||
|
for (FeatureEntry featureEntry : features)
|
||||||
|
{
|
||||||
|
EObject feature = featureEntry.getFeature();
|
||||||
|
if (feature instanceof Property && ((Property)feature).getName().equals(THIS_OBJECT))
|
||||||
|
{
|
||||||
|
Expression staticFeatureAccess = object.getSource();
|
||||||
|
if (staticFeatureAccess instanceof StaticFeatureAccess)
|
||||||
|
{
|
||||||
|
return getCommonModuleUri((StaticFeatureAccess)staticFeatureAccess);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (feature instanceof Module)
|
||||||
|
{
|
||||||
|
return EcoreUtil.getURI(feature);
|
||||||
|
}
|
||||||
|
else if (feature instanceof CommonModule)
|
||||||
|
{
|
||||||
|
EObject module = (EObject)feature.eGet(MdClassPackage.Literals.COMMON_MODULE__MODULE, false);
|
||||||
|
if (module != null)
|
||||||
|
{
|
||||||
|
return EcoreUtil.getURI(module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private URI getCommonModuleUri(StaticFeatureAccess object)
|
||||||
|
{
|
||||||
|
for (FeatureEntry entry : object.getFeatureEntries())
|
||||||
|
{
|
||||||
|
EObject f = entry.getFeature();
|
||||||
|
if (f instanceof DerivedProperty)
|
||||||
|
{
|
||||||
|
EObject source = ((DerivedProperty)f).getSource();
|
||||||
|
if (source instanceof CommonModule)
|
||||||
|
{
|
||||||
|
return EcoreUtil.getURI((EObject)source.eGet(MdClassPackage.Literals.COMMON_MODULE__MODULE, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -86,6 +86,14 @@ ModuleStructureTopRegionCheck_error_message = Module structure region is not on
|
|||||||
|
|
||||||
ModuleStructureTopRegionCheck_title = Module structure top region
|
ModuleStructureTopRegionCheck_title = Module structure top region
|
||||||
|
|
||||||
|
NotifyDescriptionToServerProcedureCheck_Notify_description_procedure_should_be_export = Notify description procedure should exist and be export
|
||||||
|
|
||||||
|
NotifyDescriptionToServerProcedureCheck_Notify_description_to_Server_procedure = Notify description to Server procedure
|
||||||
|
|
||||||
|
NotifyDescriptionToServerProcedureCheck_description = Notify description to Server procedure
|
||||||
|
|
||||||
|
NotifyDescriptionToServerProcedureCheck_title = Notify description to Server procedure
|
||||||
|
|
||||||
NstrStringLiteralFormatCheck_Check_empty_interface_for_each_language = Check empty interface for each language
|
NstrStringLiteralFormatCheck_Check_empty_interface_for_each_language = Check empty interface for each language
|
||||||
|
|
||||||
NstrStringLiteralFormatCheck_NStr_contains_unknown_language_code__S = NStr contains unknown language code {0}
|
NstrStringLiteralFormatCheck_NStr_contains_unknown_language_code__S = NStr contains unknown language code {0}
|
||||||
|
@ -86,6 +86,14 @@ ModuleStructureTopRegionCheck_error_message = Стандартная облас
|
|||||||
|
|
||||||
ModuleStructureTopRegionCheck_title = Стандартная область структуры модуля верхнеуровневая
|
ModuleStructureTopRegionCheck_title = Стандартная область структуры модуля верхнеуровневая
|
||||||
|
|
||||||
|
NotifyDescriptionToServerProcedureCheck_Notify_description_procedure_should_be_export = Процедура описания оповщения должна существовать и быть экспортной
|
||||||
|
|
||||||
|
NotifyDescriptionToServerProcedureCheck_Notify_description_to_Server_procedure = Описание оповещения на серверную процедуру
|
||||||
|
|
||||||
|
NotifyDescriptionToServerProcedureCheck_description = Описание оповещения на серверную процедуру
|
||||||
|
|
||||||
|
NotifyDescriptionToServerProcedureCheck_title = Описание оповещения на серверную процедуру
|
||||||
|
|
||||||
NstrStringLiteralFormatCheck_Check_empty_interface_for_each_language = Проверять пустой интерфейс для каждого языка
|
NstrStringLiteralFormatCheck_Check_empty_interface_for_each_language = Проверять пустой интерфейс для каждого языка
|
||||||
|
|
||||||
NstrStringLiteralFormatCheck_NStr_contains_unknown_language_code__S = НСтр содержит неизвестный код языка {0}
|
NstrStringLiteralFormatCheck_NStr_contains_unknown_language_code__S = НСтр содержит неизвестный код языка {0}
|
||||||
@ -103,7 +111,6 @@ NstrStringLiteralFormatCheck_NStr_method_should_accept_string_as_first_param =
|
|||||||
NstrStringLiteralFormatCheck_description = НСтр формат строкового литерала
|
NstrStringLiteralFormatCheck_description = НСтр формат строкового литерала
|
||||||
|
|
||||||
NstrStringLiteralFormatCheck_title = НСтр формат строкового литерала
|
NstrStringLiteralFormatCheck_title = НСтр формат строкового литерала
|
||||||
>>>>>>> refs/heads/master
|
|
||||||
|
|
||||||
QueryInLoop_Loop_has_method_with_query__0 = Цикл содержит вызов метода с запросом "{0}"
|
QueryInLoop_Loop_has_method_with_query__0 = Цикл содержит вызов метода с запросом "{0}"
|
||||||
|
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
&AtClient
|
||||||
|
Procedure Noncompliant()
|
||||||
|
|
||||||
|
Notify = new NotifyDescription("NoncompliantNotify", ThisObject);
|
||||||
|
|
||||||
|
Notify = new NotifyDescription("NoncompliantNotify2", ThisObject);
|
||||||
|
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
&AtClient
|
||||||
|
Procedure Compliant()
|
||||||
|
|
||||||
|
Notify = new NotifyDescription("CompliantNotify", ThisObject);
|
||||||
|
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
&AtClient
|
||||||
|
Procedure CompliantNotify() Export
|
||||||
|
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
&AtClient
|
||||||
|
Procedure NoncompliantNotify()
|
||||||
|
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
&AtServer
|
||||||
|
Procedure NoncompliantNotify2() Export
|
||||||
|
|
||||||
|
EndProcedure
|
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
Procedure Noncompliant()
|
||||||
|
|
||||||
|
#If Client Then
|
||||||
|
|
||||||
|
Notify = new NotifyDescription("NoncompliantNotify", ThisObject);
|
||||||
|
|
||||||
|
Notify = new NotifyDescription("NoncompliantNotify2", ThisObject);
|
||||||
|
|
||||||
|
#EndIf
|
||||||
|
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure Noncompliant2()
|
||||||
|
|
||||||
|
#If Client Then
|
||||||
|
|
||||||
|
Notify = new NotifyDescription("NoncompliantNotify", CommonModule.ThisObject);
|
||||||
|
|
||||||
|
Notify = new NotifyDescription("NoncompliantNotify2", CommonModule.ThisObject);
|
||||||
|
|
||||||
|
#EndIf
|
||||||
|
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure NoncompliantNotify()
|
||||||
|
|
||||||
|
EndProcedure
|
||||||
|
|
||||||
|
Procedure NoncompliantNotify2() Export
|
||||||
|
|
||||||
|
EndProcedure
|
@ -0,0 +1,65 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (C) 2021, 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.assertEquals;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com._1c.g5.v8.dt.validation.marker.IExtraInfoKeys;
|
||||||
|
import com._1c.g5.v8.dt.validation.marker.Marker;
|
||||||
|
import com.e1c.v8codestyle.bsl.check.NotifyDescriptionToServerProcedureCheck;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The test of {@link NotifyDescriptionToServerProcedureCheck} check.
|
||||||
|
*
|
||||||
|
* @author Dmitriy Marmyshev
|
||||||
|
*/
|
||||||
|
public class NotifyDescriptionToServerProcedureCheck2Test
|
||||||
|
extends AbstractSingleModuleTestBase
|
||||||
|
{
|
||||||
|
|
||||||
|
public NotifyDescriptionToServerProcedureCheck2Test()
|
||||||
|
{
|
||||||
|
super(NotifyDescriptionToServerProcedureCheck.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test notify description to common module server procedure.
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testCommonModuleServerProcedure() throws Exception
|
||||||
|
{
|
||||||
|
updateModule(FOLDER_RESOURCE + "notify-description-to-server-procedure2.bsl");
|
||||||
|
|
||||||
|
List<Marker> markers = getModuleMarkers();
|
||||||
|
assertEquals(4, markers.size());
|
||||||
|
|
||||||
|
Marker marker = markers.get(0);
|
||||||
|
assertEquals("6", marker.getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||||
|
|
||||||
|
marker = markers.get(1);
|
||||||
|
assertEquals("8", marker.getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||||
|
|
||||||
|
marker = markers.get(2);
|
||||||
|
assertEquals("18", marker.getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||||
|
|
||||||
|
marker = markers.get(3);
|
||||||
|
assertEquals("20", marker.getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (C) 2021, 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.assertEquals;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com._1c.g5.v8.dt.bsl.model.Module;
|
||||||
|
import com._1c.g5.v8.dt.validation.marker.IExtraInfoKeys;
|
||||||
|
import com._1c.g5.v8.dt.validation.marker.Marker;
|
||||||
|
import com.e1c.v8codestyle.bsl.check.NotifyDescriptionToServerProcedureCheck;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The test of {@link NotifyDescriptionToServerProcedureCheck} check.
|
||||||
|
*
|
||||||
|
* @author Dmitriy Marmyshev
|
||||||
|
*/
|
||||||
|
public class NotifyDescriptionToServerProcedureCheckTest
|
||||||
|
extends AbstractSingleModuleTestBase
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final String PROJECT_NAME = "CommonForm";
|
||||||
|
|
||||||
|
private static final String COMMON_FORM_FILE_NAME = "/src/CommonForms/Form/Module.bsl";
|
||||||
|
|
||||||
|
public NotifyDescriptionToServerProcedureCheckTest()
|
||||||
|
{
|
||||||
|
super(NotifyDescriptionToServerProcedureCheck.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getTestConfigurationName()
|
||||||
|
{
|
||||||
|
return PROJECT_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getModuleFileName()
|
||||||
|
{
|
||||||
|
return COMMON_FORM_FILE_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Module getModule()
|
||||||
|
{
|
||||||
|
// do not need this method
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test notify description to local server procedure in form module.
|
||||||
|
*
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testLocalServerProcedure() throws Exception
|
||||||
|
{
|
||||||
|
updateModule(FOLDER_RESOURCE + "notify-description-to-server-procedure.bsl");
|
||||||
|
|
||||||
|
List<Marker> markers = getModuleMarkers();
|
||||||
|
assertEquals(2, markers.size());
|
||||||
|
|
||||||
|
Marker marker = markers.get(0);
|
||||||
|
assertEquals("5", marker.getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||||
|
|
||||||
|
marker = markers.get(1);
|
||||||
|
assertEquals("7", marker.getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user