1
0
mirror of https://github.com/1C-Company/v8-code-style.git synced 2025-01-20 21:18:18 +02:00

#1 Перенос бандла bsl (#9)

This commit is contained in:
Dmitriy Marmyshev 2021-06-21 22:06:07 +03:00 committed by GitHub
parent e2d0071c94
commit 7169f4422a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 1041 additions and 3 deletions

View File

@ -24,10 +24,9 @@ import com.google.inject.Guice;
import com.google.inject.Injector;
/**
* The Class AutoSortPlugin.
* The bundle activator to support plug-in life-cycle
*
* @author Dmitriy Marmyshev
*
*/
public class AutoSortPlugin
extends Plugin

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.e1c.v8codestyle.bsl</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=11

View File

@ -0,0 +1,30 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: com.e1c.v8codestyle.bsl;singleton:=true
Bundle-Version: 0.1.0.qualifier
Bundle-Activator: com.e1c.v8codestyle.bsl.internal.BslPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.0.0,4.0.0)",
org.eclipse.emf.common;bundle-version="[2.15.0,3.0.0)",
org.eclipse.xtext;bundle-version="[2.17.0,3.0.0)",
org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)",
org.eclipse.xtext.builder;bundle-version="[2.18.0,3.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-11
Automatic-Module-Name: com.e1c.v8codestyle.bsl
Bundle-ActivationPolicy: lazy
Import-Package: com._1c.g5.v8.bm.core;version="[7.0.0,8.0.0)",
com._1c.g5.v8.dt.bsl.model;version="[4.0.0,5.0.0)",
com._1c.g5.v8.dt.bsl.typesystem;version="[9.0.0,10.0.0)",
com._1c.g5.v8.dt.bsl.util;version="[7.0.0,8.0.0)",
com._1c.g5.v8.dt.mcore;version="[6.0.0,7.0.0)",
com._1c.g5.v8.dt.mcore.util;version="[3.6.0,4.0.0)",
com._1c.g5.v8.dt.metadata.mdclass;version="[8.0.0,9.0.0)",
com._1c.g5.v8.dt.platform;version="[5.0.0,6.0.0)",
com._1c.g5.wiring;version="[2.0.0,3.0.0)",
com._1c.g5.wiring.binder;version="[1.0.0,2.0.0)",
com.e1c.g5.v8.dt.bsl.check;version="[1.0.0,2.0.0)",
com.e1c.g5.v8.dt.check;version="[1.0.0,2.0.0)",
com.e1c.g5.v8.dt.check.components;version="[1.0.0,2.0.0)",
com.e1c.g5.v8.dt.check.settings;version="[1.0.0,2.0.0)"

View File

@ -0,0 +1,19 @@
###############################################################################
# Copyright (C) 2021, 1C-Soft LLC and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# 1C-Soft LLC - initial API and implementation
###############################################################################
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
plugin.properties,\
plugin_ru.properties

View File

@ -0,0 +1,3 @@
*.html
*.css
*.js

View File

@ -0,0 +1,11 @@
# structure-consructor-too-many-keys
Проверка конструктора структуры содержащего больше 3х ключей
## Неправильно
## Правильно
## См.

View File

@ -0,0 +1,27 @@
# structure-consructor-too-many-keys
Check structure constructor has more then 3 keys
## Noncompliant Code Example
```bsl
Parameters = new Structure("Key1, Key2, Key3, Key4");
```
## Compliant Solution
```bsl
Parameters = new Structure();
Parameters.Insert("Key1");
Parameters.Insert("Key2");
Parameters.Insert("Key3");
Parameters.Insert("Key3");
```
## See

View File

@ -0,0 +1,18 @@
###############################################################################
# Copyright (C) 2021, 1C-Soft LLC and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# 1C-Soft LLC - initial API and implementation
###############################################################################
#Properties file for com.e1c.v8codestyle.bsl
providerName = 1C-Soft LLC
pluginName = 1C:Standards for V8 Bsl plugin
category.bsl.title = Built-in script language
category.bls.description = Checks of 1C:Enterprise build-in module language by 1C:Development standard (code style)

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
Copyright (C) 2021, 1C-Soft LLC and others.
This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0
which is available at https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
1C-Soft LLC - initial API and implementation
-->
<plugin>
<extension
point="com.e1c.g5.v8.dt.check.checks">
<category
category="com.e1c.v8codestyle"
description="%category.bls.description"
id="com.e1c.v8codestyle.bsl"
title="%category.bsl.title">
</category>
<check
category="com.e1c.v8codestyle.bsl"
class="com.e1c.v8codestyle.bsl.internal.ExecutableExtensionFactory:com.e1c.v8codestyle.bsl.check.StructureCtorTooManyKeysCheck">
</check>
</extension>
</plugin>

View File

@ -0,0 +1,21 @@
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
###############################################################################
# Copyright (C) 2021, 1C-Soft LLC and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# 1C-Soft LLC - initial API and implementation
###############################################################################
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
category.bls.description = Проверки встроенного языка исполнения 1С:Предприятия по Старндартам разработки
category.bsl.title = Встроенный язык исполнения
pluginName = 1С:Стандарты разработки V8 плагин Встроенного языка
providerName = ООО "1С-Софт"

View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2021, 1C-Soft LLC and others.
This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0
which is available at https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
1C-Soft LLC - initial API and implementation
-->
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.e1c.v8codestyle</groupId>
<artifactId>bundles</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>com.e1c.v8codestyle.bsl</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<!-- base dir of bom module: bom/parent/bundle/this-module -->
<markdown.page.generator.html.file.path>${project.parent.parent.parent.basedir}</markdown.page.generator.html.file.path>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.ruleoftech</groupId>
<artifactId>markdown-page-generator-plugin</artifactId>
<configuration>
<inputDirectory>${project.basedir}/markdown</inputDirectory>
<outputDirectory>${project.basedir}/check.descriptions</outputDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-resource-files</id>
<phase>generate-sources</phase>
<configuration>
<target>
<property name="source" value="${project.basedir}/../../bom"/>
<copy toDir="${project.basedir}/check.descriptions/css">
<fileset dir="${source}/html/css" />
</copy>
<copy toDir="${project.basedir}/check.descriptions/js">
<fileset dir="${source}/html/js" />
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,41 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
/**
*
*/
package com.e1c.v8codestyle.bsl.check;
import org.eclipse.osgi.util.NLS;
/**
* @author Dmitriy Marmyshev
*
*/
final class Messages
extends NLS
{
private static final String BUNDLE_NAME = "com.e1c.v8codestyle.bsl.check.messages"; //$NON-NLS-1$
public static String StructureCtorTooManyKeysCheck_description;
public static String StructureCtorTooManyKeysCheck_Maximum_structure_constructor_keys;
public static String StructureCtorTooManyKeysCheck_Structure_constructor_has_more_than__0__keys;
public static String StructureCtorTooManyKeysCheck_title;
static
{
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages()
{
}
}

View File

@ -0,0 +1,94 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.bsl.check;
import static com._1c.g5.v8.dt.bsl.model.BslPackage.Literals.OPERATOR_STYLE_CREATOR;
import static com._1c.g5.v8.dt.bsl.model.BslPackage.Literals.STRING_LITERAL__LINES;
import java.text.MessageFormat;
import org.eclipse.core.runtime.IProgressMonitor;
import com._1c.g5.v8.dt.bsl.model.OperatorStyleCreator;
import com._1c.g5.v8.dt.bsl.model.StringLiteral;
import com._1c.g5.v8.dt.mcore.util.McoreUtil;
import com._1c.g5.v8.dt.platform.IEObjectTypeNames;
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;
/**
* Checks Structure constructor string literal that contains too may keys.
* Default value is 3 keys in literal. Otherwise it need to use {@code Structure.Insert()} functions to insert all keys.
*
* @author Dmitriy Marmyshev
*/
public class StructureCtorTooManyKeysCheck
extends BasicCheck
{
private static final String CHECK_ID = "structure-consructor-too-many-keys"; //$NON-NLS-1$
private static final String PARAM_MAX_STRUCTURE_KEYS = "maxKeys"; //$NON-NLS-1$
private static final String DEFAULT_MAX_STRUCTURE_KEYS = "3"; //$NON-NLS-1$
@Override
public String getCheckId()
{
return CHECK_ID;
}
@Override
protected void configureCheck(CheckConfigurer builder)
{
builder.title(Messages.StructureCtorTooManyKeysCheck_title)
.description(Messages.StructureCtorTooManyKeysCheck_description)
.complexity(CheckComplexity.NORMAL)
.severity(IssueSeverity.MAJOR)
.issueType(IssueType.CODE_STYLE)
.module()
.checkedObjectType(OPERATOR_STYLE_CREATOR)
.parameter(PARAM_MAX_STRUCTURE_KEYS, Integer.class, DEFAULT_MAX_STRUCTURE_KEYS,
Messages.StructureCtorTooManyKeysCheck_Maximum_structure_constructor_keys);
}
@Override
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
IProgressMonitor monitor)
{
if (monitor.isCanceled() || !(object instanceof OperatorStyleCreator))
return;
OperatorStyleCreator osc = (OperatorStyleCreator)object;
if (IEObjectTypeNames.STRUCTURE.equals(McoreUtil.getTypeName(osc.getType())) && !osc.getParams().isEmpty()
&& osc.getParams().get(0) instanceof StringLiteral)
{
StringLiteral literal = (StringLiteral)osc.getParams().get(0);
String content = String.join("", literal.lines(true)); //$NON-NLS-1$
String[] keys = content.replace(" ", "").split(","); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
int maxKeys = parameters.getInt(PARAM_MAX_STRUCTURE_KEYS);
if (!monitor.isCanceled() && keys.length > maxKeys)
{
String message = MessageFormat.format(
Messages.StructureCtorTooManyKeysCheck_Structure_constructor_has_more_than__0__keys, maxKeys);
resultAceptor.addIssue(message, literal, STRING_LITERAL__LINES);
}
}
}
}

View File

@ -0,0 +1,16 @@
###############################################################################
# Copyright (C) 2021, 1C-Soft LLC and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# 1C-Soft LLC - initial API and implementation
###############################################################################
StructureCtorTooManyKeysCheck_description=Check structure constructor has too many keys
StructureCtorTooManyKeysCheck_Maximum_structure_constructor_keys=Maximum structure constructor keys
StructureCtorTooManyKeysCheck_Structure_constructor_has_more_than__0__keys=Structure constructor has more than {0} keys
StructureCtorTooManyKeysCheck_title=Structure constructor has too many keys

View File

@ -0,0 +1,21 @@
###############################################################################
# Copyright (C) 2021, 1C-Soft LLC and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# 1C-Soft LLC - initial API and implementation
###############################################################################
#Generated by ResourceBundle Editor (http://essiembre.github.io/eclipse-rbe/)
StructureCtorTooManyKeysCheck_Maximum_structure_constructor_keys = Мксимальное количество ключей структуры в контструкторе
StructureCtorTooManyKeysCheck_Structure_constructor_has_more_than__0__keys = Конструктор структуры содержит более чем {0} ключей
StructureCtorTooManyKeysCheck_description = Проверка конструктора структуры содержащего слишком много ключей
StructureCtorTooManyKeysCheck_title = Конструктор структуры содержит слишком много ключей

View File

@ -0,0 +1,193 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.bsl.internal;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
import com._1c.g5.v8.dt.bsl.model.BslPackage;
import com._1c.g5.wiring.InjectorAwareServiceRegistrator;
import com._1c.g5.wiring.ServiceInitialization;
import com.google.inject.Guice;
import com.google.inject.Injector;
/**
* The bundle activator to support plug-in life-cycle
*
* @author Dmitriy Marmyshev
*/
public class BslPlugin
extends Plugin
{
public static final String PLUGIN_ID = "com.e1c.v8codestyle.bsl"; //$NON-NLS-1$
private static BslPlugin plugin;
private volatile Injector injector;
private InjectorAwareServiceRegistrator registrator;
private static BundleContext context;
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static BslPlugin getDefault()
{
return plugin;
}
/**
* Writes a status to the plugin log.
*
* @param status status to log, cannot be <code>null</code>
*/
public static void log(IStatus status)
{
plugin.getLog().log(status);
}
/**
* Writes a throwable to the plugin log as error status.
*
* @param throwable throwable, cannot be <code>null</code>
*/
public static void logError(Throwable throwable)
{
log(createErrorStatus(throwable.getMessage(), throwable));
}
/**
* Creates error status by a given message and cause throwable.
*
* @param message status message, cannot be <code>null</code>
* @param throwable throwable, can be <code>null</code> if not applicable
* @return status created error status, never <code>null</code>
*/
public static IStatus createErrorStatus(String message, Throwable throwable)
{
return new Status(IStatus.ERROR, PLUGIN_ID, 0, message, throwable);
}
/**
* Creates warning status by a given message.
*
* @param message status message, cannot be <code>null</code>
* @return status created warning status, never <code>null</code>
*/
public static IStatus createWarningStatus(String message)
{
return new Status(IStatus.WARNING, PLUGIN_ID, 0, message, null);
}
/**
* Creates warning status by a given message and cause throwable.
*
* @param message status message, cannot be <code>null</code>
* @param throwable throwable, can be <code>null</code> if not applicable
* @return status created warning status, never <code>null</code>
*/
public static IStatus createWarningStatus(final String message, Exception throwable)
{
return new Status(IStatus.WARNING, PLUGIN_ID, 0, message, throwable);
}
static BundleContext getContext()
{
return context;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
@Override
public void start(BundleContext bundleContext) throws Exception
{
super.start(bundleContext);
BslPlugin.context = bundleContext;
plugin = this;
BslPackage.eINSTANCE.eClass();
registrator = new InjectorAwareServiceRegistrator(bundleContext, this::getInjector);
ServiceInitialization.schedule(() -> {
// register services from injector
});
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
@Override
public void stop(BundleContext bundleContext) throws Exception
{
registrator.deactivateManagedServices(this);
registrator.unregisterServices();
injector = null;
plugin = null;
super.stop(bundleContext);
BslPlugin.context = null;
}
/**
* Returns Guice injector of the plugin
*
* @return Guice injector of the plugin, never <code>null</code> if plugin is started
*/
/* package */ Injector getInjector()
{
Injector localInstance = injector;
if (localInstance == null)
{
synchronized (BslPlugin.class)
{
localInstance = injector;
if (localInstance == null)
{
localInstance = createInjector();
injector = localInstance;
}
}
}
return localInstance;
}
private Injector createInjector()
{
try
{
return Guice.createInjector(new ExternalDependenciesModule(this));
}
catch (Exception e)
{
log(createErrorStatus("Failed to create injector for " //$NON-NLS-1$
+ getBundle().getSymbolicName(), e));
throw new RuntimeException("Failed to create injector for " //$NON-NLS-1$
+ getBundle().getSymbolicName(), e);
}
}
}

View File

@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.bsl.internal;
import org.osgi.framework.Bundle;
import com._1c.g5.wiring.AbstractGuiceAwareExecutableExtensionFactory;
import com.google.inject.Injector;
/**
* @author Dmitriy Marmyshev
*
*/
public class ExecutableExtensionFactory
extends AbstractGuiceAwareExecutableExtensionFactory
{
@Override
protected Bundle getBundle()
{
return BslPlugin.getDefault().getBundle();
}
@Override
protected Injector getInjector()
{
return BslPlugin.getDefault().getInjector();
}
}

View File

@ -0,0 +1,39 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
package com.e1c.v8codestyle.bsl.internal;
import org.eclipse.core.runtime.Plugin;
import com._1c.g5.wiring.AbstractServiceAwareModule;
/**
* @author Dmitriy Marmyshev
*
*/
class ExternalDependenciesModule
extends AbstractServiceAwareModule
{
ExternalDependenciesModule(Plugin plugin)
{
super(plugin);
}
@Override
protected void doConfigure()
{
// bind V8 services
}
}

View File

@ -25,6 +25,7 @@
<modules>
<module>com.e1c.v8codestyle</module>
<module>com.e1c.v8codestyle.md</module>
<module>com.e1c.v8codestyle.bsl</module>
<module>com.e1c.v8codestyle.autosort</module>
<module>com.e1c.v8codestyle.autosort.ui</module>
<module>com.e1c.v8codestyle.ql</module>

2
docs/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
toc.md
changelog.md

View File

@ -53,7 +53,7 @@
<copy
file="${project.basedir}/../CHANGELOG.md"
tofile="${project.basedir}/changelog.md" />
<move
<copy
file="${project.basedir}/README.md"
tofile="${project.basedir}/toc.md" />
<property name="source" value="${project.basedir}/../bom"/>

View File

@ -74,4 +74,11 @@
version="0.0.0"
unpack="false"/>
<plugin
id="com.e1c.v8codestyle.bsl"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.e1c.v8codestyle.bsl.itests</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -0,0 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11

View File

@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: com.e1c.v8codestyle.bsl.itests;singleton:=true
Bundle-Version: 0.1.0.qualifier
Bundle-Vendor: %providerName
Fragment-Host: com.e1c.v8codestyle.bsl;bundle-version="[0.1.0,0.2.0)"
Automatic-Module-Name: com.e1c.v8codestyle.md.itests
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Localization: fragment
Import-Package: com._1c.g5.v8.dt.core.platform;version="10.4.0",
com._1c.g5.v8.dt.validation.marker;version="4.0.0",
com.e1c.g5.v8.dt.testing.check;version="[1.0.0,2.0.0)",
org.junit;version="[4.13.0,5.0.0)"

View File

@ -0,0 +1,18 @@
###############################################################################
# Copyright (C) 2021, 1C-Soft LLC and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# 1C-Soft LLC - initial API and implementation
###############################################################################
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
fragment.properties,\
workspace/

View File

@ -0,0 +1,15 @@
###############################################################################
# Copyright (C) 2021, 1C-Soft LLC and others.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# 1C-Soft LLC - initial API and implementation
###############################################################################
#Properties file for com.e1c.v8codestyle.bsl.itests
providerName = 1C-Soft LLC
pluginName = 1C:Standards for V8 Bsl Integration test plugin

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2021, 1C-Soft LLC and others.
This program and the accompanying materials are made
available under the terms of the Eclipse Public License 2.0
which is available at https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
1C-Soft LLC - initial API and implementation
-->
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.e1c.v8codestyle</groupId>
<artifactId>tests</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<artifactId>com.e1c.v8codestyle.bsl.itests</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>

View File

@ -0,0 +1,91 @@
/*******************************************************************************
* Copyright (C) 2021, 1C-Soft LLC and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* 1C-Soft LLC - initial API and implementation
*******************************************************************************/
/**
*
*/
package com.e1c.v8codestyle.bsl.check.itests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.List;
import org.eclipse.xtext.EcoreUtil2;
import org.junit.Test;
import com._1c.g5.v8.bm.core.IBmObject;
import com._1c.g5.v8.dt.bsl.model.Module;
import com._1c.g5.v8.dt.bsl.model.StringLiteral;
import com._1c.g5.v8.dt.core.platform.IDtProject;
import com._1c.g5.v8.dt.metadata.mdclass.CommonModule;
import com._1c.g5.v8.dt.validation.marker.Marker;
import com.e1c.g5.v8.dt.check.settings.CheckUid;
import com.e1c.g5.v8.dt.testing.check.SingleProjectReadOnlyCheckTestBase;
/**
* Tests for {@link ConfigurationDataLock} check.
*
* @author Dmitriy Marmyshev
*/
public class StructureCtorTooManyKeysCheckTest
extends SingleProjectReadOnlyCheckTestBase
{
private static final String CHECK_ID = "structure-consructor-too-many-keys"; //$NON-NLS-1$
private static final String PROJECT_NAME = "StructureCtorTooManyKeys";
/**
* Test the second string literal has error
*
* @throws Exception the exception
*/
@Test
public void testStructureConstructorKeys() throws Exception
{
IDtProject dtProject = dtProjectManager.getDtProject(PROJECT_NAME);
assertNotNull(dtProject);
IBmObject mdObject = getTopObjectByFqn("CommonModule.CommonModule", dtProject);
assertTrue(mdObject instanceof CommonModule);
Module module = ((CommonModule)mdObject).getModule();
assertNotNull(module);
List<StringLiteral> literals = EcoreUtil2.eAllOfType(module, StringLiteral.class);
assertEquals(3, literals.size());
String id = module.eResource().getURI().toString();
Marker[] markers = markerManager.getMarkers(dtProject.getWorkspaceProject(), id);
assertNotNull(markers);
// check incorrect string literal
assertEquals(1, markers.length);
Marker marker = markers[0];
assertEquals("11", marker.getExtraInfo().get("line"));
String uriToProblem = EcoreUtil2.getURI(literals.get(1)).toString();
assertEquals(uriToProblem, marker.getExtraInfo().get("uriToProblem"));
CheckUid checkUid =
this.checkRepository.getUidForShortUid(marker.getCheckId(), dtProject.getWorkspaceProject());
assertNotNull(checkUid);
assertTrue(CHECK_ID.equals(checkUid.getCheckId()));
}
@Override
protected String getTestConfigurationName()
{
return PROJECT_NAME;
}
}

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>StructureCtorTooManyKeys</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>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -0,0 +1,2 @@
Manifest-Version: 1.0
Runtime-Version: 8.3.19

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<mdclass:CommonModule xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="1de4f33d-d428-4d45-97e7-92b0114de68a">
<name>CommonModule</name>
<synonym>
<key>en</key>
<value>Common module</value>
</synonym>
<server>true</server>
</mdclass:CommonModule>

View File

@ -0,0 +1,22 @@
Procedure Correct(Parameters) Export
Parameters = new Structure("Key1, Key2,
| Key3");
EndProcedure
Procedure Incorrect(Parameters) Export
Parameters = new Structure("Key1, Key2,
| Key3, Key4");
EndProcedure
Procedure Suppressed(Parameters) Export
//@skip-check structure-consructor-too-many-keys
Parameters = new Structure("Key1, Key2,
| Key3, Key4");
EndProcedure

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<cmi:CommandInterface xmlns:cmi="http://g5.1c.ru/v8/dt/cmi"/>

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<mdclass:Configuration xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="9d9b343b-26c3-46e5-a701-4363dba87338">
<name>StructureCtorTooManyKeys</name>
<synonym>
<key>en</key>
<value>Structure ctor too many keys</value>
</synonym>
<containedObjects classId="9cd510cd-abfc-11d4-9434-004095e12fc7" objectId="ff2d3d9d-70dd-4ccf-b6de-535bb8ca7f4e"/>
<containedObjects classId="9fcd25a0-4822-11d4-9414-008048da11f9" objectId="68a3dfa7-33b5-4aaf-952b-c5872180aa84"/>
<containedObjects classId="e3687481-0a87-462c-a166-9f34594f9bba" objectId="74d36a43-8a9b-41c8-a2f8-d7fb846e2c47"/>
<containedObjects classId="9de14907-ec23-4a07-96f0-85521cb6b53b" objectId="2c79fd8d-314d-4a86-9e47-7d4e65ffc337"/>
<containedObjects classId="51f2d5d8-ea4d-4064-8892-82951750031e" objectId="e325d79d-fb3d-4c12-849d-9e5a0ffc6970"/>
<containedObjects classId="e68182ea-4237-4383-967f-90c1e3370bc7" objectId="95708a14-536e-4155-ab38-61087920fa6b"/>
<containedObjects classId="fb282519-d103-4dd3-bc12-cb271d631dfc" objectId="5dbd49ff-26f0-4978-a0ba-ea5f88639553"/>
<configurationExtensionCompatibilityMode>8.3.19</configurationExtensionCompatibilityMode>
<defaultRunMode>ManagedApplication</defaultRunMode>
<usePurposes>PersonalComputer</usePurposes>
<usedMobileApplicationFunctionalities>
<functionality>
<use>true</use>
</functionality>
<functionality>
<functionality>OSBackup</functionality>
<use>true</use>
</functionality>
</usedMobileApplicationFunctionalities>
<defaultLanguage>Language.English</defaultLanguage>
<dataLockControlMode>Managed</dataLockControlMode>
<objectAutonumerationMode>NotAutoFree</objectAutonumerationMode>
<modalityUseMode>DontUse</modalityUseMode>
<synchronousPlatformExtensionAndAddInCallUseMode>DontUse</synchronousPlatformExtensionAndAddInCallUseMode>
<compatibilityMode>8.3.19</compatibilityMode>
<languages uuid="3f22f2b0-8f1b-4df6-ba72-8056676d8b42">
<name>English</name>
<synonym>
<key>en</key>
<value>English</value>
</synonym>
<languageCode>en</languageCode>
</languages>
<commonModules>CommonModule.CommonModule</commonModules>
</mdclass:Configuration>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<cmi:CommandInterface xmlns:cmi="http://g5.1c.ru/v8/dt/cmi"/>

View File

@ -25,6 +25,7 @@
<modules>
<module>com.e1c.v8codestyle.md.itests</module>
<module>com.e1c.v8codestyle.bsl.itests</module>
<module>com.e1c.v8codestyle.autosort.itests</module>
<module>com.e1c.v8codestyle.ql.itests</module>
</modules>