From 7c6631253e8f0f9bc05759044fb17f8f1c800591 Mon Sep 17 00:00:00 2001 From: theshadowco Date: Thu, 11 Jan 2024 10:26:59 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B0=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=BD=D0=BE=D1=81=D1=82=D1=8C=20=D1=83=D0=BA=D0=B0=D0=B7=D0=B0?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B4=D0=B8=D0=B0=D0=B3=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=D0=BA=D0=B5=20=D0=BF=D1=80=D0=B8=D0=B7=D0=BD=D0=B0=D0=BA?= =?UTF-8?q?,=20=D1=87=D1=82=D0=BE=20=D0=B5=D0=B5=20=D0=B7=D0=B0=D0=BC?= =?UTF-8?q?=D0=B5=D1=87=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BC=D0=BE=D0=B3=D1=83?= =?UTF-8?q?=D1=82=20=D0=B1=D1=8B=D1=82=D1=8C=20=D1=80=D0=B0=D0=B7=D0=BC?= =?UTF-8?q?=D0=B5=D1=89=D0=B5=D0=BD=D1=8B=20=D0=BD=D0=B0=20=D1=83=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=BD=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/diagnostics/DenyIncompleteValues.md | 2 +- docs/en/diagnostics/DeprecatedCurrentDate.md | 5 +- ...ferringParametersBetweenClientAndServer.md | 7 +-- .../diagnostics/UsingFindElementByString.md | 2 +- .../DenyIncompleteValuesDiagnostic.java | 3 +- .../ForbiddenMetadataNameDiagnostic.java | 3 +- .../MetadataObjectNameLengthDiagnostic.java | 3 +- ...MetadataObjectAndChildNamesDiagnostic.java | 4 +- .../ScheduledJobHandlerDiagnostic.java | 3 +- .../diagnostics/metadata/DiagnosticInfo.java | 4 ++ .../metadata/DiagnosticMetadata.java | 29 ++++++++++ .../configuration/parameters-schema.json | 20 ++++++- .../languageserver/configuration/schema.json | 9 +++ .../metadata/DiagnosticInfoTest.java | 57 ++++++++++++------- 14 files changed, 113 insertions(+), 38 deletions(-) diff --git a/docs/diagnostics/DenyIncompleteValues.md b/docs/diagnostics/DenyIncompleteValues.md index bd69b8cc1fe..9c2a9bc3864 100644 --- a/docs/diagnostics/DenyIncompleteValues.md +++ b/docs/diagnostics/DenyIncompleteValues.md @@ -1,4 +1,4 @@ -# Запрет незаполненных значений (DenyIncompleteValues) +# Запрет незаполненных значений у измерений регистров (DenyIncompleteValues) ## Описание диагностики diff --git a/docs/en/diagnostics/DeprecatedCurrentDate.md b/docs/en/diagnostics/DeprecatedCurrentDate.md index 62b65410d66..4673c51026b 100644 --- a/docs/en/diagnostics/DeprecatedCurrentDate.md +++ b/docs/en/diagnostics/DeprecatedCurrentDate.md @@ -1,7 +1,8 @@ # Using of the deprecated method "CurrentDate" (DeprecatedCurrentDate) - -## Diagnostic description + +## Description + The configurations must be designed to work in conditions where the time zone on the server computer does not match the real time zone of the infobase users. For example, employees of a company from Vladivostok work with a server located in Moscow, and all operations in the system must be performed in local time (Vladivostok). Such a work scenario is often in demand in client-server infobases and in applied solutions in the service model (SaaS). diff --git a/docs/en/diagnostics/TransferringParametersBetweenClientAndServer.md b/docs/en/diagnostics/TransferringParametersBetweenClientAndServer.md index d0045c5c7fa..d6eaf85bcee 100644 --- a/docs/en/diagnostics/TransferringParametersBetweenClientAndServer.md +++ b/docs/en/diagnostics/TransferringParametersBetweenClientAndServer.md @@ -1,8 +1,7 @@ -# Transferring parameters between client and server (TransferringParametersBetweenClientAndServer) +# Transferring parameters between the client and the server (TransferringParametersBetweenClientAndServer) - -## Diagnostic description - + +## Description When transferring control from the client to the server (and vice versa), copies of the parameters are always transferred. diff --git a/docs/en/diagnostics/UsingFindElementByString.md b/docs/en/diagnostics/UsingFindElementByString.md index 5f7d1f1064f..2b5abd56ba4 100644 --- a/docs/en/diagnostics/UsingFindElementByString.md +++ b/docs/en/diagnostics/UsingFindElementByString.md @@ -1,4 +1,4 @@ -# Using FindByName, FindByCode and FindByNumber (UsingFindElementByString) +# Using FindByName, FindByCode and FindByNumber (UsingFindElementByString) ## Description diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DenyIncompleteValuesDiagnostic.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DenyIncompleteValuesDiagnostic.java index bb973858273..e7a16a2dba2 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DenyIncompleteValuesDiagnostic.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DenyIncompleteValuesDiagnostic.java @@ -42,7 +42,8 @@ tags = { DiagnosticTag.BADPRACTICE }, - scope = DiagnosticScope.BSL + scope = DiagnosticScope.BSL, + canLocateOnProject = true ) public class DenyIncompleteValuesDiagnostic extends AbstractMetadataDiagnostic { diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ForbiddenMetadataNameDiagnostic.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ForbiddenMetadataNameDiagnostic.java index d23b4ecd614..a2584b18eb2 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ForbiddenMetadataNameDiagnostic.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ForbiddenMetadataNameDiagnostic.java @@ -52,7 +52,8 @@ ModuleType.ValueManagerModule, ModuleType.SessionModule }, - scope = DiagnosticScope.BSL + scope = DiagnosticScope.BSL, + canLocateOnProject = true ) @RequiredArgsConstructor public class ForbiddenMetadataNameDiagnostic extends AbstractMetadataDiagnostic { diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MetadataObjectNameLengthDiagnostic.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MetadataObjectNameLengthDiagnostic.java index b21c94757eb..21f26f99a26 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MetadataObjectNameLengthDiagnostic.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MetadataObjectNameLengthDiagnostic.java @@ -42,7 +42,8 @@ scope = DiagnosticScope.BSL, tags = { DiagnosticTag.STANDARD - } + }, + canLocateOnProject = true ) public class MetadataObjectNameLengthDiagnostic extends AbstractMetadataDiagnostic { diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SameMetadataObjectAndChildNamesDiagnostic.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SameMetadataObjectAndChildNamesDiagnostic.java index ec4f6e51811..54dda675e11 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SameMetadataObjectAndChildNamesDiagnostic.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SameMetadataObjectAndChildNamesDiagnostic.java @@ -54,8 +54,8 @@ ModuleType.ObjectModule, ModuleType.SessionModule }, - scope = DiagnosticScope.BSL - + scope = DiagnosticScope.BSL, + canLocateOnProject = true ) public class SameMetadataObjectAndChildNamesDiagnostic extends AbstractMetadataDiagnostic { diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ScheduledJobHandlerDiagnostic.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ScheduledJobHandlerDiagnostic.java index 283cc219c3e..23723598af1 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ScheduledJobHandlerDiagnostic.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ScheduledJobHandlerDiagnostic.java @@ -48,7 +48,8 @@ tags = { DiagnosticTag.ERROR }, - scope = DiagnosticScope.BSL + scope = DiagnosticScope.BSL, + canLocateOnProject = true ) public class ScheduledJobHandlerDiagnostic extends AbstractMetadataDiagnostic { diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfo.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfo.java index 48d3e3fefe1..49960d4cb61 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfo.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfo.java @@ -194,6 +194,10 @@ public Optional getParameter(String parameterName) { return diagnosticParameters.stream().filter(param -> param.getName().equals(parameterName)).findAny(); } + public boolean canLocateOnProject() { + return diagnosticMetadata.canLocateOnProject(); + } + public Map getDefaultConfiguration() { return diagnosticParameters.stream() .collect(Collectors.toMap(DiagnosticParameterInfo::getName, DiagnosticParameterInfo::getDefaultValue)); diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticMetadata.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticMetadata.java index 6a568208e97..934d7aac59b 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticMetadata.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticMetadata.java @@ -39,19 +39,48 @@ @Primary @Scope("prototype") public @interface DiagnosticMetadata { + /** + * Тип диагностики + */ DiagnosticType type() default DiagnosticType.ERROR; + /** + * Серьезность замечания + */ DiagnosticSeverity severity() default DiagnosticSeverity.MINOR; + /** + * Область применения диагностики по диалекту языка (bsl или oscript) + */ DiagnosticScope scope() default DiagnosticScope.ALL; + /** + * Типы модулей, анализируемых диагностикой + */ ModuleType[] modules() default {}; + /** + * Время, необходимое для исправления замечания + */ int minutesToFix() default 0; + /** + * Признак включения диагностики в профиле по умолчанию + */ boolean activatedByDefault() default true; + /** + * Версия платформы 1С:Предприятие, с которой диагностика применяется + */ DiagnosticCompatibilityMode compatibilityMode() default DiagnosticCompatibilityMode.UNDEFINED; + /** + * Перечень меток (тегов) диагностики + */ DiagnosticTag[] tags() default {}; + + /** + * Замечания диагностики могут быть прикреплены на уровень анализируемого проекта (в частности в SonarQube) + */ + boolean canLocateOnProject() default false; } diff --git a/src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/parameters-schema.json b/src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/parameters-schema.json index 2dc96f59925..de990507318 100644 --- a/src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/parameters-schema.json +++ b/src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/parameters-schema.json @@ -704,12 +704,26 @@ }, "FileSystemAccess": { "description": "FileSystemAccess", - "default": true, + "default": false, "type": [ "boolean", "object" ], "title": "FileSystemAccess", + "properties": { + "globalMethods": { + "description": "Global methods pattern (regex)", + "default": "\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u0412\u0424\u0430\u0439\u043b|ValueToFile|\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0424\u0430\u0439\u043b|FileCopy|\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0424\u0430\u0439\u043b\u044b|MergeFiles|\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c\u0424\u0430\u0439\u043b|MoveFile|\u0420\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c\u0424\u0430\u0439\u043b|SplitFile|\u0421\u043e\u0437\u0434\u0430\u0442\u044c\u041a\u0430\u0442\u0430\u043b\u043e\u0433|CreateDirectory|\u0423\u0434\u0430\u043b\u0438\u0442\u044c\u0424\u0430\u0439\u043b\u044b|DeleteFiles|\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b|BinDir|\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445\u0424\u0430\u0439\u043b\u043e\u0432|TempFilesDir|\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432|DocumentsDir|\u0420\u0430\u0431\u043e\u0447\u0438\u0439\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0414\u0430\u043d\u043d\u044b\u0445\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f|UserDataWorkDir|\u041d\u0430\u0447\u0430\u0442\u044c\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u0420\u0430\u0431\u043e\u0442\u044b\u0421\u0424\u0430\u0439\u043b\u0430\u043c\u0438|BeginAttachingFileSystemExtension|\u041d\u0430\u0447\u0430\u0442\u044c\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u0420\u0430\u0431\u043e\u0442\u044b\u0421\u0424\u0430\u0439\u043b\u0430\u043c\u0438|BeginInstallFileSystemExtension|\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u0420\u0430\u0431\u043e\u0442\u044b\u0421\u0424\u0430\u0439\u043b\u0430\u043c\u0438|InstallFileSystemExtension|\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u0420\u0430\u0431\u043e\u0442\u044b\u0421\u0424\u0430\u0439\u043b\u0430\u043c\u0438\u0410\u0441\u0438\u043d\u0445|InstallFileSystemExtensionAsync|\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u0420\u0430\u0431\u043e\u0442\u044b\u0421\u0424\u0430\u0439\u043b\u0430\u043c\u0438\u0410\u0441\u0438\u043d\u0445|AttachFileSystemExtensionAsync|\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445\u0424\u0430\u0439\u043b\u043e\u0432\u0410\u0441\u0438\u043d\u0445|TempFilesDirAsync|\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432\u0410\u0441\u0438\u043d\u0445|DocumentsDirAsync|\u041d\u0430\u0447\u0430\u0442\u044c\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u0412\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445\u0424\u0430\u0439\u043b\u043e\u0432|BeginGettingTempFilesDir|\u041d\u0430\u0447\u0430\u0442\u044c\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432|BeginGettingDocumentsDir|\u041d\u0430\u0447\u0430\u0442\u044c\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u0420\u0430\u0431\u043e\u0447\u0435\u0433\u043e\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u0414\u0430\u043d\u043d\u044b\u0445\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f|BeginGettingUserDataWorkDir|\u0420\u0430\u0431\u043e\u0447\u0438\u0439\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0414\u0430\u043d\u043d\u044b\u0445\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0410\u0441\u0438\u043d\u0445|UserDataWorkDirAsync|\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0424\u0430\u0439\u043b\u0410\u0441\u0438\u043d\u0445|CopyFileAsync|\u041d\u0430\u0439\u0442\u0438\u0424\u0430\u0439\u043b\u044b\u0410\u0441\u0438\u043d\u0445|FindFilesAsync|\u041d\u0430\u0447\u0430\u0442\u044c\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u0424\u0430\u0439\u043b\u0430|BeginCopyingFile|\u041d\u0430\u0447\u0430\u0442\u044c\u041f\u0435\u0440\u0435\u043c\u0435\u0449\u0435\u043d\u0438\u0435\u0424\u0430\u0439\u043b\u0430|BeginMovingFile|\u041d\u0430\u0447\u0430\u0442\u044c\u041f\u043e\u0438\u0441\u043a\u0424\u0430\u0439\u043b\u043e\u0432|BeginFindingFiles|\u041d\u0430\u0447\u0430\u0442\u044c\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u0414\u0432\u043e\u0438\u0447\u043d\u044b\u0445\u0414\u0430\u043d\u043d\u044b\u0445\u0418\u0437\u0424\u0430\u0439\u043b\u0430|BeginCreateBinaryDataFromFile|\u041d\u0430\u0447\u0430\u0442\u044c\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0430|BeginCreatingDirectory|\u041d\u0430\u0447\u0430\u0442\u044c\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435\u0424\u0430\u0439\u043b\u043e\u0432|BeginDeletingFiles|\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c\u0424\u0430\u0439\u043b\u0410\u0441\u0438\u043d\u0445|MoveFileAsync|\u0421\u043e\u0437\u0434\u0430\u0442\u044c\u0414\u0432\u043e\u0438\u0447\u043d\u044b\u0435\u0414\u0430\u043d\u043d\u044b\u0435\u0418\u0437\u0424\u0430\u0439\u043b\u0430\u0410\u0441\u0438\u043d\u0445|CreateBinaryDataFromFileAsync|\u0421\u043e\u0437\u0434\u0430\u0442\u044c\u041a\u0430\u0442\u0430\u043b\u043e\u0433\u0410\u0441\u0438\u043d\u0445|CreateDirectoryAsync|\u0423\u0434\u0430\u043b\u0438\u0442\u044c\u0424\u0430\u0439\u043b\u044b\u0410\u0441\u0438\u043d\u0445|DeleteFilesAsync", + "type": "string", + "title": "Global methods pattern (regex)" + }, + "newExpression": { + "description": "Class names pattern (regex)", + "default": "File|\u0424\u0430\u0439\u043b|xBase|HTMLWriter|\u0417\u0430\u043f\u0438\u0441\u044cHTML|HTMLReader|\u0427\u0442\u0435\u043d\u0438\u0435HTML|FastInfosetReader|\u0427\u0442\u0435\u043d\u0438\u0435FastInfoset|FastInfosetWriter|\u0417\u0430\u043f\u0438\u0441\u044cFastInfoset|XSLTransform|\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435XSL|ZipFileWriter|\u0417\u0430\u043f\u0438\u0441\u044cZip\u0424\u0430\u0439\u043b\u0430|ZipFileReader|\u0427\u0442\u0435\u043d\u0438\u0435Zip\u0424\u0430\u0439\u043b\u0430|TextReader|\u0427\u0442\u0435\u043d\u0438\u0435\u0422\u0435\u043a\u0441\u0442\u0430|TextWriter|\u0417\u0430\u043f\u0438\u0441\u044c\u0422\u0435\u043a\u0441\u0442\u0430|TextExtraction|\u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435\u0422\u0435\u043a\u0441\u0442\u0430|BinaryData|\u0414\u0432\u043e\u0438\u0447\u043d\u044b\u0435\u0414\u0430\u043d\u043d\u044b\u0435|FileStream|\u0424\u0430\u0439\u043b\u043e\u0432\u044b\u0439\u041f\u043e\u0442\u043e\u043a|FileStreamsManager|\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0424\u0430\u0439\u043b\u043e\u0432\u044b\u0445\u041f\u043e\u0442\u043e\u043a\u043e\u0432|DataWriter|\u0417\u0430\u043f\u0438\u0441\u044c\u0414\u0430\u043d\u043d\u044b\u0445|DataReader|\u0427\u0442\u0435\u043d\u0438\u0435\u0414\u0430\u043d\u043d\u044b\u0445", + "type": "string", + "title": "Class names pattern (regex)" + } + }, "$id": "#/definitions/FileSystemAccess" }, "ForbiddenMetadataName": { @@ -2041,13 +2055,13 @@ "$id": "#/definitions/UsingExternalCodeTools" }, "UsingFindElementByString": { - "description": "Using FindByName, FindByCode and FindByNumber", + "description": "Using FindByName, FindByCode and FindByNumber", "default": true, "type": [ "boolean", "object" ], - "title": "Using FindByName, FindByCode and FindByNumber", + "title": "Using FindByName, FindByCode and FindByNumber", "$id": "#/definitions/UsingFindElementByString" }, "UsingGoto": { diff --git a/src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json b/src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json index 3626e6d94e2..bac7b3f6eed 100644 --- a/src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json +++ b/src/main/resources/com/github/_1c_syntax/bsl/languageserver/configuration/schema.json @@ -176,12 +176,18 @@ "ExportVariables": { "$ref": "parameters-schema.json#/definitions/ExportVariables" }, + "ExternalAppStarting": { + "$ref": "parameters-schema.json#/definitions/ExternalAppStarting" + }, "ExtraCommas": { "$ref": "parameters-schema.json#/definitions/ExtraCommas" }, "FieldsFromJoinsWithoutIsNull": { "$ref": "parameters-schema.json#/definitions/FieldsFromJoinsWithoutIsNull" }, + "FileSystemAccess": { + "$ref": "parameters-schema.json#/definitions/FileSystemAccess" + }, "ForbiddenMetadataName": { "$ref": "parameters-schema.json#/definitions/ForbiddenMetadataName" }, @@ -350,6 +356,9 @@ "ParseError": { "$ref": "parameters-schema.json#/definitions/ParseError" }, + "PrivilegedModuleMethodCall": { + "$ref": "parameters-schema.json#/definitions/PrivilegedModuleMethodCall" + }, "ProcedureReturnsValue": { "$ref": "parameters-schema.json#/definitions/ProcedureReturnsValue" }, diff --git a/src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfoTest.java b/src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfoTest.java index 6ff2f9c521c..ad7c945b9a3 100644 --- a/src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfoTest.java +++ b/src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfoTest.java @@ -25,6 +25,7 @@ import com.github._1c_syntax.bsl.languageserver.configuration.LanguageServerConfiguration; import com.github._1c_syntax.bsl.languageserver.diagnostics.DeprecatedAttributes8312Diagnostic; import com.github._1c_syntax.bsl.languageserver.diagnostics.EmptyCodeBlockDiagnostic; +import com.github._1c_syntax.bsl.languageserver.diagnostics.ForbiddenMetadataNameDiagnostic; import com.github._1c_syntax.bsl.languageserver.diagnostics.MultilingualStringHasAllDeclaredLanguagesDiagnostic; import com.github._1c_syntax.bsl.languageserver.diagnostics.UnusedLocalMethodDiagnostic; import com.github._1c_syntax.bsl.languageserver.util.CleanupContextBeforeClassAndAfterClass; @@ -36,8 +37,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import java.util.Optional; - import static com.github._1c_syntax.bsl.languageserver.util.Assertions.assertThat; @SpringBootTest @@ -52,7 +51,7 @@ class DiagnosticInfoTest { @Test void testParameter() { - DiagnosticInfo diagnosticInfo = new DiagnosticInfo(EmptyCodeBlockDiagnostic.class, configuration, stringInterner); + var diagnosticInfo = new DiagnosticInfo(EmptyCodeBlockDiagnostic.class, configuration, stringInterner); Assertions.assertThat(diagnosticInfo.getCode()).isEqualTo(Either.forLeft("EmptyCodeBlock")); Assertions.assertThat(diagnosticInfo.getName()).isNotEmpty(); @@ -66,25 +65,25 @@ void testParameter() { Assertions.assertThat(diagnosticInfo.getScope()).isEqualTo(DiagnosticScope.ALL); Assertions.assertThat(diagnosticInfo.getMinutesToFix()).isEqualTo(5); Assertions.assertThat(diagnosticInfo.isActivatedByDefault()).isTrue(); - Assertions.assertThat(diagnosticInfo.getTags().size()).isPositive(); + Assertions.assertThat(diagnosticInfo.getTags()).isNotEmpty(); Assertions.assertThat(diagnosticInfo.getLSPTags()).isEmpty(); + Assertions.assertThat(diagnosticInfo.canLocateOnProject()).isFalse(); - Assertions.assertThat(diagnosticInfo.getDefaultConfiguration().size()).isPositive(); - + Assertions.assertThat(diagnosticInfo.getDefaultConfiguration()).isNotEmpty(); - DiagnosticParameterInfo parameter = diagnosticInfo.getParameters().get(0); + var parameter = diagnosticInfo.getParameters().get(0); assertThat(parameter.getDescription()) .isEqualTo("Считать комментарий в блоке кодом"); assertThat(parameter.getDefaultValue()).isEqualTo(false); assertThat(parameter.getType()).isEqualTo(Boolean.class); - Optional maybeParameter = diagnosticInfo.getParameter(parameter.getName()); + var maybeParameter = diagnosticInfo.getParameter(parameter.getName()); assertThat(maybeParameter) .isPresent() .hasValue(parameter); - Optional maybeFakeParameter = diagnosticInfo.getParameter("fakeParameterName"); + var maybeFakeParameter = diagnosticInfo.getParameter("fakeParameterName"); assertThat(maybeFakeParameter).isEmpty(); } @@ -102,10 +101,11 @@ void testLSPTags() { // then assertThat(diagnosticInfo.getLSPTags()).contains(DiagnosticTag.Deprecated); } + @Test void testParameterSuper() { - DiagnosticInfo diagnosticInfo = new DiagnosticInfo(MultilingualStringHasAllDeclaredLanguagesDiagnostic.class, configuration, stringInterner); + var diagnosticInfo = new DiagnosticInfo(MultilingualStringHasAllDeclaredLanguagesDiagnostic.class, configuration, stringInterner); Assertions.assertThat(diagnosticInfo.getCode()).isEqualTo(Either.forLeft("MultilingualStringHasAllDeclaredLanguages")); Assertions.assertThat(diagnosticInfo.getName()).isNotEmpty(); @@ -118,28 +118,45 @@ void testParameterSuper() { Assertions.assertThat(diagnosticInfo.getScope()).isEqualTo(DiagnosticScope.BSL); Assertions.assertThat(diagnosticInfo.getMinutesToFix()).isEqualTo(2); Assertions.assertThat(diagnosticInfo.isActivatedByDefault()).isTrue(); - Assertions.assertThat(diagnosticInfo.getTags().size()).isNotZero(); - - Assertions.assertThat(diagnosticInfo.getDefaultConfiguration().size()).isNotZero(); - Assertions.assertThat(diagnosticInfo.getParameters().size()).isEqualTo(1); + Assertions.assertThat(diagnosticInfo.getTags()).isNotEmpty(); + Assertions.assertThat(diagnosticInfo.getDefaultConfiguration()).isNotEmpty(); + Assertions.assertThat(diagnosticInfo.getParameters()).hasSize(1); + Assertions.assertThat(diagnosticInfo.canLocateOnProject()).isFalse(); - DiagnosticParameterInfo parameter = diagnosticInfo.getParameters().get(0); + var parameter = diagnosticInfo.getParameters().get(0); assertThat(parameter.getDescription()) .isEqualTo("Заявленные языки"); assertThat(parameter.getDefaultValue()).isEqualTo("ru"); assertThat(parameter.getType()).isEqualTo(String.class); - Optional maybeParameter = diagnosticInfo.getParameter(parameter.getName()); + var maybeParameter = diagnosticInfo.getParameter(parameter.getName()); assertThat(maybeParameter) .isPresent() .hasValue(parameter); - Optional maybeFakeParameter = diagnosticInfo.getParameter("fakeParameterName"); + var maybeFakeParameter = diagnosticInfo.getParameter("fakeParameterName"); assertThat(maybeFakeParameter).isEmpty(); } + @Test + void testCanLocateOnProject() { + var diagnosticInfo = new DiagnosticInfo(ForbiddenMetadataNameDiagnostic.class, configuration, stringInterner); + Assertions.assertThat(diagnosticInfo.getCode()).isEqualTo(Either.forLeft("ForbiddenMetadataName")); + Assertions.assertThat(diagnosticInfo.getName()).isNotEmpty(); + Assertions.assertThat(diagnosticInfo.getMessage()).isNotEmpty(); + Assertions.assertThat(diagnosticInfo.getType()).isEqualTo(DiagnosticType.ERROR); + Assertions.assertThat(diagnosticInfo.getSeverity()).isEqualTo(DiagnosticSeverity.BLOCKER); + Assertions.assertThat(diagnosticInfo.getLSPSeverity()).isEqualTo(org.eclipse.lsp4j.DiagnosticSeverity.Error); + Assertions.assertThat(diagnosticInfo.getCompatibilityMode()).isEqualTo(DiagnosticCompatibilityMode.UNDEFINED); + Assertions.assertThat(diagnosticInfo.getScope()).isEqualTo(DiagnosticScope.BSL); + Assertions.assertThat(diagnosticInfo.getMinutesToFix()).isEqualTo(30); + Assertions.assertThat(diagnosticInfo.isActivatedByDefault()).isTrue(); + Assertions.assertThat(diagnosticInfo.getTags()).isNotEmpty(); + Assertions.assertThat(diagnosticInfo.canLocateOnProject()).isTrue(); + } + @Test void testParameterEn() { @@ -147,12 +164,10 @@ void testParameterEn() { configuration.setLanguage(Language.EN); // when - DiagnosticInfo diagnosticEnInfo = new DiagnosticInfo(EmptyCodeBlockDiagnostic.class, configuration, stringInterner); + var diagnosticEnInfo = new DiagnosticInfo(EmptyCodeBlockDiagnostic.class, configuration, stringInterner); // then assertThat(diagnosticEnInfo.getParameters().get(0).getDescription()) .isEqualTo("Comment as code"); - } - -} \ No newline at end of file +}