mirror of
https://github.com/1C-Company/v8-code-style.git
synced 2024-11-28 17:41:06 +02:00
Merge remote-tracking branch 'origin/master' into edt-2022-1
# Conflicts: # bundles/com.e1c.v8codestyle.autosort.ui/META-INF/MANIFEST.MF # bundles/com.e1c.v8codestyle.autosort/META-INF/MANIFEST.MF # bundles/com.e1c.v8codestyle.bsl.ui/META-INF/MANIFEST.MF # bundles/com.e1c.v8codestyle.bsl/META-INF/MANIFEST.MF # bundles/com.e1c.v8codestyle.form/META-INF/MANIFEST.MF # bundles/com.e1c.v8codestyle.md.ui/META-INF/MANIFEST.MF # bundles/com.e1c.v8codestyle.md/META-INF/MANIFEST.MF # bundles/com.e1c.v8codestyle.ql/META-INF/MANIFEST.MF # bundles/com.e1c.v8codestyle.right/META-INF/MANIFEST.MF # bundles/com.e1c.v8codestyle.ui/META-INF/MANIFEST.MF # bundles/com.e1c.v8codestyle/META-INF/MANIFEST.MF
This commit is contained in:
commit
154c4010d9
43
CHANGELOG.md
43
CHANGELOG.md
@ -2,6 +2,43 @@
|
||||
|
||||
[TOC text bullet hierarchy]
|
||||
|
||||
## 0.3.0
|
||||
|
||||
|
||||
### Новые фичи
|
||||
|
||||
|
||||
|
||||
### Новые проверки
|
||||
|
||||
|
||||
|
||||
#### Метаданные
|
||||
- Длина синонима раздела верхнего уровня, отображаемого в интерфейсе, не должна превышать 35 символов
|
||||
- Небезопасное хранение паролей в информационной базе
|
||||
|
||||
#### Формы
|
||||
- У реквизита "Ссылка" динамического списка выключен признак "Использовать всегда"
|
||||
|
||||
|
||||
#### Код модулей
|
||||
- Избыточное обращение внутри модуля через его имя или псевдоним ЭтотОбъект (к методу, свойству или реквизиту)
|
||||
|
||||
|
||||
#### Запросы
|
||||
|
||||
|
||||
|
||||
#### Права ролей
|
||||
|
||||
|
||||
|
||||
### Новые быстрые исправления (Quick-fix)
|
||||
|
||||
|
||||
|
||||
### Исправленные ошибки
|
||||
|
||||
|
||||
## 0.2.0
|
||||
|
||||
@ -24,8 +61,6 @@
|
||||
- Клиентский общий модуль с повторно используемыми значениями должен именоваться с постфиксом "КлиентПовтИсп"
|
||||
- Общий модуль ВызовСервера с повторно используемыми значениями должен именоваться с постфиксом "ВызовСервераПовтИсп"
|
||||
|
||||
#### Формы
|
||||
|
||||
#### Код модулей
|
||||
|
||||
- Использован метод "РольДоступна()"
|
||||
@ -53,10 +88,6 @@
|
||||
- Для проверок dynamic-access-method-not-found и property-return-type добавлена возможность исключения по типам (COM-Объекты)
|
||||
- Проверка типов invocation-parameter-type-intersect проверяет типы элементов коллекций: Массив, Соотвествие, СписокЗначений
|
||||
|
||||
#### Запросы
|
||||
|
||||
#### Права ролей
|
||||
|
||||
### Новые быстрые исправления (Quick-fix)
|
||||
|
||||
- Удаление аннотации строгой типизации из модуля
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
| Версия | P2-репозиторий | ZIP-архив репозитория |
|
||||
|--------|----------------|-----------------------|
|
||||
| 0.3.0 для 1C:EDT 2022.1 | https://edt.1c.ru/downloads/releases/plugins/v8-code-style/edt-2022.1/0.3.0/repo/ | https://edt.1c.ru/downloads/releases/plugins/v8-code-style/edt-2022.1/0.3.0/repo.zip |
|
||||
| 0.2.0 для 1C:EDT 2021.3 | https://edt.1c.ru/downloads/releases/plugins/v8-code-style/edt-2021.3/0.2.0/repo/ | https://edt.1c.ru/downloads/releases/plugins/v8-code-style/edt-2021.3/0.2.0/repo.zip |
|
||||
| 0.1.0 для 1C:EDT 2021.2 | https://edt.1c.ru/downloads/releases/plugins/v8-code-style/edt-2021.2/0.1.0/repo/ | https://edt.1c.ru/downloads/releases/plugins/v8-code-style/edt-2021.2/0.1.0/repo.zip |
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bom</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>BOM</name>
|
||||
@ -104,7 +104,7 @@
|
||||
<artifact>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>default</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</artifact>
|
||||
</target>
|
||||
<environments>
|
||||
|
@ -12,9 +12,9 @@
|
||||
# 1C-Soft LLC - initial API and implementation
|
||||
#*******************************************************************************
|
||||
|
||||
current_version='0.1.0'
|
||||
new_version='0.2.0'
|
||||
next_version='0.3.0'
|
||||
current_version='0.2.0'
|
||||
new_version='0.3.0'
|
||||
next_version='0.4.0'
|
||||
|
||||
find . -name 'pom.xml' -exec sed -i '' "s/${current_version}-SNAPSHOT/${new_version}-SNAPSHOT/g" {} +
|
||||
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.autosort.ui;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Activator: com.e1c.v8codestyle.internal.autosort.ui.UiPlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.ui;bundle-version="[3.118.0,4.0.0)",
|
||||
|
@ -19,9 +19,9 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bundles</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.autosort.ui</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.autosort;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Activator: com.e1c.v8codestyle.internal.autosort.AutoSortPlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.13.0,4.0.0)",
|
||||
|
@ -19,9 +19,9 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bundles</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.autosort</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
@ -13,7 +13,7 @@
|
||||
###############################################################################
|
||||
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
|
||||
|
||||
AutoSortProjectOptionProvider_description = Позволяет автоматически сортировать верхенуровневые объекты метаданных конфигурации при добавлении нового или переименовании существующего.
|
||||
AutoSortProjectOptionProvider_description = Позволяет автоматически сортировать верхнеуровневые объекты метаданных конфигурации при добавлении нового или переименовании существующего.
|
||||
|
||||
AutoSortProjectOptionProvider_presentation = Авто-сортировка верхнеуровневых объектов конфигурации
|
||||
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.bsl.ui;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Activator: com.e1c.v8codestyle.internal.bsl.ui.UiPlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.ui;bundle-version="[3.119.0,4.0.0)",
|
||||
|
@ -349,6 +349,18 @@
|
||||
<fix class="com.e1c.v8codestyle.internal.bsl.ui.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.ui.qfix.UndefinedMethodFix"/>
|
||||
<fix class="com.e1c.v8codestyle.internal.bsl.ui.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.ui.qfix.UndefinedFunctionFix"/>
|
||||
<fix class="com.e1c.v8codestyle.internal.bsl.ui.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.ui.qfix.UndefinedVariableFix"/>
|
||||
<fix
|
||||
class="com.e1c.v8codestyle.internal.bsl.ui.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.ui.qfix.SelfReferenceFix">
|
||||
</fix>
|
||||
<fix
|
||||
class="com.e1c.v8codestyle.internal.bsl.ui.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.ui.qfix.FormSelfReferenceOutdatedFix">
|
||||
</fix>
|
||||
<fix
|
||||
class="com.e1c.v8codestyle.internal.bsl.ui.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.ui.qfix.CommonModuleNamedSelfReferenceFix">
|
||||
</fix>
|
||||
<fix
|
||||
class="com.e1c.v8codestyle.internal.bsl.ui.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.ui.qfix.ManagerModuleNamedSelfReferenceFix">
|
||||
</fix>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
@ -19,9 +19,9 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bundles</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.bsl.ui</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
@ -0,0 +1,57 @@
|
||||
/*******************************************************************************
|
||||
* 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.bsl.ui.qfix;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.text.edits.DeleteEdit;
|
||||
import org.eclipse.text.edits.TextEdit;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
|
||||
import com._1c.g5.v8.dt.bsl.model.StaticFeatureAccess;
|
||||
import com.e1c.g5.v8.dt.check.qfix.components.QuickFix;
|
||||
import com.e1c.v8codestyle.bsl.qfix.external.IXtextBslModuleFixModel;
|
||||
import com.e1c.v8codestyle.bsl.qfix.external.SingleVariantXtextBslModuleFix;
|
||||
|
||||
/**
|
||||
* Quick fix for check com.e1c.v8codestyle.bsl.check:common-module-named-self-reference
|
||||
*
|
||||
* @author Maxim Galios
|
||||
*
|
||||
*/
|
||||
@QuickFix(checkId = "common-module-named-self-reference", supplierId = "com.e1c.v8codestyle.bsl")
|
||||
public class CommonModuleNamedSelfReferenceFix
|
||||
extends SingleVariantXtextBslModuleFix
|
||||
{
|
||||
@Override
|
||||
protected void configureFix(FixConfigurer configurer)
|
||||
{
|
||||
configurer.interactive(true)
|
||||
.description(Messages.CommonModuleNamedSelfReferenceFix_description)
|
||||
.details(Messages.CommonModuleNamedSelfReferenceFix_details);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextEdit fixIssue(XtextResource state, IXtextBslModuleFixModel model) throws BadLocationException
|
||||
{
|
||||
EObject element = model.getElement();
|
||||
if (!(element instanceof StaticFeatureAccess))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
INode node = NodeModelUtils.findActualNodeFor(element);
|
||||
return new DeleteEdit(node.getOffset(), node.getLength() + 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/*******************************************************************************
|
||||
* 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.bsl.ui.qfix;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.text.edits.ReplaceEdit;
|
||||
import org.eclipse.text.edits.TextEdit;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
|
||||
import com._1c.g5.v8.dt.bsl.model.StaticFeatureAccess;
|
||||
import com.e1c.g5.v8.dt.check.qfix.components.QuickFix;
|
||||
import com.e1c.v8codestyle.bsl.qfix.external.IXtextBslModuleFixModel;
|
||||
import com.e1c.v8codestyle.bsl.qfix.external.SingleVariantXtextBslModuleFix;
|
||||
|
||||
/**
|
||||
* Quick fix for check com.e1c.v8codestyle.bsl.check:form-self-reference-outdated
|
||||
*
|
||||
* @author Maxim Galios
|
||||
*
|
||||
*/
|
||||
@QuickFix(checkId = "form-self-reference", supplierId = "com.e1c.v8codestyle.bsl")
|
||||
public class FormSelfReferenceOutdatedFix
|
||||
extends SingleVariantXtextBslModuleFix
|
||||
{
|
||||
private static final String OUTDATED_SELF_REFERENCE = "ThisForm"; //$NON-NLS-1$
|
||||
|
||||
private static final String SELF_REFERENCE = "ThisObject"; //$NON-NLS-1$
|
||||
private static final String SELF_REFERENCE_RU = "ЭтотОбъект"; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
protected void configureFix(FixConfigurer configurer)
|
||||
{
|
||||
configurer.interactive(true)
|
||||
.description(Messages.FormSelfReferenceOutdatedFix_description)
|
||||
.details(Messages.FormSelfReferenceOutdatedFix_details);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextEdit fixIssue(XtextResource state, IXtextBslModuleFixModel model) throws BadLocationException
|
||||
{
|
||||
EObject element = model.getElement();
|
||||
if (!(element instanceof StaticFeatureAccess))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
StaticFeatureAccess staticFeatureAccess = (StaticFeatureAccess) element;
|
||||
String name = staticFeatureAccess.getName();
|
||||
|
||||
String replacement = name.equals(OUTDATED_SELF_REFERENCE) ? SELF_REFERENCE : SELF_REFERENCE_RU;
|
||||
INode node = NodeModelUtils.findActualNodeFor(element);
|
||||
return new ReplaceEdit(node.getOffset(), node.getLength(), replacement);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*******************************************************************************
|
||||
* 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.bsl.ui.qfix;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.text.edits.DeleteEdit;
|
||||
import org.eclipse.text.edits.TextEdit;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
|
||||
import com._1c.g5.v8.dt.bsl.model.DynamicFeatureAccess;
|
||||
import com.e1c.g5.v8.dt.check.qfix.components.QuickFix;
|
||||
import com.e1c.v8codestyle.bsl.qfix.external.IXtextBslModuleFixModel;
|
||||
import com.e1c.v8codestyle.bsl.qfix.external.SingleVariantXtextBslModuleFix;
|
||||
|
||||
/**
|
||||
* Quick fix for check com.e1c.v8codestyle.bsl.check:common-module-named-self-reference
|
||||
*
|
||||
* @author Maxim Galios
|
||||
*
|
||||
*/
|
||||
@QuickFix(checkId = "manager-module-named-self-reference", supplierId = "com.e1c.v8codestyle.bsl")
|
||||
public class ManagerModuleNamedSelfReferenceFix
|
||||
extends SingleVariantXtextBslModuleFix
|
||||
{
|
||||
@Override
|
||||
protected void configureFix(FixConfigurer configurer)
|
||||
{
|
||||
configurer.interactive(true)
|
||||
.description(Messages.ManagerModuleNamedSelfReferenceFix_description)
|
||||
.details(Messages.ManagerModuleNamedSelfReferenceFix_details);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextEdit fixIssue(XtextResource state, IXtextBslModuleFixModel model) throws BadLocationException
|
||||
{
|
||||
EObject element = model.getElement();
|
||||
if (!(element instanceof DynamicFeatureAccess))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
INode node = NodeModelUtils.findActualNodeFor(element);
|
||||
return new DeleteEdit(node.getOffset(), node.getLength() + 1);
|
||||
}
|
||||
}
|
@ -24,10 +24,26 @@ final class Messages
|
||||
{
|
||||
private static final String BUNDLE_NAME = "com.e1c.v8codestyle.bsl.ui.qfix.messages"; //$NON-NLS-1$
|
||||
|
||||
public static String CommonModuleNamedSelfReferenceFix_description;
|
||||
|
||||
public static String CommonModuleNamedSelfReferenceFix_details;
|
||||
|
||||
public static String FormSelfReferenceOutdatedFix_description;
|
||||
|
||||
public static String FormSelfReferenceOutdatedFix_details;
|
||||
|
||||
public static String ManagerModuleNamedSelfReferenceFix_description;
|
||||
|
||||
public static String ManagerModuleNamedSelfReferenceFix_details;
|
||||
|
||||
public static String OpenBslDocCommentViewFix_Description;
|
||||
|
||||
public static String OpenBslDocCommentViewFix_Details;
|
||||
|
||||
public static String SelfReferenceFix_description;
|
||||
|
||||
public static String SelfReferenceFix_details;
|
||||
|
||||
public static String UndefinedMethodFix_func_title;
|
||||
public static String UndefinedMethodFix_func_desc;
|
||||
public static String UndefinedMethodFix_proc_title;
|
||||
|
@ -0,0 +1,59 @@
|
||||
/*******************************************************************************
|
||||
* 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.bsl.ui.qfix;
|
||||
|
||||
import org.eclipse.emf.ecore.EObject;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.text.edits.DeleteEdit;
|
||||
import org.eclipse.text.edits.TextEdit;
|
||||
import org.eclipse.xtext.nodemodel.INode;
|
||||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
|
||||
import org.eclipse.xtext.resource.XtextResource;
|
||||
|
||||
import com._1c.g5.v8.dt.bsl.model.StaticFeatureAccess;
|
||||
import com.e1c.g5.v8.dt.check.qfix.components.QuickFix;
|
||||
import com.e1c.v8codestyle.bsl.qfix.external.IXtextBslModuleFixModel;
|
||||
import com.e1c.v8codestyle.bsl.qfix.external.SingleVariantXtextBslModuleFix;
|
||||
|
||||
/**
|
||||
* Quick fix for check com.e1c.v8codestyle.bsl.check:self-reference
|
||||
*
|
||||
* @author Maxim Galios
|
||||
*
|
||||
*/
|
||||
@QuickFix(checkId = "module-self-reference", supplierId = "com.e1c.v8codestyle.bsl")
|
||||
public class SelfReferenceFix
|
||||
extends SingleVariantXtextBslModuleFix
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void configureFix(FixConfigurer configurer)
|
||||
{
|
||||
configurer.interactive(true)
|
||||
.description(Messages.SelfReferenceFix_description)
|
||||
.details(Messages.SelfReferenceFix_details);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextEdit fixIssue(XtextResource state, IXtextBslModuleFixModel model) throws BadLocationException
|
||||
{
|
||||
EObject element = model.getElement();
|
||||
if (!(element instanceof StaticFeatureAccess))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
INode node = NodeModelUtils.findActualNodeFor(element);
|
||||
return new DeleteEdit(node.getOffset(), node.getLength() + 1);
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,3 @@
|
||||
OpenBslDocCommentViewFix_Details=Open documentation comment data structure view and show current probleme object.
|
||||
|
||||
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
|
||||
###############################################################################
|
||||
# Copyright (C) 2022, 1C-Soft LLC and others.
|
||||
@ -15,7 +13,16 @@ OpenBslDocCommentViewFix_Details=Open documentation comment data structure view
|
||||
# Vadim Geraskin - initial contibution
|
||||
###############################################################################
|
||||
|
||||
CommonModuleNamedSelfReferenceFix_details=Remove excessive named self reference in common module
|
||||
CommonModuleNamedSelfReferenceFix_description=Remove excessive named self reference
|
||||
FormSelfReferenceOutdatedFix_description=Replace outdated self reference
|
||||
FormSelfReferenceOutdatedFix_details=Replace outdated "ThisForm" alias with "ThisObject" alias
|
||||
ManagerModuleNamedSelfReferenceFix_description=Remove excessive named self reference
|
||||
ManagerModuleNamedSelfReferenceFix_details=Remove excessive named self reference from manager module
|
||||
OpenBslDocCommentViewFix_Details=Open documentation comment data structure view and show current probleme object.
|
||||
OpenBslDocCommentViewFix_Description=Open documentation comment structure view
|
||||
SelfReferenceFix_description=Remove excessive self reference
|
||||
SelfReferenceFix_details=Remove excessive self reference
|
||||
UndefinedMethodFix_func_title=Create function
|
||||
UndefinedMethodFix_func_desc=Create a new function in the module
|
||||
UndefinedMethodFix_proc_title=Create procedure
|
||||
|
@ -13,10 +13,22 @@
|
||||
# Vadim Geraskin - initial contibution
|
||||
###############################################################################
|
||||
|
||||
CommonModuleNamedSelfReferenceFix_details=Удалить избыточное обращение внутри общего модуля по имени
|
||||
|
||||
CommonModuleNamedSelfReferenceFix_description=Удалить избыточное обращение внутри модуля по имени
|
||||
|
||||
FormSelfReferenceOutdatedFix_description=Заменить устаревшее обращение
|
||||
|
||||
FormSelfReferenceOutdatedFix_details=Заменить устаревший псевдоним "ЭтаФорма" на псевдоним "ЭтотОбъект"
|
||||
|
||||
OpenBslDocCommentViewFix_Description = Открыть панель структуры документирующего комментария
|
||||
|
||||
OpenBslDocCommentViewFix_Details = Открыть панель структуры документирующего комментария и показать текущий проблемный объект.
|
||||
|
||||
SelfReferenceFix_description=Удалить избыточное обращение внутри модуля через псевдоним "ЭтотОбъект"
|
||||
|
||||
SelfReferenceFix_details=Удалить избыточное обращение внутри модуля через псевдоним "ЭтотОбъект"
|
||||
|
||||
UndefinedMethodFix_func_desc = Создать новую функцию в модуле
|
||||
|
||||
UndefinedMethodFix_func_title = Создать функцию
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.bsl;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Activator: com.e1c.v8codestyle.internal.bsl.BslPlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
@ -0,0 +1,47 @@
|
||||
# Excessive named self reference in common module
|
||||
|
||||
Excessive usage of named self reference in common module (when referencing method, property or attribute).
|
||||
For cached modules self reference is allowed.
|
||||
|
||||
## Noncompliant Code Example
|
||||
|
||||
Inside common module named "MyModule":
|
||||
|
||||
```bsl
|
||||
Var myParam;
|
||||
|
||||
Function test() Export
|
||||
// code here
|
||||
EndFunction
|
||||
|
||||
MyModule.myParam = MyModule.test();
|
||||
```
|
||||
|
||||
## Compliant Solution
|
||||
|
||||
Inside common module named "MyModule":
|
||||
|
||||
```bsl
|
||||
Var myParam;
|
||||
|
||||
Function test() Export
|
||||
// code here
|
||||
EndFunction
|
||||
|
||||
myParam = test();
|
||||
```
|
||||
|
||||
Inside common module named "MyModuleCached":
|
||||
|
||||
```bsl
|
||||
Var myParam;
|
||||
|
||||
Function test() Export
|
||||
// code here
|
||||
EndFunction
|
||||
|
||||
myParam = MyModuleCached.test();
|
||||
```
|
||||
|
||||
## See
|
||||
|
@ -0,0 +1,30 @@
|
||||
# Outdated alias used
|
||||
|
||||
Usage of outdated self reference `ThisForm` (when referencing method, property or attribute)
|
||||
|
||||
## Noncompliant Code Example
|
||||
|
||||
```bsl
|
||||
Var myParam;
|
||||
|
||||
Function test() Export
|
||||
// code here
|
||||
EndFunction
|
||||
|
||||
ThisForm.myParam = ThisForm.test();
|
||||
```
|
||||
|
||||
## Compliant Solution
|
||||
|
||||
```bsl
|
||||
Var myParam;
|
||||
|
||||
Function test() Export
|
||||
// code here
|
||||
EndFunction
|
||||
|
||||
ThisObject.myParam = ThisObject.test();
|
||||
```
|
||||
|
||||
## See
|
||||
|
@ -0,0 +1,34 @@
|
||||
# Excessive named self reference in manager module
|
||||
|
||||
Excessive usage of named self reference in manager module (when referencing method, property or attribute).
|
||||
|
||||
## Noncompliant Code Example
|
||||
|
||||
Inside Catalog manager module named "MyCatalog":
|
||||
|
||||
```bsl
|
||||
Var myParam;
|
||||
|
||||
Function test() Export
|
||||
// code here
|
||||
EndFunction
|
||||
|
||||
Catalog.MyCatalog.myParam = Catalog.MyCatalog.test();
|
||||
```
|
||||
|
||||
## Compliant Solution
|
||||
|
||||
Inside Catalog manager module named "MyCatalog":
|
||||
|
||||
```bsl
|
||||
Var myParam;
|
||||
|
||||
Function test() Export
|
||||
// code here
|
||||
EndFunction
|
||||
|
||||
myParam = test();
|
||||
```
|
||||
|
||||
## See
|
||||
|
@ -0,0 +1,33 @@
|
||||
# Self reference is excessive
|
||||
|
||||
Excessive usage of self reference with use of `ThisObject` (when referencing method, property or attribute)
|
||||
|
||||
For form modules only check self reference for methods and existing properties
|
||||
(if `Check only existing form properties` parameter is set, otherwise, check for all cases)
|
||||
|
||||
## Noncompliant Code Example
|
||||
|
||||
```bsl
|
||||
Var myParam;
|
||||
|
||||
Function test() Export
|
||||
// code here
|
||||
EndFunction
|
||||
|
||||
ThisObject.myParam = ThisObject.test();
|
||||
```
|
||||
|
||||
## Compliant Solution
|
||||
|
||||
```bsl
|
||||
Var myParam;
|
||||
|
||||
Function test() Export
|
||||
// code here
|
||||
EndFunction
|
||||
|
||||
myParam = test();
|
||||
```
|
||||
|
||||
## See
|
||||
|
@ -0,0 +1,46 @@
|
||||
# Избыточное обращение по собственному имени внутри общего модуля
|
||||
|
||||
Избыточное обращение по собственному имени внутри общего модуля (к методу, свойству или реквизиту)
|
||||
|
||||
Для модулей с повторным использованием возвращаемых значений обращение по собственному имени разрешено
|
||||
|
||||
## Неправильно
|
||||
|
||||
Внутри модуля с именем "МойМодуль":
|
||||
```bsl
|
||||
Парам мояПеременная;
|
||||
|
||||
Функция тест() Экспорт
|
||||
// код
|
||||
КонецФункции
|
||||
|
||||
МойМодуль.мояПеременная = МойМодуль.тест();
|
||||
```
|
||||
|
||||
## Правильно
|
||||
|
||||
Внутри модуля с именем "МойМодуль":
|
||||
|
||||
```bsl
|
||||
Парам мояПеременная;
|
||||
|
||||
Функция тест() Экспорт
|
||||
// код
|
||||
КонецФункции
|
||||
|
||||
мояПеременная = тест();
|
||||
```
|
||||
|
||||
Внутри модуля с именем "МойМодульПовтИсп":
|
||||
|
||||
```bsl
|
||||
Парам мояПеременная;
|
||||
|
||||
Функция тест() Экспорт
|
||||
// код
|
||||
КонецФункции
|
||||
|
||||
мояПеременная = МойМодульПовтИсп.тест();
|
||||
```
|
||||
|
||||
## См.
|
@ -6,5 +6,21 @@
|
||||
|
||||
## Правильно
|
||||
|
||||
```bsl
|
||||
// Описание обработки для регистрации как внешней
|
||||
//
|
||||
// Возвращаемое значение:
|
||||
// Структура:
|
||||
// * Вид - Строка
|
||||
// * Назначение - Массив Из Строка
|
||||
// * Наименование - Строка
|
||||
// * БезопасныйРежим - Булево
|
||||
// * Версия - Строка
|
||||
// * Информация - Строка
|
||||
// * Команды - ТаблицаЗначений
|
||||
//
|
||||
Функция СведенияОВнешнейОбработке() Экспорт
|
||||
```
|
||||
|
||||
## См.
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
# Использование устаревшего псевдонима
|
||||
|
||||
Следует использовать псевдоним "ЭтотОбъект" вместо устаревшего "ЭтаФорма" в модуле формы
|
||||
|
||||
## Неправильно
|
||||
|
||||
```bsl
|
||||
Парам мояПеременная;
|
||||
|
||||
Функция тест() Экспорт
|
||||
// код
|
||||
КонецФункции
|
||||
|
||||
ЭтаФорма.мояПеременная = ЭтаФорма.тест();
|
||||
```
|
||||
|
||||
## Правильно
|
||||
|
||||
```bsl
|
||||
Парам мояПеременная;
|
||||
|
||||
Функция тест() Экспорт
|
||||
// код
|
||||
КонецФункции
|
||||
|
||||
ЭтотОбъект.мояПеременная = ЭтотОбъект.тест();
|
||||
```
|
||||
|
||||
## См.
|
@ -0,0 +1,32 @@
|
||||
# Избыточное обращение по собственному имени внутри модуля менеджера
|
||||
|
||||
Избыточное обращение по собственному имени внутри модуля менеджера (к методу, свойству или реквизиту)
|
||||
|
||||
## Неправильно
|
||||
|
||||
Внутри модуля модуля менеджера типа Справочники с именем "МойСправочник":
|
||||
```bsl
|
||||
Парам мояПеременная;
|
||||
|
||||
Функция тест() Экспорт
|
||||
// код
|
||||
КонецФункции
|
||||
|
||||
Справочники.МойСправочник.мояПеременная = Справочники.МойСправочник.тест();
|
||||
```
|
||||
|
||||
## Правильно
|
||||
|
||||
Внутри модуля модуля менеджера типа Справочники с именем "МойСправочник":
|
||||
|
||||
```bsl
|
||||
Парам мояПеременная;
|
||||
|
||||
Функция тест() Экспорт
|
||||
// код
|
||||
КонецФункции
|
||||
|
||||
мояПеременная = тест();
|
||||
```
|
||||
|
||||
## См.
|
@ -0,0 +1,32 @@
|
||||
# Избыточное использование псевдонима "ЭтотОбъект"
|
||||
|
||||
Избыточное обращение внутри модуля через псевдоним "ЭтотОбъект" (к методу, свойству или реквизиту)
|
||||
|
||||
Для модулей форм проверяется только обращение к методам и существующим свойствам
|
||||
(в случае если установлен параметр `Проверять только существовующие свойства в форме`, инчае проверяются все случаи)
|
||||
|
||||
## Неправильно
|
||||
|
||||
```bsl
|
||||
Парам мояПеременная;
|
||||
|
||||
Функция тест() Экспорт
|
||||
// код
|
||||
КонецФункции
|
||||
|
||||
ЭтотОбъект.мояПеременная = ЭтотОбъект.тест();
|
||||
```
|
||||
|
||||
## Правильно
|
||||
|
||||
```bsl
|
||||
Парам мояПеременная;
|
||||
|
||||
Функция тест() Экспорт
|
||||
// код
|
||||
КонецФункции
|
||||
|
||||
мояПеременная = тест();
|
||||
```
|
||||
|
||||
## См.
|
@ -239,6 +239,22 @@
|
||||
category="com.e1c.v8codestyle.bsl"
|
||||
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.check.LockOutOfTryCheck">
|
||||
</check>
|
||||
<check
|
||||
category="com.e1c.v8codestyle.bsl"
|
||||
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.check.SelfReferenceCheck">
|
||||
</check>
|
||||
<check
|
||||
category="com.e1c.v8codestyle.bsl"
|
||||
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.check.FormSelfReferenceOutdatedCheck">
|
||||
</check>
|
||||
<check
|
||||
category="com.e1c.v8codestyle.bsl"
|
||||
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.check.CommonModuleNamedSelfReferenceCheck">
|
||||
</check>
|
||||
<check
|
||||
category="com.e1c.v8codestyle.bsl"
|
||||
class="com.e1c.v8codestyle.internal.bsl.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.check.ManagerModuleNamedSelfReferenceCheck">
|
||||
</check>
|
||||
|
||||
</extension>
|
||||
<extension
|
||||
|
@ -19,10 +19,10 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bundles</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.bsl</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
|
@ -0,0 +1,96 @@
|
||||
/*******************************************************************************
|
||||
* 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.bsl.check;
|
||||
|
||||
import static com._1c.g5.v8.dt.bsl.model.BslPackage.Literals.DYNAMIC_FEATURE_ACCESS;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.xtext.EcoreUtil2;
|
||||
|
||||
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.Module;
|
||||
import com._1c.g5.v8.dt.bsl.model.ModuleType;
|
||||
import com._1c.g5.v8.dt.bsl.model.StaticFeatureAccess;
|
||||
import com._1c.g5.v8.dt.common.StringUtils;
|
||||
import com._1c.g5.v8.dt.metadata.mdclass.CommonModule;
|
||||
import com._1c.g5.v8.dt.metadata.mdclass.ReturnValuesReuse;
|
||||
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;
|
||||
import com.e1c.v8codestyle.check.StandardCheckExtension;
|
||||
import com.e1c.v8codestyle.internal.bsl.BslPlugin;
|
||||
|
||||
/**
|
||||
* Check self references by name in common modules.
|
||||
* Modules with "ПовтИсп/Cached" in name can be self referenced.
|
||||
*
|
||||
* @author Maxim Galios
|
||||
*
|
||||
*/
|
||||
public class CommonModuleNamedSelfReferenceCheck
|
||||
extends BasicCheck
|
||||
{
|
||||
private static final String CHECK_ID = "common-module-named-self-reference"; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
public String getCheckId()
|
||||
{
|
||||
return CHECK_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureCheck(CheckConfigurer builder)
|
||||
{
|
||||
builder.title(Messages.CommonModuleNamedSelfReferenceCheck_title)
|
||||
.description(Messages.CommonModuleNamedSelfReferenceCheck_description)
|
||||
.complexity(CheckComplexity.NORMAL)
|
||||
.severity(IssueSeverity.MINOR)
|
||||
.issueType(IssueType.CODE_STYLE)
|
||||
.extension(new StandardCheckExtension(getCheckId(), BslPlugin.PLUGIN_ID))
|
||||
.module()
|
||||
.checkedObjectType(DYNAMIC_FEATURE_ACCESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
|
||||
IProgressMonitor monitor)
|
||||
{
|
||||
Expression featureAccessSource = ((DynamicFeatureAccess)object).getSource();
|
||||
if (monitor.isCanceled() || !(featureAccessSource instanceof StaticFeatureAccess))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StaticFeatureAccess source = (StaticFeatureAccess)featureAccessSource;
|
||||
|
||||
if (isReferenceExcessive(source))
|
||||
{
|
||||
resultAceptor.addIssue(Messages.CommonModuleNamedSelfReferenceCheck_issue, source);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isReferenceExcessive(StaticFeatureAccess source)
|
||||
{
|
||||
Module module = EcoreUtil2.getContainerOfType(source, Module.class);
|
||||
if (module.getModuleType() != ModuleType.COMMON_MODULE)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
CommonModule commonModule = (CommonModule)module.getOwner();
|
||||
return (commonModule.getReturnValuesReuse() == ReturnValuesReuse.DONT_USE)
|
||||
&& StringUtils.equals(commonModule.getName(), source.getName());
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
/*******************************************************************************
|
||||
* 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.bsl.check;
|
||||
|
||||
import static com._1c.g5.v8.dt.bsl.model.BslPackage.Literals.DYNAMIC_FEATURE_ACCESS;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.xtext.EcoreUtil2;
|
||||
|
||||
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.Module;
|
||||
import com._1c.g5.v8.dt.bsl.model.ModuleType;
|
||||
import com._1c.g5.v8.dt.bsl.model.StaticFeatureAccess;
|
||||
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;
|
||||
import com.e1c.v8codestyle.check.StandardCheckExtension;
|
||||
import com.e1c.v8codestyle.internal.bsl.BslPlugin;
|
||||
|
||||
/**
|
||||
* Check oudated self references in from modules. Outdated are references with "ЭтаФорма/ThisForm".
|
||||
*
|
||||
* @author Maxim Galios
|
||||
*
|
||||
*/
|
||||
public class FormSelfReferenceOutdatedCheck
|
||||
extends BasicCheck
|
||||
{
|
||||
private static final String CHECK_ID = "form-self-reference"; //$NON-NLS-1$
|
||||
|
||||
private static final Collection<String> OUTDATED_ALIASES = Set.of("ЭтаФорма", "ThisForm"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
@Override
|
||||
public String getCheckId()
|
||||
{
|
||||
return CHECK_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureCheck(CheckConfigurer builder)
|
||||
{
|
||||
builder.title(Messages.FormSelfReferenceOutdatedCheck_Title)
|
||||
.description(Messages.FormSelfReferenceOutdatedCheck_Description)
|
||||
.complexity(CheckComplexity.NORMAL)
|
||||
.severity(IssueSeverity.MINOR)
|
||||
.issueType(IssueType.CODE_STYLE)
|
||||
.extension(new StandardCheckExtension(getCheckId(), BslPlugin.PLUGIN_ID))
|
||||
.module()
|
||||
.checkedObjectType(DYNAMIC_FEATURE_ACCESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
|
||||
IProgressMonitor monitor)
|
||||
{
|
||||
Expression featureAccessSource = ((DynamicFeatureAccess)object).getSource();
|
||||
if (monitor.isCanceled() || !(featureAccessSource instanceof StaticFeatureAccess))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StaticFeatureAccess source = (StaticFeatureAccess)featureAccessSource;
|
||||
|
||||
if (isAliasOutdated(source))
|
||||
{
|
||||
resultAceptor.addIssue(Messages.FormSelfReferenceOutdatedCheck_Issue, source);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAliasOutdated(StaticFeatureAccess source)
|
||||
{
|
||||
Module module = EcoreUtil2.getContainerOfType(source, Module.class);
|
||||
return module.getModuleType() == ModuleType.FORM_MODULE && OUTDATED_ALIASES.contains(source.getName());
|
||||
}
|
||||
}
|
@ -0,0 +1,123 @@
|
||||
/*******************************************************************************
|
||||
* 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.bsl.check;
|
||||
|
||||
import static com._1c.g5.v8.dt.bsl.model.BslPackage.Literals.DYNAMIC_FEATURE_ACCESS;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.xtext.EcoreUtil2;
|
||||
import org.eclipse.xtext.naming.IQualifiedNameProvider;
|
||||
import org.eclipse.xtext.resource.IResourceServiceProvider;
|
||||
|
||||
import com._1c.g5.v8.dt.bsl.documentation.comment.LinkPart;
|
||||
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.Module;
|
||||
import com._1c.g5.v8.dt.bsl.model.ModuleType;
|
||||
import com._1c.g5.v8.dt.bsl.model.StaticFeatureAccess;
|
||||
import com._1c.g5.v8.dt.common.StringUtils;
|
||||
import com._1c.g5.v8.dt.lcore.util.CaseInsensitiveString;
|
||||
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;
|
||||
import com.e1c.v8codestyle.check.StandardCheckExtension;
|
||||
import com.e1c.v8codestyle.internal.bsl.BslPlugin;
|
||||
|
||||
/**
|
||||
* CHeck self reference by name in manager modules.
|
||||
*
|
||||
* @author Maxim Galios
|
||||
*
|
||||
*/
|
||||
public class ManagerModuleNamedSelfReferenceCheck
|
||||
extends BasicCheck
|
||||
{
|
||||
private static final String CHECK_ID = "manager-module-named-self-reference"; //$NON-NLS-1$
|
||||
|
||||
private IQualifiedNameProvider bslQualifiedNameProvider;
|
||||
|
||||
@Override
|
||||
public String getCheckId()
|
||||
{
|
||||
return CHECK_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureCheck(CheckConfigurer builder)
|
||||
{
|
||||
builder.title(Messages.ManagerModuleNamedSelfReferenceCheck_title)
|
||||
.description(Messages.ManagerModuleNamedSelfReferenceCheck_description)
|
||||
.complexity(CheckComplexity.NORMAL)
|
||||
.severity(IssueSeverity.MINOR)
|
||||
.issueType(IssueType.CODE_STYLE)
|
||||
.extension(new StandardCheckExtension(getCheckId(), BslPlugin.PLUGIN_ID))
|
||||
.module()
|
||||
.checkedObjectType(DYNAMIC_FEATURE_ACCESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
|
||||
IProgressMonitor monitor)
|
||||
{
|
||||
Expression featureAccessSource = ((DynamicFeatureAccess)object).getSource();
|
||||
Module module = EcoreUtil2.getContainerOfType(featureAccessSource, Module.class);
|
||||
|
||||
if (monitor.isCanceled() || !(featureAccessSource instanceof DynamicFeatureAccess)
|
||||
|| module.getModuleType() != ModuleType.MANAGER_MODULE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DynamicFeatureAccess source = (DynamicFeatureAccess)featureAccessSource;
|
||||
|
||||
Expression managerTypeExpression = source.getSource();
|
||||
if (monitor.isCanceled() || !(managerTypeExpression instanceof StaticFeatureAccess))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StaticFeatureAccess managerType = (StaticFeatureAccess)managerTypeExpression;
|
||||
|
||||
if (isManagerTypeValid(managerType) && isReferenceExcessive(source, module))
|
||||
{
|
||||
resultAceptor.addIssue(Messages.ManagerModuleNamedSelfReferenceCheck_issue, source);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isManagerTypeValid(StaticFeatureAccess managerType)
|
||||
{
|
||||
CaseInsensitiveString managerTypeName = new CaseInsensitiveString(managerType.getName());
|
||||
return LinkPart.MD_OBJECT_MANAGERS.containsKey(managerTypeName)
|
||||
|| LinkPart.MD_OBJECT_MANAGERS_RU.containsKey(managerTypeName);
|
||||
}
|
||||
|
||||
private boolean isReferenceExcessive(DynamicFeatureAccess source, Module module)
|
||||
{
|
||||
return StringUtils.equals(getNameProvider().getFullyQualifiedName(module).getSegment(1),
|
||||
source.getName());
|
||||
}
|
||||
|
||||
private IQualifiedNameProvider getNameProvider()
|
||||
{
|
||||
if (bslQualifiedNameProvider == null)
|
||||
{
|
||||
IResourceServiceProvider resourceServiceProvider =
|
||||
IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(URI.createURI("*.bsl")); //$NON-NLS-1$
|
||||
bslQualifiedNameProvider = resourceServiceProvider.get(IQualifiedNameProvider.class);
|
||||
}
|
||||
return bslQualifiedNameProvider;
|
||||
}
|
||||
}
|
@ -46,6 +46,12 @@ final class Messages
|
||||
public static String ChangeAndValidateInsteadOfAroundCheck_Use_ChangeAndValidate_instead_of_Around;
|
||||
public static String ChangeAndValidateInsteadOfAroundCheck_title;
|
||||
|
||||
public static String CommonModuleNamedSelfReferenceCheck_description;
|
||||
|
||||
public static String CommonModuleNamedSelfReferenceCheck_issue;
|
||||
|
||||
public static String CommonModuleNamedSelfReferenceCheck_title;
|
||||
|
||||
public static String EmptyExceptStatementCheck_description;
|
||||
public static String EmptyExceptStatementCheck_title;
|
||||
|
||||
@ -84,6 +90,12 @@ final class Messages
|
||||
|
||||
public static String ExportMethodInCommandModule_Do_not_use_export_method_in_commands_module;
|
||||
|
||||
public static String ManagerModuleNamedSelfReferenceCheck_description;
|
||||
|
||||
public static String ManagerModuleNamedSelfReferenceCheck_issue;
|
||||
|
||||
public static String ManagerModuleNamedSelfReferenceCheck_title;
|
||||
|
||||
public static String ModuleStructureTopRegionCheck_description;
|
||||
|
||||
public static String ModuleStructureTopRegionCheck_error_message;
|
||||
@ -112,6 +124,14 @@ final class Messages
|
||||
public static String QueryInLoop_Loop_has_query;
|
||||
public static String QueryInLoop_title;
|
||||
|
||||
public static String SelfReferenceCheck_check_only_existing_form_properties;
|
||||
|
||||
public static String SelfReferenceCheck_Description;
|
||||
|
||||
public static String SelfReferenceCheck_Title;
|
||||
|
||||
public static String SelfReferenceCheck_Issue;
|
||||
|
||||
public static String StructureCtorTooManyKeysCheck_description;
|
||||
public static String StructureCtorTooManyKeysCheck_Maximum_structure_constructor_keys;
|
||||
public static String StructureCtorTooManyKeysCheck_Structure_constructor_has_more_than__0__keys;
|
||||
@ -187,6 +207,12 @@ final class Messages
|
||||
|
||||
public static String FormModuleMissingPragmaCheck_title;
|
||||
|
||||
public static String FormSelfReferenceOutdatedCheck_Description;
|
||||
|
||||
public static String FormSelfReferenceOutdatedCheck_Issue;
|
||||
|
||||
public static String FormSelfReferenceOutdatedCheck_Title;
|
||||
|
||||
public static String InvocationFormEventHandlerCheck_Program_invocation_of_form_event_handler_description;
|
||||
|
||||
public static String InvocationFormEventHandlerCheck_Program_invocation_of_form_event_handler_result;
|
||||
|
@ -0,0 +1,131 @@
|
||||
/*******************************************************************************
|
||||
* 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.bsl.check;
|
||||
|
||||
import static com._1c.g5.v8.dt.bsl.model.BslPackage.Literals.DYNAMIC_FEATURE_ACCESS;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.xtext.EcoreUtil2;
|
||||
|
||||
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.Invocation;
|
||||
import com._1c.g5.v8.dt.bsl.model.Module;
|
||||
import com._1c.g5.v8.dt.bsl.model.ModuleType;
|
||||
import com._1c.g5.v8.dt.bsl.model.StaticFeatureAccess;
|
||||
import com._1c.g5.v8.dt.bsl.resource.DynamicFeatureAccessComputer;
|
||||
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;
|
||||
import com.e1c.v8codestyle.check.StandardCheckExtension;
|
||||
import com.e1c.v8codestyle.internal.bsl.BslPlugin;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* Check excessive self references in modules.
|
||||
* For form modules only check self reference for methods and existing properties
|
||||
* (if PARAMETER_CHECK_ONLY_EXISTING_FORM_PROPERTIES is set, otherwise, check for all cases)
|
||||
*
|
||||
* @author Maxim Galios
|
||||
*
|
||||
*/
|
||||
public class SelfReferenceCheck
|
||||
extends BasicCheck
|
||||
{
|
||||
|
||||
private static final String CHECK_ID = "module-self-reference"; //$NON-NLS-1$
|
||||
|
||||
private static final Collection<String> EXCESSIVE_NAMES = Set.of("ЭтотОбъект", "ThisObject"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
public static final String PARAMETER_CHECK_ONLY_EXISTING_FORM_PROPERTIES = "checkOnlyExistingFormProperties"; //$NON-NLS-1$
|
||||
|
||||
private DynamicFeatureAccessComputer dynamicFeatureAccessComputer;
|
||||
|
||||
/**
|
||||
* Instantiates a new self reference check.
|
||||
*
|
||||
* @param dynamicFeatureAccessComputer dynamic feature computer, cannot be {@code null}.
|
||||
*/
|
||||
@Inject
|
||||
public SelfReferenceCheck(DynamicFeatureAccessComputer dynamicFeatureAccessComputer)
|
||||
{
|
||||
super();
|
||||
this.dynamicFeatureAccessComputer = dynamicFeatureAccessComputer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCheckId()
|
||||
{
|
||||
return CHECK_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureCheck(CheckConfigurer builder)
|
||||
{
|
||||
builder.title(Messages.SelfReferenceCheck_Title)
|
||||
.description(Messages.SelfReferenceCheck_Description)
|
||||
.complexity(CheckComplexity.NORMAL)
|
||||
.severity(IssueSeverity.MINOR)
|
||||
.issueType(IssueType.CODE_STYLE)
|
||||
.extension(new StandardCheckExtension(getCheckId(), BslPlugin.PLUGIN_ID))
|
||||
.module()
|
||||
.checkedObjectType(DYNAMIC_FEATURE_ACCESS)
|
||||
.parameter(PARAMETER_CHECK_ONLY_EXISTING_FORM_PROPERTIES, Boolean.class, Boolean.TRUE.toString(),
|
||||
Messages.SelfReferenceCheck_check_only_existing_form_properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
|
||||
IProgressMonitor monitor)
|
||||
{
|
||||
DynamicFeatureAccess dynamicFeatureAccess = (DynamicFeatureAccess)object;
|
||||
|
||||
Expression featureAccessSource = dynamicFeatureAccess.getSource();
|
||||
if (monitor.isCanceled() || !(featureAccessSource instanceof StaticFeatureAccess))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
StaticFeatureAccess source = (StaticFeatureAccess)featureAccessSource;
|
||||
|
||||
if (isReferenceExcessive(dynamicFeatureAccess, source,
|
||||
parameters.getBoolean(PARAMETER_CHECK_ONLY_EXISTING_FORM_PROPERTIES)))
|
||||
{
|
||||
resultAceptor.addIssue(Messages.SelfReferenceCheck_Issue,
|
||||
source);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isReferenceExcessive(DynamicFeatureAccess dynamicFeatureAccess, StaticFeatureAccess source,
|
||||
boolean checkOnlyExistingFormProperties)
|
||||
{
|
||||
if (!EXCESSIVE_NAMES.contains(source.getName()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!checkOnlyExistingFormProperties || (dynamicFeatureAccess.eContainer() instanceof Invocation))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Module module = EcoreUtil2.getContainerOfType(dynamicFeatureAccess, Module.class);
|
||||
|
||||
return !(module.getModuleType() == ModuleType.FORM_MODULE
|
||||
&& dynamicFeatureAccessComputer.resolveObject(dynamicFeatureAccess, module.environments()).isEmpty());
|
||||
}
|
||||
}
|
@ -40,6 +40,12 @@ ChangeAndValidateInsteadOfAroundCheck_description = Checks that pragma &ChangeAn
|
||||
|
||||
ChangeAndValidateInsteadOfAroundCheck_title = Use pragma &ChangeAndValidate instead of &Around
|
||||
|
||||
CommonModuleNamedSelfReferenceCheck_description=Excessive named self reference
|
||||
|
||||
CommonModuleNamedSelfReferenceCheck_issue=Excessive named self reference
|
||||
|
||||
CommonModuleNamedSelfReferenceCheck_title=Excessive named self reference in common module
|
||||
|
||||
EmptyExceptStatementCheck_description = Empty except statement
|
||||
|
||||
EmptyExceptStatementCheck_title = Empty except statement
|
||||
@ -93,6 +99,12 @@ FormModulePragmaCheck_description = Use form module compilation pragma
|
||||
|
||||
FormModulePragmaCheck_title = Use form module compilation pragma
|
||||
|
||||
FormSelfReferenceOutdatedCheck_Description="ThisObject" should be used instead of outdated "ThisForm"
|
||||
|
||||
FormSelfReferenceOutdatedCheck_Issue="ThisObject" should be used instead of outdated "ThisForm"
|
||||
|
||||
FormSelfReferenceOutdatedCheck_Title=Outdated alias used
|
||||
|
||||
InvocationFormEventHandlerCheck_Program_invocation_of_form_event_handler_description=Program invocation of form event handler
|
||||
|
||||
InvocationFormEventHandlerCheck_Program_invocation_of_form_event_handler_result=Program invocation of form event handler
|
||||
@ -113,6 +125,12 @@ LockOutOfTry_Lock_out_of_try=Lock out of Try
|
||||
|
||||
LockOutOfTry_Method_lock_out_of_try=Method Lock() out of try block
|
||||
|
||||
ManagerModuleNamedSelfReferenceCheck_description=Excessive named self reference
|
||||
|
||||
ManagerModuleNamedSelfReferenceCheck_issue=Excessive named self reference
|
||||
|
||||
ManagerModuleNamedSelfReferenceCheck_title=Excessive named self reference in manager module
|
||||
|
||||
MethodTooManyPramsCheck_Max_parameters = Max parameters
|
||||
|
||||
MethodTooManyPramsCheck_Max_parameters_with_default_value = Max parameters with default value
|
||||
@ -205,6 +223,14 @@ RegionEmptyCheck_description = Check that module region is empty
|
||||
|
||||
RegionEmptyCheck_title = Region is empty
|
||||
|
||||
SelfReferenceCheck_check_only_existing_form_properties=Check only existing form properties
|
||||
|
||||
SelfReferenceCheck_Description=Excessive usage of self reference (when referencing method, property or attribute)
|
||||
|
||||
SelfReferenceCheck_Title=Excessive self reference
|
||||
|
||||
SelfReferenceCheck_Issue=Excessive usage of self reference (when referencing method, property or attribute)
|
||||
|
||||
StructureCtorTooManyKeysCheck_Maximum_structure_constructor_keys = Maximum structure constructor keys
|
||||
|
||||
StructureCtorTooManyKeysCheck_Structure_constructor_has_more_than__0__keys = Structure constructor has more than {0} keys
|
||||
|
@ -40,6 +40,12 @@ ChangeAndValidateInsteadOfAroundCheck_description = Проверяет, что
|
||||
|
||||
ChangeAndValidateInsteadOfAroundCheck_title = Используется аннотация &ИзменениеИКонтроль вместо &Вместо
|
||||
|
||||
CommonModuleNamedSelfReferenceCheck_description=Избыточное обращение по собственному имени
|
||||
|
||||
CommonModuleNamedSelfReferenceCheck_issue=Избыточное обращение по собственному имени
|
||||
|
||||
CommonModuleNamedSelfReferenceCheck_title=Избыточное обращение по собственному имени в общем модуле
|
||||
|
||||
EmptyExceptStatementCheck_description = "Попытка...Исключение" не содержит кода в исключении
|
||||
|
||||
EmptyExceptStatementCheck_title = "Попытка...Исключение" не содержит кода в исключении
|
||||
@ -96,6 +102,12 @@ FormModulePragmaCheck_description = Использование директив
|
||||
|
||||
FormModulePragmaCheck_title = Использование директив компиляции модуля формы
|
||||
|
||||
FormSelfReferenceOutdatedCheck_Description=Следует использовать псевдоним "ЭтотОбъект" вместо устаревшего "ЭтаФорма"
|
||||
|
||||
FormSelfReferenceOutdatedCheck_Issue=Следует использовать псевдоним "ЭтотОбъект" вместо устаревшего "ЭтаФорма"
|
||||
|
||||
FormSelfReferenceOutdatedCheck_Title=Использование устаревшего псевдонима
|
||||
|
||||
InvocationFormEventHandlerCheck_Program_invocation_of_form_event_handler_description=Программный вызов обработчика события формы
|
||||
|
||||
InvocationFormEventHandlerCheck_Program_invocation_of_form_event_handler_result=Программный вызов обработчика события формы
|
||||
@ -116,6 +128,12 @@ LockOutOfTry_Lock_out_of_try=Метод Заблокировать() вне бл
|
||||
|
||||
LockOutOfTry_Method_lock_out_of_try=Метод Заблокировать() вне блока Попытка-Исключение
|
||||
|
||||
ManagerModuleNamedSelfReferenceCheck_description=Избыточное обращение по собственному имени
|
||||
|
||||
ManagerModuleNamedSelfReferenceCheck_issue=Избыточное обращение по собственному имени
|
||||
|
||||
ManagerModuleNamedSelfReferenceCheck_title=Избыточное обращение по собственному имени в модуле менеджера
|
||||
|
||||
MethodTooManyPramsCheck_Max_parameters = Максимум параметров
|
||||
|
||||
MethodTooManyPramsCheck_Max_parameters_with_default_value = Максимум параметров со значением по умолчанию
|
||||
@ -208,6 +226,14 @@ RegionEmptyCheck_description = Проверяет что область моду
|
||||
|
||||
RegionEmptyCheck_title = Область пустая
|
||||
|
||||
SelfReferenceCheck_check_only_existing_form_properties=Проверять только существовующие свойства в форме
|
||||
|
||||
SelfReferenceCheck_Description=Избыточное обращение внутри модуля через псевдоним "ЭтотОбъект" (к методу, свойству или реквизиту)
|
||||
|
||||
SelfReferenceCheck_Title=Избыточное использование псевдонима "ЭтотОбъект"
|
||||
|
||||
SelfReferenceCheck_Issue=Избыточное обращение внутри модуля через псевдоним "ЭтотОбъект" (к методу, свойству или реквизиту)
|
||||
|
||||
StructureCtorTooManyKeysCheck_Maximum_structure_constructor_keys = Максимальное количество ключей структуры в конструкторе
|
||||
|
||||
StructureCtorTooManyKeysCheck_Structure_constructor_has_more_than__0__keys = Конструктор структуры содержит более чем {0} ключей
|
||||
|
@ -17,6 +17,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
@ -192,8 +193,9 @@ public abstract class AbstractTypeCheck
|
||||
String typeName = fa.getName();
|
||||
String propertyName = dfa.getName();
|
||||
TypeItem type = sourceTypes.get(0);
|
||||
if ((typeName.equalsIgnoreCase(McoreUtil.getTypeNameRu(type))
|
||||
|| typeName.equalsIgnoreCase(McoreUtil.getTypeName(type)))
|
||||
if (typeName != null
|
||||
&& (typeName.equalsIgnoreCase(McoreUtil.getTypeNameRu(type))
|
||||
|| typeName.equalsIgnoreCase(McoreUtil.getTypeName(type)))
|
||||
&& dynamicFeatureAccessComputer.getAllProperties(sourceTypes, object.eResource())
|
||||
.stream()
|
||||
.flatMap(e -> e.getFirst().stream())
|
||||
@ -308,11 +310,17 @@ public abstract class AbstractTypeCheck
|
||||
{
|
||||
type = (TypeItem)EcoreUtil.resolve(type, context);
|
||||
String typeName = McoreUtil.getTypeName(type);
|
||||
typeNames.add(typeName);
|
||||
if (type instanceof TypeSet)
|
||||
if (typeName != null)
|
||||
{
|
||||
typeNames.addAll(
|
||||
((TypeSet)type).getTypes().stream().map(McoreUtil::getTypeName).collect(Collectors.toList()));
|
||||
typeNames.add(typeName);
|
||||
}
|
||||
if (type instanceof TypeSet && typeName != null)
|
||||
{
|
||||
typeNames.addAll(((TypeSet)type).getTypes()
|
||||
.stream()
|
||||
.map(McoreUtil::getTypeName)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
if (IEObjectTypeNames.ANY_REF.equals(typeName))
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
@ -176,8 +177,10 @@ public class FunctionCtorReturnSectionCheck
|
||||
|
||||
Set<String> checkTypes = getCheckTypes(parameters);
|
||||
|
||||
List<String> computedReturnTypeNames =
|
||||
computedReturnTypes.stream().map(McoreUtil::getTypeName).collect(Collectors.toList());
|
||||
List<String> computedReturnTypeNames = computedReturnTypes.stream()
|
||||
.map(McoreUtil::getTypeName)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
if (isUserDataTypes(computedReturnTypeNames, checkTypes))
|
||||
{
|
||||
|
||||
@ -256,8 +259,11 @@ public class FunctionCtorReturnSectionCheck
|
||||
{
|
||||
String propertyName = useRussianScript ? declaredProperty.getNameRu() : declaredProperty.getName();
|
||||
declaredProertyNames.add(propertyName);
|
||||
List<String> declaredType =
|
||||
declaredProperty.getTypes().stream().map(McoreUtil::getTypeName).collect(Collectors.toList());
|
||||
List<String> declaredType = declaredProperty.getTypes()
|
||||
.stream()
|
||||
.map(McoreUtil::getTypeName)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
if (declaredType.isEmpty())
|
||||
{
|
||||
continue;
|
||||
@ -271,7 +277,7 @@ public class FunctionCtorReturnSectionCheck
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<TypeItem> types2 = types.stream()
|
||||
.filter(t -> !declaredType.contains(McoreUtil.getTypeName(t)))
|
||||
.filter(t -> McoreUtil.getTypeName(t) != null && !declaredType.contains(McoreUtil.getTypeName(t)))
|
||||
.collect(Collectors.toList());
|
||||
if (types.isEmpty())
|
||||
{
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.form;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Activator: com.e1c.v8codestyle.internal.form.CorePlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.20.0,4.0.0)",
|
||||
|
@ -0,0 +1,12 @@
|
||||
# Check if Use Always flag is enabled for the Reference attribute in dynamic list
|
||||
|
||||
In developing print commands (the Print subsystem of **Standard Subsystems Library**), the **Reference** attribute with the **Use Always** flag is required for these commands.
|
||||
|
||||
## Noncompliant Code Example
|
||||
|
||||
## Compliant Solution
|
||||
|
||||
## See
|
||||
|
||||
[Reference attribute in dynamic lists](https://support.1ci.com/hc/en-us/articles/360011004020-Reference-attribute-in-dynamic-lists)
|
||||
|
@ -0,0 +1,11 @@
|
||||
# У реквизита "Ссылка" динамического списка выключен признак "Использовать всегда"
|
||||
|
||||
Наличие реквизита **Ссылка** с признаком **"Использовать всегда"** является обязательным при разработке команд печати (подсистема "Печать" **Библиотеки стандартных подсистем**) для корректной работы этих команд.
|
||||
|
||||
## Неправильно
|
||||
|
||||
## Правильно
|
||||
|
||||
## См.
|
||||
|
||||
[Реквизит Ссылка и признак "Использовать всегда" в динамических списках объектов](https://its.1c.ru/db/v8std#content:702:hdoc:2.2)
|
@ -26,6 +26,10 @@
|
||||
category="com.e1c.v8codestyle.form"
|
||||
class="com.e1c.v8codestyle.internal.form.ExecutableExtensionFactory:com.e1c.v8codestyle.form.check.InputFieldListChoiceMode">
|
||||
</check>
|
||||
<check
|
||||
category="com.e1c.v8codestyle.form"
|
||||
class="com.e1c.v8codestyle.form.check.FormListRefUseAlwaysFlagDisabledCheck">
|
||||
</check>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
@ -18,10 +18,10 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bundles</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.form</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
|
@ -0,0 +1,110 @@
|
||||
/*******************************************************************************
|
||||
* 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 static com._1c.g5.v8.dt.form.model.FormPackage.Literals.FORM;
|
||||
import static com._1c.g5.v8.dt.form.model.FormPackage.Literals.FORM_ATTRIBUTE;
|
||||
import static com._1c.g5.v8.dt.form.model.FormPackage.Literals.FORM_ATTRIBUTE__NOT_DEFAULT_USE_ALWAYS_ATTRIBUTES;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
|
||||
import com._1c.g5.v8.dt.form.model.AbstractDataPath;
|
||||
import com._1c.g5.v8.dt.form.model.DynamicListExtInfo;
|
||||
import com._1c.g5.v8.dt.form.model.FormAttribute;
|
||||
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;
|
||||
import com.e1c.v8codestyle.check.StandardCheckExtension;
|
||||
import com.e1c.v8codestyle.internal.form.CorePlugin;
|
||||
|
||||
/**
|
||||
* Check if Use Always flag is enabled for the Reference attribute in dynamic list.
|
||||
*
|
||||
* @author Olga Bozhko
|
||||
*/
|
||||
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$
|
||||
|
||||
@Override
|
||||
public String getCheckId()
|
||||
{
|
||||
return CHECK_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureCheck(CheckConfigurer builder)
|
||||
{
|
||||
builder.title(Messages.FormListRefUseAlwaysFlagDisabledCheck_title)
|
||||
.description(Messages.FormListRefUseAlwaysFlagDisabledCheck_description)
|
||||
.complexity(CheckComplexity.NORMAL)
|
||||
.severity(IssueSeverity.MAJOR)
|
||||
.issueType(IssueType.UI_STYLE)
|
||||
.extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID))
|
||||
.topObject(FORM)
|
||||
.containment(FORM_ATTRIBUTE)
|
||||
.features(FORM_ATTRIBUTE__NOT_DEFAULT_USE_ALWAYS_ATTRIBUTES);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
|
||||
IProgressMonitor monitor)
|
||||
{
|
||||
|
||||
if (monitor.isCanceled() || !(object instanceof FormAttribute))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
FormAttribute formAttribute = (FormAttribute)object;
|
||||
if (formAttribute.getExtInfo() instanceof DynamicListExtInfo
|
||||
&& formAttribute.getNotDefaultUseAlwaysAttributes().stream().noneMatch(pathCheck))
|
||||
{
|
||||
resultAceptor.addIssue(
|
||||
Messages.FormListRefUseAlwaysFlagDisabledCheck_UseAlways_flag_is_disabled_for_the_Ref_field,
|
||||
formAttribute);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Predicate<AbstractDataPath> pathCheck = path -> {
|
||||
EList<String> segments = path.getSegments();
|
||||
if (segments.size() != 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!segments.get(0).equals(REF_ABSTRACT_DATA_PATH.get(0))
|
||||
&& !segments.get(0).equals(REF_ABSTRACT_DATA_PATH_RU.get(0)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!segments.get(1).equals(REF_ABSTRACT_DATA_PATH.get(1))
|
||||
&& !segments.get(1).equals(REF_ABSTRACT_DATA_PATH_RU.get(1)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
}
|
@ -22,6 +22,9 @@ final class Messages
|
||||
extends NLS
|
||||
{
|
||||
private static final String BUNDLE_NAME = "com.e1c.v8codestyle.form.check.messages"; //$NON-NLS-1$
|
||||
public static String FormListRefUseAlwaysFlagDisabledCheck_description;
|
||||
public static String FormListRefUseAlwaysFlagDisabledCheck_title;
|
||||
public static String FormListRefUseAlwaysFlagDisabledCheck_UseAlways_flag_is_disabled_for_the_Ref_field;
|
||||
public static String InputFieldListChoiceMode_description;
|
||||
public static String InputFieldListChoiceMode_Form_input_field_the_list_choice_mode_not_set_with_filled_choice_list;
|
||||
public static String InputFieldListChoiceMode_title;
|
||||
|
@ -1,7 +1,6 @@
|
||||
|
||||
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
|
||||
###############################################################################
|
||||
# Copyright (C) 2021, 1C-Soft LLC and others.
|
||||
# Copyright (C) 2021-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
|
||||
@ -13,6 +12,12 @@
|
||||
# 1C-Soft LLC - initial API and implementation
|
||||
###############################################################################
|
||||
|
||||
FormListRefUseAlwaysFlagDisabledCheck_UseAlways_flag_is_disabled_for_the_Ref_field = UseAlways flag is disabled for the Ref field
|
||||
|
||||
FormListRefUseAlwaysFlagDisabledCheck_description = UseAlways flag is disabled for the Ref field
|
||||
|
||||
FormListRefUseAlwaysFlagDisabledCheck_title = UseAlways flag is disabled for the Ref field
|
||||
|
||||
InputFieldListChoiceMode_Form_input_field_the_list_choice_mode_not_set_with_filled_choice_list = Form input field the "list choice mode" not set with filled choice list
|
||||
|
||||
InputFieldListChoiceMode_description = Check input field has correct list choice mode if choice list is not empty
|
||||
|
@ -1,6 +1,6 @@
|
||||
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
|
||||
###############################################################################
|
||||
# Copyright (C) 2021, 1C-Soft LLC and others.
|
||||
# Copyright (C) 2021-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
|
||||
@ -13,6 +13,12 @@
|
||||
###############################################################################
|
||||
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
|
||||
|
||||
FormListRefUseAlwaysFlagDisabledCheck_UseAlways_flag_is_disabled_for_the_Ref_field = У реквизита "Ссылка" динамического списка выключен признак "Использовать всегда"
|
||||
|
||||
FormListRefUseAlwaysFlagDisabledCheck_description = У реквизита "Ссылка" динамического списка выключен признак "Использовать всегда"
|
||||
|
||||
FormListRefUseAlwaysFlagDisabledCheck_title = У реквизита "Ссылка" динамического списка выключен признак "Использовать всегда"
|
||||
|
||||
InputFieldListChoiceMode_Form_input_field_the_list_choice_mode_not_set_with_filled_choice_list = У поля ввода формы с заполненным списком выбора отключено свойство "Режим выбора из списка"
|
||||
|
||||
InputFieldListChoiceMode_description = Проверяет, что поле ввода содержит корректный режим ввыбора из списка, если список выбора заполнен
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.md.ui;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Activator: com.e1c.v8codestyle.internal.md.ui.UiPlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.ui;bundle-version="[3.119.0,4.0.0)",
|
||||
|
@ -18,10 +18,10 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bundles</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.md.ui</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
</project>
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.md;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Activator: com.e1c.v8codestyle.internal.md.CorePlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.18.0,4.0.0)",
|
||||
|
@ -0,0 +1,12 @@
|
||||
# Длина названия раздела превышает 35 символов
|
||||
|
||||
Общая длина названия раздела не должна превышать 35 знаков с учетом пробелов (это позволяет разместить название в 2 строки, при дальнейшем увеличении количества знаков появится многоточие). Лучше выбирать названия примерно одного размеры по ширине, чтобы они смотрелись единообразно и ровно.
|
||||
|
||||
|
||||
## Неправильно
|
||||
|
||||
## Правильно
|
||||
|
||||
## См.
|
||||
|
||||
- [Инструкции по разработке на 1С - Панель разделов, пункт 2.1](https://its.1c.ru/db/v8std#content:712:hdoc)
|
@ -0,0 +1,11 @@
|
||||
# Небезопасное хранение паролей в информационной базе
|
||||
|
||||
Для сведения к минимуму возможности перехвата пароля злоумышленниками не следует хранить пароли и
|
||||
другую конфиденциальную информацию в информационной базе.
|
||||
|
||||
## Неправильно
|
||||
|
||||
## Правильно
|
||||
|
||||
## См.
|
||||
[Безопасное хранение паролей](https://its.1c.ru/db/v8std#content:740:hdoc:2)
|
@ -0,0 +1,13 @@
|
||||
# Section name is more then 35 characters long
|
||||
|
||||
Section names must not exceed 35 characters including spaces. The names can take two lines. If you increase the number of characters, an ellipsis is added. We recommend that you choose names of the same length to make them look consistently.
|
||||
|
||||
|
||||
## Noncompliant Code Example
|
||||
|
||||
## Compliant Solution
|
||||
|
||||
## See
|
||||
|
||||
- [1Ci Support - Sections panel, section 2.1](https://support.1ci.com/hc/en-us/articles/360011003580-Sections-panel#:~:text=2.1)
|
||||
- [Knowledge base - Sections panel](https://1c-dn.com/library/user_manual_taxi_interface_sections_panel/)
|
@ -0,0 +1,11 @@
|
||||
# Unsafe password storage
|
||||
|
||||
To minimize risks of unauthorized access to passwords,
|
||||
avoid storing passwords or any other confidential information in the infobase.
|
||||
|
||||
## Noncompliant Code Example
|
||||
|
||||
## Compliant Solution
|
||||
|
||||
## See
|
||||
[Secure password storage](https://support.1ci.com/hc/en-us/articles/360011003100-Secure-password-storage)
|
@ -78,6 +78,14 @@
|
||||
category="com.e1c.v8codestyle.md"
|
||||
class="com.e1c.v8codestyle.internal.md.ExecutableExtensionFactory:com.e1c.v8codestyle.md.check.CommonModuleNameServerCallCachedCheck">
|
||||
</check>
|
||||
<check
|
||||
category="com.e1c.v8codestyle.md"
|
||||
class="com.e1c.v8codestyle.md.check.UnsafePasswordStorageCheck">
|
||||
</check>
|
||||
<check
|
||||
category="com.e1c.v8codestyle.md"
|
||||
class="com.e1c.v8codestyle.md.check.SubsystemSynonymTooLongCheck">
|
||||
</check>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
@ -18,10 +18,10 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bundles</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.md</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
|
@ -59,6 +59,14 @@ final class Messages
|
||||
public static String MdScheduledJobPeriodicityCheck_The_minimum_job_interval_is_less_then_minute;
|
||||
public static String MdScheduledJobPeriodicityCheck_title;
|
||||
public static String MdScheduledJobPeriodicityCheck_Minimum_job_interval_description;
|
||||
public static String UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase;
|
||||
public static String UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase_description;
|
||||
public static String UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase_error;
|
||||
public static String SubsystemSynonymTooLongCheck_description;
|
||||
public static String SubsystemSynonymTooLongCheck_Exclude_languages_comma_separated;
|
||||
public static String SubsystemSynonymTooLongCheck_Length_of_section_name_more_than_symbols_for_language;
|
||||
public static String SubsystemSynonymTooLongCheck_Maximum_section_name_length;
|
||||
public static String SubsystemSynonymTooLongCheck_title;
|
||||
static
|
||||
{
|
||||
// initialize resource bundle
|
||||
|
@ -0,0 +1,126 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
* Denis Maslennikov - issue #37
|
||||
*******************************************************************************/
|
||||
package com.e1c.v8codestyle.md.check;
|
||||
|
||||
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.MD_OBJECT__SYNONYM;
|
||||
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.SUBSYSTEM;
|
||||
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.SUBSYSTEM__INCLUDE_IN_COMMAND_INTERFACE;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.emf.common.util.EMap;
|
||||
|
||||
import com._1c.g5.v8.dt.metadata.mdclass.MdObject;
|
||||
import com._1c.g5.v8.dt.metadata.mdclass.Subsystem;
|
||||
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.components.TopObjectFilterExtension;
|
||||
import com.e1c.g5.v8.dt.check.settings.IssueSeverity;
|
||||
import com.e1c.g5.v8.dt.check.settings.IssueType;
|
||||
|
||||
/**
|
||||
* Check top subsystem synonym length that should be less then 35 by default or value
|
||||
* of the parameter MAX_SUBSYSTEM_SYNONYM_LENGTH, if it is set.
|
||||
*
|
||||
* @author Denis Maslennikov
|
||||
*/
|
||||
public class SubsystemSynonymTooLongCheck
|
||||
extends BasicCheck
|
||||
{
|
||||
|
||||
private static final String CHECK_ID = "subsystem-synonym-too-long"; //$NON-NLS-1$
|
||||
|
||||
public static final String MAX_SUBSYSTEM_SYNONYM_LENGTH = "maxSubsystemSynonymLength"; //$NON-NLS-1$
|
||||
|
||||
public static final String MAX_SUBSYSTEM_SYNONYM_DEFAULT = "35"; //$NON-NLS-1$
|
||||
|
||||
public static final String SUBSYSTEM_SYNONYM_LANGS_FILTER = "subsystemSynonymLangFilter"; //$NON-NLS-1$
|
||||
|
||||
public static final String SUBSYSTEM_SYNONYM_LANGS_DEFAULT = ""; //$NON-NLS-1$
|
||||
|
||||
private static final String LANG_DELIMITER = ","; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
public String getCheckId()
|
||||
{
|
||||
return CHECK_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureCheck(CheckConfigurer builder)
|
||||
{
|
||||
builder.title(Messages.SubsystemSynonymTooLongCheck_title)
|
||||
.description(Messages.SubsystemSynonymTooLongCheck_description)
|
||||
.complexity(CheckComplexity.NORMAL)
|
||||
.severity(IssueSeverity.MINOR)
|
||||
.extension(new TopObjectFilterExtension())
|
||||
.issueType(IssueType.UI_STYLE)
|
||||
.topObject(SUBSYSTEM)
|
||||
.checkTop()
|
||||
.features(MD_OBJECT__SYNONYM, SUBSYSTEM__INCLUDE_IN_COMMAND_INTERFACE)
|
||||
.parameter(MAX_SUBSYSTEM_SYNONYM_LENGTH, Integer.class, MAX_SUBSYSTEM_SYNONYM_DEFAULT,
|
||||
Messages.SubsystemSynonymTooLongCheck_Maximum_section_name_length)
|
||||
.parameter(SUBSYSTEM_SYNONYM_LANGS_FILTER, String.class, SUBSYSTEM_SYNONYM_LANGS_DEFAULT,
|
||||
Messages.SubsystemSynonymTooLongCheck_Exclude_languages_comma_separated);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
|
||||
IProgressMonitor monitor)
|
||||
{
|
||||
if (!(object instanceof MdObject) || monitor.isCanceled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Subsystem subsystem = (Subsystem)object;
|
||||
// Check subsystem is not top-level and included to command interface
|
||||
if (subsystem.getParentSubsystem() != null || !subsystem.isIncludeInCommandInterface())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int max = parameters.getInt(MAX_SUBSYSTEM_SYNONYM_LENGTH);
|
||||
if (max <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> excludeLangs =
|
||||
Arrays.asList(parameters.getString(SUBSYSTEM_SYNONYM_LANGS_FILTER).split(LANG_DELIMITER));
|
||||
excludeLangs.replaceAll(String::trim);
|
||||
|
||||
EMap<String, String> synonyms = subsystem.getSynonym();
|
||||
|
||||
for (Map.Entry<String, String> entry : synonyms.entrySet())
|
||||
{
|
||||
String key = entry.getKey();
|
||||
if (!excludeLangs.contains(key))
|
||||
{
|
||||
String name = entry.getValue();
|
||||
if (name != null && name.length() > max)
|
||||
{
|
||||
resultAceptor.addIssue(MessageFormat.format(
|
||||
Messages.SubsystemSynonymTooLongCheck_Length_of_section_name_more_than_symbols_for_language,
|
||||
name.length(), max, key), MD_OBJECT__SYNONYM);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
/*******************************************************************************
|
||||
* 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.md.check;
|
||||
|
||||
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.BASIC_FEATURE;
|
||||
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.BASIC_FEATURE__PASSWORD_MODE;
|
||||
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.CATALOG;
|
||||
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.CHART_OF_CHARACTERISTIC_TYPES;
|
||||
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.CONSTANT;
|
||||
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.CONSTANT__PASSWORD_MODE;
|
||||
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.DOCUMENT;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
||||
import com._1c.g5.v8.dt.metadata.mdclass.BasicFeature;
|
||||
import com._1c.g5.v8.dt.metadata.mdclass.Constant;
|
||||
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;
|
||||
import com.e1c.v8codestyle.check.StandardCheckExtension;
|
||||
import com.e1c.v8codestyle.internal.md.CorePlugin;
|
||||
|
||||
/**
|
||||
* Check not secure password storage in the information database.
|
||||
*
|
||||
* @author Artem Iliukhin
|
||||
*/
|
||||
public final class UnsafePasswordStorageCheck
|
||||
extends BasicCheck
|
||||
{
|
||||
|
||||
private static final String CHECK_ID = "unsafe-password-ib-storage"; //$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
public String getCheckId()
|
||||
{
|
||||
return CHECK_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configureCheck(CheckConfigurer builder)
|
||||
{
|
||||
builder.title(Messages.UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase)
|
||||
.description(Messages.UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase_description)
|
||||
.complexity(CheckComplexity.NORMAL)
|
||||
.severity(IssueSeverity.MINOR)
|
||||
.issueType(IssueType.SECURITY)
|
||||
.extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID))
|
||||
.topObject(CONSTANT)
|
||||
.checkTop()
|
||||
.features(CONSTANT__PASSWORD_MODE)
|
||||
.topObject(CATALOG)
|
||||
.containment(BASIC_FEATURE)
|
||||
.features(BASIC_FEATURE__PASSWORD_MODE)
|
||||
.topObject(DOCUMENT)
|
||||
.containment(BASIC_FEATURE)
|
||||
.features(BASIC_FEATURE__PASSWORD_MODE)
|
||||
.topObject(CHART_OF_CHARACTERISTIC_TYPES)
|
||||
.containment(BASIC_FEATURE)
|
||||
.features(BASIC_FEATURE__PASSWORD_MODE); //TODO change to BASIC_DB_OBJECT, when will it work
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
|
||||
IProgressMonitor monitor)
|
||||
{
|
||||
if (object instanceof BasicFeature && ((BasicFeature)object).isPasswordMode())
|
||||
{
|
||||
resultAceptor.addIssue(Messages.UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase_error, object,
|
||||
BASIC_FEATURE__PASSWORD_MODE);
|
||||
}
|
||||
else if (object instanceof Constant && ((Constant)object).isPasswordMode())
|
||||
{
|
||||
resultAceptor.addIssue(Messages.UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase_error, object,
|
||||
CONSTANT__PASSWORD_MODE);
|
||||
}
|
||||
}
|
||||
}
|
@ -72,3 +72,19 @@ MdScheduledJobPeriodicityCheck_The_minimum_job_interval_is_less_then_minute = Th
|
||||
MdScheduledJobPeriodicityCheck_description = The minimum job interval is less then {0}s
|
||||
|
||||
MdScheduledJobPeriodicityCheck_title = The minimum job interval is less then {0}s
|
||||
|
||||
UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase=Avoid storing passwords in the infobase
|
||||
|
||||
UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase_description=To minimize risks of unauthorized access to passwords, avoid storing passwords in the infobase.
|
||||
|
||||
UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase_error=Avoid storing passwords in the infobase
|
||||
|
||||
SubsystemSynonymTooLongCheck_Exclude_languages_comma_separated = Exclude languages (codes, comma-separated)
|
||||
|
||||
SubsystemSynonymTooLongCheck_Length_of_section_name_more_than_symbols_for_language = Length of section synonym "{0}" more than {1} symbols for language {2}
|
||||
|
||||
SubsystemSynonymTooLongCheck_Maximum_section_name_length = Maximum section name length
|
||||
|
||||
SubsystemSynonymTooLongCheck_description = Section name is more then 35 characters long
|
||||
|
||||
SubsystemSynonymTooLongCheck_title = Section name is more then 35 characters long
|
||||
|
@ -66,10 +66,26 @@ MdScheduledJobDescriptionCheck_message = Задано наименование
|
||||
|
||||
MdScheduledJobDescriptionCheck_title = Задано наименование предопределенного регламентного задания
|
||||
|
||||
MdScheduledJobPeriodicityCheck_Minimum_job_interval_description = Минимальный интервал выполнения
|
||||
|
||||
MdScheduledJobPeriodicityCheck_The_minimum_job_interval_is_less_then_minute = Периодичность выполнения регламентного задания меньше {0}сек
|
||||
|
||||
MdScheduledJobPeriodicityCheck_description = Периодичность выполнения регламентного задания меньше {0}сек
|
||||
|
||||
MdScheduledJobPeriodicityCheck_title = Периодичность выполнения регламентного задания меньше {0}сек
|
||||
|
||||
MdScheduledJobPeriodicityCheck_Minimum_job_interval_description = Минимальный интервал выполнения
|
||||
SubsystemSynonymTooLongCheck_Exclude_languages_comma_separated = Исключить языки (коды, разделенных запятыми)
|
||||
|
||||
SubsystemSynonymTooLongCheck_Length_of_section_name_more_than_symbols_for_language = Длина синонима раздела "{0}" превышает {1} символов для языка {2}
|
||||
|
||||
SubsystemSynonymTooLongCheck_Maximum_section_name_length = Максимальная длина названия раздела верхнего уровня
|
||||
|
||||
SubsystemSynonymTooLongCheck_description = Длина названия раздела превышает 35 символов
|
||||
|
||||
SubsystemSynonymTooLongCheck_title = Длина названия раздела превышает 35 символов
|
||||
|
||||
UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase=Не следует хранить пароли в информационной базе
|
||||
|
||||
UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase_description=Для сведения к минимуму возможности перехвата пароля злоумышленниками не следует хранить пароли в информационной базе
|
||||
|
||||
UnsafePasswordStorageCheck_Avoid_storing_password_in_infobase_error=Не следует хранить пароли в информационной базе
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.ql;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Activator: com.e1c.v8codestyle.internal.ql.CorePlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.18.0,4.0.0)",
|
||||
|
@ -18,10 +18,10 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bundles</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.ql</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.right;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Activator: com.e1c.v8codestyle.internal.right.CorePlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.18.0,4.0.0)",
|
||||
|
@ -18,10 +18,10 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bundles</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.right</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
<properties>
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.ui;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Activator: com.e1c.v8codestyle.internal.ui.UiPlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
@ -18,10 +18,10 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bundles</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.ui</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
</project>
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Activator: com.e1c.v8codestyle.internal.CorePlugin
|
||||
Bundle-Vendor: %providerName
|
||||
Bundle-Localization: plugin
|
||||
|
@ -19,9 +19,9 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bundles</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
@ -12,7 +12,7 @@
|
||||
###############################################################################
|
||||
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
|
||||
|
||||
CommonChecksProjectOptionProvider_description = Проверки правильного проектирвоания, кодирования, применение "лучших практик" и т.д, не регламентированные стандартами 1С.
|
||||
CommonChecksProjectOptionProvider_description = Проверки правильного проектирования, кодирования, применение "лучших практик" и т.д, не регламентированные стандартами 1С.
|
||||
|
||||
CommonChecksProjectOptionProvider_presentation = Все общие проверки стиля кодирования
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.docs;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Vendor: %providerName
|
||||
Automatic-Module-Name: com.e1c.v8codestyle.docs
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
|
@ -20,10 +20,10 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.docs</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
<feature
|
||||
id="com.e1c.v8codestyle.feature"
|
||||
label="%feature.name"
|
||||
version="0.2.0.qualifier"
|
||||
version="0.3.0.qualifier"
|
||||
provider-name="%feature.vendor"
|
||||
plugin="com.e1c.v8codestyle"
|
||||
license-feature="org.eclipse.license"
|
||||
|
@ -19,11 +19,11 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>features</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>com.e1c.v8codestyle.feature</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-feature</packaging>
|
||||
|
||||
<build>
|
||||
|
@ -14,7 +14,7 @@
|
||||
<feature
|
||||
id="com.e1c.v8codestyle.sdk"
|
||||
label="%featureName"
|
||||
version="0.2.0.qualifier"
|
||||
version="0.3.0.qualifier"
|
||||
provider-name="%providerName"
|
||||
license-feature="org.eclipse.license"
|
||||
license-feature-version="2.0.2.qualifier">
|
||||
@ -33,11 +33,11 @@
|
||||
|
||||
<includes
|
||||
id="com.e1c.v8codestyle.feature.source"
|
||||
version="0.2.0.qualifier"
|
||||
version="0.3.0.qualifier"
|
||||
optional="true"/>
|
||||
|
||||
<includes
|
||||
id="com.e1c.v8codestyle.feature"
|
||||
version="0.2.0.qualifier"/>
|
||||
version="0.3.0.qualifier"/>
|
||||
|
||||
</feature>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>features</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>com.e1c.v8codestyle.sdk</artifactId>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>features</artifactId>
|
||||
|
4
pom.xml
4
pom.xml
@ -16,13 +16,13 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>bom</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<relativePath>./bom/pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>1C:Code style V8</name>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>repositories</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>com.e1c.v8codestyle.repository.sdk</artifactId>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>repositories</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>com.e1c.v8codestyle.repository</artifactId>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>repositories</artifactId>
|
||||
|
@ -19,12 +19,12 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>targets</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>default</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
|
||||
<packaging>eclipse-target-definition</packaging>
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>parent</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>targets</artifactId>
|
||||
|
@ -2,9 +2,9 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.autosort.itests;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Vendor: %providerName
|
||||
Fragment-Host: com.e1c.v8codestyle.autosort;bundle-version="[0.2.0,0.3.0)"
|
||||
Fragment-Host: com.e1c.v8codestyle.autosort;bundle-version="[0.3.0,0.4.0)"
|
||||
Automatic-Module-Name: com.e1c.v8codestyle.autosort.itests
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Bundle-Localization: fragment
|
||||
|
@ -19,9 +19,9 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>tests</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.autosort.itests</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-test-plugin</packaging>
|
||||
</project>
|
@ -2,9 +2,9 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %pluginName
|
||||
Bundle-SymbolicName: com.e1c.v8codestyle.bsl.itests;singleton:=true
|
||||
Bundle-Version: 0.2.0.qualifier
|
||||
Bundle-Version: 0.3.0.qualifier
|
||||
Bundle-Vendor: %providerName
|
||||
Fragment-Host: com.e1c.v8codestyle.bsl;bundle-version="[0.2.0,0.3.0)"
|
||||
Fragment-Host: com.e1c.v8codestyle.bsl;bundle-version="[0.3.0,0.4.0)"
|
||||
Automatic-Module-Name: com.e1c.v8codestyle.md.itests
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||
Bundle-Localization: fragment
|
||||
|
@ -19,9 +19,9 @@
|
||||
<parent>
|
||||
<groupId>com.e1c.v8codestyle</groupId>
|
||||
<artifactId>tests</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>com.e1c.v8codestyle.bsl.itests</artifactId>
|
||||
<version>0.2.0-SNAPSHOT</version>
|
||||
<version>0.3.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-test-plugin</packaging>
|
||||
</project>
|
@ -0,0 +1,94 @@
|
||||
/*******************************************************************************
|
||||
* 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.bsl.check.itests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.core.runtime.Path;
|
||||
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.CommonModuleNamedSelfReferenceCheck;
|
||||
|
||||
/**
|
||||
* Test for the class {@link CommonModuleNamedSelfReferenceCheck}
|
||||
*
|
||||
* @author Maxim Galios
|
||||
*
|
||||
*/
|
||||
public class CommonModuleNamedSelfReferenceCheckTest
|
||||
extends AbstractSingleModuleTestBase
|
||||
{
|
||||
private static final String PROJECT_NAME = "CommonModuleNamedSelfReferenceCheck";
|
||||
|
||||
private static final String COMMON_MODULE_FILE_NAME = "/src/CommonModules/MyCommonModule/Module.bsl";
|
||||
|
||||
private static final String CACHED_COMMON_MODULE_FILE_NAME = "/src/CommonModules/MyCommonModuleCached/Module.bsl";
|
||||
|
||||
|
||||
public CommonModuleNamedSelfReferenceCheckTest()
|
||||
{
|
||||
super(CommonModuleNamedSelfReferenceCheck.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestConfigurationName()
|
||||
{
|
||||
return PROJECT_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check self references by name in common module
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testCommonModule() throws Exception
|
||||
{
|
||||
List<Marker> markers = getMarkers(COMMON_MODULE_FILE_NAME);
|
||||
assertEquals(2, markers.size());
|
||||
|
||||
assertEquals("6", markers.get(0).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("6", markers.get(1).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check self references by name in cached common moudle
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testCachedCommonModule() throws Exception
|
||||
{
|
||||
List<Marker> markers = getMarkers(CACHED_COMMON_MODULE_FILE_NAME);
|
||||
assertEquals(0, markers.size());
|
||||
}
|
||||
|
||||
private List<Marker> getMarkers(String moduleFileName)
|
||||
{
|
||||
String moduleId = Path.ROOT.append(getTestConfigurationName()).append(moduleFileName).toString();
|
||||
List<Marker> markers = List.of(markerManager.getMarkers(getProject().getWorkspaceProject(), moduleId));
|
||||
|
||||
String chekcId = getCheckId();
|
||||
|
||||
assertNotNull(chekcId);
|
||||
return markers.stream()
|
||||
.filter(marker -> chekcId.equals(getCheckIdFromMarker(marker, getProject())))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/*******************************************************************************
|
||||
* 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.bsl.check.itests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.Path;
|
||||
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.FormSelfReferenceOutdatedCheck;
|
||||
|
||||
/**
|
||||
* The test for class {@link FormSelfReferenceOutdatedCheck}
|
||||
* @author Maxim Galios
|
||||
*
|
||||
*/
|
||||
public class FormSelfReferenceOutdatedCheckTest
|
||||
extends AbstractSingleModuleTestBase
|
||||
{
|
||||
private static final String PROJECT_NAME = "FormSelfReferenceOutdatedCheck";
|
||||
|
||||
private static final String FORM_MODULE_FILE_NAME = "/src/CommonForms/MyForm/Module.bsl";
|
||||
|
||||
public FormSelfReferenceOutdatedCheckTest()
|
||||
{
|
||||
super(FormSelfReferenceOutdatedCheck.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestConfigurationName()
|
||||
{
|
||||
return PROJECT_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getModuleId()
|
||||
{
|
||||
return Path.ROOT.append(getTestConfigurationName()).append(FORM_MODULE_FILE_NAME).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test ЭтаФорма/ThisForm references presence in form module
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testFormModule() throws Exception
|
||||
{
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(2, markers.size());
|
||||
|
||||
assertEquals("11", markers.get(0).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("12", markers.get(1).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
/*******************************************************************************
|
||||
* 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.bsl.check.itests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.Path;
|
||||
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.ManagerModuleNamedSelfReferenceCheck;
|
||||
|
||||
/**
|
||||
* Test for the class {@link ManagerModuleNamedSelfReferenceCheck}
|
||||
*
|
||||
* @author Maxim Galios
|
||||
*
|
||||
*/
|
||||
public class ManagerModuleNamedSelfReferenceCheckTest
|
||||
extends AbstractSingleModuleTestBase
|
||||
{
|
||||
private static final String PROJECT_NAME = "ManagerModuleNamedSelfReferenceCheck";
|
||||
|
||||
private static final String MANAGER_MODULE_FILE_NAME = "/src/Catalogs/Catalog/ManagerModule.bsl";
|
||||
|
||||
public ManagerModuleNamedSelfReferenceCheckTest()
|
||||
{
|
||||
super(ManagerModuleNamedSelfReferenceCheck.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestConfigurationName()
|
||||
{
|
||||
return PROJECT_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getModuleId()
|
||||
{
|
||||
return Path.ROOT.append(getTestConfigurationName()).append(MANAGER_MODULE_FILE_NAME).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check self reference in manager module
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testManagerModule() throws Exception
|
||||
{
|
||||
List<Marker> markers = getModuleMarkers();
|
||||
assertEquals(4, markers.size());
|
||||
|
||||
assertEquals("6", markers.get(0).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("6", markers.get(1).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("7", markers.get(2).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("7", markers.get(3).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
}
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
/*******************************************************************************
|
||||
* 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.bsl.check.itests;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.junit.Test;
|
||||
|
||||
import com._1c.g5.v8.dt.core.platform.IDtProject;
|
||||
import com._1c.g5.v8.dt.validation.marker.IExtraInfoKeys;
|
||||
import com._1c.g5.v8.dt.validation.marker.Marker;
|
||||
import com.e1c.g5.v8.dt.check.settings.CheckUid;
|
||||
import com.e1c.g5.v8.dt.check.settings.ICheckSettings;
|
||||
import com.e1c.v8codestyle.bsl.check.SelfReferenceCheck;
|
||||
import com.e1c.v8codestyle.internal.bsl.BslPlugin;
|
||||
|
||||
/**
|
||||
* The test for class {@link SelfReferenceCheck}.
|
||||
*
|
||||
* @author Maxim Galios
|
||||
*
|
||||
*/
|
||||
public class SelfReferenceCheckTest
|
||||
extends AbstractSingleModuleTestBase
|
||||
{
|
||||
|
||||
private static final String PROJECT_NAME = "SelfReferenceCheck";
|
||||
|
||||
private static final String COMMON_MODULE_FILE_NAME = "/src/CommonModules/MyCommonModule/Module.bsl";
|
||||
|
||||
private static final String FORM_MODULE_FILE_NAME = "/src/CommonForms/MyForm/Module.bsl";
|
||||
|
||||
private static final String OBJECT_MODULE_FILE_NAME = "/src/Catalogs/Products/ObjectModule.bsl";
|
||||
|
||||
public SelfReferenceCheckTest()
|
||||
{
|
||||
super(SelfReferenceCheck.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestConfigurationName()
|
||||
{
|
||||
return PROJECT_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test ThisPbject/ЭтотОбъект references presence in common module
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testCommonModule() throws Exception
|
||||
{
|
||||
List<Marker> markers = getMarkers(COMMON_MODULE_FILE_NAME);
|
||||
assertEquals(4, markers.size());
|
||||
|
||||
assertEquals("6", markers.get(0).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("6", markers.get(1).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("10", markers.get(2).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("10", markers.get(3).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test ThisPbject/ЭтотОбъект references presence in form module
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testFormModule() throws Exception
|
||||
{
|
||||
List<Marker> markers = getMarkers(FORM_MODULE_FILE_NAME);
|
||||
assertEquals(3, markers.size());
|
||||
|
||||
assertEquals("11", markers.get(0).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("12", markers.get(1).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("13", markers.get(2).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
|
||||
IDtProject dtProject = getProject();
|
||||
IProject project = dtProject.getWorkspaceProject();
|
||||
|
||||
ICheckSettings settings = checkRepository.getSettings(new CheckUid(getCheckId(), BslPlugin.PLUGIN_ID), project);
|
||||
settings.getParameters()
|
||||
.get(SelfReferenceCheck.PARAMETER_CHECK_ONLY_EXISTING_FORM_PROPERTIES)
|
||||
.setValue(Boolean.toString(false));
|
||||
checkRepository.applyChanges(Collections.singleton(settings), project);
|
||||
waitForDD(dtProject);
|
||||
|
||||
List<Marker> markersAfterSettingsChange = getMarkers(FORM_MODULE_FILE_NAME);
|
||||
assertEquals(5, markersAfterSettingsChange.size());
|
||||
|
||||
assertEquals("11",
|
||||
markersAfterSettingsChange.get(0).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("11",
|
||||
markersAfterSettingsChange.get(1).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("12",
|
||||
markersAfterSettingsChange.get(2).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("12",
|
||||
markersAfterSettingsChange.get(3).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("13",
|
||||
markersAfterSettingsChange.get(4).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test ThisPbject/ЭтотОбъект references presence in object module
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void testObjectModule() throws Exception
|
||||
{
|
||||
List<Marker> markers = getMarkers(OBJECT_MODULE_FILE_NAME);
|
||||
assertEquals(4, markers.size());
|
||||
|
||||
assertEquals("8", markers.get(0).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("8", markers.get(1).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("9", markers.get(2).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
assertEquals("9", markers.get(3).getExtraInfo().get(IExtraInfoKeys.TEXT_EXTRA_INFO_LINE_KEY));
|
||||
}
|
||||
|
||||
private List<Marker> getMarkers(String moduleFileName)
|
||||
{
|
||||
String moduleId = Path.ROOT.append(getTestConfigurationName()).append(moduleFileName).toString();
|
||||
List<Marker> markers = List.of(markerManager.getMarkers(getProject().getWorkspaceProject(), moduleId));
|
||||
|
||||
String chekcId = getCheckId();
|
||||
|
||||
assertNotNull(chekcId);
|
||||
return markers.stream()
|
||||
.filter(marker -> chekcId.equals(getCheckIdFromMarker(marker, getProject())))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>CommonModuleNamedSelfReferenceCheck</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
|
||||
<nature>com._1c.g5.v8.dt.core.V8ConfigurationNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
topObjects=true
|
@ -0,0 +1,3 @@
|
||||
addModuleStrictTypesAnnotation=false
|
||||
createModuleStructure=false
|
||||
eclipse.preferences.version=1
|
@ -0,0 +1,3 @@
|
||||
commonChecks=true
|
||||
eclipse.preferences.version=1
|
||||
standardChecks=true
|
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
@ -0,0 +1,2 @@
|
||||
Manifest-Version: 1.0
|
||||
Runtime-Version: 8.3.21
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user