diff --git a/bundles/com.e1c.v8codestyle.bsl/markdown/not-support-goto-operator-webclient.md b/bundles/com.e1c.v8codestyle.bsl/markdown/not-support-goto-operator-webclient.md new file mode 100644 index 00000000..11ed94b2 --- /dev/null +++ b/bundles/com.e1c.v8codestyle.bsl/markdown/not-support-goto-operator-webclient.md @@ -0,0 +1,25 @@ +# Unsupported Goto operator + +Do not use the GoTo operator in common modules with the "Client (managed application)" flag selected, +command modules, and client code of managed form modules as this method is not supported in the web client. + +## Noncompliant Code Example + +If ChartOfCalculationTypes = Object.ChartOfCalculationTypes Then + + GoTo ~ChartOfCalculationTypes; + + EndIf; + +## Compliant Solution: + +If ChartOfCalculationTypes = Object.ChartOfCalculationTypes Then + + ProcessChartOfCalculationTypes(); + + EndIf; + + ## See + +[GoTo operator](https://kb.1ci.com/1C_Enterprise_Platform/Guides/Developer_Guides/1C_Enterprise_Development_Standards/Code_conventions/Using_1C_Enterprise_language_structures/GoTo_operator/?language=en) + \ No newline at end of file diff --git a/bundles/com.e1c.v8codestyle.bsl/markdown/ru/not-support-goto-operator-webclient.md b/bundles/com.e1c.v8codestyle.bsl/markdown/ru/not-support-goto-operator-webclient.md new file mode 100644 index 00000000..183a20e7 --- /dev/null +++ b/bundles/com.e1c.v8codestyle.bsl/markdown/ru/not-support-goto-operator-webclient.md @@ -0,0 +1,33 @@ +# Ограничение на использование оператора Перейти + +В коде на встроенном языке не рекомендуется использовать оператор Перейти, так как необдуманное использование +данного оператора приводит к получению запутанных, плохо структурированных модулей, по тексту которых затруднительно +понять порядок исполнения и взаимозависимость фрагментов. Вместо оператора Перейти рекомендуется использовать +другие конструкции встроенного языка. +Запрещается использовать оператор Перейти в общих модулях с признаком +"Клиент (управляемое приложение)", модулях команд и в клиентском коде модулей управляемых форм, так как данный метод +не поддерживается платформой 1С:Предприятие в режиме веб-клиента. + +## Неправильно + +Например, неправильно: + + Если ПланВидовРасчета = Объект.ПланВидовРасчета Тогда + + Перейти ~ПланВидовРасчета; + + КонецЕсли; + +## Правильно + +Например, правельно: + + Если ПланВидовРасчета = Объект.ПланВидовРасчета Тогда + + ОбработатьПланВидовРасчета(); + + КонецЕсли; + + ## См. + +- [Ограничение на использование оператора Перейти](https://its.1c.ru/db/v8std#content:547:hdoc:2) diff --git a/bundles/com.e1c.v8codestyle.bsl/markdown/ru/self-assign.md b/bundles/com.e1c.v8codestyle.bsl/markdown/ru/self-assign.md new file mode 100644 index 00000000..88d4e280 --- /dev/null +++ b/bundles/com.e1c.v8codestyle.bsl/markdown/ru/self-assign.md @@ -0,0 +1,20 @@ +# Присвоение переменной самой себе + +Присвоение переменной самой себе не имеет смысла и обычно указывает на ошибку. + +## Неправильно + +Например, неправильно: + +П1 = ""; +П1 = П1; + +## Правильно + +Например, правельно: + +П1 = ""; + + ## См. + +- [Присвоение переменной самой себе](https://1c-syntax.github.io/bsl-language-server/diagnostics/SelfAssign/) \ No newline at end of file diff --git a/bundles/com.e1c.v8codestyle.bsl/markdown/self-assign.md b/bundles/com.e1c.v8codestyle.bsl/markdown/self-assign.md new file mode 100644 index 00000000..2bd4e02a --- /dev/null +++ b/bundles/com.e1c.v8codestyle.bsl/markdown/self-assign.md @@ -0,0 +1,13 @@ +# Self assigne variable + +Assigning a variable to itself is meaningless and usually indicates an error. + +## Noncompliant Code Example + +P1 = ""; +P1 = P1; + +## Compliant Solution + +P1 = ""; + diff --git a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/NotSupportGotoOperatorCheckTest.java b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/NotSupportGotoOperatorCheckTest.java index 5b0a0b40..089a7f9c 100644 --- a/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/NotSupportGotoOperatorCheckTest.java +++ b/tests/com.e1c.v8codestyle.bsl.itests/src/com/e1c/v8codestyle/bsl/check/itests/NotSupportGotoOperatorCheckTest.java @@ -31,12 +31,19 @@ import com.e1c.v8codestyle.bsl.check.NotSupportGotoOperatorWebCheck; public class NotSupportGotoOperatorCheckTest extends AbstractSingleModuleTestBase { + private static final String PROJECT_NAME = "NotSupportGotoOperatorCheckTest"; public NotSupportGotoOperatorCheckTest() { super(NotSupportGotoOperatorWebCheck.class); } + @Override + protected String getTestConfigurationName() + { + return PROJECT_NAME; + } + /** * Test not support goto operator. * @@ -47,6 +54,7 @@ public class NotSupportGotoOperatorCheckTest { updateModule(FOLDER_RESOURCE + "not-support-goto-operator.bsl"); + List markers = getModuleMarkers(); assertEquals(1, markers.size()); Marker marker = markers.get(0); diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/.project b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/.project new file mode 100644 index 00000000..a637a5cc --- /dev/null +++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/.project @@ -0,0 +1,18 @@ + + + StructureModule + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + + org.eclipse.xtext.ui.shared.xtextNature + com._1c.g5.v8.dt.core.V8ConfigurationNature + + diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/.settings/org.eclipse.core.resources.prefs b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..99f26c02 --- /dev/null +++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/DT-INF/PROJECT.PMF b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/DT-INF/PROJECT.PMF new file mode 100644 index 00000000..6835f1cd --- /dev/null +++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/DT-INF/PROJECT.PMF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 +Runtime-Version: 8.3.19 diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/src/CommonModules/CommonModule/CommonModule.mdo b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/src/CommonModules/CommonModule/CommonModule.mdo new file mode 100644 index 00000000..64185c1e --- /dev/null +++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/src/CommonModules/CommonModule/CommonModule.mdo @@ -0,0 +1,12 @@ + + + CommonModule + + en + Common module + + true + true + true + true + diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/src/Configuration/CommandInterface.cmi b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/src/Configuration/CommandInterface.cmi new file mode 100644 index 00000000..0cf6de8a --- /dev/null +++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/src/Configuration/CommandInterface.cmi @@ -0,0 +1,2 @@ + + diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/src/Configuration/Configuration.mdo b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/src/Configuration/Configuration.mdo new file mode 100644 index 00000000..05bf56ec --- /dev/null +++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/src/Configuration/Configuration.mdo @@ -0,0 +1,46 @@ + + + StructureModule + + en + Structure module + + + + + + + + + 8.3.20 + ManagedApplication + PersonalComputer + + + true + + + OSBackup + true + + + Language.English + Managed + NotAutoFree + DontUse + DontUse + 8.3.20 + + English + + en + English + + en + + CommonModule.CommonModule + EventSubscription.EventSubscription + Catalog.CatalogInRegion + Catalog.CatalogInRegionWrongMethod + Catalog.CatalogInWrongRegion + diff --git a/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/src/Configuration/MainSectionCommandInterface.cmi b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/src/Configuration/MainSectionCommandInterface.cmi new file mode 100644 index 00000000..0cf6de8a --- /dev/null +++ b/tests/com.e1c.v8codestyle.bsl.itests/workspace/NotSupportGotoOperatorCheckTest/src/Configuration/MainSectionCommandInterface.cmi @@ -0,0 +1,2 @@ + +