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

#431 Задано наименование предопределенного регламентного задания (#786)

This commit is contained in:
kuzja086 2021-09-21 15:15:53 +05:00 committed by GitHub
parent dcf348df9d
commit 5a8e01e2b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 333 additions and 1 deletions

View File

@ -22,6 +22,7 @@
- Клиент-серверный общий модуль должен оканчиваться на суффикс КлиентСервер
- Клиентский общий модуль должен оканчиваться на суффикс Клиент
- Не заполненено ни представление объекта, ни представление списка
- У предопределенного регламентного задания не должно быть заполнено наименование
#### Формы

View File

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

View File

@ -0,0 +1,8 @@
# The description of the predefine sheduled job is set
Description of predefined Scheduled jobs should not be set.
Instead, it is enough to set only synonym for a predefined scheduled job.
## See
[Sheduled jobs: localization requirements](https://its.1c.ru/db/v8std#content:767:hdoc:1)

View File

@ -0,0 +1,9 @@
# Задано наименование предопределенного регламентного задания
Предопределенным регламентным заданиям не следует задавать
наименования в конфигураторе. Вместо этого, достаточно задать синоним
предопределенного регламентного задания.
## См.
[Регламентные задания: требования по локализации](https://its.1c.ru/db/v8std#content:767:hdoc:1)

View File

@ -50,6 +50,10 @@
category="com.e1c.v8codestyle.md"
class="com.e1c.v8codestyle.internal.md.ExecutableExtensionFactory:com.e1c.v8codestyle.md.check.MdListObjectPresentationCheck">
</check>
<check
category="com.e1c.v8codestyle.md"
class="com.e1c.v8codestyle.internal.md.ExecutableExtensionFactory:com.e1c.v8codestyle.md.check.MdScheduledJobDescriptionCheck">
</check>
</extension>
</plugin>

View File

@ -0,0 +1,78 @@
/*******************************************************************************
* 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
* Sergey Kozynskiy - issue #431
*******************************************************************************/
package com.e1c.v8codestyle.md.check;
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.SCHEDULED_JOB;
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.SCHEDULED_JOB__DESCRIPTION;
import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.SCHEDULED_JOB__PREDEFINED;
import org.eclipse.core.runtime.IProgressMonitor;
import com._1c.g5.v8.dt.common.StringUtils;
import com._1c.g5.v8.dt.metadata.mdclass.ScheduledJob;
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;
/**
* The check the predefined {@link SCHEDULED_JOB} has't description.
*
* @author Sergey Kozynskiy
*/
public class MdScheduledJobDescriptionCheck
extends BasicCheck
{
private static final String CHECK_ID = "mdo-scheduled-job-description"; //$NON-NLS-1$
@Override
public String getCheckId()
{
return CHECK_ID;
}
@Override
protected void configureCheck(CheckConfigurer builder)
{
builder.title(Messages.MdScheduledJobDescriptionCheck_title)
.description(Messages.MdScheduledJobDescriptionCheck_description)
.complexity(CheckComplexity.NORMAL)
.severity(IssueSeverity.MINOR)
.issueType(IssueType.UI_STYLE)
.topObject(SCHEDULED_JOB)
.checkTop()
.features(SCHEDULED_JOB__DESCRIPTION, SCHEDULED_JOB__PREDEFINED);
}
@Override
protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters,
IProgressMonitor monitor)
{
if (monitor.isCanceled())
{
return;
}
ScheduledJob mdObject = (ScheduledJob)object;
String description = mdObject.getDescription();
if (mdObject.isPredefined() && !StringUtils.isBlank(description))
{
resultAceptor.addIssue(Messages.MdScheduledJobDescriptionCheck_message, SCHEDULED_JOB__DESCRIPTION);
}
}
}

View File

@ -48,6 +48,9 @@ final class Messages
public static String MdListObjectPresentationCheck_decription;
public static String MdListObjectPresentationCheck_Neither_Object_presentation_nor_List_presentation_is_not_filled;
public static String MdListObjectPresentationCheck_title;
public static String MdScheduledJobDescriptionCheck_title;
public static String MdScheduledJobDescriptionCheck_description;
public static String MdScheduledJobDescriptionCheck_message;
static
{
// initialize resource bundle

View File

@ -44,3 +44,9 @@ MdObjectNameLength_message = Metadata object name should be less then {0}
MdObjectNameLength_title = Metadata object name length
MdObjectNameWithoutSuffix_Name_suffix_list_title = Name suffix list, comma separated
MdScheduledJobDescriptionCheck_description = The description of the predefine sheduled job is set
MdScheduledJobDescriptionCheck_message = The description of the predefine sheduled job is set
MdScheduledJobDescriptionCheck_title = The description of the predefine sheduled job is set

View File

@ -45,3 +45,9 @@ MdObjectNameLength_message = Длина имени объекта метадан
MdObjectNameLength_title = Длина имени объекта метаданных
MdObjectNameWithoutSuffix_Name_suffix_list_title = Список суффиксов имени, разделенный запятой
MdScheduledJobDescriptionCheck_description = Задано наименование предопределенного регламентного задания
MdScheduledJobDescriptionCheck_message = Задано наименование предопределенного регламентного задания
MdScheduledJobDescriptionCheck_title = Задано наименование предопределенного регламентного задания

View File

@ -0,0 +1,57 @@
/*******************************************************************************
* 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
* Sergey Kozynskiy - issue #431
*******************************************************************************/
package com.e1c.v8codestyle.md.check.itests;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Test;
import com._1c.g5.v8.dt.core.platform.IDtProject;
import com._1c.g5.v8.dt.validation.marker.Marker;
import com.e1c.g5.v8.dt.testing.check.CheckTestBase;
import com.e1c.v8codestyle.md.check.MdScheduledJobDescriptionCheck;
/**
* The test for class {@link MdScheduledJobDescriptionCheck}.
*
* @author Sergey Kozynskiy
*
*/
public class ScheduledJobDescriptionCheckTest
extends CheckTestBase
{
private static final String CHECK_ID = "mdo-scheduled-job-description"; //$NON-NLS-1$
private static final String PROJECT_NAME = "ScheduledJobs";
/**
* Scheduled job description is empty if Scheduled job is predefined
*
* @throws Exception the exception
*/
@Test
public void MdScheduledJobDescriptionIsEmpty() throws Exception
{
IDtProject dtProject = openProjectAndWaitForValidationFinish(PROJECT_NAME);
assertNotNull(dtProject);
long id = getTopObjectIdByFqn("ScheduledJob.PredefinedJob", dtProject);
Marker marker = getFirstMarker(CHECK_ID, id, dtProject);
assertNotNull(marker);
id = getTopObjectIdByFqn("ScheduledJob.NotPredefinedJob", dtProject);
marker = getFirstMarker(CHECK_ID, id, dtProject);
assertNull(marker);
}
}

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ScheduledJobs</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="03405280-186f-45a7-9812-6398eeec058d">
<name>Jobs</name>
<synonym>
<key>en</key>
<value>Jobs</value>
</synonym>
<server>true</server>
</mdclass:CommonModule>

View File

@ -0,0 +1,10 @@
Procedure PredefinedJob() Export
// Insert hanlder code.
EndProcedure
Procedure NotPredefinedJob() Export
// Insert hanlder code.
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,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<mdclass:Configuration xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="6039c022-ea5e-4a92-acde-b0f440156cd8">
<name>ScheduledJobs</name>
<synonym>
<key>en</key>
<value>Scheduled job description</value>
</synonym>
<containedObjects classId="9cd510cd-abfc-11d4-9434-004095e12fc7" objectId="92a6ce1e-980e-4e20-967c-3d3854d72799"/>
<containedObjects classId="9fcd25a0-4822-11d4-9414-008048da11f9" objectId="6077191f-0602-4f15-a484-64ec66235ce9"/>
<containedObjects classId="e3687481-0a87-462c-a166-9f34594f9bba" objectId="d33c1ec3-49d7-4caa-a5e9-94e6d7830fe0"/>
<containedObjects classId="9de14907-ec23-4a07-96f0-85521cb6b53b" objectId="8039419c-e720-412a-9be9-ddcc1ff5f1f8"/>
<containedObjects classId="51f2d5d8-ea4d-4064-8892-82951750031e" objectId="591e3e7f-a6de-477c-9db8-e264b7140d08"/>
<containedObjects classId="e68182ea-4237-4383-967f-90c1e3370bc7" objectId="b274210c-ef64-42d2-b100-9e37df546d56"/>
<containedObjects classId="fb282519-d103-4dd3-bc12-cb271d631dfc" objectId="16a0e033-f65a-4372-89f9-ee5505a52da1"/>
<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="8d39d188-4544-451d-a60f-5d8934625b93">
<name>English</name>
<synonym>
<key>en</key>
<value>English</value>
</synonym>
<languageCode>en</languageCode>
</languages>
<commonModules>CommonModule.Jobs</commonModules>
<scheduledJobs>ScheduledJob.NotPredefinedJob</scheduledJobs>
<scheduledJobs>ScheduledJob.PredefinedJob</scheduledJobs>
</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

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<mdclass:ScheduledJob xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="7ab6a1ee-8196-4dfe-84c6-9e79a7480799">
<name>NotPredefinedJob</name>
<synonym>
<key>en</key>
<value>Not predefined job</value>
</synonym>
<methodName>CommonModule.Jobs.NotPredefinedJob</methodName>
<description>Description</description>
<use>true</use>
<restartCountOnFailure>3</restartCountOnFailure>
<restartIntervalOnFailure>10</restartIntervalOnFailure>
</mdclass:ScheduledJob>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<schedule:Schedule xmlns:schedule="http://g5.1c.ru/v8/dt/schedule" beginDate="0001-01-01" endDate="0001-01-01" beginTime="00:00:00" endTime="00:00:00" completionTime="00:00:00" weeksPeriod="1">
<weekDays>Sun</weekDays>
<weekDays>Mon</weekDays>
<weekDays>Tue</weekDays>
<weekDays>Wed</weekDays>
<weekDays>Thu</weekDays>
<weekDays>Fri</weekDays>
<weekDays>Sat</weekDays>
<months>Jan</months>
<months>Feb</months>
<months>Mar</months>
<months>Apr</months>
<months>May</months>
<months>Jun</months>
<months>Jul</months>
<months>Aug</months>
<months>Sep</months>
<months>Oct</months>
<months>Nov</months>
<months>Dec</months>
</schedule:Schedule>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<mdclass:ScheduledJob xmlns:mdclass="http://g5.1c.ru/v8/dt/metadata/mdclass" uuid="1bfcb8ca-7a4c-4cf2-8ebb-a917aed0cfc5">
<name>PredefinedJob</name>
<synonym>
<key>en</key>
<value>Predefined job</value>
</synonym>
<methodName>CommonModule.Jobs.PredefinedJob</methodName>
<description>Description</description>
<use>true</use>
<predefined>true</predefined>
<restartCountOnFailure>3</restartCountOnFailure>
<restartIntervalOnFailure>10</restartIntervalOnFailure>
</mdclass:ScheduledJob>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<schedule:Schedule xmlns:schedule="http://g5.1c.ru/v8/dt/schedule" beginDate="0001-01-01" endDate="0001-01-01" beginTime="00:00:00" endTime="00:00:00" completionTime="00:00:00" weeksPeriod="1">
<weekDays>Sun</weekDays>
<weekDays>Mon</weekDays>
<weekDays>Tue</weekDays>
<weekDays>Wed</weekDays>
<weekDays>Thu</weekDays>
<weekDays>Fri</weekDays>
<weekDays>Sat</weekDays>
<months>Jan</months>
<months>Feb</months>
<months>Mar</months>
<months>Apr</months>
<months>May</months>
<months>Jun</months>
<months>Jul</months>
<months>Aug</months>
<months>Sep</months>
<months>Oct</months>
<months>Nov</months>
<months>Dec</months>
</schedule:Schedule>