From f006661d04f2c6db2efac05c2b016d91b22778ca Mon Sep 17 00:00:00 2001 From: AndreiIurko <54847291+AndreiIurko@users.noreply.github.com> Date: Mon, 10 Feb 2025 13:42:08 +0300 Subject: [PATCH] :sparkles: QD-10723 Test summary, comment and push-fixes for azure pipelines (#444) Co-authored-by: Andrei Iurko --- common/__tests__/data/empty.sarif.json | 8053 ++ common/__tests__/data/some.sarif.json | 8278 ++ common/__tests__/main.test.ts | 113 + common/jest.config.js | 30 + common/output.ts | 337 + common/package.json | 9 +- common/tsconfig.json | 7 +- common/utils.ts | 49 + package-lock.json | 33 + package.json | 2 +- scan/__tests__/main.test.ts | 165 +- scan/dist/index.js | 1130 +- scan/src/annotations.ts | 37 +- scan/src/output.ts | 315 +- scan/src/utils.ts | 3 +- vsts/QodanaScan/index.js | 66482 ++++++++++++++++- vsts/README.md | 56 +- vsts/__tests__/data/empty.sarif.json | 8053 ++ vsts/__tests__/data/some.sarif.json | 8275 ++ vsts/__tests__/data/with.baseline.sarif.json | 8387 +++ vsts/__tests__/main.test.ts | 147 + vsts/jest.config.js | 31 + vsts/package.json | 5 +- vsts/src/gitApiProvider.ts | 24 + vsts/src/main.ts | 26 +- vsts/src/output.ts | 125 + vsts/src/utils.ts | 324 +- vsts/vss-extension.dev.json | 2 +- 28 files changed, 108623 insertions(+), 1875 deletions(-) create mode 100644 common/__tests__/data/empty.sarif.json create mode 100644 common/__tests__/data/some.sarif.json create mode 100644 common/__tests__/main.test.ts create mode 100644 common/jest.config.js create mode 100644 common/output.ts create mode 100644 common/utils.ts create mode 100644 vsts/__tests__/data/empty.sarif.json create mode 100644 vsts/__tests__/data/some.sarif.json create mode 100644 vsts/__tests__/data/with.baseline.sarif.json create mode 100644 vsts/__tests__/main.test.ts create mode 100644 vsts/jest.config.js create mode 100644 vsts/src/gitApiProvider.ts create mode 100644 vsts/src/output.ts diff --git a/common/__tests__/data/empty.sarif.json b/common/__tests__/data/empty.sarif.json new file mode 100644 index 00000000..f210772f --- /dev/null +++ b/common/__tests__/data/empty.sarif.json @@ -0,0 +1,8053 @@ +{ + "version": "2.1.0", + "runs": [ + { + "tool": { + "driver": { + "name": "QDJVM", + "fullName": "Qodana for JVM", + "version": "213.6433.60", + "rules": [], + "taxa": [], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + "extensions": [ + { + "name": "org.jetbrains.kotlin", + "version": "213-1.5.10-release-949-IJ6433", + "rules": [ + { + "id": "RedundantRunCatching", + "shortDescription": { + "text": "Redundant 'runCatching' call" + }, + "fullDescription": { + "text": "Reports 'runCatching' calls that are immediately followed by 'getOrThrow'. Such calls can be replaced with just 'run'. Example: 'fun foo() = runCatching { doSomething() }.getOrThrow()' After the quick-fix is applied: 'fun foo() = run { doSomething() }'", + "markdown": "Reports `runCatching` calls that are immediately followed by `getOrThrow`. Such calls can be replaced with just `run`.\n\n**Example:**\n\n\n fun foo() = runCatching { doSomething() }.getOrThrow()\n\nAfter the quick-fix is applied:\n\n\n fun foo() = run { doSomething() }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimpleRedundantLet", + "shortDescription": { + "text": "Redundant receiver-based 'let' call" + }, + "fullDescription": { + "text": "Reports redundant receiver-based 'let' calls. The quick-fix removes the redundant 'let' call. Example: 'fun test(s: String?): Int? = s?.let { it.length }' After the quick-fix is applied: 'fun test(s: String?): Int? = s?.length'", + "markdown": "Reports redundant receiver-based `let` calls.\n\nThe quick-fix removes the redundant `let` call.\n\n**Example:**\n\n\n fun test(s: String?): Int? = s?.let { it.length }\n\nAfter the quick-fix is applied:\n\n\n fun test(s: String?): Int? = s?.length\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveSingleExpressionStringTemplate", + "shortDescription": { + "text": "Redundant string template" + }, + "fullDescription": { + "text": "Reports single-expression string templates that can be safely removed. Example: 'val x = \"Hello\"\n val y = \"$x\"' After the quick-fix is applied: 'val x = \"Hello\"\n val y = x // <== Updated'", + "markdown": "Reports single-expression string templates that can be safely removed.\n\n**Example:**\n\n val x = \"Hello\"\n val y = \"$x\"\n\nAfter the quick-fix is applied:\n\n val x = \"Hello\"\n val y = x // <== Updated\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IncompleteDestructuring", + "shortDescription": { + "text": "Incomplete destructuring declaration" + }, + "fullDescription": { + "text": "Reports incomplete destructuring declaration. Example: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person' The quick fix completes destructuring declaration with new variables: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person'", + "markdown": "Reports incomplete destructuring declaration.\n\n**Example:**\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person\n\nThe quick fix completes destructuring declaration with new variables:\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ScopeFunctionConversion", + "shortDescription": { + "text": "Scope function can be converted to another one" + }, + "fullDescription": { + "text": "Reports scope functions ('let', 'run', 'apply', 'also') that can be converted between each other. Using corresponding functions makes your code simpler. The quick-fix replaces the scope function to another one. Example: 'val x = \"\".let {\n it.length\n }' After the quick-fix is applied: 'val x = \"\".run {\n length\n }'", + "markdown": "Reports scope functions (`let`, `run`, `apply`, `also`) that can be converted between each other.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the scope function to another one.\n\n**Example:**\n\n\n val x = \"\".let {\n it.length\n }\n\nAfter the quick-fix is applied:\n\n\n val x = \"\".run {\n length\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TrailingComma", + "shortDescription": { + "text": "Trailing comma recommendations" + }, + "fullDescription": { + "text": "Reports trailing commas that are not follow the recommended style guide.", + "markdown": "Reports trailing commas that are not follow the recommended [style guide](https://kotlinlang.org/docs/coding-conventions.html#trailing-commas)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FoldInitializerAndIfToElvis", + "shortDescription": { + "text": "If-Null return/break/... foldable to '?:'" + }, + "fullDescription": { + "text": "Reports an 'if' expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer. Example: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }' The quick-fix converts the 'if' expression with an initializer into an elvis expression: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }'", + "markdown": "Reports an `if` expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer.\n\n**Example:**\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }\n\nThe quick-fix converts the `if` expression with an initializer into an elvis expression:\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinInvalidBundleOrProperty", + "shortDescription": { + "text": "Invalid property key" + }, + "fullDescription": { + "text": "Reports unresolved references to '.properties' file keys and resource bundles in Kotlin files.", + "markdown": "Reports unresolved references to `.properties` file keys and resource bundles in Kotlin files." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UselessCallOnCollection", + "shortDescription": { + "text": "Useless call on collection type" + }, + "fullDescription": { + "text": "Reports 'filter…' calls from the standard library on already filtered collections. Several functions from the standard library such as 'filterNotNull()' or 'filterIsInstance' have sense only when they are called on receivers that have types distinct from the resulting one. Otherwise, such calls can be omitted as the result will be the same. Remove redundant call quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }'", + "markdown": "Reports `filter...` calls from the standard library on already filtered collections.\n\nSeveral functions from the standard library such as `filterNotNull()` or `filterIsInstance`\nhave sense only when they are called on receivers that have types distinct from the resulting one. Otherwise,\nsuch calls can be omitted as the result will be the same.\n\n**Remove redundant call** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantRequireNotNullCall", + "shortDescription": { + "text": "Redundant 'requireNotNull' or 'checkNotNull' call" + }, + "fullDescription": { + "text": "Reports redundant 'requireNotNull' or 'checkNotNull' call on non-nullable expressions. Example: 'fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }' After the quick-fix is applied: 'fun foo(i: Int) {\n ...\n }'", + "markdown": "Reports redundant `requireNotNull` or `checkNotNull` call on non-nullable expressions.\n\n**Example:**\n\n\n fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(i: Int) {\n ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObjectPropertyName", + "shortDescription": { + "text": "Object property naming convention" + }, + "fullDescription": { + "text": "Reports properties that do not follow the naming conventions. The following properties are reported: Top-level properties Properties in objects and companion objects You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with an uppercase letter, use camel case and no underscores. Example: '// top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }'", + "markdown": "Reports properties that do not follow the naming conventions.\n\nThe following properties are reported:\n\n* Top-level properties\n* Properties in objects and companion objects\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): it has to start with an uppercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n // top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PackageDirectoryMismatch", + "shortDescription": { + "text": "Package name does not match containing directory" + }, + "fullDescription": { + "text": "Reports 'package' directives that do not match the location of the file.", + "markdown": "Reports `package` directives that do not match the location of the file." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinCovariantEquals", + "shortDescription": { + "text": "Covariant 'equals()'" + }, + "fullDescription": { + "text": "Reports 'equals()' that takes an argument type other than 'Any?' if the class does not have another 'equals()' that takes 'Any?' as its argument type. Example: 'class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }' To fix the problem create 'equals()' method that takes an argument of type 'Any?'.", + "markdown": "Reports `equals()` that takes an argument type other than `Any?` if the class does not have another `equals()` that takes `Any?` as its argument type.\n\n**Example:**\n\n\n class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }\n\nTo fix the problem create `equals()` method that takes an argument of type `Any?`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSizeZeroCheckWithIsEmpty", + "shortDescription": { + "text": "Size zero check can be replaced with 'isEmpty()'" + }, + "fullDescription": { + "text": "Reports 'size == 0' checks on 'Collections/Array/String' that should be replaced with 'isEmpty()'. Using 'isEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }'", + "markdown": "Reports `size == 0` checks on `Collections/Array/String` that should be replaced with `isEmpty()`.\n\nUsing `isEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantEnumConstructorInvocation", + "shortDescription": { + "text": "Redundant enum constructor invocation" + }, + "fullDescription": { + "text": "Reports redundant constructor invocation on an enum entry. Example: 'enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }' After the quick-fix is applied: 'enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }'", + "markdown": "Reports redundant constructor invocation on an enum entry.\n\n**Example:**\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }\n\nAfter the quick-fix is applied:\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DirectUseOfResultType", + "shortDescription": { + "text": "Function returning Result directly" + }, + "fullDescription": { + "text": "Reports functions that use 'Result' as a return type. 'Result' should never be used as a return type. Throw an exception, use a nullable type, or use a domain-specific result class to indicate failure. Example: 'fun foo() = Result.success(true)'", + "markdown": "Reports functions that use `Result` as a return type.\n\n\n`Result` should never be used as a return type.\nThrow an exception, use a nullable type, or use a domain-specific result class to indicate failure.\n\n**Example:**\n\n\n fun foo() = Result.success(true)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FakeJvmFieldConstant", + "shortDescription": { + "text": "Kotlin non-const property used as Java constant" + }, + "fullDescription": { + "text": "Reports Kotlin properties that are not 'const' and used as Java annotation arguments. For example, a property with the '@JvmField' annotation has an initializer that can be evaluated at compile-time, and it has a primitive or 'String' type. Such properties have a 'ConstantValue' attribute in bytecode in Kotlin 1.1-1.2. This attribute allows javac to fold usages of the corresponding field and use that field in annotations. This can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code. This behavior is subject to change in Kotlin 1.3 (no 'ConstantValue' attribute any more). Example: Kotlin code in foo.kt file: 'annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"' Java code: 'public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }' To fix the problem replace the '@JvmField' annotation with the 'const' modifier on a relevant Kotlin property or inline it.", + "markdown": "Reports Kotlin properties that are not `const` and used as Java annotation arguments.\n\n\nFor example, a property with the `@JvmField` annotation has an initializer that can be evaluated at compile-time,\nand it has a primitive or `String` type.\n\n\nSuch properties have a `ConstantValue` attribute in bytecode in Kotlin 1.1-1.2.\nThis attribute allows javac to fold usages of the corresponding field and use that field in annotations.\nThis can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code.\nThis behavior is subject to change in Kotlin 1.3 (no `ConstantValue` attribute any more).\n\n**Example:**\n\nKotlin code in foo.kt file:\n\n\n annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"\n\nJava code:\n\n\n public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }\n\nTo fix the problem replace the `@JvmField` annotation with the `const` modifier on a relevant Kotlin property or inline it." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WhenWithOnlyElse", + "shortDescription": { + "text": "'when' has only 'else' branch and can be simplified" + }, + "fullDescription": { + "text": "Reports 'when' expressions with only an 'else' branch that can be simplified. Simplify expression quick-fix can be used to amend the code automatically. Example: 'fun redundant() {\n val x = when { // <== redundant, a quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }'", + "markdown": "Reports `when` expressions with only an `else` branch that can be simplified.\n\n**Simplify expression** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun redundant() {\n val x = when { // <== redundant, a quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Reformat", + "shortDescription": { + "text": "File is not formatted according to project settings" + }, + "fullDescription": { + "text": "Reports places that are not formatted according to the project settings. Use the 'Reformat Code' and 'Reformat File...' quick-fixes to format either the highlighted code block or the entire file accordingly.", + "markdown": "Reports places that are not formatted according to the project settings.\n\nUse the 'Reformat Code' and 'Reformat File...' quick-fixes to format either the highlighted code block\nor the entire file accordingly." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinTestJUnit", + "shortDescription": { + "text": "kotlin-test-junit could be used" + }, + "fullDescription": { + "text": "Reports usage of 'kotlin-test' and 'junit' dependency without 'kotlin-test-junit'. It is recommended to use 'kotlin-test-junit' dependency to work with Kotlin and JUnit.", + "markdown": "Reports usage of `kotlin-test` and `junit` dependency without `kotlin-test-junit`.\n\nIt is recommended to use `kotlin-test-junit` dependency to work with Kotlin and JUnit." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SafeCastWithReturn", + "shortDescription": { + "text": "Safe cast with 'return' should be replaced with 'if' type check" + }, + "fullDescription": { + "text": "Reports safe cast with 'return' that can be replaced with 'if' type check. Using corresponding functions makes your code simpler. The quick-fix replaces the safe cast with 'if' type check. Example: 'fun test(x: Any) {\n x as? String ?: return\n }' After the quick-fix is applied: 'fun test(x: Any) {\n if (x !is String) return\n }'", + "markdown": "Reports safe cast with `return` that can be replaced with `if` type check.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the safe cast with `if` type check.\n\n**Example:**\n\n\n fun test(x: Any) {\n x as? String ?: return\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(x: Any) {\n if (x !is String) return\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceAssertBooleanWithAssertEquality", + "shortDescription": { + "text": "Assert boolean could be replaced with assert equality" + }, + "fullDescription": { + "text": "Reports calls to 'assertTrue()' and 'assertFalse()' that can be replaced with assert equality functions. 'assertEquals()', 'assertSame()', and their negating counterparts (-Not-) provide more informative messages on failure. Example: 'assertTrue(a == b)' After the quick-fix is applied: 'assertEquals(a, b)'", + "markdown": "Reports calls to `assertTrue()` and `assertFalse()` that can be replaced with assert equality functions.\n\n\n`assertEquals()`, `assertSame()`, and their negating counterparts (-Not-) provide more informative messages on\nfailure.\n\n**Example:**\n\n assertTrue(a == b)\n\nAfter the quick-fix is applied:\n\n assertEquals(a, b)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceStringFormatWithLiteral", + "shortDescription": { + "text": "'String.format' call can be replaced with string templates" + }, + "fullDescription": { + "text": "Reports 'String.format' calls that can be replaced with string templates. Using string templates makes your code simpler. The quick-fix replaces the call with a string template. Example: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }' After the quick-fix is applied: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }'", + "markdown": "Reports `String.format` calls that can be replaced with string templates.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces the call with a string template.\n\n**Example:**\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceNotNullAssertionWithElvisReturn", + "shortDescription": { + "text": "Not-null assertion can be replaced with 'return'" + }, + "fullDescription": { + "text": "Reports not-null assertion ('!!') calls that can be replaced with the elvis operator and return ('?: return'). A not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of '!!' is good practice. The quick-fix replaces the not-null assertion with 'return' or 'return null'. Example: 'fun test(number: Int?) {\n val x = number!!\n }' After the quick-fix is applied: 'fun test(number: Int?) {\n val x = number ?: return\n }'", + "markdown": "Reports not-null assertion (`!!`) calls that can be replaced with the elvis operator and return (`?: return`).\n\nA not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of `!!` is good practice.\n\nThe quick-fix replaces the not-null assertion with `return` or `return null`.\n\n**Example:**\n\n\n fun test(number: Int?) {\n val x = number!!\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(number: Int?) {\n val x = number ?: return\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithSubstringBefore", + "shortDescription": { + "text": "'substring' call should be replaced with 'substringBefore'" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, s.indexOf(x))' that can be replaced with 's.substringBefore(x)'. Using 'substringBefore()' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringBefore'. Example: 'fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringBefore('x')\n }'", + "markdown": "Reports calls like `s.substring(0, s.indexOf(x))` that can be replaced with `s.substringBefore(x)`.\n\nUsing `substringBefore()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringBefore`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringBefore('x')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithOperatorAssignment", + "shortDescription": { + "text": "Assignment can be replaced with operator assignment" + }, + "fullDescription": { + "text": "Reports modifications of variables with a simple assignment (such as 'y = y + x') that can be replaced with an operator assignment. The quick-fix replaces the assignment with an assignment operator. Example: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }' After the quick-fix is applied: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }'", + "markdown": "Reports modifications of variables with a simple assignment (such as `y = y + x`) that can be replaced with an operator assignment.\n\nThe quick-fix replaces the assignment with an assignment operator.\n\n**Example:**\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedSymbol", + "shortDescription": { + "text": "Unused symbol" + }, + "fullDescription": { + "text": "Reports symbols that are not used or not reachable from entry points.", + "markdown": "Reports symbols that are not used or not reachable from entry points." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceCollectionCountWithSize", + "shortDescription": { + "text": "Collection count can be converted to size" + }, + "fullDescription": { + "text": "Reports calls to 'Collection.count()'. This function call can be replaced with '.size'. '.size' form ensures that the operation is O(1) and won't allocate extra objects, whereas 'count()' could be confused with 'Iterable.count()', which is O(n) and allocating. Example: 'fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }' After the quick-fix is applied: 'fun foo() {\n var list = listOf(1,2,3)\n list.size\n }'", + "markdown": "Reports calls to `Collection.count()`.\n\n\nThis function call can be replaced with `.size`.\n\n\n`.size` form ensures that the operation is O(1) and won't allocate extra objects, whereas\n`count()` could be confused with `Iterable.count()`, which is O(n) and allocating.\n\n\n**Example:**\n\n fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }\n\nAfter the quick-fix is applied:\n\n fun foo() {\n var list = listOf(1,2,3)\n list.size\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceArrayEqualityOpWithArraysEquals", + "shortDescription": { + "text": "Arrays comparison via '==' and '!='" + }, + "fullDescription": { + "text": "Reports usages of '==' or '!=' operator for arrays that should be replaced with 'contentEquals()'. The '==' and '!='operators compare array references instead of their content. Examples: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }' After the quick-fix is applied: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }'", + "markdown": "Reports usages of `==` or `!=` operator for arrays that should be replaced with `contentEquals()`.\n\n\nThe `==` and `!=`operators compare array references instead of their content.\n\n**Examples:**\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }\n\nAfter the quick-fix is applied:\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedGradleDependency", + "shortDescription": { + "text": "Deprecated library is used in Gradle" + }, + "fullDescription": { + "text": "Reports deprecated dependencies in Gradle build scripts. Example: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }' After the quick-fix applied: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }'", + "markdown": "Reports deprecated dependencies in Gradle build scripts.\n\n**Example:**\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }\n\nAfter the quick-fix applied:\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertReferenceToLambda", + "shortDescription": { + "text": "Can be replaced with lambda" + }, + "fullDescription": { + "text": "Reports a function reference expression that can be replaced with a function literal (lambda). Sometimes, passing a lambda looks more straightforward and more consistent with the rest of the code. Also, the fix might be handy if you need to replace a simple call with something more complex. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }'", + "markdown": "Reports a function reference expression that can be replaced with a function literal (lambda).\n\n\nSometimes, passing a lambda looks more straightforward and more consistent with the rest of the code.\nAlso, the fix might be handy if you need to replace a simple call with something more complex.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnlabeledReturnInsideLambda", + "shortDescription": { + "text": "Unlabeled return inside lambda" + }, + "fullDescription": { + "text": "Reports unlabeled 'return' expressions inside inline lambda. Such expressions can be confusing because it might be unclear which scope belongs to 'return'. Change to return@… quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }'", + "markdown": "Reports unlabeled `return` expressions inside inline lambda.\n\nSuch expressions can be confusing because it might be unclear which scope belongs to `return`.\n\n**Change to return@...** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LateinitVarOverridesLateinitVar", + "shortDescription": { + "text": "lateinit var property overrides lateinit var property" + }, + "fullDescription": { + "text": "Reports 'lateinit var' properties that override another 'lateinit var' property. A subclass instance will have two fields for the single property, and the one from the superclass will remain effectively unused. Example: open class BaseClass { open lateinit var name: String } class RealClass : BaseClass() { override lateinit var name: String } ''", + "markdown": "Reports `lateinit var` properties that override another `lateinit var` property.\n\n\nA subclass instance will have two fields for the single property, and the one from the superclass will remain effectively unused.\n\n**Example:**\nopen class BaseClass { open lateinit var name: String } class RealClass : BaseClass() { override lateinit var name: String }\n\n```\n\n```" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentKotlinGradleVersion", + "shortDescription": { + "text": "Kotlin Gradle and IDE plugins versions are different" + }, + "fullDescription": { + "text": "Reports that different IDE and Gradle plugin versions are used. This can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }' To fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin.", + "markdown": "Reports that different IDE and Gradle plugin versions are used.\n\nThis can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }\n\nTo fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinEqualsBetweenInconvertibleTypes", + "shortDescription": { + "text": "'equals()' between objects of inconvertible types" + }, + "fullDescription": { + "text": "Reports calls to 'equals()' where the receiver and the argument are of incompatible primitive, enum, or string types. While such a call might theoretically be useful, most likely it represents a bug. Example: '5.equals(\"\");'", + "markdown": "Reports calls to `equals()` where the receiver and the argument are of incompatible primitive, enum, or string types.\n\nWhile such a call might theoretically be useful, most likely it represents a bug.\n\n**Example:**\n\n 5.equals(\"\");\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JoinDeclarationAndAssignment", + "shortDescription": { + "text": "Join declaration and assignment" + }, + "fullDescription": { + "text": "Reports property declarations that can be joined with the following assignment. Example: 'val x: String\n x = System.getProperty(\"\")' The quick fix joins the declaration with the assignment: 'val x = System.getProperty(\"\")'", + "markdown": "Reports property declarations that can be joined with the following assignment.\n\n**Example:**\n\n\n val x: String\n x = System.getProperty(\"\")\n\nThe quick fix joins the declaration with the assignment:\n\n\n val x = System.getProperty(\"\")\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HasPlatformType", + "shortDescription": { + "text": "Function or property has platform type" + }, + "fullDescription": { + "text": "Reports functions and properties that have a platform type. To prevent unexpected errors, the type should be declared explicitly. Example: 'fun foo() = java.lang.String.valueOf(1)' The quick fix allows you to specify the return type: 'fun foo(): String = java.lang.String.valueOf(1)'", + "markdown": "Reports functions and properties that have a platform type.\n\nTo prevent unexpected errors, the type should be declared explicitly.\n\n**Example:**\n\n\n fun foo() = java.lang.String.valueOf(1)\n\nThe quick fix allows you to specify the return type:\n\n\n fun foo(): String = java.lang.String.valueOf(1)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DataClassPrivateConstructor", + "shortDescription": { + "text": "Private data class constructor is exposed via the 'copy' method" + }, + "fullDescription": { + "text": "Reports the 'private' primary constructor in data classes. 'data' classes have a 'copy()' factory method that can be used similarly to a constructor. A constructor should not be marked as 'private' to provide enough safety. Example: 'data class User private constructor(val name: String)' A quick-fix changes the constructor visibility modifier to 'public': 'data class User(val name: String)'", + "markdown": "Reports the `private` primary constructor in data classes.\n\n\n`data` classes have a `copy()` factory method that can be used similarly to a constructor.\nA constructor should not be marked as `private` to provide enough safety.\n\n**Example:**\n\n\n data class User private constructor(val name: String)\n\nA quick-fix changes the constructor visibility modifier to `public`:\n\n\n data class User(val name: String)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantInnerClassModifier", + "shortDescription": { + "text": "Redundant 'inner' modifier" + }, + "fullDescription": { + "text": "Reports the 'inner' modifier on a class as redundant if it doesn't reference members of its outer class. Example: 'class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }' After the quick-fix is applied: 'class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }'", + "markdown": "Reports the `inner` modifier on a class as redundant if it doesn't reference members of its outer class.\n\n**Example:**\n\n\n class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaCollectionsStaticMethodOnImmutableList", + "shortDescription": { + "text": "Call of Java mutator method on immutable Kotlin collection" + }, + "fullDescription": { + "text": "Reports Java mutator methods calls (like 'fill', 'reverse', 'shuffle', 'sort') on an immutable Kotlin collection. This can lead to 'UnsupportedOperationException' at runtime. Example: 'import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }' To fix the problem make the list mutable.", + "markdown": "Reports Java mutator methods calls (like `fill`, `reverse`, `shuffle`, `sort`) on an immutable Kotlin collection.\n\nThis can lead to `UnsupportedOperationException` at runtime.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }\n\nTo fix the problem make the list mutable." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MavenCoroutinesDeprecation", + "shortDescription": { + "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Maven" + }, + "fullDescription": { + "text": "Reports kotlinx.coroutines library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later.", + "markdown": "Reports **kotlinx.coroutines** library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration/Maven", + "index": 119, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NullableBooleanElvis", + "shortDescription": { + "text": "Equality check can be used instead of elvis for nullable boolean check" + }, + "fullDescription": { + "text": "Reports cases when an equality check should be used instead of the elvis operator. Example: 'fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n}' After the quick-fix is applied: 'fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n}'", + "markdown": "Reports cases when an equality check should be used instead of the elvis operator.\n\n**Example:**\n\n\n fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n }\n\nAfter the quick-fix is applied:\n\n\n fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedMavenDependency", + "shortDescription": { + "text": "Deprecated library is used in Maven" + }, + "fullDescription": { + "text": "Reports deprecated maven dependency. Example: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n ' The quick fix changes the deprecated dependency to a maintained one: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n '", + "markdown": "Reports deprecated maven dependency.\n\n**Example:**\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n \n\nThe quick fix changes the deprecated dependency to a maintained one:\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnnecessaryVariable", + "shortDescription": { + "text": "Unnecessary local variable" + }, + "fullDescription": { + "text": "Reports local variables that used only in the very next 'return' statement or exact copies of other variables. Such variables can be safely inlined to make the code more clear.", + "markdown": "Reports local variables that used only in the very next `return` statement or exact copies of other variables.\n\nSuch variables can be safely inlined to make the code more clear." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantEmptyInitializerBlock", + "shortDescription": { + "text": "Redundant empty initializer block" + }, + "fullDescription": { + "text": "Reports redundant empty initializer blocks. Example: 'class Foo {\n init {\n // Empty init block\n }\n }' After the quick-fix is applied: 'class Foo {\n }'", + "markdown": "Reports redundant empty initializer blocks.\n\n**Example:**\n\n\n class Foo {\n init {\n // Empty init block\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "GradleKotlinxCoroutinesDeprecation", + "shortDescription": { + "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Gradle" + }, + "fullDescription": { + "text": "Reports 'kotlinx.coroutines' library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+. Example: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }' The quick fix changes the 'kotlinx.coroutines' library version to a compatible with Kotlin 1.3: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }'", + "markdown": "Reports `kotlinx.coroutines` library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+.\n\n**Example:**\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }\n\nThe quick fix changes the `kotlinx.coroutines` library version to a compatible with Kotlin 1.3:\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration/Gradle", + "index": 127, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantWith", + "shortDescription": { + "text": "Redundant 'with' call" + }, + "fullDescription": { + "text": "Reports redundant 'with' function calls that don't access anything from the receiver. Examples: 'class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }'", + "markdown": "Reports redundant `with` function calls that don't access anything from the receiver.\n\n**Examples:**\n\n\n class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WarningOnMainUnusedParameterMigration", + "shortDescription": { + "text": "Unused `args` on `main` since 1.4" + }, + "fullDescription": { + "text": "Reports 'main' function with an unused single parameter. Since Kotlin 1.4, it is possible to use the 'main' function without parameter as the entry point to the Kotlin program. The compiler reports a warning for the 'main' function with an unused parameter.", + "markdown": "Reports `main` function with an unused single parameter.\n\nSince Kotlin 1.4, it is possible to use the `main` function without parameter as the entry point to the Kotlin program.\nThe compiler reports a warning for the `main` function with an unused parameter." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLabelMigration", + "shortDescription": { + "text": "Redundant label" + }, + "fullDescription": { + "text": "Reports redundant labels which cause compilation errors since Kotlin 1.4. Since Kotlin 1.0, one can mark any statement with a label: 'fun foo() {\n L1@ val x = L2@bar()\n }' However, these labels can be referenced only in a limited number of ways: break / continue from a loop non-local return from an inline lambda or inline anonymous function sssss Such labels are prohibited since Kotlin 1.4. This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports redundant labels which cause compilation errors since Kotlin 1.4.\n\nSince Kotlin 1.0, one can mark any statement with a label:\n\n\n fun foo() {\n L1@ val x = L2@bar()\n }\n\nHowever, these labels can be referenced only in a limited number of ways:\n\n* break / continue from a loop\n* non-local return from an inline lambda or inline anonymous function\nsssss\n\nSuch labels are prohibited since Kotlin 1.4.\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceNegatedIsEmptyWithIsNotEmpty", + "shortDescription": { + "text": "Negated call can be simplified" + }, + "fullDescription": { + "text": "Reports negation 'isEmpty()' and 'isNotEmpty()' for collections and 'String', or 'isBlank()' and 'isNotBlank()' for 'String'. Using corresponding functions makes your code simpler. The quick-fix replaces the negation call with the corresponding call from the Standard Library. Example: 'fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }' After the quick-fix is applied: 'fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }'", + "markdown": "Reports negation `isEmpty()` and `isNotEmpty()` for collections and `String`, or `isBlank()` and `isNotBlank()` for `String`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the negation call with the corresponding call from the Standard Library.\n\n**Example:**\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DelegationToVarProperty", + "shortDescription": { + "text": "Delegating to 'var' property" + }, + "fullDescription": { + "text": "Reports interface delegation to a 'var' property. Only initial value of a property is used for delegation, any later assignments do not affect it. Example: 'class Example(var text: CharSequence): CharSequence by text' A quick-fix replaces a property with immutable one: 'class Example(val text: CharSequence): CharSequence by text' Alternative way, if you rely on mutability for some reason: 'class Example(text: CharSequence): CharSequence by text {\n var text = text\n }'", + "markdown": "Reports interface delegation to a `var` property.\n\nOnly initial value of a property is used for delegation, any later assignments do not affect it.\n\n**Example:**\n\n\n class Example(var text: CharSequence): CharSequence by text\n\nA quick-fix replaces a property with immutable one:\n\n\n class Example(val text: CharSequence): CharSequence by text\n\nAlternative way, if you rely on mutability for some reason:\n\n\n class Example(text: CharSequence): CharSequence by text {\n var text = text\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstantConditionIf", + "shortDescription": { + "text": "Condition of 'if' expression is constant" + }, + "fullDescription": { + "text": "Reports 'if' expressions that have 'true' or 'false' constant literal condition and can be simplified. While occasionally intended, this construction is confusing and often the result of a typo or previous refactoring. Example: 'fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }' A quick-fix removes the 'if' condition: 'fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }'", + "markdown": "Reports `if` expressions that have `true` or `false` constant literal condition and can be simplified.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo\nor previous refactoring.\n\n**Example:**\n\n\n fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }\n\nA quick-fix removes the `if` condition:\n\n\n fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLambdaArrow", + "shortDescription": { + "text": "Redundant lambda arrow" + }, + "fullDescription": { + "text": "Reports redundant lambda arrows in lambdas without parameters. Example: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -> println(\"Hi!\") }\n }' After the quick-fix is applied: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }'", + "markdown": "Reports redundant lambda arrows in lambdas without parameters.\n\n**Example:**\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -\\> println(\"Hi!\") }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinInternalInJava", + "shortDescription": { + "text": "Usage of Kotlin internal declarations from Java" + }, + "fullDescription": { + "text": "Reports usages of Kotlin 'internal' declarations in Java code that is located in a different module. The 'internal' keyword is designed to restrict access to a class, function, or property from other modules. Due to JVM limitations, 'internal' classes, functions, and properties can still be accessed from outside Kotlin, which may later lead to compatibility problems.", + "markdown": "Reports usages of Kotlin `internal` declarations in Java code that is located in a different module.\n\n\nThe `internal` keyword is designed to restrict access to a class, function, or property from other modules.\nDue to JVM limitations, `internal` classes, functions, and properties can still be\naccessed from outside Kotlin, which may later lead to compatibility problems." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UseWithIndex", + "shortDescription": { + "text": "Manually incremented index variable can be replaced with use of 'withIndex()'" + }, + "fullDescription": { + "text": "Reports 'for' loops with a manually incremented index variable. 'for' loops with a manually incremented index variable can be simplified with the 'withIndex()' function. Use withIndex() instead of manual index increment quick-fix can be used to amend the code automatically. Example: 'fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }' After the quick-fix is applied: 'fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }'", + "markdown": "Reports `for` loops with a manually incremented index variable.\n\n`for` loops with a manually incremented index variable can be simplified with the `withIndex()` function.\n\n**Use withIndex() instead of manual index increment** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ImplicitThis", + "shortDescription": { + "text": "Implicit 'this'" + }, + "fullDescription": { + "text": "Reports usages of implicit this. Example: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }' The quick fix specifies this explicitly: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }'", + "markdown": "Reports usages of implicit **this** .\n\n**Example:**\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }\n\nThe quick fix specifies **this** explicitly:\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinCatchMayIgnoreException", + "shortDescription": { + "text": "'catch' block may ignore exception" + }, + "fullDescription": { + "text": "Reports 'catch' blocks that are empty or may ignore an exception. While occasionally intended, empty 'catch' blocks may complicate debugging. Also, ignoring a 'catch' parameter might be wrong. The inspection won't report any 'catch' parameters named 'ignore', 'ignored', or '_'. You can use a quick-fix to change the exception name to '_'. Example: 'try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }' After the quick-fix is applied: 'try {\n throwingMethod()\n } catch (_: IOException) {\n\n }' Use the Do not warn when 'catch' block contains a comment option to ignore 'catch' blocks with comments.", + "markdown": "Reports `catch` blocks that are empty or may ignore an exception.\n\nWhile occasionally intended, empty `catch` blocks may complicate debugging.\nAlso, ignoring a `catch` parameter might be wrong.\n\n\nThe inspection won't report any `catch` parameters named `ignore`, `ignored`, or `_`.\n\n\nYou can use a quick-fix to change the exception name to `_`.\n\n**Example:**\n\n\n try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n throwingMethod()\n } catch (_: IOException) {\n\n }\n\nUse the **Do not warn when 'catch' block contains a comment** option to ignore `catch` blocks with comments." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentStdlibGradleVersion", + "shortDescription": { + "text": "Kotlin library and Gradle plugin versions are different" + }, + "fullDescription": { + "text": "Reports different Kotlin stdlib and compiler versions. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }' To fix the problem change the kotlin stdlib version to match the kotlin compiler version.", + "markdown": "Reports different Kotlin stdlib and compiler versions.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }\n\nTo fix the problem change the kotlin stdlib version to match the kotlin compiler version." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBeVal", + "shortDescription": { + "text": "Local 'var' is never modified and can be declared as 'val'" + }, + "fullDescription": { + "text": "Reports local variables declared with the 'var' keyword that are never modified. Kotlin encourages to declare practically immutable variables using the 'val' keyword, ensuring that their value will never change. Example: 'fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }' A quick-fix replaces the 'var' keyword with 'val': 'fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }'", + "markdown": "Reports local variables declared with the `var` keyword that are never modified.\n\nKotlin encourages to declare practically immutable variables using the `val` keyword, ensuring that their value will never change.\n\n**Example:**\n\n\n fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n\nA quick-fix replaces the `var` keyword with `val`:\n\n\n fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithIgnoreCaseEquals", + "shortDescription": { + "text": "Should be replaced with 'equals(..., ignoreCase = true)'" + }, + "fullDescription": { + "text": "Reports case-insensitive comparisons that can be replaced with 'equals(..., ignoreCase = true)'. By using 'equals()' you don't have to allocate extra strings with 'toLowerCase()' or 'toUpperCase()' to compare strings. The quick-fix replaces the case-insensitive comparison that uses 'toLowerCase()' or 'toUpperCase()' with 'equals(..., ignoreCase = true)'. Note: May change semantics for some locales. Example: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }' After the quick-fix is applied: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }'", + "markdown": "Reports case-insensitive comparisons that can be replaced with `equals(..., ignoreCase = true)`.\n\nBy using `equals()` you don't have to allocate extra strings with `toLowerCase()` or `toUpperCase()` to compare strings.\n\nThe quick-fix replaces the case-insensitive comparison that uses `toLowerCase()` or `toUpperCase()` with `equals(..., ignoreCase = true)`.\n\n**Note:** May change semantics for some locales.\n\n**Example:**\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithSubstringAfter", + "shortDescription": { + "text": "'substring' call should be replaced with 'substringAfter'" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(s.indexOf(x))' that can be replaced with 's.substringAfter(x)'. Using 's.substringAfter(x)' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringAfter'. Example: 'fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringAfter('x')\n }'", + "markdown": "Reports calls like `s.substring(s.indexOf(x))` that can be replaced with `s.substringAfter(x)`.\n\nUsing `s.substringAfter(x)` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringAfter`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringAfter('x')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantCompanionReference", + "shortDescription": { + "text": "Redundant 'Companion' reference" + }, + "fullDescription": { + "text": "Reports redundant 'Companion' reference. Example: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }' After the quick-fix is applied: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }'", + "markdown": "Reports redundant `Companion` reference.\n\n**Example:**\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }\n\nAfter the quick-fix is applied:\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KDocUnresolvedReference", + "shortDescription": { + "text": "Unresolved reference in KDoc" + }, + "fullDescription": { + "text": "Reports unresolved references in KDoc comments. Example: '/**\n * [unresolvedLink]\n */\n fun foo() {}' To fix the problem make the link valid.", + "markdown": "Reports unresolved references in KDoc comments.\n\n**Example:**\n\n\n /**\n * [unresolvedLink]\n */\n fun foo() {}\n\nTo fix the problem make the link valid." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NestedLambdaShadowedImplicitParameter", + "shortDescription": { + "text": "Nested lambda has shadowed implicit parameter" + }, + "fullDescription": { + "text": "Reports nested lambdas with shadowed implicit parameters. Example: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n}' After the quick-fix is applied: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n}'", + "markdown": "Reports nested lambdas with shadowed implicit parameters.\n\n**Example:**\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSamConstructor", + "shortDescription": { + "text": "Redundant SAM constructor" + }, + "fullDescription": { + "text": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas. Example: 'fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}' After the quick-fix is applied: 'fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}'", + "markdown": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas.\n\n**Example:**\n\n\n fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "InconsistentCommentForJavaParameter", + "shortDescription": { + "text": "Inconsistent comment for java parameter" + }, + "fullDescription": { + "text": "Reports inconsistent parameter name for java method specified in a comment block. Examples: '// Java\n public class JavaService {\n public void invoke(String command) {}\n }' '// Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }' The quick fix corrects parameter name in a comment block: 'fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }'", + "markdown": "Reports inconsistent parameter name for **java** method specified in a comment block.\n\n**Examples:**\n\n\n // Java\n public class JavaService {\n public void invoke(String command) {}\n }\n\n\n // Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }\n\nThe quick fix corrects parameter name in a comment block:\n\n\n fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantCallsOfConversionMethods", + "shortDescription": { + "text": "Redundant call of conversion method" + }, + "fullDescription": { + "text": "Reports redundant calls to conversion methods (for example, 'toString()' on a 'String' or 'toDouble()' on a 'Double'). Use the 'Remove redundant calls of the conversion method' quick-fix to clean up the code.", + "markdown": "Reports redundant calls to conversion methods (for example, `toString()` on a `String` or `toDouble()` on a `Double`).\n\nUse the 'Remove redundant calls of the conversion method' quick-fix to clean up the code." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinThrowableNotThrown", + "shortDescription": { + "text": "Throwable not thrown" + }, + "fullDescription": { + "text": "Reports instantiations of 'Throwable' or its subclasses, when the created 'Throwable' is never actually thrown. The reported code indicates mistakes that are hard to catch in tests. Also, this inspection reports method calls that return instances of 'Throwable' or its subclasses, when the resulting 'Throwable' instance is not thrown. Example: 'fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }'", + "markdown": "Reports instantiations of `Throwable` or its subclasses, when the created `Throwable` is never actually thrown.\n\nThe reported code indicates mistakes that are hard to catch in tests.\n\n\nAlso, this inspection reports method calls that return instances of `Throwable` or its subclasses,\nwhen the resulting `Throwable` instance is not thrown.\n\n**Example:**\n\n\n fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinSealedInheritorsInJava", + "shortDescription": { + "text": "Inheritance of Kotlin sealed interface/class from Java" + }, + "fullDescription": { + "text": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code. Example: '// Kotlin file: MathExpression.kt\n\nsealed class MathExpression\n\ndata class Const(val number: Double) : MathExpression()\ndata class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()' '// Java file: NotANumber.java\n\npublic class NotANumber extends MathExpression {\n}'", + "markdown": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code.\n\n**Example:**\n\n\n // Kotlin file: MathExpression.kt\n\n sealed class MathExpression\n\n data class Const(val number: Double) : MathExpression()\n data class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()\n\n\n // Java file: NotANumber.java\n\n public class NotANumber extends MathExpression {\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyNegatedBinaryExpression", + "shortDescription": { + "text": "Negated boolean expression can be simplified" + }, + "fullDescription": { + "text": "Reports negated binary expressions that can be simplified. The quick-fix simplifies the binary expression. Example: 'fun test(n: Int) {\n !(0 == 1)\n }' After the quick-fix is applied: 'fun test(n: Int) {\n 0 != 1\n }'", + "markdown": "Reports negated binary expressions that can be simplified.\n\nThe quick-fix simplifies the binary expression.\n\n**Example:**\n\n\n fun test(n: Int) {\n !(0 == 1)\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(n: Int) {\n 0 != 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MemberVisibilityCanBePrivate", + "shortDescription": { + "text": "Class member can have 'private' visibility" + }, + "fullDescription": { + "text": "Reports declarations that can be made 'private' to follow the encapsulation principle. Example: 'class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}' After the quick-fix is applied (considering there are no usages of 'url' outside of 'Service' class): 'class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}'", + "markdown": "Reports declarations that can be made `private` to follow the encapsulation principle.\n\n**Example:**\n\n\n class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n\nAfter the quick-fix is applied (considering there are no usages of `url` outside of `Service` class):\n\n\n class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SelfAssignment", + "shortDescription": { + "text": "Redundant assignment" + }, + "fullDescription": { + "text": "Reports assignments of a variable to itself. The quick-fix removes the redundant assignment. Example: 'fun test() {\n var bar = 1\n bar = bar\n }' After the quick-fix is applied: 'fun test() {\n var bar = 1\n }'", + "markdown": "Reports assignments of a variable to itself.\n\nThe quick-fix removes the redundant assignment.\n\n**Example:**\n\n\n fun test() {\n var bar = 1\n bar = bar\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n var bar = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RecursiveEqualsCall", + "shortDescription": { + "text": "Recursive equals call" + }, + "fullDescription": { + "text": "Reports recursive 'equals'('==') calls. In Kotlin, '==' compares object values by calling 'equals' method under the hood. '===', on the other hand, compares objects by reference. '===' is commonly used in 'equals' method implementation. But '===' may be mistakenly mixed up with '==' leading to infinite recursion. Example: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }' After the quick-fix is applied: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }'", + "markdown": "Reports recursive `equals`(`==`) calls.\n\n\nIn Kotlin, `==` compares object values by calling `equals` method under the hood.\n`===`, on the other hand, compares objects by reference.\n\n\n`===` is commonly used in `equals` method implementation.\nBut `===` may be mistakenly mixed up with `==` leading to infinite recursion.\n\n**Example:**\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ExplicitThis", + "shortDescription": { + "text": "Redundant explicit 'this'" + }, + "fullDescription": { + "text": "Reports an explicit 'this' when it can be omitted. Example: 'class C {\n private val i = 1\n fun f() = this.i\n }' The quick-fix removes the redundant 'this': 'class C {\n private val i = 1\n fun f() = i\n }'", + "markdown": "Reports an explicit `this` when it can be omitted.\n\n**Example:**\n\n\n class C {\n private val i = 1\n fun f() = this.i\n }\n\nThe quick-fix removes the redundant `this`:\n\n\n class C {\n private val i = 1\n fun f() = i\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NullChecksToSafeCall", + "shortDescription": { + "text": "Null-checks can be replaced with safe-calls" + }, + "fullDescription": { + "text": "Reports chained null-checks that can be replaced with safe-calls. Example: 'fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }' After the quick-fix is applied: 'fun test(my: My?) {\n if (my?.foo() != null) {}\n }'", + "markdown": "Reports chained null-checks that can be replaced with safe-calls.\n\n**Example:**\n\n\n fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(my: My?) {\n if (my?.foo() != null) {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedMainParameter", + "shortDescription": { + "text": "Main parameter is not necessary" + }, + "fullDescription": { + "text": "Reports 'main' function with an unused single parameter.", + "markdown": "Reports `main` function with an unused single parameter." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionWithLambdaExpressionBody", + "shortDescription": { + "text": "Function with `= { ... }` and inferred return type" + }, + "fullDescription": { + "text": "Reports functions with '= { ... }' and inferred return type. Example: 'fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.' The quick fix removes braces: 'fun sum(a: Int, b: Int) = a + b'", + "markdown": "Reports functions with `= { ... }` and inferred return type.\n\n**Example:**\n\n\n fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.\n\nThe quick fix removes braces:\n\n\n fun sum(a: Int, b: Int) = a + b\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ArrayInDataClass", + "shortDescription": { + "text": "Array property in data class" + }, + "fullDescription": { + "text": "Reports properties with an 'Array' type in a 'data' class without overridden 'equals()' or 'hashCode()'. Array parameters are compared by reference equality, which is likely an unexpected behavior. It is strongly recommended to override 'equals()' and 'hashCode()' in such cases. Example: 'data class Text(val lines: Array)' A quick-fix generates missing 'equals()' and 'hashCode()' implementations: 'data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }'", + "markdown": "Reports properties with an `Array` type in a `data` class without overridden `equals()` or `hashCode()`.\n\n\nArray parameters are compared by reference equality, which is likely an unexpected behavior.\nIt is strongly recommended to override `equals()` and `hashCode()` in such cases.\n\n**Example:**\n\n\n data class Text(val lines: Array)\n\nA quick-fix generates missing `equals()` and `hashCode()` implementations:\n\n\n data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertTwoComparisonsToRangeCheck", + "shortDescription": { + "text": "Two comparisons should be converted to a range check" + }, + "fullDescription": { + "text": "Reports two consecutive comparisons that can be converted to a range check. Checking against a range makes code simpler by removing test subject duplication. Example: 'fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }' A quick-fix replaces the comparison-based check with a range one: 'fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }'", + "markdown": "Reports two consecutive comparisons that can be converted to a range check.\n\nChecking against a range makes code simpler by removing test subject duplication.\n\n**Example:**\n\n\n fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }\n\nA quick-fix replaces the comparison-based check with a range one:\n\n\n fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LocalVariableName", + "shortDescription": { + "text": "Local variable naming convention" + }, + "fullDescription": { + "text": "Reports local variables that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with a lowercase letter, use camel case and no underscores. Example: 'fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }'", + "markdown": "Reports local variables that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#function-names): it has to start with a lowercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantQualifierName", + "shortDescription": { + "text": "Redundant qualifier name" + }, + "fullDescription": { + "text": "Reports redundant qualifiers (or their parts) on class names, functions, and properties. A fully qualified name is an unambiguous identifier that specifies which object, function, or property a call refers to. In the contexts where the name can be shortened, the inspection informs on the opportunity and the associated 'Remove redundant qualifier name' quick-fix allows amending the code. Examples: 'package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = my.simple.name.Foo() // 'Foo' resides in the declared 'my.simple.name' package, qualifier is redundant\n val b = kotlin.Int.MAX_VALUE // Can be replaced with 'MAX_VALUE' since it's imported\n val c = kotlin.Double.MAX_VALUE // Can be replaced with 'Double.MAX_VALUE' since built-in types are imported automatically\n }' After the quick-fix is applied: 'package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = Foo()\n val b = MAX_VALUE\n val c = Double.MAX_VALUE\n }'", + "markdown": "Reports redundant qualifiers (or their parts) on class names, functions, and properties.\n\n\nA fully qualified name is an unambiguous identifier that specifies which object, function, or property a call refers to.\nIn the contexts where the name can be shortened, the inspection informs on the opportunity and the associated\n'Remove redundant qualifier name' quick-fix allows amending the code.\n\n**Examples:**\n\n\n package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = my.simple.name.Foo() // 'Foo' resides in the declared 'my.simple.name' package, qualifier is redundant\n val b = kotlin.Int.MAX_VALUE // Can be replaced with 'MAX_VALUE' since it's imported\n val c = kotlin.Double.MAX_VALUE // Can be replaced with 'Double.MAX_VALUE' since built-in types are imported automatically\n }\n\nAfter the quick-fix is applied:\n\n\n package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = Foo()\n val b = MAX_VALUE\n val c = Double.MAX_VALUE\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveCurlyBracesFromTemplate", + "shortDescription": { + "text": "Redundant curly braces in string template" + }, + "fullDescription": { + "text": "Reports usages of curly braces in string templates around simple identifiers. Use the 'Remove curly braces' quick-fix to remove the redundant braces. Examples: 'fun redundant() {\n val x = 4\n val y = \"${x}\" // <== redundant\n }\n\n fun correctUsage() {\n val x = \"x\"\n val y = \"${x.length}\" // <== Ok\n }' After the quick-fix is applied: 'fun redundant() {\n val x = 4\n val y = \"$x\"\n }\n\n fun correctUsage() {\n val x = \"x\" <== Updated\n val y = \"${x.length}\"\n }'", + "markdown": "Reports usages of curly braces in string templates around simple identifiers.\n\nUse the 'Remove curly braces' quick-fix to remove the redundant braces.\n\n**Examples:**\n\n\n fun redundant() {\n val x = 4\n val y = \"${x}\" // <== redundant\n }\n\n fun correctUsage() {\n val x = \"x\"\n val y = \"${x.length}\" // <== Ok\n }\n\nAfter the quick-fix is applied:\n\n\n fun redundant() {\n val x = 4\n val y = \"$x\"\n }\n\n fun correctUsage() {\n val x = \"x\" <== Updated\n val y = \"${x.length}\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithIndexingOperation", + "shortDescription": { + "text": "'substring' call should be replaced with indexing operator" + }, + "fullDescription": { + "text": "Reports calls like '\"abc\".substring(0, 1)' that can be replaced with '\"abc\"[0]'. Obtaining the element by index makes your code simpler. The quick-fix replaces the 'substring' call with the indexing operator. Example: 'fun foo() {\n \"abc\".substring(0, 1)\n }' After the quick-fix is applied: 'fun foo() {\n \"abc\"[0]\n }'", + "markdown": "Reports calls like `\"abc\".substring(0, 1)` that can be replaced with `\"abc\"[0]`.\n\nObtaining the element by index makes your code simpler.\n\nThe quick-fix replaces the `substring` call with the indexing operator.\n\n**Example:**\n\n\n fun foo() {\n \"abc\".substring(0, 1)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n \"abc\"[0]\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MoveLambdaOutsideParentheses", + "shortDescription": { + "text": "Lambda argument inside parentheses" + }, + "fullDescription": { + "text": "Reports lambda expressions in parentheses which can be moved outside. Example: 'fun square(a: Int, b: (Int) -> Int) {\n b(a * a)\n}\n\nfun foo() {\n square(2, { it })\n}' After the quick-fix is applied: 'fun foo() {\n square(2){ it }\n}'", + "markdown": "Reports lambda expressions in parentheses which can be moved outside.\n\n**Example:**\n\n\n fun square(a: Int, b: (Int) -> Int) {\n b(a * a)\n }\n\n fun foo() {\n square(2, { it })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n square(2){ it }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OverridingDeprecatedMember", + "shortDescription": { + "text": "Overriding deprecated member" + }, + "fullDescription": { + "text": "Reports declarations that inherit from deprecated members. Example: 'open class BaseService {\n @Deprecated(\"obsolete\", replaceWith = ReplaceWith(\"connection\"))\n open fun connect() {}\n\n open fun connection() {}\n} \n\nclass SomeService: BaseService() {\n override fun connect() {\n super.connect()\n }\n}'", + "markdown": "Reports declarations that inherit from deprecated members.\n\n**Example:**\n\n\n open class BaseService {\n @Deprecated(\"obsolete\", replaceWith = ReplaceWith(\"connection\"))\n open fun connect() {}\n\n open fun connection() {}\n } \n\n class SomeService: BaseService() {\n override fun connect() {\n super.connect()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitTypeParametersForLocalVariablesMigration", + "shortDescription": { + "text": "Local variable with type parameters" + }, + "fullDescription": { + "text": "Reports local variables with type parameters. A type parameter for a local variable doesn't make sense because it can't be specialized. Example: 'fun main() {\n val x = \"\"\n }' After the quick-fix is applied: 'fun main() {\n val x = \"\"\n }' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports local variables with type parameters.\n\nA type parameter for a local variable doesn't make sense because it can't be specialized.\n\n**Example:**\n\n\n fun main() {\n val x = \"\"\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val x = \"\"\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TestFunctionName", + "shortDescription": { + "text": "Test function naming convention" + }, + "fullDescription": { + "text": "Reports test function names that do not follow the recommended naming conventions.", + "markdown": "Reports test function names that do not follow the [recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#names-for-test-methods)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RecursivePropertyAccessor", + "shortDescription": { + "text": "Recursive property accessor" + }, + "fullDescription": { + "text": "Reports recursive property accessor calls which can end up with a 'StackOverflowError'. Such calls are usually confused with backing field access. Example: 'var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }' After the quick-fix is applied: 'var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }'", + "markdown": "Reports recursive property accessor calls which can end up with a `StackOverflowError`.\nSuch calls are usually confused with backing field access.\n\n**Example:**\n\n\n var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }\n\nAfter the quick-fix is applied:\n\n\n var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantUnitExpression", + "shortDescription": { + "text": "Redundant 'Unit'" + }, + "fullDescription": { + "text": "Reports redundant 'Unit' expressions. 'Unit' in Kotlin can be used as the return type of functions that do not return anything meaningful. The 'Unit' type has only one possible value, which is the 'Unit' object. Examples: 'fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }'", + "markdown": "Reports redundant `Unit` expressions.\n\n\n`Unit` in Kotlin can be used as the return type of functions that do not return anything meaningful.\nThe `Unit` type has only one possible value, which is the `Unit` object.\n\n**Examples:**\n\n\n fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PlatformExtensionReceiverOfInline", + "shortDescription": { + "text": "'inline fun' with nullable receiver until Kotlin 1.2" + }, + "fullDescription": { + "text": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). It's recommended to add an explicit '!!' you want an exception to be thrown, or consider changing the function's receiver type to nullable if it should work without exceptions. Example: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }' After the quick-fix is applied: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", + "markdown": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nIt's recommended to add an explicit `!!` you want an exception to be thrown,\nor consider changing the function's receiver type to nullable if it should work without exceptions.\n\n**Example:**\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousEqualsCombination", + "shortDescription": { + "text": "Suspicious combination of == and ===" + }, + "fullDescription": { + "text": "Reports '==' and '===' comparisons that are both used on the same variable within a single expression. Due to similarities '==' and '===' could be mixed without notice, and it takes a close look to check that '==' used instead of '===' Example: 'if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return'", + "markdown": "Reports `==` and `===` comparisons that are both used on the same variable within a single expression.\n\nDue to similarities `==` and `===` could be mixed without notice, and\nit takes a close look to check that `==` used instead of `===`\n\nExample:\n\n\n if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedDataClassCopyResult", + "shortDescription": { + "text": "Unused result of data class copy" + }, + "fullDescription": { + "text": "Reports calls to data class 'copy' function without using its result.", + "markdown": "Reports calls to data class `copy` function without using its result." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantElseInIf", + "shortDescription": { + "text": "Redundant 'else' in 'if'" + }, + "fullDescription": { + "text": "Reports redundant 'else' in 'if' with 'return' Example: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }' After the quick-fix is applied: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }'", + "markdown": "Reports redundant `else` in `if` with `return`\n\n**Example:**\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplacePutWithAssignment", + "shortDescription": { + "text": "'map.put()' can be converted to assignment" + }, + "fullDescription": { + "text": "Reports 'map.put' function calls that can be replaced with indexing operator ('[]'). Using syntactic sugar makes your code simpler. The quick-fix replaces 'put' call with the assignment. Example: 'fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }' After the quick-fix is applied: 'fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }'", + "markdown": "Reports `map.put` function calls that can be replaced with indexing operator (`[]`).\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces `put` call with the assignment.\n\n**Example:**\n\n\n fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinDoubleNegation", + "shortDescription": { + "text": "Redundant double negation" + }, + "fullDescription": { + "text": "Reports redundant double negations. Example: 'val truth = !!true'", + "markdown": "Reports redundant double negations.\n\n**Example:**\n\n val truth = !!true\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionName", + "shortDescription": { + "text": "Function naming convention" + }, + "fullDescription": { + "text": "Reports function names that do not follow the recommended naming conventions. Example: 'fun Foo() {}' To fix the problem change the name of the function to match the recommended naming conventions.", + "markdown": "Reports function names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n fun Foo() {}\n\nTo fix the problem change the name of the function to match the recommended naming conventions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentKotlinMavenVersion", + "shortDescription": { + "text": "Maven and IDE plugins versions are different" + }, + "fullDescription": { + "text": "Reports the Maven plugin version of the Kotlin compiler that is different from the one that is used in the IDE plugin. This inconsistency may lead to different error reporting behavior in the IDE and the compiler", + "markdown": "Reports the Maven plugin version of the Kotlin compiler that is different from the one that is used in the IDE plugin.\n\nThis inconsistency may lead to different error reporting behavior in the IDE and the compiler" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantUnitReturnType", + "shortDescription": { + "text": "Redundant 'Unit' return type" + }, + "fullDescription": { + "text": "Reports a redundant 'Unit' return type which can be omitted.", + "markdown": "Reports a redundant `Unit` return type which can be omitted." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceRangeToWithUntil", + "shortDescription": { + "text": "'rangeTo' or the '..' call should be replaced with 'until'" + }, + "fullDescription": { + "text": "Reports calls to 'rangeTo' or the '..' operator instead of calls to 'until'. Using corresponding functions makes your code simpler. The quick-fix replaces 'rangeTo' or the '..' call with 'until'. Example: 'fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }' After the quick-fix is applied: 'fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }'", + "markdown": "Reports calls to `rangeTo` or the `..` operator instead of calls to `until`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces `rangeTo` or the `..` call with `until`.\n\n**Example:**\n\n\n fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedEquals", + "shortDescription": { + "text": "Unused equals expression" + }, + "fullDescription": { + "text": "Reports unused 'equals'('==') expressions.", + "markdown": "Reports unused `equals`(`==`) expressions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnclearPrecedenceOfBinaryExpression", + "shortDescription": { + "text": "Multiple operators with different precedence" + }, + "fullDescription": { + "text": "Reports binary expressions that consist of different operators without parentheses. Such expressions can be less readable due to different precedence rules of operators. Example: fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }", + "markdown": "Reports binary expressions that consist of different operators without parentheses.\n\nSuch expressions can be less readable due to different [precedence rules](https://kotlinlang.org/docs/reference/grammar.html#expressions) of operators.\n\nExample:\n\n```\n fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }\n```" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedLambdaExpressionBody", + "shortDescription": { + "text": "Unused return value of a function with lambda expression body" + }, + "fullDescription": { + "text": "Reports calls with an unused return value when the called function returns a lambda from an expression body. If there is '=' between function header and body block, code from the function will not be evaluated which can lead to incorrect behavior. Remove = token from function declaration can be used to amend the code automatically. Example: 'fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }' After the quick-fix is applied: 'fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }'", + "markdown": "Reports calls with an unused return value when the called function returns a lambda from an expression body.\n\n\nIf there is `=` between function header and body block,\ncode from the function will not be evaluated which can lead to incorrect behavior.\n\n**Remove = token from function declaration** can be used to amend the code automatically.\n\nExample:\n\n\n fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }\n\nAfter the quick-fix is applied:\n\n\n fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertLambdaToReference", + "shortDescription": { + "text": "Can be replaced with function reference" + }, + "fullDescription": { + "text": "Reports function literal expressions that can be replaced with function references. Replacing lambdas with function references often makes code look more concise and understandable. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }'", + "markdown": "Reports function literal expressions that can be replaced with function references.\n\nReplacing lambdas with function references often makes code look more concise and understandable.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSetter", + "shortDescription": { + "text": "Redundant property setter" + }, + "fullDescription": { + "text": "Reports redundant property setters. Setter is considered to be redundant in one of the following cases: Setter has no body. Accessor visibility isn't changed, declaration isn't 'external' and has no annotations. 'var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated' Setter body is a block with a single statement assigning the parameter to the backing field. 'var prop: Int = 0\n set(value) { // redundant\n field = value\n }'", + "markdown": "Reports redundant property setters.\n\n\nSetter is considered to be redundant in one of the following cases:\n\n1. Setter has no body. Accessor visibility isn't changed, declaration isn't `external` and has no annotations.\n\n\n var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated\n \n2. Setter body is a block with a single statement assigning the parameter to the backing field.\n\n\n var prop: Int = 0\n set(value) { // redundant\n field = value\n }\n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanSealedSubClassBeObject", + "shortDescription": { + "text": "Sealed sub-class without state and overridden equals" + }, + "fullDescription": { + "text": "Reports direct inheritors of 'sealed' classes that have no state and overridden 'equals()' method. It's highly recommended to override 'equals()' to provide comparison stability, or convert the 'class' to an 'object' to reach the same effect. Example: 'sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }' A quick-fix converts a 'class' into an 'object': 'sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }'", + "markdown": "Reports direct inheritors of `sealed` classes that have no state and overridden `equals()` method.\n\nIt's highly recommended to override `equals()` to provide comparison stability, or convert the `class` to an `object` to reach the same effect.\n\n**Example:**\n\n\n sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n\nA quick-fix converts a `class` into an `object`:\n\n\n sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PropertyName", + "shortDescription": { + "text": "Property naming convention" + }, + "fullDescription": { + "text": "Reports property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, property names should start with a lowercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val My_Cool_Property = \"\"' A quick-fix renames the class according to the Kotlin naming conventions: 'val myCoolProperty = \"\"'", + "markdown": "Reports property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nproperty names should start with a lowercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val My_Cool_Property = \"\"\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val myCoolProperty = \"\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinMavenPluginPhase", + "shortDescription": { + "text": "Kotlin Maven Plugin misconfigured" + }, + "fullDescription": { + "text": "Reports kotlin-maven-plugin configuration issues", + "markdown": "Reports kotlin-maven-plugin configuration issues" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertToStringTemplate", + "shortDescription": { + "text": "String concatenation that can be converted to string template" + }, + "fullDescription": { + "text": "Reports string concatenation that can be converted to a string template. Using string templates is recommended as it makes code easier to read. Example: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }' After the quick-fix is applied: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }'", + "markdown": "Reports string concatenation that can be converted to a string template.\n\nUsing string templates is recommended as it makes code easier to read.\n\n**Example:**\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifiableCall", + "shortDescription": { + "text": "Library function call could be simplified" + }, + "fullDescription": { + "text": "Reports library function calls which could be replaced by simplified one. Using corresponding functions makes your code simpler. The quick-fix replaces the function calls with another one. Example: 'fun test(list: List) {\n list.filter { it is String }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.filterIsInstance()\n }'", + "markdown": "Reports library function calls which could be replaced by simplified one.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the function calls with another one.\n\n**Example:**\n\n\n fun test(list: List) {\n list.filter { it is String }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.filterIsInstance()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObjectLiteralToLambda", + "shortDescription": { + "text": "Object literal can be converted to lambda" + }, + "fullDescription": { + "text": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression. Example: 'class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n}' After the quick-fix is applied: 'fun foo() {\n threadPool.submit { println(\"hello\") }\n }'", + "markdown": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression.\n\n**Example:**\n\n\n class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n threadPool.submit { println(\"hello\") }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLambdaOrAnonymousFunction", + "shortDescription": { + "text": "Redundant creation of lambda or anonymous function" + }, + "fullDescription": { + "text": "Reports lambdas or anonymous functions that are created and used immediately. 'fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }'", + "markdown": "Reports lambdas or anonymous functions that are created and used immediately.\n\n\n fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "BooleanLiteralArgument", + "shortDescription": { + "text": "Boolean literal argument without parameter name" + }, + "fullDescription": { + "text": "Reports call arguments with 'Boolean' type without explicit parameter names specified. When multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes. Explicit parameter names allow for easier code reading and understanding. Example: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }' A quick-fix adds missing parameter names: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }'", + "markdown": "Reports call arguments with `Boolean` type without explicit parameter names specified.\n\n\nWhen multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes.\nExplicit parameter names allow for easier code reading and understanding.\n\n**Example:**\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }\n\nA quick-fix adds missing parameter names:\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertArgumentToSet", + "shortDescription": { + "text": "Argument could be converted to 'Set' to improve performance" + }, + "fullDescription": { + "text": "Detects the function calls that could work faster with an argument converted to 'Set'. Operations like 'minus' or 'intersect' are more effective when their argument is a set. An explicit conversion of an 'Iterable' or an 'Array' into a 'Set' can often make code more effective. The quick-fix adds an explicit conversion to the function call. Example: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size' After the quick-fix is applied: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size'", + "markdown": "Detects the function calls that could work faster with an argument converted to `Set`.\n\n\nOperations like 'minus' or 'intersect' are more effective when their argument is a set.\nAn explicit conversion of an `Iterable` or an `Array`\ninto a `Set` can often make code more effective.\n\n\nThe quick-fix adds an explicit conversion to the function call.\n\n**Example:**\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size\n\nAfter the quick-fix is applied:\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceGuardClauseWithFunctionCall", + "shortDescription": { + "text": "Guard clause can be replaced with Kotlin's function call" + }, + "fullDescription": { + "text": "Reports guard clauses that can be replaced with a function call. Example: 'fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }' After the quick-fix is applied: 'fun test(foo: Int?) {\n checkNotNull(foo)\n }'", + "markdown": "Reports guard clauses that can be replaced with a function call.\n\n**Example:**\n\n fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }\n\nAfter the quick-fix is applied:\n\n fun test(foo: Int?) {\n checkNotNull(foo)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceToStringWithStringTemplate", + "shortDescription": { + "text": "Call of 'toString' could be replaced with string template" + }, + "fullDescription": { + "text": "Reports 'toString' function calls that can be replaced with a string template. Using string templates makes your code simpler. The quick-fix replaces 'toString' with a string template. Example: 'fun test(): String {\n val x = 1\n return x.toString()\n }' After the quick-fix is applied: 'fun test(): String {\n val x = 1\n return \"$x\"\n }'", + "markdown": "Reports `toString` function calls that can be replaced with a string template.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces `toString` with a string template.\n\n**Example:**\n\n\n fun test(): String {\n val x = 1\n return x.toString()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(): String {\n val x = 1\n return \"$x\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProtectedInFinal", + "shortDescription": { + "text": "'protected' visibility is effectively 'private' in a final class" + }, + "fullDescription": { + "text": "Reports 'protected' visibility used inside of a 'final' class. In such cases 'protected' members are accessible only in the class itself, so they are effectively 'private'. Example: 'class FinalClass {\n protected fun foo() {}\n }' After the quick-fix is applied: 'class FinalClass {\n private fun foo() {}\n }'", + "markdown": "Reports `protected` visibility used inside of a `final` class. In such cases `protected` members are accessible only in the class itself, so they are effectively `private`.\n\n**Example:**\n\n\n class FinalClass {\n protected fun foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class FinalClass {\n private fun foo() {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceRangeStartEndInclusiveWithFirstLast", + "shortDescription": { + "text": "Boxed properties should be replaced with unboxed" + }, + "fullDescription": { + "text": "Reports boxed 'Range.start' and 'Range.endInclusive' properties. These properties can be replaced with unboxed 'first' and 'last' properties to avoid redundant calls. The quick-fix replaces 'start' and 'endInclusive' properties with the corresponding 'first' and 'last'. Example: 'fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }' After the quick-fix is applied: 'fun foo(range: CharRange) {\n val lastElement = range.last\n }'", + "markdown": "Reports **boxed** `Range.start` and `Range.endInclusive` properties.\n\nThese properties can be replaced with **unboxed** `first` and `last` properties to avoid redundant calls.\n\nThe quick-fix replaces `start` and `endInclusive` properties with the corresponding `first` and `last`.\n\n**Example:**\n\n\n fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(range: CharRange) {\n val lastElement = range.last\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSizeCheckWithIsNotEmpty", + "shortDescription": { + "text": "Size check can be replaced with 'isNotEmpty()'" + }, + "fullDescription": { + "text": "Reports size checks of 'Collections/Array/String' that should be replaced with 'isNotEmpty()'. Using 'isNotEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isNotEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }'", + "markdown": "Reports size checks of `Collections/Array/String` that should be replaced with `isNotEmpty()`.\n\nUsing `isNotEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isNotEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSemicolon", + "shortDescription": { + "text": "Redundant semicolon" + }, + "fullDescription": { + "text": "Reports redundant semicolons (';') that can be safely removed. Kotlin does not require a semicolon at the end of each statement or expression. A quick-fix is suggested to remove redundant semicolons. Example: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};' After the quick-fix is applied: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}' There are two cases though where a semicolon is required: Several statements placed on a single line need to be separated with semicolons: 'map.forEach { val (key, value) = it; println(\"$key -> $value\") }' 'enum' classes that also declare properties or functions, require a semicolon after the list of enum constants: 'enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }'", + "markdown": "Reports redundant semicolons (`;`) that can be safely removed.\n\n\nKotlin does not require a semicolon at the end of each statement or expression.\nA quick-fix is suggested to remove redundant semicolons.\n\n**Example:**\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};\n\nAfter the quick-fix is applied:\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}\n\nThere are two cases though where a semicolon is required:\n\n1. Several statements placed on a single line need to be separated with semicolons:\n\n\n map.forEach { val (key, value) = it; println(\"$key -> $value\") }\n\n2. `enum` classes that also declare properties or functions, require a semicolon after the list of enum constants:\n\n\n enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }\n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IntroduceWhenSubject", + "shortDescription": { + "text": "'when' that can be simplified by introducing an argument" + }, + "fullDescription": { + "text": "Reports a 'when' expression that can be simplified by introducing a subject argument. Example: 'fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }' The quick fix introduces a subject argument: 'fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }'", + "markdown": "Reports a `when` expression that can be simplified by introducing a subject argument.\n\n**Example:**\n\n\n fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n\nThe quick fix introduces a subject argument:\n\n\n fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedCallableAddReplaceWith", + "shortDescription": { + "text": "@Deprecated annotation without 'replaceWith' argument" + }, + "fullDescription": { + "text": "Reports deprecated functions and properties that do not have the 'kotlin.ReplaceWith' argument in its 'kotlin.deprecated' annotation and suggests to add one based on their body. Kotlin provides the 'ReplaceWith' argument to replace deprecated declarations automatically. It is recommended to use the argument to fix deprecation issues in code. Example: '@Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42' A quick-fix adds the 'ReplaceWith()' argument: '@Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42'", + "markdown": "Reports deprecated functions and properties that do not have the `kotlin.ReplaceWith` argument in its `kotlin.deprecated` annotation and suggests to add one based on their body.\n\n\nKotlin provides the `ReplaceWith` argument to replace deprecated declarations automatically.\nIt is recommended to use the argument to fix deprecation issues in code.\n\n**Example:**\n\n\n @Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42\n\nA quick-fix adds the `ReplaceWith()` argument:\n\n\n @Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ComplexRedundantLet", + "shortDescription": { + "text": "Redundant argument-based `let` call" + }, + "fullDescription": { + "text": "Reports a redundant argument-based 'let' call. 'let' is redundant when the lambda parameter is only used as a qualifier in a call expression. If you need to give a name to the qualifying expression, declare a local variable. Example: 'fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }' A quick-fix removes the extra 'let()' call: 'fun example() {\n \"1,2,3\".split(',')\n }' Alternative: 'fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }'", + "markdown": "Reports a redundant argument-based `let` call.\n\n`let` is redundant when the lambda parameter is only used as a qualifier in a call expression.\n\nIf you need to give a name to the qualifying expression, declare a local variable.\n\n**Example:**\n\n\n fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }\n\nA quick-fix removes the extra `let()` call:\n\n\n fun example() {\n \"1,2,3\".split(',')\n }\n\nAlternative:\n\n\n fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantSpreadOperator", + "shortDescription": { + "text": "Redundant spread operator" + }, + "fullDescription": { + "text": "Reports the use of a redundant spread operator for a family of 'arrayOf' function calls. Use the 'Remove redundant spread operator' quick-fix to clean up the code. Examples: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }' After the quick-fix is applied: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }'", + "markdown": "Reports the use of a redundant spread operator for a family of `arrayOf` function calls.\n\nUse the 'Remove redundant spread operator' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitJvmOverloadsOnConstructorsOfAnnotationClassesMigration", + "shortDescription": { + "text": "'@JvmOverloads' annotation cannot be used on constructors of annotation classes since 1.4" + }, + "fullDescription": { + "text": "Reports '@JvmOverloads' on constructors of annotation classes because it's meaningless. There is no footprint of '@JvmOverloads' in the generated bytecode and Kotlin metadata, so '@JvmOverloads' doesn't affect the generated bytecode and the code behavior. '@JvmOverloads' on constructors of annotation classes causes a compilation error since Kotlin 1.4. Example: 'annotation class A @JvmOverloads constructor(val x: Int = 1)' After the quick-fix is applied: 'annotation class A constructor(val x: Int = 1)'", + "markdown": "Reports `@JvmOverloads` on constructors of annotation classes because it's meaningless.\n\n\nThere is no footprint of `@JvmOverloads` in the generated bytecode and Kotlin metadata,\nso `@JvmOverloads` doesn't affect the generated bytecode and the code behavior.\n\n`@JvmOverloads` on constructors of annotation classes causes a compilation error since Kotlin 1.4.\n\n**Example:**\n\n\n annotation class A @JvmOverloads constructor(val x: Int = 1)\n\nAfter the quick-fix is applied:\n\n\n annotation class A constructor(val x: Int = 1)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveSetterParameterType", + "shortDescription": { + "text": "Redundant setter parameter type" + }, + "fullDescription": { + "text": "Reports explicitly specified parameter types in property setters. Setter parameter type always matches the property type, so it's not required to be explicit. The 'Remove explicit type specification' quick-fix allows amending the code accordingly. Examples: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted' After the quick-fix is applied: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)'", + "markdown": "Reports explicitly specified parameter types in property setters.\n\n\nSetter parameter type always matches the property type, so it's not required to be explicit.\nThe 'Remove explicit type specification' quick-fix allows amending the code accordingly.\n\n**Examples:**\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted\n\nAfter the quick-fix is applied:\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IfThenToElvis", + "shortDescription": { + "text": "If-Then foldable to '?:'" + }, + "fullDescription": { + "text": "Reports 'if-then' expressions that can be folded into elvis ('?:') expressions. Example: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo' The quick fix converts the 'if-then' expression into an elvis ('?:') expression: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"'", + "markdown": "Reports `if-then` expressions that can be folded into elvis (`?:`) expressions.\n\n**Example:**\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo\n\nThe quick fix converts the `if-then` expression into an elvis (`?:`) expression:\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WrapUnaryOperator", + "shortDescription": { + "text": "Ambiguous unary operator use with number constant" + }, + "fullDescription": { + "text": "Reports an unary operator followed by a dot qualifier such as '-1.inc()'. Code like '-1.inc()' can be misleading because '-' has a lower precedence than '.inc()'. As a result, '-1.inc()' evaluates to '-2' and not '0' as it might be expected. Wrap unary operator and value with () quick-fix can be used to amend the code automatically.", + "markdown": "Reports an unary operator followed by a dot qualifier such as `-1.inc()`.\n\nCode like `-1.inc()` can be misleading because `-` has a lower precedence than `.inc()`.\nAs a result, `-1.inc()` evaluates to `-2` and not `0` as it might be expected.\n\n**Wrap unary operator and value with ()** quick-fix can be used to amend the code automatically." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConflictingExtensionProperty", + "shortDescription": { + "text": "Extension property conflicting with synthetic one" + }, + "fullDescription": { + "text": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java 'get' or 'set' methods. Such properties should be either removed or renamed to avoid breaking code by future changes in the compiler. A quick-fix deletes an extention property. Example: 'val File.name: String\n get() = getName()' A quick-fix adds the '@Deprecated' annotation: '@Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()'", + "markdown": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java `get` or `set` methods.\n\nSuch properties should be either removed or renamed to avoid breaking code by future changes in the compiler.\n\nA quick-fix deletes an extention property.\n\n**Example:**\n\n\n val File.name: String\n get() = getName()\n\nA quick-fix adds the `@Deprecated` annotation:\n\n\n @Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceJavaStaticMethodWithKotlinAnalog", + "shortDescription": { + "text": "Java methods should be replaced with Kotlin analog" + }, + "fullDescription": { + "text": "Reports a Java method call that can be replaced with a Kotlin function, for example, 'System.out.println()'. Replacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code. The quick-fix replaces the Java method calls on the same Kotlin call. Example: 'import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }' After the quick-fix is applied: 'fun main() {\n val a = listOf(1, 3, null)\n }'", + "markdown": "Reports a Java method call that can be replaced with a Kotlin function, for example, `System.out.println()`.\n\nReplacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code.\n\nThe quick-fix replaces the Java method calls on the same Kotlin call.\n\n**Example:**\n\n\n import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = listOf(1, 3, null)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyParenthesesFromLambdaCall", + "shortDescription": { + "text": "Remove unnecessary parentheses from function call with lambda" + }, + "fullDescription": { + "text": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses. Use the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code. Examples: 'fun foo() {\n listOf(1).forEach() { }\n }' After the quick-fix is applied: 'fun foo() {\n listOf(1).forEach { }\n }'", + "markdown": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses.\n\nUse the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo() {\n listOf(1).forEach() { }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n listOf(1).forEach { }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveExplicitSuperQualifier", + "shortDescription": { + "text": "Unnecessary supertype qualification" + }, + "fullDescription": { + "text": "Reports 'super' member calls with redundant supertype qualification. Code in a derived class can call its superclass functions and property accessors implementations using the 'super' keyword. To specify the supertype from which the inherited implementation is taken, 'super' can be qualified by the supertype name in angle brackets, e.g. 'super'. Sometimes this qualification is redundant and can be omitted. Use the 'Remove explicit supertype qualification' quick-fix to clean up the code. Examples: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }' After the quick-fix is applied: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }'", + "markdown": "Reports `super` member calls with redundant supertype qualification.\n\n\nCode in a derived class can call its superclass functions and property accessors implementations using the `super` keyword.\nTo specify the supertype from which the inherited implementation is taken, `super` can be qualified by the supertype name in\nangle brackets, e.g. `super`. Sometimes this qualification is redundant and can be omitted.\nUse the 'Remove explicit supertype qualification' quick-fix to clean up the code.\n\n**Examples:**\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }\n\nAfter the quick-fix is applied:\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantExplicitType", + "shortDescription": { + "text": "Obvious explicit type" + }, + "fullDescription": { + "text": "Reports local variables' explicitly given types which are obvious and thus redundant, like 'val f: Foo = Foo()'. Example: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }' After the quick-fix is applied: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }'", + "markdown": "Reports local variables' explicitly given types which are obvious and thus redundant, like `val f: Foo = Foo()`.\n\n**Example:**\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }\n\nAfter the quick-fix is applied:\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousVarProperty", + "shortDescription": { + "text": "Suspicious 'var' property: its setter does not influence its getter result" + }, + "fullDescription": { + "text": "Reports 'var' properties with default setter and getter that do not reference backing field. Such properties do not affect calling its setter; therefore, it will be clearer to change such property to 'val' and delete the initializer. Change to val and delete initializer quick-fix can be used to amend the code automatically. Example: '// This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1'", + "markdown": "Reports `var` properties with default setter and getter that do not reference backing field.\n\n\nSuch properties do not affect calling its setter; therefore, it will be clearer to change such property to `val` and delete the initializer.\n\n**Change to val and delete initializer** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n // This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaCollectionsStaticMethod", + "shortDescription": { + "text": "Java Collections static method call can be replaced with Kotlin stdlib" + }, + "fullDescription": { + "text": "Reports a Java 'Collections' static method call that can be replaced with Kotlin stdlib. Example: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }' The quick fix replaces Java 'Collections' static method call with the corresponding Kotlin stdlib method call: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }'", + "markdown": "Reports a Java `Collections` static method call that can be replaced with Kotlin stdlib.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }\n\nThe quick fix replaces Java `Collections` static method call with the corresponding Kotlin stdlib method call:\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantAsync", + "shortDescription": { + "text": "Redundant 'async' call" + }, + "fullDescription": { + "text": "Reports 'async' calls that are immediately followed by 'await'. Such calls can be replaced with blocking calls. Example: 'suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n scope.async(ctx) { doSomeJob() }.await()\n }' After the quick-fix is applied: 'suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n withContext(scope.coroutineContext + ctx) { doSomeJob() }\n }'", + "markdown": "Reports `async` calls that are immediately followed by `await`.\nSuch calls can be replaced with blocking calls.\n\n**Example:**\n\n\n suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n scope.async(ctx) { doSomeJob() }.await()\n }\n\nAfter the quick-fix is applied:\n\n\n suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n withContext(scope.coroutineContext + ctx) { doSomeJob() }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MoveVariableDeclarationIntoWhen", + "shortDescription": { + "text": "Variable declaration could be moved inside `when`" + }, + "fullDescription": { + "text": "Reports variable declarations that can be moved inside a 'when' expression. Example: 'fun someCalc(x: Int) = x * 42\n\nfun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}' After the quick-fix is applied: 'fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}'", + "markdown": "Reports variable declarations that can be moved inside a `when` expression.\n\n**Example:**\n\n\n fun someCalc(x: Int) = x * 42\n\n fun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeferredIsResult", + "shortDescription": { + "text": "Function returning Deferred directly" + }, + "fullDescription": { + "text": "Reports functions with the 'kotlinx.coroutines.Deferred' return type. Functions that use 'Deferred' as return type should have a name with the 'Async' suffix. Otherwise, it's recommended to mark a function as 'suspend' and unwrap 'Deferred' inside it. Example: 'fun calcEverything(): Deferred {\n return CompletableDeferred(42)\n }' After the quick-fix that adds the 'Async' suffix applied: 'fun calcEverythingAsync(): Deferred {\n return CompletableDeferred(42)\n }' After the quick-fix that converts the function into a 'suspend' one applied: 'suspend fun calcEverything(): Int {\n return CompletableDeferred(42).await()\n }'", + "markdown": "Reports functions with the `kotlinx.coroutines.Deferred` return type.\n\n\nFunctions that use `Deferred` as return type should have a name with the `Async` suffix.\nOtherwise, it's recommended to mark a function as `suspend` and unwrap `Deferred` inside it.\n\n**Example:**\n\n\n fun calcEverything(): Deferred {\n return CompletableDeferred(42)\n }\n\nAfter the quick-fix that adds the `Async` suffix applied:\n\n\n fun calcEverythingAsync(): Deferred {\n return CompletableDeferred(42)\n }\n\nAfter the quick-fix that converts the function into a `suspend` one applied:\n\n\n suspend fun calcEverything(): Int {\n return CompletableDeferred(42).await()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyParenthesesFromAnnotationEntry", + "shortDescription": { + "text": "Remove unnecessary parentheses" + }, + "fullDescription": { + "text": "Reports redundant empty parentheses in annotation entries. Use the 'Remove unnecessary parentheses' quick-fix to clean up the code. Examples: 'annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }'", + "markdown": "Reports redundant empty parentheses in annotation entries.\n\nUse the 'Remove unnecessary parentheses' quick-fix to clean up the code.\n\n**Examples:**\n\n\n annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifiableCallChain", + "shortDescription": { + "text": "Call chain on collection type can be simplified" + }, + "fullDescription": { + "text": "Reports two-call chains replaceable by a single call. It can help you to avoid redundant code execution. The quick-fix replaces the call chain with a single call. Example: 'fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }' After the quick-fix is applied: 'fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }'", + "markdown": "Reports two-call chains replaceable by a single call.\n\nIt can help you to avoid redundant code execution.\n\nThe quick-fix replaces the call chain with a single call.\n\n**Example:**\n\n\n fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceCallWithBinaryOperator", + "shortDescription": { + "text": "Can be replaced with binary operator" + }, + "fullDescription": { + "text": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones. Example: 'fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }' After the quick-fix is applied: 'fun test(): Boolean {\n return 2 > 1\n }'", + "markdown": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones.\n\n**Example:**\n\n fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }\n\nAfter the quick-fix is applied:\n\n fun test(): Boolean {\n return 2 > 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedUnaryOperator", + "shortDescription": { + "text": "Unused unary operator" + }, + "fullDescription": { + "text": "Reports unary operators for number types on unused expressions. Unary operators break previous expression if they are used without braces. As a result, mathematical expressions spanning multi lines can be misleading. Example: 'fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }'", + "markdown": "Reports unary operators for number types on unused expressions.\n\nUnary operators break previous expression if they are used without braces.\nAs a result, mathematical expressions spanning multi lines can be misleading.\n\nExample:\n\n\n fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ClassName", + "shortDescription": { + "text": "Class naming convention" + }, + "fullDescription": { + "text": "Reports class names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, class names should start with an uppercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'class user(val name: String)' A quick-fix renames the class according to the Kotlin naming conventions: 'class User(val name: String)'", + "markdown": "Reports class names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nclass names should start with an uppercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n class user(val name: String)\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n class User(val name: String)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyPrimaryConstructor", + "shortDescription": { + "text": "Redundant empty primary constructor" + }, + "fullDescription": { + "text": "Reports empty primary constructors when they are implicitly available anyway. A primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers. Use the 'Remove empty primary constructor' quick-fix to clean up the code. Examples: 'class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier'", + "markdown": "Reports empty primary constructors when they are implicitly available anyway.\n\n\nA primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers.\nUse the 'Remove empty primary constructor' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptySecondaryConstructorBody", + "shortDescription": { + "text": "Redundant constructor body" + }, + "fullDescription": { + "text": "Reports empty bodies of secondary constructors.", + "markdown": "Reports empty bodies of secondary constructors." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FloatingPointLiteralPrecision", + "shortDescription": { + "text": "Floating-point literal exceeds the available precision" + }, + "fullDescription": { + "text": "Reports floating-point literals that cannot be represented with the required precision using IEEE 754 'Float' and 'Double' types. For example, '1.9999999999999999999' has too many significant digits, so its representation as a 'Double' will be rounded to '2.0'. Specifying excess digits may be misleading as it hides the fact that computations use rounded values instead. The quick-fix replaces the literal with a rounded value that matches the actual representation of the constant. Example: 'val x: Float = 3.14159265359f' After the quick-fix is applied: 'val x: Float = 3.1415927f'", + "markdown": "Reports floating-point literals that cannot be represented with the required precision using [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) `Float` and `Double` types.\n\n\nFor example, `1.9999999999999999999` has too many significant digits,\nso its representation as a `Double` will be rounded to `2.0`.\nSpecifying excess digits may be misleading as it hides the fact that computations\nuse rounded values instead.\n\n\nThe quick-fix replaces the literal with a rounded value that matches the actual representation\nof the constant.\n\n**Example:**\n\n\n val x: Float = 3.14159265359f\n\nAfter the quick-fix is applied:\n\n\n val x: Float = 3.1415927f\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertPairConstructorToToFunction", + "shortDescription": { + "text": "Convert Pair constructor to 'to' function" + }, + "fullDescription": { + "text": "Reports a 'Pair' constructor invocation that can be replaced with a 'to()' infix function call. Explicit constructor invocations may add verbosity, especially if they are used multiple times. Replacing constructor calls with 'to()' makes code easier to read and maintain. Example: 'val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )' After the quick-fix is applied: 'val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )'", + "markdown": "Reports a `Pair` constructor invocation that can be replaced with a `to()` infix function call.\n\n\nExplicit constructor invocations may add verbosity, especially if they are used multiple times.\nReplacing constructor calls with `to()` makes code easier to read and maintain.\n\n**Example:**\n\n\n val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )\n\nAfter the quick-fix is applied:\n\n\n val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantGetter", + "shortDescription": { + "text": "Redundant property getter" + }, + "fullDescription": { + "text": "Reports redundant property getters. Example: 'class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }' After the quick-fix is applied: 'class Test {\n val a = 1\n val b = 1\n }'", + "markdown": "Reports redundant property getters.\n\n**Example:**\n\n\n class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n val a = 1\n val b = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantIf", + "shortDescription": { + "text": "Redundant 'if' statement" + }, + "fullDescription": { + "text": "Reports 'if' statements which can be simplified to a single statement. Example: 'fun test() {\n if (foo()) {\n return true\n } else {\n return false\n }\n }' After the quick-fix is applied: 'fun test() {\n return foo()\n }'", + "markdown": "Reports `if` statements which can be simplified to a single statement.\n\n**Example:**\n\n\n fun test() {\n if (foo()) {\n return true\n } else {\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n return foo()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KDocMissingDocumentation", + "shortDescription": { + "text": "Missing KDoc comments for public declarations" + }, + "fullDescription": { + "text": "Reports public declarations that do not have KDoc comments. Example: 'class A' The quick fix generates the comment block above the declaration: '/**\n *\n */\n class A'", + "markdown": "Reports public declarations that do not have KDoc comments.\n\n**Example:**\n\n\n class A\n\nThe quick fix generates the comment block above the declaration:\n\n\n /**\n *\n */\n class A\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveExplicitTypeArguments", + "shortDescription": { + "text": "Unnecessary type argument" + }, + "fullDescription": { + "text": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted. Use the 'Remove explicit type arguments' quick-fix to clean up the code. Examples: '// 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()' After the quick-fix is applied: 'fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()'", + "markdown": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted.\n\nUse the 'Remove explicit type arguments' quick-fix to clean up the code.\n\n**Examples:**\n\n\n // 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()\n\nAfter the quick-fix is applied:\n\n\n fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantVisibilityModifier", + "shortDescription": { + "text": "Redundant visibility modifier" + }, + "fullDescription": { + "text": "Reports visibility modifiers that match the default visibility of an element ('public' for most elements, 'protected' for members that override a protected member).", + "markdown": "Reports visibility modifiers that match the default visibility of an element (`public` for most elements, `protected` for members that override a protected member)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UsePropertyAccessSyntax", + "shortDescription": { + "text": "Accessor call that can be replaced with property access syntax" + }, + "fullDescription": { + "text": "Reports Java 'get' and 'set' method calls that can be replaced with the Kotlin synthetic properties. Use property access syntax quick-fix can be used to amen the code automatically. Example: '// Java:\n public class JavaClassWithGetter {\n private final String expr = \"result\";\n\n // ...\n\n public String getExpr() {\n return expr;\n }\n }' '// Kotlin:\n fun test(j: JavaClassWithGetter) {\n // ...\n j.getExpr() // <== A quick-fix simplifies the expression to 'j.expr'\n }'", + "markdown": "Reports Java `get` and `set` method calls that can be replaced with the Kotlin synthetic properties.\n\n**Use property access syntax** quick-fix can be used to amen the code automatically.\n\nExample:\n\n\n // Java:\n public class JavaClassWithGetter {\n private final String expr = \"result\";\n\n // ...\n\n public String getExpr() {\n return expr;\n }\n }\n\n\n // Kotlin:\n fun test(j: JavaClassWithGetter) {\n // ...\n j.getExpr() // <== A quick-fix simplifies the expression to 'j.expr'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UseExpressionBody", + "shortDescription": { + "text": "Expression body syntax is preferable here" + }, + "fullDescription": { + "text": "Reports 'return' expressions (one-liners or 'when') that can be replaced with expression body syntax. Expression body syntax is recommended by the style guide. Convert to expression body quick-fix can be used to amend the code automatically. Example: 'fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }' After the quick-fix is applied: 'fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }'", + "markdown": "Reports `return` expressions (one-liners or `when`) that can be replaced with expression body syntax.\n\nExpression body syntax is recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#functions).\n\n**Convert to expression body** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MapGetWithNotNullAssertionOperator", + "shortDescription": { + "text": "'map.get()' with not-null assertion operator (!!)" + }, + "fullDescription": { + "text": "Reports 'map.get()!!' that can be replaced with 'map.getValue()', 'map.getOrElse()', and so on. Example: 'fun test(map: Map): String = map.get(0)!!' After the quick-fix is applied: 'fun test(map: Map): String = map.getValue(0)'", + "markdown": "Reports `map.get()!!` that can be replaced with `map.getValue()`, `map.getOrElse()`, and so on.\n\n**Example:**\n\n\n fun test(map: Map): String = map.get(0)!!\n\nAfter the quick-fix is applied:\n\n\n fun test(map: Map): String = map.getValue(0)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SortModifiers", + "shortDescription": { + "text": "Non-canonical modifier order" + }, + "fullDescription": { + "text": "Reports modifiers that do not follow the order recommended by the style guide. Sort modifiers quick-fix can be used to amend the code automatically. Examples: 'private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"'", + "markdown": "Reports modifiers that do not follow the order recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#modifiers-order).\n\n**Sort modifiers** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EnumEntryName", + "shortDescription": { + "text": "Enum entry naming convention" + }, + "fullDescription": { + "text": "Reports enum entry names that do not follow the recommended naming conventions. Example: 'enum class Foo {\n _Foo,\n foo\n }' To fix the problem rename enum entries to match the recommended naming conventions.", + "markdown": "Reports enum entry names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n enum class Foo {\n _Foo,\n foo\n }\n\nTo fix the problem rename enum entries to match the recommended naming conventions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithDropLast", + "shortDescription": { + "text": "'substring' call should be replaced with 'dropLast' call" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, s.length - x)' that can be replaced with 's.dropLast(x)'. Using corresponding functions makes your code simpler. The quick-fix replaces the 'substring' call with 'dropLast'. Example: 'fun foo(s: String) {\n s.substring(0, s.length - 5)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.dropLast(5)\n }'", + "markdown": "Reports calls like `s.substring(0, s.length - x)` that can be replaced with `s.dropLast(x)`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `dropLast`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.length - 5)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.dropLast(5)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SetterBackingFieldAssignment", + "shortDescription": { + "text": "Existing backing field without assignment" + }, + "fullDescription": { + "text": "Reports property setters that don't update the backing field. The quick-fix adds an assignment to the backing field. Example: 'class Test {\n var foo: Int = 1\n set(value) {\n }\n }' After the quick-fix is applied: 'class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }'", + "markdown": "Reports property setters that don't update the backing field.\n\nThe quick-fix adds an assignment to the backing field.\n\n**Example:**\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CopyWithoutNamedArguments", + "shortDescription": { + "text": "'copy' method of data class is called without named arguments" + }, + "fullDescription": { + "text": "Reports calls to a data class' 'copy()' method without named arguments. As all arguments of the 'copy()' function are optional, it might be hard to understand what properties are modified. Providing parameter names explicitly makes code easy to understand without navigating to the 'data class' declaration. Example: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }' A quick-fix provides parameter names to all 'copy()' arguments: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }'", + "markdown": "Reports calls to a data class' `copy()` method without named arguments.\n\n\nAs all arguments of the `copy()` function are optional, it might be hard to understand what properties are modified.\nProviding parameter names explicitly makes code easy to understand without navigating to the `data class` declaration.\n\n**Example:**\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }\n\nA quick-fix provides parameter names to all `copy()` arguments:\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinDeprecation", + "shortDescription": { + "text": "Usage of redundant or deprecated syntax or deprecated symbols" + }, + "fullDescription": { + "text": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (Code | Code Cleanup). A quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax. It also replaces deprecated symbols with their proposed substitutions.", + "markdown": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (**Code \\| Code Cleanup** ).\n\n\nA quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax.\n\n\nIt also replaces deprecated symbols with their proposed substitutions." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithTake", + "shortDescription": { + "text": "'substring' call should be replaced with 'take' call" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, x)' that can be replaced with 's.take(x)'. Using 'take()' makes your code simpler. The quick-fix replaces the 'substring' call with 'take()'. Example: 'fun foo(s: String) {\n s.substring(0, 10)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.take(10)\n }'", + "markdown": "Reports calls like `s.substring(0, x)` that can be replaced with `s.take(x)`.\n\nUsing `take()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `take()`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, 10)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.take(10)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertCallChainIntoSequence", + "shortDescription": { + "text": "Call chain on collection could be converted into 'Sequence' to improve performance" + }, + "fullDescription": { + "text": "Reports call chain on a 'Collection' that should be converted into Sequence. Each 'Collection' transforming function (such as 'map()' or 'filter()') creates a new 'Collection' (typically 'List' or 'Set') under the hood. In case of multiple consequent calls, and a huge number of items in 'Collection', memory traffic might be significant. In such a case, using 'Sequence' is preferred. Example: 'class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }' A quick-fix wraps call chain into 'asSequence()' and 'toList()': 'class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()'", + "markdown": "Reports call chain on a `Collection` that should be converted into **Sequence** .\n\nEach `Collection` transforming function (such as `map()` or `filter()`) creates a new\n`Collection` (typically `List` or `Set`) under the hood.\nIn case of multiple consequent calls, and a huge number of items in `Collection`, memory traffic might be significant.\nIn such a case, using `Sequence` is preferred.\n\n**Example:**\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n\nA quick-fix wraps call chain into `asSequence()` and `toList()`:\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AddOperatorModifier", + "shortDescription": { + "text": "Function should have 'operator' modifier" + }, + "fullDescription": { + "text": "Reports a function that matches one of the operator conventions but lacks the 'operator' keyword. By adding the 'operator' modifier, you might allow function consumers to write idiomatic Kotlin code. Example: 'class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }' A quick-fix adds the 'operator' modifier keyword: 'class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }'", + "markdown": "Reports a function that matches one of the operator conventions but lacks the `operator` keyword.\n\nBy adding the `operator` modifier, you might allow function consumers to write idiomatic Kotlin code.\n\n**Example:**\n\n\n class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }\n\nA quick-fix adds the `operator` modifier keyword:\n\n\n class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MayBeConstant", + "shortDescription": { + "text": "Might be 'const'" + }, + "fullDescription": { + "text": "Reports top-level 'val' properties in objects that might be declared as 'const' for better performance and Java interoperability. Example: 'object A {\n val foo = 1\n }' After the quick-fix is applied: 'object A {\n const val foo = 1\n }'", + "markdown": "Reports top-level `val` properties in objects that might be declared as `const` for better performance and Java interoperability.\n\n**Example:**\n\n\n object A {\n val foo = 1\n }\n\nAfter the quick-fix is applied:\n\n\n object A {\n const val foo = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceIsEmptyWithIfEmpty", + "shortDescription": { + "text": "'if' condition can be replaced with lambda call" + }, + "fullDescription": { + "text": "Reports 'isEmpty', 'isBlank', 'isNotEmpty', or 'isNotBlank' calls in an 'if' statement to assign a default value. The quick-fix replaces the 'if' condition with 'ifEmpty' or 'ifBlank' calls. Example: 'fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }' After the quick-fix is applied: 'fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }' This inspection only reports if the Kotlin language version of the project or module is 1.3 or higher.", + "markdown": "Reports `isEmpty`, `isBlank`, `isNotEmpty`, or `isNotBlank` calls in an `if` statement to assign a default value.\n\nThe quick-fix replaces the `if` condition with `ifEmpty` or `ifBlank` calls.\n\n**Example:**\n\n\n fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }\n\nThis inspection only reports if the Kotlin language version of the project or module is 1.3 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithImportAlias", + "shortDescription": { + "text": "Fully qualified name can be replaced with existing import alias" + }, + "fullDescription": { + "text": "Reports fully qualified names that can be replaced with an existing import alias. Example: 'import foo.Foo as Bar\nfun main() {\n foo.Foo()\n}' After the quick-fix is applied: 'import foo.Foo as Bar\nfun main() {\n Bar()\n}'", + "markdown": "Reports fully qualified names that can be replaced with an existing import alias.\n\n**Example:**\n\n\n import foo.Foo as Bar\n fun main() {\n foo.Foo()\n }\n\nAfter the quick-fix is applied:\n\n\n import foo.Foo as Bar\n fun main() {\n Bar()\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyBooleanWithConstants", + "shortDescription": { + "text": "Boolean expression can be simplified" + }, + "fullDescription": { + "text": "Reports boolean expression parts that can be reduced to constants. The quick-fix simplifies the condition. Example: 'fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }' After the quick-fix is applied: 'fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }'", + "markdown": "Reports boolean expression parts that can be reduced to constants.\n\nThe quick-fix simplifies the condition.\n\n**Example:**\n\n\n fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantModalityModifier", + "shortDescription": { + "text": "Redundant modality modifier" + }, + "fullDescription": { + "text": "Reports the modality modifiers that match the default modality of an element ('final' for most elements, 'open' for members with an 'override'). Example: 'final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }' After the quick-fix is applied: 'class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }'", + "markdown": "Reports the modality modifiers that match the default modality of an element (`final` for most elements, `open` for members with an `override`).\n\n**Example:**\n\n\n final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyAssertNotNull", + "shortDescription": { + "text": "'assert' call can be replaced with '!!' or '?:'" + }, + "fullDescription": { + "text": "Reports 'assert' calls that check a not null value of the declared variable. Using '!!' or '?:' makes your code simpler. The quick-fix replaces 'assert' with '!!' or '?:' operator in the variable initializer. Example: 'fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }' After the quick-fix is applied: 'fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }'", + "markdown": "Reports `assert` calls that check a not null value of the declared variable.\n\nUsing `!!` or `?:` makes your code simpler.\n\nThe quick-fix replaces `assert` with `!!` or `?:` operator in the variable initializer.\n\n**Example:**\n\n\n fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertNaNEquality", + "shortDescription": { + "text": "Convert equality check with 'NaN' to 'isNaN' call" + }, + "fullDescription": { + "text": "Reports an equality check with 'Float.NaN' or 'Double.NaN' that should be replaced with an 'isNaN()' check. According to IEEE 754, equality check against NaN always returns 'false', even for 'NaN == NaN'. Therefore, such a check is likely to be a mistake. A quick-fix replaces comparison with 'isNaN()' check that uses a different comparison technique and handles 'NaN' values correctly. Example: 'fun check(value: Double): Boolean {\n return Double.NaN == value\n }' After the fix is applied: 'fun check(value: Double): Boolean {\n return value.isNaN()\n }'", + "markdown": "Reports an equality check with `Float.NaN` or `Double.NaN` that should be replaced with an `isNaN()` check.\n\n\nAccording to IEEE 754, equality check against NaN always returns `false`, even for `NaN == NaN`.\nTherefore, such a check is likely to be a mistake.\n\nA quick-fix replaces comparison with `isNaN()` check that uses a different comparison technique and handles `NaN` values correctly.\n\n**Example:**\n\n\n fun check(value: Double): Boolean {\n return Double.NaN == value\n }\n\nAfter the fix is applied:\n\n\n fun check(value: Double): Boolean {\n return value.isNaN()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceManualRangeWithIndicesCalls", + "shortDescription": { + "text": "Range can be converted to indices or iteration" + }, + "fullDescription": { + "text": "Reports 'until' and 'rangeTo' operators that can be replaced with 'Collection.indices' or iteration over collection inside 'for' loop. Using syntactic sugar makes your code simpler. The quick-fix replaces the manual range with the corresponding construction. Example: 'fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }' After the quick-fix is applied: 'fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }'", + "markdown": "Reports `until` and `rangeTo` operators that can be replaced with `Collection.indices` or iteration over collection inside `for` loop.\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces the manual range with the corresponding construction.\n\n**Example:**\n\n\n fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinLoggerInitializedWithForeignClass", + "shortDescription": { + "text": "Logger initialized with foreign class" + }, + "fullDescription": { + "text": "Reports 'Logger' instances initialized with a class literal other than the class the 'Logger' resides in. This can happen when copy-pasting from another class. It may result in logging events under an unexpected category and incorrect filtering. Use the inspection options to specify the logger factory classes and methods recognized by this inspection. Example: 'class AnotherService\nclass MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n}' After the quick-fix is applied: 'class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n}'", + "markdown": "Reports `Logger` instances initialized with a class literal other than the class the `Logger` resides in.\n\n\nThis can happen when copy-pasting from another class.\nIt may result in logging events under an unexpected category and incorrect filtering.\n\n\nUse the inspection options to specify the logger factory classes and methods recognized by this inspection.\n\n**Example:**\n\n\n class AnotherService\n class MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n }\n\nAfter the quick-fix is applied:\n\n\n class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Logging", + "index": 158, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantAsSequence", + "shortDescription": { + "text": "Redundant 'asSequence' call" + }, + "fullDescription": { + "text": "Reports redundant 'asSequence()' call that can never have a positive performance effect. 'asSequence()' speeds up collection processing that includes multiple operations because it performs operations lazily and doesn't create intermediate collections. However, if a terminal operation (such as 'toList()') is used right after 'asSequence()', this doesn't give you any positive performance effect. Example: 'fun test(list: List) {\n list.asSequence().last()\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.last()\n }'", + "markdown": "Reports redundant `asSequence()` call that can never have a positive performance effect.\n\n\n`asSequence()` speeds up collection processing that includes multiple operations because it performs operations lazily\nand doesn't create intermediate collections.\n\n\nHowever, if a terminal operation (such as `toList()`) is used right after `asSequence()`, this doesn't give\nyou any positive performance effect.\n\n**Example:**\n\n\n fun test(list: List) {\n list.asSequence().last()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.last()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveToStringInStringTemplate", + "shortDescription": { + "text": "Redundant call to 'toString()' in string template" + }, + "fullDescription": { + "text": "Reports calls to 'toString()' in string templates that can be safely removed. Example: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }'", + "markdown": "Reports calls to `toString()` in string templates that can be safely removed.\n\n**Example:**\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }\n\nAfter the quick-fix is applied:\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinUnusedImport", + "shortDescription": { + "text": "Unused import directive" + }, + "fullDescription": { + "text": "Reports redundant 'import' statements. Default and unused imports can be safely removed. Example: 'import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }'", + "markdown": "Reports redundant `import` statements.\n\nDefault and unused imports can be safely removed.\n\n**Example:**\n\n\n import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBePrimaryConstructorProperty", + "shortDescription": { + "text": "Property is explicitly assigned to constructor parameter" + }, + "fullDescription": { + "text": "Reports properties that are explicitly assigned to primary constructor parameters. Properties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability. Example: 'class User(name: String) {\n val name = name\n }' A quick-fix joins the parameter and property declaration into a primary constructor parameter: 'class User(val name: String) {\n }'", + "markdown": "Reports properties that are explicitly assigned to primary constructor parameters.\n\nProperties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability.\n\n**Example:**\n\n\n class User(name: String) {\n val name = name\n }\n\nA quick-fix joins the parameter and property declaration into a primary constructor parameter:\n\n\n class User(val name: String) {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaMapForEach", + "shortDescription": { + "text": "Java Map.forEach method call should be replaced with Kotlin's forEach" + }, + "fullDescription": { + "text": "Reports a Java Map.'forEach' method call that can be replaced with Kotlin's forEach. Example: 'fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}' The quick fix removes parentheses: 'fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}'", + "markdown": "Reports a Java Map.`forEach` method call that can be replaced with Kotlin's **forEach** .\n\n**Example:**\n\n\n fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n\nThe quick fix removes parentheses:\n\n\n fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantObjectTypeCheck", + "shortDescription": { + "text": "Non-idiomatic 'is' type check for an object" + }, + "fullDescription": { + "text": "Reports non-idiomatic 'is' type checks for an object. It's recommended to replace such checks with reference comparison. Example: 'object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }' After the quick-fix is applied: 'object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }'", + "markdown": "Reports non-idiomatic `is` type checks for an object.\n\nIt's recommended to replace such checks with reference comparison.\n\n**Example:**\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }\n\nAfter the quick-fix is applied:\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspendFunctionOnCoroutineScope", + "shortDescription": { + "text": "Ambiguous coroutineContext due to CoroutineScope receiver of suspend function" + }, + "fullDescription": { + "text": "Reports calls and accesses of 'CoroutineScope' extensions or members inside suspend functions with 'CoroutineScope' receiver. When a function is 'suspend' and has 'CoroutineScope' receiver, it has ambiguous access to 'CoroutineContext' via 'kotlin.coroutines.coroutineContext' and via 'CoroutineScope.coroutineContext', and two these contexts are different in general. To improve this situation, one can wrap suspicious call inside 'coroutineScope { ... }' or get rid of 'CoroutineScope' function receiver.", + "markdown": "Reports calls and accesses of `CoroutineScope` extensions or members inside suspend functions with `CoroutineScope` receiver.\n\nWhen a function is `suspend` and has `CoroutineScope` receiver,\nit has ambiguous access to `CoroutineContext` via `kotlin.coroutines.coroutineContext` and via `CoroutineScope.coroutineContext`,\nand two these contexts are different in general.\n\n\nTo improve this situation, one can wrap suspicious call inside `coroutineScope { ... }` or\nget rid of `CoroutineScope` function receiver." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentMavenStdlibVersion", + "shortDescription": { + "text": "Library and maven plugin versions are different" + }, + "fullDescription": { + "text": "Reports different Kotlin stdlib and compiler versions. Using different versions of the Kotlin compiler and the standard library can lead to unpredictable runtime problems and should be avoided.", + "markdown": "Reports different Kotlin stdlib and compiler versions.\n\nUsing different versions of the Kotlin compiler and the standard library can lead to unpredictable\nruntime problems and should be avoided." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ImplicitNullableNothingType", + "shortDescription": { + "text": "Implicit `Nothing?` type" + }, + "fullDescription": { + "text": "Reports variables and functions with the implicit Nothing? type. Example: 'fun foo() = null' The quick fix specifies the return type explicitly: 'fun foo(): Nothing? = null'", + "markdown": "Reports variables and functions with the implicit **Nothing?** type.\n\n**Example:**\n\n\n fun foo() = null\n\nThe quick fix specifies the return type explicitly:\n\n\n fun foo(): Nothing? = null\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceAssociateFunction", + "shortDescription": { + "text": "'associate' can be replaced with 'associateBy' or 'associateWith'" + }, + "fullDescription": { + "text": "Reports calls to 'associate()' and 'associateTo()' that can be replaced with 'associateBy()' or 'associateWith()'. Both functions accept a transformer function applied to elements of a given sequence or collection (as a receiver). The pairs are then used to build the resulting 'Map'. Given the transformer refers to 'it', the 'associate[To]()' call can be replaced with more performant 'associateBy()' or 'associateWith()'. Examples: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }' After the quick-fix is applied: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }'", + "markdown": "Reports calls to `associate()` and `associateTo()` that can be replaced with `associateBy()` or `associateWith()`.\n\n\nBoth functions accept a transformer function applied to elements of a given sequence or collection (as a receiver).\nThe pairs are then used to build the resulting `Map`.\n\n\nGiven the transformer refers to `it`, the `associate[To]()` call can be replaced with more performant `associateBy()`\nor `associateWith()`.\n\n**Examples:**\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }\n\nAfter the quick-fix is applied:\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObsoleteExperimentalCoroutines", + "shortDescription": { + "text": "Experimental coroutines usages are deprecated since 1.3" + }, + "fullDescription": { + "text": "Reports code that uses experimental coroutines. Such usages are incompatible with Kotlin 1.3+ and should be updated.", + "markdown": "Reports code that uses experimental coroutines.\n\nSuch usages are incompatible with Kotlin 1.3+ and should be updated." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LiftReturnOrAssignment", + "shortDescription": { + "text": "Return or assignment can be lifted out" + }, + "fullDescription": { + "text": "Reports 'if', 'when', and 'try' statements that can be converted to expressions by lifting the 'return' statement or an assignment out. Example: 'fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }' After the quick-fix is applied: 'fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }'", + "markdown": "Reports `if`, `when`, and `try` statements that can be converted to expressions by lifting the `return` statement or an assignment out.\n\n**Example:**\n\n\n fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyWhenWithBooleanConstantCondition", + "shortDescription": { + "text": "Simplifiable 'when'" + }, + "fullDescription": { + "text": "Reports 'when' expressions with the constant 'true' or 'false' branches. Simplify \"when\" quick-fix can be used to amend the code automatically. Examples: 'fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }'", + "markdown": "Reports `when` expressions with the constant `true` or `false` branches.\n\n**Simplify \"when\"** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinConstantConditions", + "shortDescription": { + "text": "Constant conditions" + }, + "fullDescription": { + "text": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable 'when' branches and some expressions that are statically known to fail always. Examples: 'fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n}\nfun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n}' New in 2021.3", + "markdown": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable `when` branches and some expressions that are statically known to fail always.\n\nExamples:\n\n\n fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n }\n fun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n }\n\nNew in 2021.3" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ForEachParameterNotUsed", + "shortDescription": { + "text": "Iterated elements are not used in forEach" + }, + "fullDescription": { + "text": "Reports 'forEach' loops that do not use iterable values. Example: 'listOf(1, 2, 3).forEach { }' The quick fix introduces anonymous parameter in the 'forEach' section: 'listOf(1, 2, 3).forEach { _ -> }'", + "markdown": "Reports `forEach` loops that do not use iterable values.\n\n**Example:**\n\n\n listOf(1, 2, 3).forEach { }\n\nThe quick fix introduces anonymous parameter in the `forEach` section:\n\n\n listOf(1, 2, 3).forEach { _ -> }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LeakingThis", + "shortDescription": { + "text": "Leaking 'this' in constructor" + }, + "fullDescription": { + "text": "Reports unsafe operations with 'this' during object construction including: Accessing a non-final property during class initialization: from a constructor or property initialization Calling a non-final function during class initialization Using 'this' as a function argument in a constructor of a non-final class If other classes inherit from the given class, they may not be fully initialized at the moment when an unsafe operation is carried out. Example: 'abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }'", + "markdown": "Reports unsafe operations with `this` during object construction including:\n\n* Accessing a non-final property during class initialization: from a constructor or property initialization\n* Calling a non-final function during class initialization\n* Using `this` as a function argument in a constructor of a non-final class\n\n\nIf other classes inherit from the given class,\nthey may not be fully initialized at the moment when an unsafe operation is carried out.\n\n**Example:**\n\n\n abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AddVarianceModifier", + "shortDescription": { + "text": "Type parameter can have 'in' or 'out' variance" + }, + "fullDescription": { + "text": "Reports type parameters that can have 'in' or 'out' variance. Using 'in' and 'out' variance provides more precise type inference in Kotlin and clearer code semantics. Example: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }' A quick-fix adds the matching variance modifier: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }'", + "markdown": "Reports type parameters that can have `in` or `out` variance.\n\nUsing `in` and `out` variance provides more precise type inference in Kotlin and clearer code semantics.\n\n**Example:**\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }\n\nA quick-fix adds the matching variance modifier:\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveForLoopIndices", + "shortDescription": { + "text": "Unused loop index" + }, + "fullDescription": { + "text": "Reports 'for' loops iterating over a collection using the 'withIndex()' function and not using the index variable. Use the \"Remove indices in 'for' loop\" quick-fix to clean up the code. Examples: 'fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }' After the quick-fix is applied: 'fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }'", + "markdown": "Reports `for` loops iterating over a collection using the `withIndex()` function and not using the index variable.\n\nUse the \"Remove indices in 'for' loop\" quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSuspendModifier", + "shortDescription": { + "text": "Redundant 'suspend' modifier" + }, + "fullDescription": { + "text": "Reports 'suspend' modifier as redundant if no other suspending functions are called inside.", + "markdown": "Reports `suspend` modifier as redundant if no other suspending functions are called inside." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousAsDynamic", + "shortDescription": { + "text": "Suspicious 'asDynamic' member invocation" + }, + "fullDescription": { + "text": "Reports usages of 'asDynamic' function on a receiver of dynamic type. 'asDynamic' function has no effect for expressions of dynamic type. 'asDynamic' function on a receiver of dynamic type can lead to runtime problems because 'asDynamic' will be executed in JavaScript environment, and such function may not be present at runtime. The intended way is to use this function on usual Kotlin type. Remove \"asDynamic\" invocation quick-fix can be used to amend the code automatically. Example: 'fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }'", + "markdown": "Reports usages of `asDynamic` function on a receiver of dynamic type.\n\n`asDynamic` function has no effect for expressions of dynamic type.\n\n`asDynamic` function on a receiver of dynamic type can lead to runtime problems because `asDynamic`\nwill be executed in JavaScript environment, and such function may not be present at runtime.\nThe intended way is to use this function on usual Kotlin type.\n\n**Remove \"asDynamic\" invocation** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FromClosedRangeMigration", + "shortDescription": { + "text": "MIN_VALUE step in fromClosedRange() since 1.3" + }, + "fullDescription": { + "text": "Reports 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. It is prohibited to call 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. All such calls should be checked during migration to Kotlin 1.3+. Example: 'IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)' To fix the problem change the step of the progression.", + "markdown": "Reports `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with `MIN_VALUE` step.\n\n\nIt is prohibited to call `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with\n`MIN_VALUE` step. All such calls should be checked during migration to Kotlin 1.3+.\n\n**Example:**\n\n\n IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)\n\nTo fix the problem change the step of the progression." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantBackticks", + "shortDescription": { + "text": "Redundant backticks" + }, + "fullDescription": { + "text": "Reports redundant backticks in references. Some of the Kotlin keywords are valid identifiers in Java, for example: 'in', 'object', 'is'. If a Java library uses a Kotlin keyword for a method, you can still call the method escaping it with the backtick character ('`'), for example, 'foo.`is`(bar)'. Sometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is paired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code. Examples: 'fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks'", + "markdown": "Reports redundant backticks in references.\n\n\nSome of the Kotlin keywords are valid identifiers in Java, for example: `in`, `object`, `is`.\nIf a Java library uses a Kotlin keyword for a method, you can still call the method escaping it\nwith the backtick character (`````), for example, ``foo.`is`(bar)``.\nSometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is\npaired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code.\n\n**Examples:**\n\n\n fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyNestedEachInScopeFunction", + "shortDescription": { + "text": "Scope function with nested forEach can be simplified" + }, + "fullDescription": { + "text": "Reports 'forEach' functions in the scope functions such as 'also' or 'apply' that can be simplified. Convert forEach call to onEach quick-fix can be used to amend the code automatically. Examples: 'fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }' After the quick-fix is applied: 'fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }'", + "markdown": "Reports `forEach` functions in the scope functions such as `also` or `apply` that can be simplified.\n\n**Convert forEach call to onEach** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnsafeCastFromDynamic", + "shortDescription": { + "text": "Implicit (unsafe) cast from dynamic type" + }, + "fullDescription": { + "text": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type.", + "markdown": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PublicApiImplicitType", + "shortDescription": { + "text": "Public API declaration with implicit return type" + }, + "fullDescription": { + "text": "Reports 'public' and 'protected' functions and properties that have an implicit return type. For API stability reasons, it's recommended to specify such types explicitly. Example: 'fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()' After the quick-fix is applied: 'fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()'", + "markdown": "Reports `public` and `protected` functions and properties that have an implicit return type.\nFor API stability reasons, it's recommended to specify such types explicitly.\n\n**Example:**\n\n\n fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n\nAfter the quick-fix is applied:\n\n\n fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceMapIndexedWithListGenerator", + "shortDescription": { + "text": "Replace 'mapIndexed' with List generator" + }, + "fullDescription": { + "text": "Reports a 'mapIndexed' call that can be replaced by 'List' generator. Example: 'val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }' After the quick-fix is applied: 'val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }'", + "markdown": "Reports a `mapIndexed` call that can be replaced by `List` generator.\n\n**Example:**\n\n\n val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }\n\nAfter the quick-fix is applied:\n\n\n val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ControlFlowWithEmptyBody", + "shortDescription": { + "text": "Control flow with empty body" + }, + "fullDescription": { + "text": "Reports 'if', 'while', 'do' or 'for' statements with empty bodies. While occasionally intended, this construction is confusing and often the result of a typo. A quick-fix removes a statement. Example: 'if (a > b) {}'", + "markdown": "Reports `if`, `while`, `do` or `for` statements with empty bodies.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo.\n\nA quick-fix removes a statement.\n\n**Example:**\n\n\n if (a > b) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LoopToCallChain", + "shortDescription": { + "text": "Loop can be replaced with stdlib operations" + }, + "fullDescription": { + "text": "Reports 'for' loops that can be replaced with a sequence of stdlib operations (like 'map', 'filter', and so on). Example: 'fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n}' After the quick-fix is applied: 'fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n}'", + "markdown": "Reports `for` loops that can be replaced with a sequence of stdlib operations (like `map`, `filter`, and so on).\n\n**Example:**\n\n\n fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyClassBody", + "shortDescription": { + "text": "Replace empty class body" + }, + "fullDescription": { + "text": "Reports declarations of classes and objects with an empty body. Use the 'Remove redundant empty class body' quick-fix to clean up the code. Examples: 'class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }' After the quick fix is applied: 'class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }'", + "markdown": "Reports declarations of classes and objects with an empty body.\n\nUse the 'Remove redundant empty class body' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }\n\nAfter the quick fix is applied:\n\n\n class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBeParameter", + "shortDescription": { + "text": "Constructor parameter is never used as a property" + }, + "fullDescription": { + "text": "Reports primary constructor parameters that can have 'val' or 'var' removed. Class properties declared in the constructor increase memory consumption. If the parameter value is only used in the constructor, you can omit them. Note that the referenced object might be garbage-collected earlier. Example: 'class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }' A quick-fix removes the extra 'val' or 'var' keyword: 'class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }'", + "markdown": "Reports primary constructor parameters that can have `val` or `var` removed.\n\n\nClass properties declared in the constructor increase memory consumption.\nIf the parameter value is only used in the constructor, you can omit them.\n\nNote that the referenced object might be garbage-collected earlier.\n\n**Example:**\n\n\n class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n\nA quick-fix removes the extra `val` or `var` keyword:\n\n\n class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantReturnLabel", + "shortDescription": { + "text": "Redundant 'return' label" + }, + "fullDescription": { + "text": "Reports redundant return labels outside of lambda expressions. Example: 'fun test() {\n return@test\n }' After the quick-fix is applied: 'fun test() {\n return\n }'", + "markdown": "Reports redundant return labels outside of lambda expressions.\n\n**Example:**\n\n\n fun test() {\n return@test\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n return\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PackageName", + "shortDescription": { + "text": "Package naming convention" + }, + "fullDescription": { + "text": "Reports package names that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: names of packages are always lowercase and should not contain underscores. Example: 'org.example.project' Using multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case Example: 'org.example.myProject'", + "markdown": "Reports package names that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): names of packages are always lowercase and should not contain underscores.\n\n**Example:**\n`org.example.project`\n\nUsing multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case\n\n**Example:**\n`org.example.myProject`" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitUseSiteTargetAnnotationsOnSuperTypesMigration", + "shortDescription": { + "text": "Meaningless annotations targets on superclass" + }, + "fullDescription": { + "text": "Reports meaningless annotation targets on superclasses since Kotlin 1.4. Annotation targets such as '@get:' are meaningless on superclasses and are prohibited. Example: 'interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo' After the quick-fix is applied: 'interface Foo\n\n annotation class Ann\n\n class E : Foo' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports meaningless annotation targets on superclasses since Kotlin 1.4.\n\nAnnotation targets such as `@get:` are meaningless on superclasses and are prohibited.\n\n**Example:**\n\n\n interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo\n\nAfter the quick-fix is applied:\n\n\n interface Foo\n\n annotation class Ann\n\n class E : Foo\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithEnumMap", + "shortDescription": { + "text": "'HashMap' can be replaced with 'EnumMap'" + }, + "fullDescription": { + "text": "Reports 'hashMapOf' function or 'HashMap' constructor calls that can be replaced with an 'EnumMap' constructor call. Using 'EnumMap' constructor makes your code simpler. The quick-fix replaces the function call with the 'EnumMap' constructor call. Example: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()' After the quick-fix is applied: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)'", + "markdown": "Reports `hashMapOf` function or `HashMap` constructor calls that can be replaced with an `EnumMap` constructor call.\n\nUsing `EnumMap` constructor makes your code simpler.\n\nThe quick-fix replaces the function call with the `EnumMap` constructor call.\n\n**Example:**\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()\n\nAfter the quick-fix is applied:\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousCollectionReassignment", + "shortDescription": { + "text": "Augmented assignment creates a new collection under the hood" + }, + "fullDescription": { + "text": "Reports augmented assignment ('+=') expressions on read-only 'Collection'. Augment assignment ('+=') expression on read-only 'Collection' doesn't modify the target collection, it creates a new one under the hood which can be misleading and lead to performance issues. Change type to mutable quick-fix can be used to amend the code automatically. Example: 'fun test() {\n var list = listOf(0)\n list += 42 // new list is created, variable 'list' still contains only '0'\n }' After the quick-fix is applied: 'fun test() {\n val list = mutableListOf(0)\n list += 42\n }'", + "markdown": "Reports augmented assignment (`+=`) expressions on read-only `Collection`.\n\nAugment assignment (`+=`) expression on read-only `Collection` doesn't modify the target collection,\nit creates a new one under the hood which can be misleading and lead to performance issues.\n\n**Change type to mutable** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test() {\n var list = listOf(0)\n list += 42 // new list is created, variable 'list' still contains only '0'\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n val list = mutableListOf(0)\n list += 42\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantNotNullExtensionReceiverOfInline", + "shortDescription": { + "text": "'inline fun' extension receiver can be explicitly nullable until Kotlin 1.2" + }, + "fullDescription": { + "text": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). Thus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's recommended to make such functions to have nullable receiver. Example: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' After the quick-fix is applied: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", + "markdown": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nThus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's\nrecommended to make such functions to have nullable receiver.\n\n**Example:**\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantElvisReturnNull", + "shortDescription": { + "text": "Redundant '?: return null'" + }, + "fullDescription": { + "text": "Reports redundant '?: return null' Example: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }' After the quick-fix is applied: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }'", + "markdown": "Reports redundant `?: return null`\n\n**Example:**\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PrivatePropertyName", + "shortDescription": { + "text": "Private property naming convention" + }, + "fullDescription": { + "text": "Reports private property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, private property names should start with a lowercase letter and use camel case. Optionally, underscore prefix is allowed but only for private properties. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val _My_Cool_Property = \"\"' A quick-fix renames the class according to the Kotlin naming conventions: 'val _myCoolProperty = \"\"'", + "markdown": "Reports private property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nprivate property names should start with a lowercase letter and use camel case.\nOptionally, underscore prefix is allowed but only for **private** properties.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val _My_Cool_Property = \"\"\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val _myCoolProperty = \"\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObsoleteKotlinJsPackages", + "shortDescription": { + "text": "'kotlin.browser' and 'kotlin.dom' packages are deprecated since 1.4" + }, + "fullDescription": { + "text": "Reports usages of 'kotlin.dom' and 'kotlin.browser' packages. These packages were moved to 'kotlinx.dom' and 'kotlinx.browser' respectively in Kotlin 1.4+.", + "markdown": "Reports usages of `kotlin.dom` and `kotlin.browser` packages.\n\nThese packages were moved to `kotlinx.dom` and `kotlinx.browser`\nrespectively in Kotlin 1.4+." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CascadeIf", + "shortDescription": { + "text": "Cascade if can be replaced with when" + }, + "fullDescription": { + "text": "Reports 'if' statements with three or more branches that can be replaced with the 'when' expression. Example: 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }' A quick-fix converts the 'if' expression to 'when': 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }'", + "markdown": "Reports `if` statements with three or more branches that can be replaced with the `when` expression.\n\n**Example:**\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n\nA quick-fix converts the `if` expression to `when`:\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EmptyRange", + "shortDescription": { + "text": "Range with start greater than endInclusive is empty" + }, + "fullDescription": { + "text": "Reports ranges that are empty because the 'start' value is greater than the 'endInclusive' value. Example: 'val range = 2..1' The quick-fix changes the '..' operator to 'downTo': 'val range = 2 downTo 1'", + "markdown": "Reports ranges that are empty because the `start` value is greater than the `endInclusive` value.\n\n**Example:**\n\n\n val range = 2..1\n\nThe quick-fix changes the `..` operator to `downTo`:\n\n\n val range = 2 downTo 1\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OptionalExpectation", + "shortDescription": { + "text": "Optionally expected annotation has no actual annotation" + }, + "fullDescription": { + "text": "Reports optionally expected annotations without actual annotation in some platform modules. Example: '// common code\n@OptionalExpectation\nexpect annotation class JvmName(val name: String)\n\n@JvmName(name = \"JvmFoo\")\nfun foo() { }\n\n// jvm code\nactual annotation class JvmName(val name: String)' The inspection also reports cases when 'actual annotation class JvmName' is omitted for non-JVM platforms (for example, Native).", + "markdown": "Reports optionally expected annotations without actual annotation in some platform modules.\n\n**Example:**\n\n // common code\n @OptionalExpectation\n expect annotation class JvmName(val name: String)\n\n @JvmName(name = \"JvmFoo\")\n fun foo() { }\n\n // jvm code\n actual annotation class JvmName(val name: String)\n\nThe inspection also reports cases when `actual annotation class JvmName` is omitted for non-JVM platforms (for example, Native)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DestructuringWrongName", + "shortDescription": { + "text": "Variable in destructuring declaration uses name of a wrong data class property" + }, + "fullDescription": { + "text": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class. Example: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }' The quick-fix changes variable's name to match the name of the corresponding class field: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }'", + "markdown": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class.\n\n**Example:**\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }\n\nThe quick-fix changes variable's name to match the name of the corresponding class field:\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IfThenToSafeAccess", + "shortDescription": { + "text": "If-Then foldable to '?.'" + }, + "fullDescription": { + "text": "Reports 'if-then' expressions that can be folded into safe-access ('?.') expressions. Example: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }' The quick fix converts the 'if-then' expression into a safe-access ('?.') expression: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }'", + "markdown": "Reports `if-then` expressions that can be folded into safe-access (`?.`) expressions.\n\n**Example:**\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }\n\nThe quick fix converts the `if-then` expression into a safe-access (`?.`) expression:\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RestrictReturnStatementTargetMigration", + "shortDescription": { + "text": "Target label does not denote a function since 1.4" + }, + "fullDescription": { + "text": "Reports labels that don't points to a functions. It's forbidden to declare a target label that does not denote a function. The quick-fix removes the label. Example: 'fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }' After the quick-fix is applied: 'fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }' This inspection only reports if the language level of the project or module is 1.4 or higher.", + "markdown": "Reports labels that don't points to a functions.\n\nIt's forbidden to declare a target label that does not denote a function.\n\nThe quick-fix removes the label.\n\n**Example:**\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }\n\nAfter the quick-fix is applied:\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }\n\nThis inspection only reports if the language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MigrateDiagnosticSuppression", + "shortDescription": { + "text": "Diagnostic name should be replaced" + }, + "fullDescription": { + "text": "Reports suppressions with old diagnostic names, for example '@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")'. Some of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant. Example: '@Suppress(\"HEADER_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}' After the quick-fix is applied: '@Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}'", + "markdown": "Reports suppressions with old diagnostic names, for example `@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")`.\n\n\nSome of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant.\n\n**Example:**\n\n\n @Suppress(\"HEADER_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n\nAfter the quick-fix is applied:\n\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeferredResultUnused", + "shortDescription": { + "text": "'@Deferred' result is unused" + }, + "fullDescription": { + "text": "Reports function calls with the 'Deferred' result type if the return value is not used. If the 'Deferred' return value is not used, the call site would not wait to complete this function. Example: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }' A quick-fix provides a variable with the 'Deferred' initializer: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }'", + "markdown": "Reports function calls with the `Deferred` result type if the return value is not used.\n\nIf the `Deferred` return value is not used, the call site would not wait to complete this function.\n\n**Example:**\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }\n\nA quick-fix provides a variable with the `Deferred` initializer:\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SelfReferenceConstructorParameter", + "shortDescription": { + "text": "Constructor can never be complete" + }, + "fullDescription": { + "text": "Reports constructors with a non-null self-reference parameter. Such constructors never instantiate a class. The quick-fix converts the parameter type to nullable. Example: 'class SelfRef(val ref: SelfRef)' After the quick-fix is applied: 'class SelfRef(val ref: SelfRef?)'", + "markdown": "Reports constructors with a non-null self-reference parameter.\n\nSuch constructors never instantiate a class.\n\nThe quick-fix converts the parameter type to nullable.\n\n**Example:**\n\n\n class SelfRef(val ref: SelfRef)\n\nAfter the quick-fix is applied:\n\n\n class SelfRef(val ref: SelfRef?)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MainFunctionReturnUnit", + "shortDescription": { + "text": "Entry point function should return Unit" + }, + "fullDescription": { + "text": "Reports entry point functions with an incorrect return type (should be 'Unit'). Example: 'fun main() = \"Hello world!\"'", + "markdown": "Reports entry point functions with an incorrect return type (should be `Unit`).\n\n**Example:**\n`fun main() = \"Hello world!\"`" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousCallableReferenceInLambda", + "shortDescription": { + "text": "Suspicious callable reference used as lambda result" + }, + "fullDescription": { + "text": "Reports lambda expressions with one callable reference. It is a common error to replace a lambda with a callable reference without changing curly braces to parentheses. Example: 'listOf(1,2,3).map { it::toString }' After the quick-fix is applied: 'listOf(1,2,3).map(Int::toString)'", + "markdown": "Reports lambda expressions with one callable reference.\n\nIt is a common error to replace a lambda with a callable reference without changing curly braces to parentheses.\n\n**Example:**\n\n listOf(1,2,3).map { it::toString }\n\nAfter the quick-fix is applied:\n\n listOf(1,2,3).map(Int::toString)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertSecondaryConstructorToPrimary", + "shortDescription": { + "text": "Convert to primary constructor" + }, + "fullDescription": { + "text": "Reports a secondary constructor that can be replaced with a more concise primary constructor. Example: 'class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }' A quick-fix converts code automatically: 'class User(val name: String) {\n }'", + "markdown": "Reports a secondary constructor that can be replaced with a more concise primary constructor.\n\n**Example:**\n\n\n class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }\n\nA quick-fix converts code automatically:\n\n\n class User(val name: String) {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceGetOrSet", + "shortDescription": { + "text": "Explicit 'get' or 'set' call" + }, + "fullDescription": { + "text": "Reports explicit calls to 'get' or 'set' functions which can be replaced by an indexing operator '[]'. Kotlin allows custom implementations for the predefined set of operators on types. To overload an operator, you can mark the corresponding function with the 'operator' modifier: 'operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}' The functions above correspond to the indexing operator. Example: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }' After the quick-fix is applied: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }'", + "markdown": "Reports explicit calls to `get` or `set` functions which can be replaced by an indexing operator `[]`.\n\n\nKotlin allows custom implementations for the predefined set of operators on types.\nTo overload an operator, you can mark the corresponding function with the `operator` modifier:\n\n\n operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}\n \nThe functions above correspond to the indexing operator.\n\n**Example:**\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }\n\nAfter the quick-fix is applied:\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitRepeatedUseSiteTargetAnnotationsMigration", + "shortDescription": { + "text": "Repeated annotation which is not marked as '@Repeatable'" + }, + "fullDescription": { + "text": "Reports the repeated use of a non-'@Repeatable' annotation on property accessors. As a result of using non-'@Repeatable' annotation multiple times, both annotation usages will appear in the bytecode leading to an ambiguity in reflection calls. Since Kotlin 1.4 it's mandatory to either mark annotation as '@Repeatable' or not repeat the annotation, otherwise it will lead to compilation error. Example: 'annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports the repeated use of a non-`@Repeatable` annotation on property accessors.\n\n\nAs a result of using non-`@Repeatable` annotation multiple times, both annotation usages\nwill appear in the bytecode leading to an ambiguity in reflection calls.\n\n\nSince Kotlin 1.4 it's mandatory to either mark annotation as `@Repeatable` or not\nrepeat the annotation, otherwise it will lead to compilation error.\n\n**Example:**\n\n\n annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Destructure", + "shortDescription": { + "text": "Use destructuring declaration" + }, + "fullDescription": { + "text": "Reports declarations that can be destructured. Example: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }' The quick-fix destructures the declaration and introduces new variables with names from the corresponding class: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }'", + "markdown": "Reports declarations that can be destructured.\n\n**Example:**\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }\n\nThe quick-fix destructures the declaration and introduces new variables with names from the corresponding class:\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedReceiverParameter", + "shortDescription": { + "text": "Unused receiver parameter" + }, + "fullDescription": { + "text": "Reports receiver parameter of extension functions and properties that is not used. Remove redundant receiver parameter can be used to amend the code automatically.", + "markdown": "Reports receiver parameter of extension functions and properties that is not used.\n\n**Remove redundant receiver parameter** can be used to amend the code automatically." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertTryFinallyToUseCall", + "shortDescription": { + "text": "Convert try / finally to use() call" + }, + "fullDescription": { + "text": "Reports a 'try-finally' block with 'resource.close()' in 'finally' which can be converted to a 'resource.use()' call. 'use()' is easier to read and less error-prone as there is no need in explicit 'close()' call. Example: 'fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }' After the quick-fix applied: 'fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }'", + "markdown": "Reports a `try-finally` block with `resource.close()` in `finally` which can be converted to a `resource.use()` call.\n\n`use()` is easier to read and less error-prone as there is no need in explicit `close()` call.\n\n**Example:**\n\n\n fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }\n\nAfter the quick-fix applied:\n\n\n fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinRedundantOverride", + "shortDescription": { + "text": "Redundant overriding method" + }, + "fullDescription": { + "text": "Reports redundant overriding declarations. An override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility. Example: 'open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }' After the quick-fix is applied: 'class Bar : Foo() {\n }'", + "markdown": "Reports redundant overriding declarations.\n\n\nAn override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility.\n\n**Example:**\n\n\n open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }\n\nAfter the quick-fix is applied:\n\n\n class Bar : Foo() {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceArrayOfWithLiteral", + "shortDescription": { + "text": "'arrayOf' call can be replaced with array literal [...]" + }, + "fullDescription": { + "text": "Reports 'arrayOf' calls that can be replaced with array literals '[...]'. Examples: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass' After the quick-fix is applied: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass'", + "markdown": "Reports `arrayOf` calls that can be replaced with array literals `[...]`.\n\n**Examples:**\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass\n\nAfter the quick-fix is applied:\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceToWithInfixForm", + "shortDescription": { + "text": "'to' call should be replaced with infix form" + }, + "fullDescription": { + "text": "Reports 'to' function calls that can be replaced with the infix form. Using the infix form makes your code simpler. The quick-fix replaces 'to' with the infix form. Example: 'fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) {\n val pair = a to b\n }'", + "markdown": "Reports `to` function calls that can be replaced with the infix form.\n\nUsing the infix form makes your code simpler.\n\nThe quick-fix replaces `to` with the infix form.\n\n**Example:**\n\n\n fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int, b: Int) {\n val pair = a to b\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstPropertyName", + "shortDescription": { + "text": "Const property naming convention" + }, + "fullDescription": { + "text": "Reports 'const' property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, 'const' properties should use uppercase underscore-separated names. Example: 'const val Planck: Double = 6.62607015E-34' A quick-fix renames the property: 'const val PLANCK: Double = 6.62607015E-34'", + "markdown": "Reports `const` property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#property-names),\n`const` properties should use uppercase underscore-separated names.\n\n**Example:**\n\n\n const val Planck: Double = 6.62607015E-34\n\nA quick-fix renames the property:\n\n\n const val PLANCK: Double = 6.62607015E-34\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantNullableReturnType", + "shortDescription": { + "text": "Redundant nullable return type" + }, + "fullDescription": { + "text": "Reports functions and variables with nullable return type which never return or become 'null'. Example: 'fun greeting(user: String): String? = \"Hello, $user!\"' After the quick-fix is applied: 'fun greeting(user: String): String = \"Hello, $user!\"'", + "markdown": "Reports functions and variables with nullable return type which never return or become `null`.\n\n**Example:**\n\n\n fun greeting(user: String): String? = \"Hello, $user!\"\n\nAfter the quick-fix is applied:\n\n\n fun greeting(user: String): String = \"Hello, $user!\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UselessCallOnNotNull", + "shortDescription": { + "text": "Useless call on not-null type" + }, + "fullDescription": { + "text": "Reports calls on not-null receiver that make sense only for nullable receiver. Several functions from the standard library such as 'orEmpty()' or 'isNullOrEmpty' have sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same. Remove redundant call and Change call to … quick-fixes can be used to amend the code automatically. Examples: 'fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }'", + "markdown": "Reports calls on not-null receiver that make sense only for nullable receiver.\n\nSeveral functions from the standard library such as `orEmpty()` or `isNullOrEmpty`\nhave sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same.\n\n**Remove redundant call** and **Change call to ...** quick-fixes can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EqualsOrHashCode", + "shortDescription": { + "text": "'equals()' and 'hashCode()' not paired" + }, + "fullDescription": { + "text": "Reports classes that override 'equals()' but do not override 'hashCode()', or vice versa. It also reports object declarations that override either 'equals()' or 'hashCode()'. This can lead to undesired behavior when a class is added to a 'Collection' Example: 'class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }' The quick-fix overrides 'equals()' or 'hashCode()' for classes and deletes these methods for objects: 'class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }'", + "markdown": "Reports classes that override `equals()` but do not override `hashCode()`, or vice versa. It also reports object declarations that override either `equals()` or `hashCode()`.\n\nThis can lead to undesired behavior when a class is added to a `Collection`\n\n**Example:**\n\n\n class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }\n\nThe quick-fix overrides `equals()` or `hashCode()` for classes and deletes these methods for objects:\n\n\n class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + } + ] + }, + "invocations": [ + { + "exitCode": 0, + "toolExecutionNotifications": [], + "executionSuccessful": true + } + ], + "language": "en-US", + "results": [], + "automationDetails": { + "id": "project - 12/13/21, 3:48 PM", + "guid": "d0a57b70-6936-41ab-bf04-97c58449a43d" + }, + "newlineSequences": [ + "\r\n", + "\n" + ], + "properties": { + "coverage": { + "totalCoverage": 0, + "totalLines": 100, + "totalCoveredLines": 0, + "freshCoverage": 0, + "freshLines": 100, + "freshCoveredLines": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/common/__tests__/data/some.sarif.json b/common/__tests__/data/some.sarif.json new file mode 100644 index 00000000..35af98ad --- /dev/null +++ b/common/__tests__/data/some.sarif.json @@ -0,0 +1,8278 @@ +{ + "version": "2.1.0", + "runs": [ + { + "tool": { + "driver": { + "name": "QDJVM", + "fullName": "Qodana for JVM", + "version": "213.6433.60", + "rules": [], + "taxa": [], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + "extensions": [ + { + "name": "org.jetbrains.kotlin", + "version": "213-1.5.10-release-949-IJ6433", + "rules": [ + { + "id": "RedundantRunCatching", + "shortDescription": { + "text": "Redundant 'runCatching' call" + }, + "fullDescription": { + "text": "Reports 'runCatching' calls that are immediately followed by 'getOrThrow'. Such calls can be replaced with just 'run'. Example: 'fun foo() = runCatching { doSomething() }.getOrThrow()' After the quick-fix is applied: 'fun foo() = run { doSomething() }'", + "markdown": "Reports `runCatching` calls that are immediately followed by `getOrThrow`. Such calls can be replaced with just `run`.\n\n**Example:**\n\n\n fun foo() = runCatching { doSomething() }.getOrThrow()\n\nAfter the quick-fix is applied:\n\n\n fun foo() = run { doSomething() }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimpleRedundantLet", + "shortDescription": { + "text": "Redundant receiver-based 'let' call" + }, + "fullDescription": { + "text": "Reports redundant receiver-based 'let' calls. The quick-fix removes the redundant 'let' call. Example: 'fun test(s: String?): Int? = s?.let { it.length }' After the quick-fix is applied: 'fun test(s: String?): Int? = s?.length'", + "markdown": "Reports redundant receiver-based `let` calls.\n\nThe quick-fix removes the redundant `let` call.\n\n**Example:**\n\n\n fun test(s: String?): Int? = s?.let { it.length }\n\nAfter the quick-fix is applied:\n\n\n fun test(s: String?): Int? = s?.length\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveSingleExpressionStringTemplate", + "shortDescription": { + "text": "Redundant string template" + }, + "fullDescription": { + "text": "Reports single-expression string templates that can be safely removed. Example: 'val x = \"Hello\"\n val y = \"$x\"' After the quick-fix is applied: 'val x = \"Hello\"\n val y = x // <== Updated'", + "markdown": "Reports single-expression string templates that can be safely removed.\n\n**Example:**\n\n val x = \"Hello\"\n val y = \"$x\"\n\nAfter the quick-fix is applied:\n\n val x = \"Hello\"\n val y = x // <== Updated\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IncompleteDestructuring", + "shortDescription": { + "text": "Incomplete destructuring declaration" + }, + "fullDescription": { + "text": "Reports incomplete destructuring declaration. Example: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person' The quick fix completes destructuring declaration with new variables: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person'", + "markdown": "Reports incomplete destructuring declaration.\n\n**Example:**\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person\n\nThe quick fix completes destructuring declaration with new variables:\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ScopeFunctionConversion", + "shortDescription": { + "text": "Scope function can be converted to another one" + }, + "fullDescription": { + "text": "Reports scope functions ('let', 'run', 'apply', 'also') that can be converted between each other. Using corresponding functions makes your code simpler. The quick-fix replaces the scope function to another one. Example: 'val x = \"\".let {\n it.length\n }' After the quick-fix is applied: 'val x = \"\".run {\n length\n }'", + "markdown": "Reports scope functions (`let`, `run`, `apply`, `also`) that can be converted between each other.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the scope function to another one.\n\n**Example:**\n\n\n val x = \"\".let {\n it.length\n }\n\nAfter the quick-fix is applied:\n\n\n val x = \"\".run {\n length\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TrailingComma", + "shortDescription": { + "text": "Trailing comma recommendations" + }, + "fullDescription": { + "text": "Reports trailing commas that are not follow the recommended style guide.", + "markdown": "Reports trailing commas that are not follow the recommended [style guide](https://kotlinlang.org/docs/coding-conventions.html#trailing-commas)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FoldInitializerAndIfToElvis", + "shortDescription": { + "text": "If-Null return/break/... foldable to '?:'" + }, + "fullDescription": { + "text": "Reports an 'if' expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer. Example: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }' The quick-fix converts the 'if' expression with an initializer into an elvis expression: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }'", + "markdown": "Reports an `if` expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer.\n\n**Example:**\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }\n\nThe quick-fix converts the `if` expression with an initializer into an elvis expression:\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinInvalidBundleOrProperty", + "shortDescription": { + "text": "Invalid property key" + }, + "fullDescription": { + "text": "Reports unresolved references to '.properties' file keys and resource bundles in Kotlin files.", + "markdown": "Reports unresolved references to `.properties` file keys and resource bundles in Kotlin files." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UselessCallOnCollection", + "shortDescription": { + "text": "Useless call on collection type" + }, + "fullDescription": { + "text": "Reports 'filter…' calls from the standard library on already filtered collections. Several functions from the standard library such as 'filterNotNull()' or 'filterIsInstance' have sense only when they are called on receivers that have types distinct from the resulting one. Otherwise, such calls can be omitted as the result will be the same. Remove redundant call quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }'", + "markdown": "Reports `filter...` calls from the standard library on already filtered collections.\n\nSeveral functions from the standard library such as `filterNotNull()` or `filterIsInstance`\nhave sense only when they are called on receivers that have types distinct from the resulting one. Otherwise,\nsuch calls can be omitted as the result will be the same.\n\n**Remove redundant call** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantRequireNotNullCall", + "shortDescription": { + "text": "Redundant 'requireNotNull' or 'checkNotNull' call" + }, + "fullDescription": { + "text": "Reports redundant 'requireNotNull' or 'checkNotNull' call on non-nullable expressions. Example: 'fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }' After the quick-fix is applied: 'fun foo(i: Int) {\n ...\n }'", + "markdown": "Reports redundant `requireNotNull` or `checkNotNull` call on non-nullable expressions.\n\n**Example:**\n\n\n fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(i: Int) {\n ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObjectPropertyName", + "shortDescription": { + "text": "Object property naming convention" + }, + "fullDescription": { + "text": "Reports properties that do not follow the naming conventions. The following properties are reported: Top-level properties Properties in objects and companion objects You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with an uppercase letter, use camel case and no underscores. Example: '// top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }'", + "markdown": "Reports properties that do not follow the naming conventions.\n\nThe following properties are reported:\n\n* Top-level properties\n* Properties in objects and companion objects\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): it has to start with an uppercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n // top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PackageDirectoryMismatch", + "shortDescription": { + "text": "Package name does not match containing directory" + }, + "fullDescription": { + "text": "Reports 'package' directives that do not match the location of the file.", + "markdown": "Reports `package` directives that do not match the location of the file." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinCovariantEquals", + "shortDescription": { + "text": "Covariant 'equals()'" + }, + "fullDescription": { + "text": "Reports 'equals()' that takes an argument type other than 'Any?' if the class does not have another 'equals()' that takes 'Any?' as its argument type. Example: 'class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }' To fix the problem create 'equals()' method that takes an argument of type 'Any?'.", + "markdown": "Reports `equals()` that takes an argument type other than `Any?` if the class does not have another `equals()` that takes `Any?` as its argument type.\n\n**Example:**\n\n\n class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }\n\nTo fix the problem create `equals()` method that takes an argument of type `Any?`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSizeZeroCheckWithIsEmpty", + "shortDescription": { + "text": "Size zero check can be replaced with 'isEmpty()'" + }, + "fullDescription": { + "text": "Reports 'size == 0' checks on 'Collections/Array/String' that should be replaced with 'isEmpty()'. Using 'isEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }'", + "markdown": "Reports `size == 0` checks on `Collections/Array/String` that should be replaced with `isEmpty()`.\n\nUsing `isEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantEnumConstructorInvocation", + "shortDescription": { + "text": "Redundant enum constructor invocation" + }, + "fullDescription": { + "text": "Reports redundant constructor invocation on an enum entry. Example: 'enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }' After the quick-fix is applied: 'enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }'", + "markdown": "Reports redundant constructor invocation on an enum entry.\n\n**Example:**\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }\n\nAfter the quick-fix is applied:\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DirectUseOfResultType", + "shortDescription": { + "text": "Function returning Result directly" + }, + "fullDescription": { + "text": "Reports functions that use 'Result' as a return type. 'Result' should never be used as a return type. Throw an exception, use a nullable type, or use a domain-specific result class to indicate failure. Example: 'fun foo() = Result.success(true)'", + "markdown": "Reports functions that use `Result` as a return type.\n\n\n`Result` should never be used as a return type.\nThrow an exception, use a nullable type, or use a domain-specific result class to indicate failure.\n\n**Example:**\n\n\n fun foo() = Result.success(true)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FakeJvmFieldConstant", + "shortDescription": { + "text": "Kotlin non-const property used as Java constant" + }, + "fullDescription": { + "text": "Reports Kotlin properties that are not 'const' and used as Java annotation arguments. For example, a property with the '@JvmField' annotation has an initializer that can be evaluated at compile-time, and it has a primitive or 'String' type. Such properties have a 'ConstantValue' attribute in bytecode in Kotlin 1.1-1.2. This attribute allows javac to fold usages of the corresponding field and use that field in annotations. This can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code. This behavior is subject to change in Kotlin 1.3 (no 'ConstantValue' attribute any more). Example: Kotlin code in foo.kt file: 'annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"' Java code: 'public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }' To fix the problem replace the '@JvmField' annotation with the 'const' modifier on a relevant Kotlin property or inline it.", + "markdown": "Reports Kotlin properties that are not `const` and used as Java annotation arguments.\n\n\nFor example, a property with the `@JvmField` annotation has an initializer that can be evaluated at compile-time,\nand it has a primitive or `String` type.\n\n\nSuch properties have a `ConstantValue` attribute in bytecode in Kotlin 1.1-1.2.\nThis attribute allows javac to fold usages of the corresponding field and use that field in annotations.\nThis can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code.\nThis behavior is subject to change in Kotlin 1.3 (no `ConstantValue` attribute any more).\n\n**Example:**\n\nKotlin code in foo.kt file:\n\n\n annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"\n\nJava code:\n\n\n public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }\n\nTo fix the problem replace the `@JvmField` annotation with the `const` modifier on a relevant Kotlin property or inline it." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WhenWithOnlyElse", + "shortDescription": { + "text": "'when' has only 'else' branch and can be simplified" + }, + "fullDescription": { + "text": "Reports 'when' expressions with only an 'else' branch that can be simplified. Simplify expression quick-fix can be used to amend the code automatically. Example: 'fun redundant() {\n val x = when { // <== redundant, a quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }'", + "markdown": "Reports `when` expressions with only an `else` branch that can be simplified.\n\n**Simplify expression** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun redundant() {\n val x = when { // <== redundant, a quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Reformat", + "shortDescription": { + "text": "File is not formatted according to project settings" + }, + "fullDescription": { + "text": "Reports places that are not formatted according to the project settings. Use the 'Reformat Code' and 'Reformat File...' quick-fixes to format either the highlighted code block or the entire file accordingly.", + "markdown": "Reports places that are not formatted according to the project settings.\n\nUse the 'Reformat Code' and 'Reformat File...' quick-fixes to format either the highlighted code block\nor the entire file accordingly." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinTestJUnit", + "shortDescription": { + "text": "kotlin-test-junit could be used" + }, + "fullDescription": { + "text": "Reports usage of 'kotlin-test' and 'junit' dependency without 'kotlin-test-junit'. It is recommended to use 'kotlin-test-junit' dependency to work with Kotlin and JUnit.", + "markdown": "Reports usage of `kotlin-test` and `junit` dependency without `kotlin-test-junit`.\n\nIt is recommended to use `kotlin-test-junit` dependency to work with Kotlin and JUnit." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SafeCastWithReturn", + "shortDescription": { + "text": "Safe cast with 'return' should be replaced with 'if' type check" + }, + "fullDescription": { + "text": "Reports safe cast with 'return' that can be replaced with 'if' type check. Using corresponding functions makes your code simpler. The quick-fix replaces the safe cast with 'if' type check. Example: 'fun test(x: Any) {\n x as? String ?: return\n }' After the quick-fix is applied: 'fun test(x: Any) {\n if (x !is String) return\n }'", + "markdown": "Reports safe cast with `return` that can be replaced with `if` type check.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the safe cast with `if` type check.\n\n**Example:**\n\n\n fun test(x: Any) {\n x as? String ?: return\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(x: Any) {\n if (x !is String) return\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceAssertBooleanWithAssertEquality", + "shortDescription": { + "text": "Assert boolean could be replaced with assert equality" + }, + "fullDescription": { + "text": "Reports calls to 'assertTrue()' and 'assertFalse()' that can be replaced with assert equality functions. 'assertEquals()', 'assertSame()', and their negating counterparts (-Not-) provide more informative messages on failure. Example: 'assertTrue(a == b)' After the quick-fix is applied: 'assertEquals(a, b)'", + "markdown": "Reports calls to `assertTrue()` and `assertFalse()` that can be replaced with assert equality functions.\n\n\n`assertEquals()`, `assertSame()`, and their negating counterparts (-Not-) provide more informative messages on\nfailure.\n\n**Example:**\n\n assertTrue(a == b)\n\nAfter the quick-fix is applied:\n\n assertEquals(a, b)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceStringFormatWithLiteral", + "shortDescription": { + "text": "'String.format' call can be replaced with string templates" + }, + "fullDescription": { + "text": "Reports 'String.format' calls that can be replaced with string templates. Using string templates makes your code simpler. The quick-fix replaces the call with a string template. Example: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }' After the quick-fix is applied: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }'", + "markdown": "Reports `String.format` calls that can be replaced with string templates.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces the call with a string template.\n\n**Example:**\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceNotNullAssertionWithElvisReturn", + "shortDescription": { + "text": "Not-null assertion can be replaced with 'return'" + }, + "fullDescription": { + "text": "Reports not-null assertion ('!!') calls that can be replaced with the elvis operator and return ('?: return'). A not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of '!!' is good practice. The quick-fix replaces the not-null assertion with 'return' or 'return null'. Example: 'fun test(number: Int?) {\n val x = number!!\n }' After the quick-fix is applied: 'fun test(number: Int?) {\n val x = number ?: return\n }'", + "markdown": "Reports not-null assertion (`!!`) calls that can be replaced with the elvis operator and return (`?: return`).\n\nA not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of `!!` is good practice.\n\nThe quick-fix replaces the not-null assertion with `return` or `return null`.\n\n**Example:**\n\n\n fun test(number: Int?) {\n val x = number!!\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(number: Int?) {\n val x = number ?: return\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithSubstringBefore", + "shortDescription": { + "text": "'substring' call should be replaced with 'substringBefore'" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, s.indexOf(x))' that can be replaced with 's.substringBefore(x)'. Using 'substringBefore()' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringBefore'. Example: 'fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringBefore('x')\n }'", + "markdown": "Reports calls like `s.substring(0, s.indexOf(x))` that can be replaced with `s.substringBefore(x)`.\n\nUsing `substringBefore()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringBefore`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringBefore('x')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithOperatorAssignment", + "shortDescription": { + "text": "Assignment can be replaced with operator assignment" + }, + "fullDescription": { + "text": "Reports modifications of variables with a simple assignment (such as 'y = y + x') that can be replaced with an operator assignment. The quick-fix replaces the assignment with an assignment operator. Example: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }' After the quick-fix is applied: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }'", + "markdown": "Reports modifications of variables with a simple assignment (such as `y = y + x`) that can be replaced with an operator assignment.\n\nThe quick-fix replaces the assignment with an assignment operator.\n\n**Example:**\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedSymbol", + "shortDescription": { + "text": "Unused symbol" + }, + "fullDescription": { + "text": "Reports symbols that are not used or not reachable from entry points.", + "markdown": "Reports symbols that are not used or not reachable from entry points." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceCollectionCountWithSize", + "shortDescription": { + "text": "Collection count can be converted to size" + }, + "fullDescription": { + "text": "Reports calls to 'Collection.count()'. This function call can be replaced with '.size'. '.size' form ensures that the operation is O(1) and won't allocate extra objects, whereas 'count()' could be confused with 'Iterable.count()', which is O(n) and allocating. Example: 'fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }' After the quick-fix is applied: 'fun foo() {\n var list = listOf(1,2,3)\n list.size\n }'", + "markdown": "Reports calls to `Collection.count()`.\n\n\nThis function call can be replaced with `.size`.\n\n\n`.size` form ensures that the operation is O(1) and won't allocate extra objects, whereas\n`count()` could be confused with `Iterable.count()`, which is O(n) and allocating.\n\n\n**Example:**\n\n fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }\n\nAfter the quick-fix is applied:\n\n fun foo() {\n var list = listOf(1,2,3)\n list.size\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceArrayEqualityOpWithArraysEquals", + "shortDescription": { + "text": "Arrays comparison via '==' and '!='" + }, + "fullDescription": { + "text": "Reports usages of '==' or '!=' operator for arrays that should be replaced with 'contentEquals()'. The '==' and '!='operators compare array references instead of their content. Examples: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }' After the quick-fix is applied: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }'", + "markdown": "Reports usages of `==` or `!=` operator for arrays that should be replaced with `contentEquals()`.\n\n\nThe `==` and `!=`operators compare array references instead of their content.\n\n**Examples:**\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }\n\nAfter the quick-fix is applied:\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedGradleDependency", + "shortDescription": { + "text": "Deprecated library is used in Gradle" + }, + "fullDescription": { + "text": "Reports deprecated dependencies in Gradle build scripts. Example: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }' After the quick-fix applied: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }'", + "markdown": "Reports deprecated dependencies in Gradle build scripts.\n\n**Example:**\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }\n\nAfter the quick-fix applied:\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertReferenceToLambda", + "shortDescription": { + "text": "Can be replaced with lambda" + }, + "fullDescription": { + "text": "Reports a function reference expression that can be replaced with a function literal (lambda). Sometimes, passing a lambda looks more straightforward and more consistent with the rest of the code. Also, the fix might be handy if you need to replace a simple call with something more complex. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }'", + "markdown": "Reports a function reference expression that can be replaced with a function literal (lambda).\n\n\nSometimes, passing a lambda looks more straightforward and more consistent with the rest of the code.\nAlso, the fix might be handy if you need to replace a simple call with something more complex.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnlabeledReturnInsideLambda", + "shortDescription": { + "text": "Unlabeled return inside lambda" + }, + "fullDescription": { + "text": "Reports unlabeled 'return' expressions inside inline lambda. Such expressions can be confusing because it might be unclear which scope belongs to 'return'. Change to return@… quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }'", + "markdown": "Reports unlabeled `return` expressions inside inline lambda.\n\nSuch expressions can be confusing because it might be unclear which scope belongs to `return`.\n\n**Change to return@...** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LateinitVarOverridesLateinitVar", + "shortDescription": { + "text": "lateinit var property overrides lateinit var property" + }, + "fullDescription": { + "text": "Reports 'lateinit var' properties that override another 'lateinit var' property. A subclass instance will have two fields for the single property, and the one from the superclass will remain effectively unused. Example: open class BaseClass { open lateinit var name: String } class RealClass : BaseClass() { override lateinit var name: String } ''", + "markdown": "Reports `lateinit var` properties that override another `lateinit var` property.\n\n\nA subclass instance will have two fields for the single property, and the one from the superclass will remain effectively unused.\n\n**Example:**\nopen class BaseClass { open lateinit var name: String } class RealClass : BaseClass() { override lateinit var name: String }\n\n```\n\n```" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentKotlinGradleVersion", + "shortDescription": { + "text": "Kotlin Gradle and IDE plugins versions are different" + }, + "fullDescription": { + "text": "Reports that different IDE and Gradle plugin versions are used. This can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }' To fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin.", + "markdown": "Reports that different IDE and Gradle plugin versions are used.\n\nThis can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }\n\nTo fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinEqualsBetweenInconvertibleTypes", + "shortDescription": { + "text": "'equals()' between objects of inconvertible types" + }, + "fullDescription": { + "text": "Reports calls to 'equals()' where the receiver and the argument are of incompatible primitive, enum, or string types. While such a call might theoretically be useful, most likely it represents a bug. Example: '5.equals(\"\");'", + "markdown": "Reports calls to `equals()` where the receiver and the argument are of incompatible primitive, enum, or string types.\n\nWhile such a call might theoretically be useful, most likely it represents a bug.\n\n**Example:**\n\n 5.equals(\"\");\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JoinDeclarationAndAssignment", + "shortDescription": { + "text": "Join declaration and assignment" + }, + "fullDescription": { + "text": "Reports property declarations that can be joined with the following assignment. Example: 'val x: String\n x = System.getProperty(\"\")' The quick fix joins the declaration with the assignment: 'val x = System.getProperty(\"\")'", + "markdown": "Reports property declarations that can be joined with the following assignment.\n\n**Example:**\n\n\n val x: String\n x = System.getProperty(\"\")\n\nThe quick fix joins the declaration with the assignment:\n\n\n val x = System.getProperty(\"\")\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HasPlatformType", + "shortDescription": { + "text": "Function or property has platform type" + }, + "fullDescription": { + "text": "Reports functions and properties that have a platform type. To prevent unexpected errors, the type should be declared explicitly. Example: 'fun foo() = java.lang.String.valueOf(1)' The quick fix allows you to specify the return type: 'fun foo(): String = java.lang.String.valueOf(1)'", + "markdown": "Reports functions and properties that have a platform type.\n\nTo prevent unexpected errors, the type should be declared explicitly.\n\n**Example:**\n\n\n fun foo() = java.lang.String.valueOf(1)\n\nThe quick fix allows you to specify the return type:\n\n\n fun foo(): String = java.lang.String.valueOf(1)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DataClassPrivateConstructor", + "shortDescription": { + "text": "Private data class constructor is exposed via the 'copy' method" + }, + "fullDescription": { + "text": "Reports the 'private' primary constructor in data classes. 'data' classes have a 'copy()' factory method that can be used similarly to a constructor. A constructor should not be marked as 'private' to provide enough safety. Example: 'data class User private constructor(val name: String)' A quick-fix changes the constructor visibility modifier to 'public': 'data class User(val name: String)'", + "markdown": "Reports the `private` primary constructor in data classes.\n\n\n`data` classes have a `copy()` factory method that can be used similarly to a constructor.\nA constructor should not be marked as `private` to provide enough safety.\n\n**Example:**\n\n\n data class User private constructor(val name: String)\n\nA quick-fix changes the constructor visibility modifier to `public`:\n\n\n data class User(val name: String)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantInnerClassModifier", + "shortDescription": { + "text": "Redundant 'inner' modifier" + }, + "fullDescription": { + "text": "Reports the 'inner' modifier on a class as redundant if it doesn't reference members of its outer class. Example: 'class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }' After the quick-fix is applied: 'class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }'", + "markdown": "Reports the `inner` modifier on a class as redundant if it doesn't reference members of its outer class.\n\n**Example:**\n\n\n class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaCollectionsStaticMethodOnImmutableList", + "shortDescription": { + "text": "Call of Java mutator method on immutable Kotlin collection" + }, + "fullDescription": { + "text": "Reports Java mutator methods calls (like 'fill', 'reverse', 'shuffle', 'sort') on an immutable Kotlin collection. This can lead to 'UnsupportedOperationException' at runtime. Example: 'import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }' To fix the problem make the list mutable.", + "markdown": "Reports Java mutator methods calls (like `fill`, `reverse`, `shuffle`, `sort`) on an immutable Kotlin collection.\n\nThis can lead to `UnsupportedOperationException` at runtime.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }\n\nTo fix the problem make the list mutable." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MavenCoroutinesDeprecation", + "shortDescription": { + "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Maven" + }, + "fullDescription": { + "text": "Reports kotlinx.coroutines library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later.", + "markdown": "Reports **kotlinx.coroutines** library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration/Maven", + "index": 119, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NullableBooleanElvis", + "shortDescription": { + "text": "Equality check can be used instead of elvis for nullable boolean check" + }, + "fullDescription": { + "text": "Reports cases when an equality check should be used instead of the elvis operator. Example: 'fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n}' After the quick-fix is applied: 'fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n}'", + "markdown": "Reports cases when an equality check should be used instead of the elvis operator.\n\n**Example:**\n\n\n fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n }\n\nAfter the quick-fix is applied:\n\n\n fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedMavenDependency", + "shortDescription": { + "text": "Deprecated library is used in Maven" + }, + "fullDescription": { + "text": "Reports deprecated maven dependency. Example: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n ' The quick fix changes the deprecated dependency to a maintained one: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n '", + "markdown": "Reports deprecated maven dependency.\n\n**Example:**\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n \n\nThe quick fix changes the deprecated dependency to a maintained one:\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnnecessaryVariable", + "shortDescription": { + "text": "Unnecessary local variable" + }, + "fullDescription": { + "text": "Reports local variables that used only in the very next 'return' statement or exact copies of other variables. Such variables can be safely inlined to make the code more clear.", + "markdown": "Reports local variables that used only in the very next `return` statement or exact copies of other variables.\n\nSuch variables can be safely inlined to make the code more clear." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantEmptyInitializerBlock", + "shortDescription": { + "text": "Redundant empty initializer block" + }, + "fullDescription": { + "text": "Reports redundant empty initializer blocks. Example: 'class Foo {\n init {\n // Empty init block\n }\n }' After the quick-fix is applied: 'class Foo {\n }'", + "markdown": "Reports redundant empty initializer blocks.\n\n**Example:**\n\n\n class Foo {\n init {\n // Empty init block\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "GradleKotlinxCoroutinesDeprecation", + "shortDescription": { + "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Gradle" + }, + "fullDescription": { + "text": "Reports 'kotlinx.coroutines' library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+. Example: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }' The quick fix changes the 'kotlinx.coroutines' library version to a compatible with Kotlin 1.3: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }'", + "markdown": "Reports `kotlinx.coroutines` library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+.\n\n**Example:**\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }\n\nThe quick fix changes the `kotlinx.coroutines` library version to a compatible with Kotlin 1.3:\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration/Gradle", + "index": 127, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantWith", + "shortDescription": { + "text": "Redundant 'with' call" + }, + "fullDescription": { + "text": "Reports redundant 'with' function calls that don't access anything from the receiver. Examples: 'class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }'", + "markdown": "Reports redundant `with` function calls that don't access anything from the receiver.\n\n**Examples:**\n\n\n class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WarningOnMainUnusedParameterMigration", + "shortDescription": { + "text": "Unused `args` on `main` since 1.4" + }, + "fullDescription": { + "text": "Reports 'main' function with an unused single parameter. Since Kotlin 1.4, it is possible to use the 'main' function without parameter as the entry point to the Kotlin program. The compiler reports a warning for the 'main' function with an unused parameter.", + "markdown": "Reports `main` function with an unused single parameter.\n\nSince Kotlin 1.4, it is possible to use the `main` function without parameter as the entry point to the Kotlin program.\nThe compiler reports a warning for the `main` function with an unused parameter." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLabelMigration", + "shortDescription": { + "text": "Redundant label" + }, + "fullDescription": { + "text": "Reports redundant labels which cause compilation errors since Kotlin 1.4. Since Kotlin 1.0, one can mark any statement with a label: 'fun foo() {\n L1@ val x = L2@bar()\n }' However, these labels can be referenced only in a limited number of ways: break / continue from a loop non-local return from an inline lambda or inline anonymous function sssss Such labels are prohibited since Kotlin 1.4. This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports redundant labels which cause compilation errors since Kotlin 1.4.\n\nSince Kotlin 1.0, one can mark any statement with a label:\n\n\n fun foo() {\n L1@ val x = L2@bar()\n }\n\nHowever, these labels can be referenced only in a limited number of ways:\n\n* break / continue from a loop\n* non-local return from an inline lambda or inline anonymous function\nsssss\n\nSuch labels are prohibited since Kotlin 1.4.\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceNegatedIsEmptyWithIsNotEmpty", + "shortDescription": { + "text": "Negated call can be simplified" + }, + "fullDescription": { + "text": "Reports negation 'isEmpty()' and 'isNotEmpty()' for collections and 'String', or 'isBlank()' and 'isNotBlank()' for 'String'. Using corresponding functions makes your code simpler. The quick-fix replaces the negation call with the corresponding call from the Standard Library. Example: 'fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }' After the quick-fix is applied: 'fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }'", + "markdown": "Reports negation `isEmpty()` and `isNotEmpty()` for collections and `String`, or `isBlank()` and `isNotBlank()` for `String`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the negation call with the corresponding call from the Standard Library.\n\n**Example:**\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DelegationToVarProperty", + "shortDescription": { + "text": "Delegating to 'var' property" + }, + "fullDescription": { + "text": "Reports interface delegation to a 'var' property. Only initial value of a property is used for delegation, any later assignments do not affect it. Example: 'class Example(var text: CharSequence): CharSequence by text' A quick-fix replaces a property with immutable one: 'class Example(val text: CharSequence): CharSequence by text' Alternative way, if you rely on mutability for some reason: 'class Example(text: CharSequence): CharSequence by text {\n var text = text\n }'", + "markdown": "Reports interface delegation to a `var` property.\n\nOnly initial value of a property is used for delegation, any later assignments do not affect it.\n\n**Example:**\n\n\n class Example(var text: CharSequence): CharSequence by text\n\nA quick-fix replaces a property with immutable one:\n\n\n class Example(val text: CharSequence): CharSequence by text\n\nAlternative way, if you rely on mutability for some reason:\n\n\n class Example(text: CharSequence): CharSequence by text {\n var text = text\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstantConditionIf", + "shortDescription": { + "text": "Condition of 'if' expression is constant" + }, + "fullDescription": { + "text": "Reports 'if' expressions that have 'true' or 'false' constant literal condition and can be simplified. While occasionally intended, this construction is confusing and often the result of a typo or previous refactoring. Example: 'fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }' A quick-fix removes the 'if' condition: 'fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }'", + "markdown": "Reports `if` expressions that have `true` or `false` constant literal condition and can be simplified.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo\nor previous refactoring.\n\n**Example:**\n\n\n fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }\n\nA quick-fix removes the `if` condition:\n\n\n fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLambdaArrow", + "shortDescription": { + "text": "Redundant lambda arrow" + }, + "fullDescription": { + "text": "Reports redundant lambda arrows in lambdas without parameters. Example: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -> println(\"Hi!\") }\n }' After the quick-fix is applied: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }'", + "markdown": "Reports redundant lambda arrows in lambdas without parameters.\n\n**Example:**\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -\\> println(\"Hi!\") }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinInternalInJava", + "shortDescription": { + "text": "Usage of Kotlin internal declarations from Java" + }, + "fullDescription": { + "text": "Reports usages of Kotlin 'internal' declarations in Java code that is located in a different module. The 'internal' keyword is designed to restrict access to a class, function, or property from other modules. Due to JVM limitations, 'internal' classes, functions, and properties can still be accessed from outside Kotlin, which may later lead to compatibility problems.", + "markdown": "Reports usages of Kotlin `internal` declarations in Java code that is located in a different module.\n\n\nThe `internal` keyword is designed to restrict access to a class, function, or property from other modules.\nDue to JVM limitations, `internal` classes, functions, and properties can still be\naccessed from outside Kotlin, which may later lead to compatibility problems." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UseWithIndex", + "shortDescription": { + "text": "Manually incremented index variable can be replaced with use of 'withIndex()'" + }, + "fullDescription": { + "text": "Reports 'for' loops with a manually incremented index variable. 'for' loops with a manually incremented index variable can be simplified with the 'withIndex()' function. Use withIndex() instead of manual index increment quick-fix can be used to amend the code automatically. Example: 'fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }' After the quick-fix is applied: 'fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }'", + "markdown": "Reports `for` loops with a manually incremented index variable.\n\n`for` loops with a manually incremented index variable can be simplified with the `withIndex()` function.\n\n**Use withIndex() instead of manual index increment** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ImplicitThis", + "shortDescription": { + "text": "Implicit 'this'" + }, + "fullDescription": { + "text": "Reports usages of implicit this. Example: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }' The quick fix specifies this explicitly: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }'", + "markdown": "Reports usages of implicit **this** .\n\n**Example:**\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }\n\nThe quick fix specifies **this** explicitly:\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinCatchMayIgnoreException", + "shortDescription": { + "text": "'catch' block may ignore exception" + }, + "fullDescription": { + "text": "Reports 'catch' blocks that are empty or may ignore an exception. While occasionally intended, empty 'catch' blocks may complicate debugging. Also, ignoring a 'catch' parameter might be wrong. The inspection won't report any 'catch' parameters named 'ignore', 'ignored', or '_'. You can use a quick-fix to change the exception name to '_'. Example: 'try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }' After the quick-fix is applied: 'try {\n throwingMethod()\n } catch (_: IOException) {\n\n }' Use the Do not warn when 'catch' block contains a comment option to ignore 'catch' blocks with comments.", + "markdown": "Reports `catch` blocks that are empty or may ignore an exception.\n\nWhile occasionally intended, empty `catch` blocks may complicate debugging.\nAlso, ignoring a `catch` parameter might be wrong.\n\n\nThe inspection won't report any `catch` parameters named `ignore`, `ignored`, or `_`.\n\n\nYou can use a quick-fix to change the exception name to `_`.\n\n**Example:**\n\n\n try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n throwingMethod()\n } catch (_: IOException) {\n\n }\n\nUse the **Do not warn when 'catch' block contains a comment** option to ignore `catch` blocks with comments." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentStdlibGradleVersion", + "shortDescription": { + "text": "Kotlin library and Gradle plugin versions are different" + }, + "fullDescription": { + "text": "Reports different Kotlin stdlib and compiler versions. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }' To fix the problem change the kotlin stdlib version to match the kotlin compiler version.", + "markdown": "Reports different Kotlin stdlib and compiler versions.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }\n\nTo fix the problem change the kotlin stdlib version to match the kotlin compiler version." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBeVal", + "shortDescription": { + "text": "Local 'var' is never modified and can be declared as 'val'" + }, + "fullDescription": { + "text": "Reports local variables declared with the 'var' keyword that are never modified. Kotlin encourages to declare practically immutable variables using the 'val' keyword, ensuring that their value will never change. Example: 'fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }' A quick-fix replaces the 'var' keyword with 'val': 'fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }'", + "markdown": "Reports local variables declared with the `var` keyword that are never modified.\n\nKotlin encourages to declare practically immutable variables using the `val` keyword, ensuring that their value will never change.\n\n**Example:**\n\n\n fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n\nA quick-fix replaces the `var` keyword with `val`:\n\n\n fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithIgnoreCaseEquals", + "shortDescription": { + "text": "Should be replaced with 'equals(..., ignoreCase = true)'" + }, + "fullDescription": { + "text": "Reports case-insensitive comparisons that can be replaced with 'equals(..., ignoreCase = true)'. By using 'equals()' you don't have to allocate extra strings with 'toLowerCase()' or 'toUpperCase()' to compare strings. The quick-fix replaces the case-insensitive comparison that uses 'toLowerCase()' or 'toUpperCase()' with 'equals(..., ignoreCase = true)'. Note: May change semantics for some locales. Example: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }' After the quick-fix is applied: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }'", + "markdown": "Reports case-insensitive comparisons that can be replaced with `equals(..., ignoreCase = true)`.\n\nBy using `equals()` you don't have to allocate extra strings with `toLowerCase()` or `toUpperCase()` to compare strings.\n\nThe quick-fix replaces the case-insensitive comparison that uses `toLowerCase()` or `toUpperCase()` with `equals(..., ignoreCase = true)`.\n\n**Note:** May change semantics for some locales.\n\n**Example:**\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithSubstringAfter", + "shortDescription": { + "text": "'substring' call should be replaced with 'substringAfter'" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(s.indexOf(x))' that can be replaced with 's.substringAfter(x)'. Using 's.substringAfter(x)' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringAfter'. Example: 'fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringAfter('x')\n }'", + "markdown": "Reports calls like `s.substring(s.indexOf(x))` that can be replaced with `s.substringAfter(x)`.\n\nUsing `s.substringAfter(x)` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringAfter`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringAfter('x')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantCompanionReference", + "shortDescription": { + "text": "Redundant 'Companion' reference" + }, + "fullDescription": { + "text": "Reports redundant 'Companion' reference. Example: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }' After the quick-fix is applied: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }'", + "markdown": "Reports redundant `Companion` reference.\n\n**Example:**\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }\n\nAfter the quick-fix is applied:\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KDocUnresolvedReference", + "shortDescription": { + "text": "Unresolved reference in KDoc" + }, + "fullDescription": { + "text": "Reports unresolved references in KDoc comments. Example: '/**\n * [unresolvedLink]\n */\n fun foo() {}' To fix the problem make the link valid.", + "markdown": "Reports unresolved references in KDoc comments.\n\n**Example:**\n\n\n /**\n * [unresolvedLink]\n */\n fun foo() {}\n\nTo fix the problem make the link valid." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NestedLambdaShadowedImplicitParameter", + "shortDescription": { + "text": "Nested lambda has shadowed implicit parameter" + }, + "fullDescription": { + "text": "Reports nested lambdas with shadowed implicit parameters. Example: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n}' After the quick-fix is applied: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n}'", + "markdown": "Reports nested lambdas with shadowed implicit parameters.\n\n**Example:**\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSamConstructor", + "shortDescription": { + "text": "Redundant SAM constructor" + }, + "fullDescription": { + "text": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas. Example: 'fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}' After the quick-fix is applied: 'fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}'", + "markdown": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas.\n\n**Example:**\n\n\n fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "InconsistentCommentForJavaParameter", + "shortDescription": { + "text": "Inconsistent comment for java parameter" + }, + "fullDescription": { + "text": "Reports inconsistent parameter name for java method specified in a comment block. Examples: '// Java\n public class JavaService {\n public void invoke(String command) {}\n }' '// Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }' The quick fix corrects parameter name in a comment block: 'fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }'", + "markdown": "Reports inconsistent parameter name for **java** method specified in a comment block.\n\n**Examples:**\n\n\n // Java\n public class JavaService {\n public void invoke(String command) {}\n }\n\n\n // Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }\n\nThe quick fix corrects parameter name in a comment block:\n\n\n fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantCallsOfConversionMethods", + "shortDescription": { + "text": "Redundant call of conversion method" + }, + "fullDescription": { + "text": "Reports redundant calls to conversion methods (for example, 'toString()' on a 'String' or 'toDouble()' on a 'Double'). Use the 'Remove redundant calls of the conversion method' quick-fix to clean up the code.", + "markdown": "Reports redundant calls to conversion methods (for example, `toString()` on a `String` or `toDouble()` on a `Double`).\n\nUse the 'Remove redundant calls of the conversion method' quick-fix to clean up the code." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinThrowableNotThrown", + "shortDescription": { + "text": "Throwable not thrown" + }, + "fullDescription": { + "text": "Reports instantiations of 'Throwable' or its subclasses, when the created 'Throwable' is never actually thrown. The reported code indicates mistakes that are hard to catch in tests. Also, this inspection reports method calls that return instances of 'Throwable' or its subclasses, when the resulting 'Throwable' instance is not thrown. Example: 'fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }'", + "markdown": "Reports instantiations of `Throwable` or its subclasses, when the created `Throwable` is never actually thrown.\n\nThe reported code indicates mistakes that are hard to catch in tests.\n\n\nAlso, this inspection reports method calls that return instances of `Throwable` or its subclasses,\nwhen the resulting `Throwable` instance is not thrown.\n\n**Example:**\n\n\n fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinSealedInheritorsInJava", + "shortDescription": { + "text": "Inheritance of Kotlin sealed interface/class from Java" + }, + "fullDescription": { + "text": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code. Example: '// Kotlin file: MathExpression.kt\n\nsealed class MathExpression\n\ndata class Const(val number: Double) : MathExpression()\ndata class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()' '// Java file: NotANumber.java\n\npublic class NotANumber extends MathExpression {\n}'", + "markdown": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code.\n\n**Example:**\n\n\n // Kotlin file: MathExpression.kt\n\n sealed class MathExpression\n\n data class Const(val number: Double) : MathExpression()\n data class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()\n\n\n // Java file: NotANumber.java\n\n public class NotANumber extends MathExpression {\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyNegatedBinaryExpression", + "shortDescription": { + "text": "Negated boolean expression can be simplified" + }, + "fullDescription": { + "text": "Reports negated binary expressions that can be simplified. The quick-fix simplifies the binary expression. Example: 'fun test(n: Int) {\n !(0 == 1)\n }' After the quick-fix is applied: 'fun test(n: Int) {\n 0 != 1\n }'", + "markdown": "Reports negated binary expressions that can be simplified.\n\nThe quick-fix simplifies the binary expression.\n\n**Example:**\n\n\n fun test(n: Int) {\n !(0 == 1)\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(n: Int) {\n 0 != 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MemberVisibilityCanBePrivate", + "shortDescription": { + "text": "Class member can have 'private' visibility" + }, + "fullDescription": { + "text": "Reports declarations that can be made 'private' to follow the encapsulation principle. Example: 'class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}' After the quick-fix is applied (considering there are no usages of 'url' outside of 'Service' class): 'class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}'", + "markdown": "Reports declarations that can be made `private` to follow the encapsulation principle.\n\n**Example:**\n\n\n class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n\nAfter the quick-fix is applied (considering there are no usages of `url` outside of `Service` class):\n\n\n class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SelfAssignment", + "shortDescription": { + "text": "Redundant assignment" + }, + "fullDescription": { + "text": "Reports assignments of a variable to itself. The quick-fix removes the redundant assignment. Example: 'fun test() {\n var bar = 1\n bar = bar\n }' After the quick-fix is applied: 'fun test() {\n var bar = 1\n }'", + "markdown": "Reports assignments of a variable to itself.\n\nThe quick-fix removes the redundant assignment.\n\n**Example:**\n\n\n fun test() {\n var bar = 1\n bar = bar\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n var bar = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RecursiveEqualsCall", + "shortDescription": { + "text": "Recursive equals call" + }, + "fullDescription": { + "text": "Reports recursive 'equals'('==') calls. In Kotlin, '==' compares object values by calling 'equals' method under the hood. '===', on the other hand, compares objects by reference. '===' is commonly used in 'equals' method implementation. But '===' may be mistakenly mixed up with '==' leading to infinite recursion. Example: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }' After the quick-fix is applied: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }'", + "markdown": "Reports recursive `equals`(`==`) calls.\n\n\nIn Kotlin, `==` compares object values by calling `equals` method under the hood.\n`===`, on the other hand, compares objects by reference.\n\n\n`===` is commonly used in `equals` method implementation.\nBut `===` may be mistakenly mixed up with `==` leading to infinite recursion.\n\n**Example:**\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ExplicitThis", + "shortDescription": { + "text": "Redundant explicit 'this'" + }, + "fullDescription": { + "text": "Reports an explicit 'this' when it can be omitted. Example: 'class C {\n private val i = 1\n fun f() = this.i\n }' The quick-fix removes the redundant 'this': 'class C {\n private val i = 1\n fun f() = i\n }'", + "markdown": "Reports an explicit `this` when it can be omitted.\n\n**Example:**\n\n\n class C {\n private val i = 1\n fun f() = this.i\n }\n\nThe quick-fix removes the redundant `this`:\n\n\n class C {\n private val i = 1\n fun f() = i\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NullChecksToSafeCall", + "shortDescription": { + "text": "Null-checks can be replaced with safe-calls" + }, + "fullDescription": { + "text": "Reports chained null-checks that can be replaced with safe-calls. Example: 'fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }' After the quick-fix is applied: 'fun test(my: My?) {\n if (my?.foo() != null) {}\n }'", + "markdown": "Reports chained null-checks that can be replaced with safe-calls.\n\n**Example:**\n\n\n fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(my: My?) {\n if (my?.foo() != null) {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedMainParameter", + "shortDescription": { + "text": "Main parameter is not necessary" + }, + "fullDescription": { + "text": "Reports 'main' function with an unused single parameter.", + "markdown": "Reports `main` function with an unused single parameter." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionWithLambdaExpressionBody", + "shortDescription": { + "text": "Function with `= { ... }` and inferred return type" + }, + "fullDescription": { + "text": "Reports functions with '= { ... }' and inferred return type. Example: 'fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.' The quick fix removes braces: 'fun sum(a: Int, b: Int) = a + b'", + "markdown": "Reports functions with `= { ... }` and inferred return type.\n\n**Example:**\n\n\n fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.\n\nThe quick fix removes braces:\n\n\n fun sum(a: Int, b: Int) = a + b\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ArrayInDataClass", + "shortDescription": { + "text": "Array property in data class" + }, + "fullDescription": { + "text": "Reports properties with an 'Array' type in a 'data' class without overridden 'equals()' or 'hashCode()'. Array parameters are compared by reference equality, which is likely an unexpected behavior. It is strongly recommended to override 'equals()' and 'hashCode()' in such cases. Example: 'data class Text(val lines: Array)' A quick-fix generates missing 'equals()' and 'hashCode()' implementations: 'data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }'", + "markdown": "Reports properties with an `Array` type in a `data` class without overridden `equals()` or `hashCode()`.\n\n\nArray parameters are compared by reference equality, which is likely an unexpected behavior.\nIt is strongly recommended to override `equals()` and `hashCode()` in such cases.\n\n**Example:**\n\n\n data class Text(val lines: Array)\n\nA quick-fix generates missing `equals()` and `hashCode()` implementations:\n\n\n data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertTwoComparisonsToRangeCheck", + "shortDescription": { + "text": "Two comparisons should be converted to a range check" + }, + "fullDescription": { + "text": "Reports two consecutive comparisons that can be converted to a range check. Checking against a range makes code simpler by removing test subject duplication. Example: 'fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }' A quick-fix replaces the comparison-based check with a range one: 'fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }'", + "markdown": "Reports two consecutive comparisons that can be converted to a range check.\n\nChecking against a range makes code simpler by removing test subject duplication.\n\n**Example:**\n\n\n fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }\n\nA quick-fix replaces the comparison-based check with a range one:\n\n\n fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LocalVariableName", + "shortDescription": { + "text": "Local variable naming convention" + }, + "fullDescription": { + "text": "Reports local variables that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with a lowercase letter, use camel case and no underscores. Example: 'fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }'", + "markdown": "Reports local variables that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#function-names): it has to start with a lowercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantQualifierName", + "shortDescription": { + "text": "Redundant qualifier name" + }, + "fullDescription": { + "text": "Reports redundant qualifiers (or their parts) on class names, functions, and properties. A fully qualified name is an unambiguous identifier that specifies which object, function, or property a call refers to. In the contexts where the name can be shortened, the inspection informs on the opportunity and the associated 'Remove redundant qualifier name' quick-fix allows amending the code. Examples: 'package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = my.simple.name.Foo() // 'Foo' resides in the declared 'my.simple.name' package, qualifier is redundant\n val b = kotlin.Int.MAX_VALUE // Can be replaced with 'MAX_VALUE' since it's imported\n val c = kotlin.Double.MAX_VALUE // Can be replaced with 'Double.MAX_VALUE' since built-in types are imported automatically\n }' After the quick-fix is applied: 'package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = Foo()\n val b = MAX_VALUE\n val c = Double.MAX_VALUE\n }'", + "markdown": "Reports redundant qualifiers (or their parts) on class names, functions, and properties.\n\n\nA fully qualified name is an unambiguous identifier that specifies which object, function, or property a call refers to.\nIn the contexts where the name can be shortened, the inspection informs on the opportunity and the associated\n'Remove redundant qualifier name' quick-fix allows amending the code.\n\n**Examples:**\n\n\n package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = my.simple.name.Foo() // 'Foo' resides in the declared 'my.simple.name' package, qualifier is redundant\n val b = kotlin.Int.MAX_VALUE // Can be replaced with 'MAX_VALUE' since it's imported\n val c = kotlin.Double.MAX_VALUE // Can be replaced with 'Double.MAX_VALUE' since built-in types are imported automatically\n }\n\nAfter the quick-fix is applied:\n\n\n package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = Foo()\n val b = MAX_VALUE\n val c = Double.MAX_VALUE\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveCurlyBracesFromTemplate", + "shortDescription": { + "text": "Redundant curly braces in string template" + }, + "fullDescription": { + "text": "Reports usages of curly braces in string templates around simple identifiers. Use the 'Remove curly braces' quick-fix to remove the redundant braces. Examples: 'fun redundant() {\n val x = 4\n val y = \"${x}\" // <== redundant\n }\n\n fun correctUsage() {\n val x = \"x\"\n val y = \"${x.length}\" // <== Ok\n }' After the quick-fix is applied: 'fun redundant() {\n val x = 4\n val y = \"$x\"\n }\n\n fun correctUsage() {\n val x = \"x\" <== Updated\n val y = \"${x.length}\"\n }'", + "markdown": "Reports usages of curly braces in string templates around simple identifiers.\n\nUse the 'Remove curly braces' quick-fix to remove the redundant braces.\n\n**Examples:**\n\n\n fun redundant() {\n val x = 4\n val y = \"${x}\" // <== redundant\n }\n\n fun correctUsage() {\n val x = \"x\"\n val y = \"${x.length}\" // <== Ok\n }\n\nAfter the quick-fix is applied:\n\n\n fun redundant() {\n val x = 4\n val y = \"$x\"\n }\n\n fun correctUsage() {\n val x = \"x\" <== Updated\n val y = \"${x.length}\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithIndexingOperation", + "shortDescription": { + "text": "'substring' call should be replaced with indexing operator" + }, + "fullDescription": { + "text": "Reports calls like '\"abc\".substring(0, 1)' that can be replaced with '\"abc\"[0]'. Obtaining the element by index makes your code simpler. The quick-fix replaces the 'substring' call with the indexing operator. Example: 'fun foo() {\n \"abc\".substring(0, 1)\n }' After the quick-fix is applied: 'fun foo() {\n \"abc\"[0]\n }'", + "markdown": "Reports calls like `\"abc\".substring(0, 1)` that can be replaced with `\"abc\"[0]`.\n\nObtaining the element by index makes your code simpler.\n\nThe quick-fix replaces the `substring` call with the indexing operator.\n\n**Example:**\n\n\n fun foo() {\n \"abc\".substring(0, 1)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n \"abc\"[0]\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MoveLambdaOutsideParentheses", + "shortDescription": { + "text": "Lambda argument inside parentheses" + }, + "fullDescription": { + "text": "Reports lambda expressions in parentheses which can be moved outside. Example: 'fun square(a: Int, b: (Int) -> Int) {\n b(a * a)\n}\n\nfun foo() {\n square(2, { it })\n}' After the quick-fix is applied: 'fun foo() {\n square(2){ it }\n}'", + "markdown": "Reports lambda expressions in parentheses which can be moved outside.\n\n**Example:**\n\n\n fun square(a: Int, b: (Int) -> Int) {\n b(a * a)\n }\n\n fun foo() {\n square(2, { it })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n square(2){ it }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OverridingDeprecatedMember", + "shortDescription": { + "text": "Overriding deprecated member" + }, + "fullDescription": { + "text": "Reports declarations that inherit from deprecated members. Example: 'open class BaseService {\n @Deprecated(\"obsolete\", replaceWith = ReplaceWith(\"connection\"))\n open fun connect() {}\n\n open fun connection() {}\n} \n\nclass SomeService: BaseService() {\n override fun connect() {\n super.connect()\n }\n}'", + "markdown": "Reports declarations that inherit from deprecated members.\n\n**Example:**\n\n\n open class BaseService {\n @Deprecated(\"obsolete\", replaceWith = ReplaceWith(\"connection\"))\n open fun connect() {}\n\n open fun connection() {}\n } \n\n class SomeService: BaseService() {\n override fun connect() {\n super.connect()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitTypeParametersForLocalVariablesMigration", + "shortDescription": { + "text": "Local variable with type parameters" + }, + "fullDescription": { + "text": "Reports local variables with type parameters. A type parameter for a local variable doesn't make sense because it can't be specialized. Example: 'fun main() {\n val x = \"\"\n }' After the quick-fix is applied: 'fun main() {\n val x = \"\"\n }' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports local variables with type parameters.\n\nA type parameter for a local variable doesn't make sense because it can't be specialized.\n\n**Example:**\n\n\n fun main() {\n val x = \"\"\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val x = \"\"\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TestFunctionName", + "shortDescription": { + "text": "Test function naming convention" + }, + "fullDescription": { + "text": "Reports test function names that do not follow the recommended naming conventions.", + "markdown": "Reports test function names that do not follow the [recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#names-for-test-methods)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RecursivePropertyAccessor", + "shortDescription": { + "text": "Recursive property accessor" + }, + "fullDescription": { + "text": "Reports recursive property accessor calls which can end up with a 'StackOverflowError'. Such calls are usually confused with backing field access. Example: 'var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }' After the quick-fix is applied: 'var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }'", + "markdown": "Reports recursive property accessor calls which can end up with a `StackOverflowError`.\nSuch calls are usually confused with backing field access.\n\n**Example:**\n\n\n var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }\n\nAfter the quick-fix is applied:\n\n\n var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantUnitExpression", + "shortDescription": { + "text": "Redundant 'Unit'" + }, + "fullDescription": { + "text": "Reports redundant 'Unit' expressions. 'Unit' in Kotlin can be used as the return type of functions that do not return anything meaningful. The 'Unit' type has only one possible value, which is the 'Unit' object. Examples: 'fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }'", + "markdown": "Reports redundant `Unit` expressions.\n\n\n`Unit` in Kotlin can be used as the return type of functions that do not return anything meaningful.\nThe `Unit` type has only one possible value, which is the `Unit` object.\n\n**Examples:**\n\n\n fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PlatformExtensionReceiverOfInline", + "shortDescription": { + "text": "'inline fun' with nullable receiver until Kotlin 1.2" + }, + "fullDescription": { + "text": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). It's recommended to add an explicit '!!' you want an exception to be thrown, or consider changing the function's receiver type to nullable if it should work without exceptions. Example: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }' After the quick-fix is applied: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", + "markdown": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nIt's recommended to add an explicit `!!` you want an exception to be thrown,\nor consider changing the function's receiver type to nullable if it should work without exceptions.\n\n**Example:**\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousEqualsCombination", + "shortDescription": { + "text": "Suspicious combination of == and ===" + }, + "fullDescription": { + "text": "Reports '==' and '===' comparisons that are both used on the same variable within a single expression. Due to similarities '==' and '===' could be mixed without notice, and it takes a close look to check that '==' used instead of '===' Example: 'if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return'", + "markdown": "Reports `==` and `===` comparisons that are both used on the same variable within a single expression.\n\nDue to similarities `==` and `===` could be mixed without notice, and\nit takes a close look to check that `==` used instead of `===`\n\nExample:\n\n\n if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedDataClassCopyResult", + "shortDescription": { + "text": "Unused result of data class copy" + }, + "fullDescription": { + "text": "Reports calls to data class 'copy' function without using its result.", + "markdown": "Reports calls to data class `copy` function without using its result." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantElseInIf", + "shortDescription": { + "text": "Redundant 'else' in 'if'" + }, + "fullDescription": { + "text": "Reports redundant 'else' in 'if' with 'return' Example: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }' After the quick-fix is applied: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }'", + "markdown": "Reports redundant `else` in `if` with `return`\n\n**Example:**\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplacePutWithAssignment", + "shortDescription": { + "text": "'map.put()' can be converted to assignment" + }, + "fullDescription": { + "text": "Reports 'map.put' function calls that can be replaced with indexing operator ('[]'). Using syntactic sugar makes your code simpler. The quick-fix replaces 'put' call with the assignment. Example: 'fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }' After the quick-fix is applied: 'fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }'", + "markdown": "Reports `map.put` function calls that can be replaced with indexing operator (`[]`).\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces `put` call with the assignment.\n\n**Example:**\n\n\n fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinDoubleNegation", + "shortDescription": { + "text": "Redundant double negation" + }, + "fullDescription": { + "text": "Reports redundant double negations. Example: 'val truth = !!true'", + "markdown": "Reports redundant double negations.\n\n**Example:**\n\n val truth = !!true\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionName", + "shortDescription": { + "text": "Function naming convention" + }, + "fullDescription": { + "text": "Reports function names that do not follow the recommended naming conventions. Example: 'fun Foo() {}' To fix the problem change the name of the function to match the recommended naming conventions.", + "markdown": "Reports function names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n fun Foo() {}\n\nTo fix the problem change the name of the function to match the recommended naming conventions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentKotlinMavenVersion", + "shortDescription": { + "text": "Maven and IDE plugins versions are different" + }, + "fullDescription": { + "text": "Reports the Maven plugin version of the Kotlin compiler that is different from the one that is used in the IDE plugin. This inconsistency may lead to different error reporting behavior in the IDE and the compiler", + "markdown": "Reports the Maven plugin version of the Kotlin compiler that is different from the one that is used in the IDE plugin.\n\nThis inconsistency may lead to different error reporting behavior in the IDE and the compiler" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantUnitReturnType", + "shortDescription": { + "text": "Redundant 'Unit' return type" + }, + "fullDescription": { + "text": "Reports a redundant 'Unit' return type which can be omitted.", + "markdown": "Reports a redundant `Unit` return type which can be omitted." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceRangeToWithUntil", + "shortDescription": { + "text": "'rangeTo' or the '..' call should be replaced with 'until'" + }, + "fullDescription": { + "text": "Reports calls to 'rangeTo' or the '..' operator instead of calls to 'until'. Using corresponding functions makes your code simpler. The quick-fix replaces 'rangeTo' or the '..' call with 'until'. Example: 'fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }' After the quick-fix is applied: 'fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }'", + "markdown": "Reports calls to `rangeTo` or the `..` operator instead of calls to `until`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces `rangeTo` or the `..` call with `until`.\n\n**Example:**\n\n\n fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedEquals", + "shortDescription": { + "text": "Unused equals expression" + }, + "fullDescription": { + "text": "Reports unused 'equals'('==') expressions.", + "markdown": "Reports unused `equals`(`==`) expressions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnclearPrecedenceOfBinaryExpression", + "shortDescription": { + "text": "Multiple operators with different precedence" + }, + "fullDescription": { + "text": "Reports binary expressions that consist of different operators without parentheses. Such expressions can be less readable due to different precedence rules of operators. Example: fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }", + "markdown": "Reports binary expressions that consist of different operators without parentheses.\n\nSuch expressions can be less readable due to different [precedence rules](https://kotlinlang.org/docs/reference/grammar.html#expressions) of operators.\n\nExample:\n\n```\n fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }\n```" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedLambdaExpressionBody", + "shortDescription": { + "text": "Unused return value of a function with lambda expression body" + }, + "fullDescription": { + "text": "Reports calls with an unused return value when the called function returns a lambda from an expression body. If there is '=' between function header and body block, code from the function will not be evaluated which can lead to incorrect behavior. Remove = token from function declaration can be used to amend the code automatically. Example: 'fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }' After the quick-fix is applied: 'fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }'", + "markdown": "Reports calls with an unused return value when the called function returns a lambda from an expression body.\n\n\nIf there is `=` between function header and body block,\ncode from the function will not be evaluated which can lead to incorrect behavior.\n\n**Remove = token from function declaration** can be used to amend the code automatically.\n\nExample:\n\n\n fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }\n\nAfter the quick-fix is applied:\n\n\n fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertLambdaToReference", + "shortDescription": { + "text": "Can be replaced with function reference" + }, + "fullDescription": { + "text": "Reports function literal expressions that can be replaced with function references. Replacing lambdas with function references often makes code look more concise and understandable. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }'", + "markdown": "Reports function literal expressions that can be replaced with function references.\n\nReplacing lambdas with function references often makes code look more concise and understandable.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSetter", + "shortDescription": { + "text": "Redundant property setter" + }, + "fullDescription": { + "text": "Reports redundant property setters. Setter is considered to be redundant in one of the following cases: Setter has no body. Accessor visibility isn't changed, declaration isn't 'external' and has no annotations. 'var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated' Setter body is a block with a single statement assigning the parameter to the backing field. 'var prop: Int = 0\n set(value) { // redundant\n field = value\n }'", + "markdown": "Reports redundant property setters.\n\n\nSetter is considered to be redundant in one of the following cases:\n\n1. Setter has no body. Accessor visibility isn't changed, declaration isn't `external` and has no annotations.\n\n\n var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated\n \n2. Setter body is a block with a single statement assigning the parameter to the backing field.\n\n\n var prop: Int = 0\n set(value) { // redundant\n field = value\n }\n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanSealedSubClassBeObject", + "shortDescription": { + "text": "Sealed sub-class without state and overridden equals" + }, + "fullDescription": { + "text": "Reports direct inheritors of 'sealed' classes that have no state and overridden 'equals()' method. It's highly recommended to override 'equals()' to provide comparison stability, or convert the 'class' to an 'object' to reach the same effect. Example: 'sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }' A quick-fix converts a 'class' into an 'object': 'sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }'", + "markdown": "Reports direct inheritors of `sealed` classes that have no state and overridden `equals()` method.\n\nIt's highly recommended to override `equals()` to provide comparison stability, or convert the `class` to an `object` to reach the same effect.\n\n**Example:**\n\n\n sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n\nA quick-fix converts a `class` into an `object`:\n\n\n sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PropertyName", + "shortDescription": { + "text": "Property naming convention" + }, + "fullDescription": { + "text": "Reports property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, property names should start with a lowercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val My_Cool_Property = \"\"' A quick-fix renames the class according to the Kotlin naming conventions: 'val myCoolProperty = \"\"'", + "markdown": "Reports property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nproperty names should start with a lowercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val My_Cool_Property = \"\"\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val myCoolProperty = \"\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinMavenPluginPhase", + "shortDescription": { + "text": "Kotlin Maven Plugin misconfigured" + }, + "fullDescription": { + "text": "Reports kotlin-maven-plugin configuration issues", + "markdown": "Reports kotlin-maven-plugin configuration issues" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertToStringTemplate", + "shortDescription": { + "text": "String concatenation that can be converted to string template" + }, + "fullDescription": { + "text": "Reports string concatenation that can be converted to a string template. Using string templates is recommended as it makes code easier to read. Example: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }' After the quick-fix is applied: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }'", + "markdown": "Reports string concatenation that can be converted to a string template.\n\nUsing string templates is recommended as it makes code easier to read.\n\n**Example:**\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifiableCall", + "shortDescription": { + "text": "Library function call could be simplified" + }, + "fullDescription": { + "text": "Reports library function calls which could be replaced by simplified one. Using corresponding functions makes your code simpler. The quick-fix replaces the function calls with another one. Example: 'fun test(list: List) {\n list.filter { it is String }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.filterIsInstance()\n }'", + "markdown": "Reports library function calls which could be replaced by simplified one.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the function calls with another one.\n\n**Example:**\n\n\n fun test(list: List) {\n list.filter { it is String }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.filterIsInstance()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObjectLiteralToLambda", + "shortDescription": { + "text": "Object literal can be converted to lambda" + }, + "fullDescription": { + "text": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression. Example: 'class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n}' After the quick-fix is applied: 'fun foo() {\n threadPool.submit { println(\"hello\") }\n }'", + "markdown": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression.\n\n**Example:**\n\n\n class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n threadPool.submit { println(\"hello\") }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLambdaOrAnonymousFunction", + "shortDescription": { + "text": "Redundant creation of lambda or anonymous function" + }, + "fullDescription": { + "text": "Reports lambdas or anonymous functions that are created and used immediately. 'fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }'", + "markdown": "Reports lambdas or anonymous functions that are created and used immediately.\n\n\n fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "BooleanLiteralArgument", + "shortDescription": { + "text": "Boolean literal argument without parameter name" + }, + "fullDescription": { + "text": "Reports call arguments with 'Boolean' type without explicit parameter names specified. When multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes. Explicit parameter names allow for easier code reading and understanding. Example: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }' A quick-fix adds missing parameter names: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }'", + "markdown": "Reports call arguments with `Boolean` type without explicit parameter names specified.\n\n\nWhen multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes.\nExplicit parameter names allow for easier code reading and understanding.\n\n**Example:**\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }\n\nA quick-fix adds missing parameter names:\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertArgumentToSet", + "shortDescription": { + "text": "Argument could be converted to 'Set' to improve performance" + }, + "fullDescription": { + "text": "Detects the function calls that could work faster with an argument converted to 'Set'. Operations like 'minus' or 'intersect' are more effective when their argument is a set. An explicit conversion of an 'Iterable' or an 'Array' into a 'Set' can often make code more effective. The quick-fix adds an explicit conversion to the function call. Example: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size' After the quick-fix is applied: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size'", + "markdown": "Detects the function calls that could work faster with an argument converted to `Set`.\n\n\nOperations like 'minus' or 'intersect' are more effective when their argument is a set.\nAn explicit conversion of an `Iterable` or an `Array`\ninto a `Set` can often make code more effective.\n\n\nThe quick-fix adds an explicit conversion to the function call.\n\n**Example:**\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size\n\nAfter the quick-fix is applied:\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceGuardClauseWithFunctionCall", + "shortDescription": { + "text": "Guard clause can be replaced with Kotlin's function call" + }, + "fullDescription": { + "text": "Reports guard clauses that can be replaced with a function call. Example: 'fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }' After the quick-fix is applied: 'fun test(foo: Int?) {\n checkNotNull(foo)\n }'", + "markdown": "Reports guard clauses that can be replaced with a function call.\n\n**Example:**\n\n fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }\n\nAfter the quick-fix is applied:\n\n fun test(foo: Int?) {\n checkNotNull(foo)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceToStringWithStringTemplate", + "shortDescription": { + "text": "Call of 'toString' could be replaced with string template" + }, + "fullDescription": { + "text": "Reports 'toString' function calls that can be replaced with a string template. Using string templates makes your code simpler. The quick-fix replaces 'toString' with a string template. Example: 'fun test(): String {\n val x = 1\n return x.toString()\n }' After the quick-fix is applied: 'fun test(): String {\n val x = 1\n return \"$x\"\n }'", + "markdown": "Reports `toString` function calls that can be replaced with a string template.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces `toString` with a string template.\n\n**Example:**\n\n\n fun test(): String {\n val x = 1\n return x.toString()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(): String {\n val x = 1\n return \"$x\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProtectedInFinal", + "shortDescription": { + "text": "'protected' visibility is effectively 'private' in a final class" + }, + "fullDescription": { + "text": "Reports 'protected' visibility used inside of a 'final' class. In such cases 'protected' members are accessible only in the class itself, so they are effectively 'private'. Example: 'class FinalClass {\n protected fun foo() {}\n }' After the quick-fix is applied: 'class FinalClass {\n private fun foo() {}\n }'", + "markdown": "Reports `protected` visibility used inside of a `final` class. In such cases `protected` members are accessible only in the class itself, so they are effectively `private`.\n\n**Example:**\n\n\n class FinalClass {\n protected fun foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class FinalClass {\n private fun foo() {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceRangeStartEndInclusiveWithFirstLast", + "shortDescription": { + "text": "Boxed properties should be replaced with unboxed" + }, + "fullDescription": { + "text": "Reports boxed 'Range.start' and 'Range.endInclusive' properties. These properties can be replaced with unboxed 'first' and 'last' properties to avoid redundant calls. The quick-fix replaces 'start' and 'endInclusive' properties with the corresponding 'first' and 'last'. Example: 'fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }' After the quick-fix is applied: 'fun foo(range: CharRange) {\n val lastElement = range.last\n }'", + "markdown": "Reports **boxed** `Range.start` and `Range.endInclusive` properties.\n\nThese properties can be replaced with **unboxed** `first` and `last` properties to avoid redundant calls.\n\nThe quick-fix replaces `start` and `endInclusive` properties with the corresponding `first` and `last`.\n\n**Example:**\n\n\n fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(range: CharRange) {\n val lastElement = range.last\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSizeCheckWithIsNotEmpty", + "shortDescription": { + "text": "Size check can be replaced with 'isNotEmpty()'" + }, + "fullDescription": { + "text": "Reports size checks of 'Collections/Array/String' that should be replaced with 'isNotEmpty()'. Using 'isNotEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isNotEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }'", + "markdown": "Reports size checks of `Collections/Array/String` that should be replaced with `isNotEmpty()`.\n\nUsing `isNotEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isNotEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSemicolon", + "shortDescription": { + "text": "Redundant semicolon" + }, + "fullDescription": { + "text": "Reports redundant semicolons (';') that can be safely removed. Kotlin does not require a semicolon at the end of each statement or expression. A quick-fix is suggested to remove redundant semicolons. Example: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};' After the quick-fix is applied: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}' There are two cases though where a semicolon is required: Several statements placed on a single line need to be separated with semicolons: 'map.forEach { val (key, value) = it; println(\"$key -> $value\") }' 'enum' classes that also declare properties or functions, require a semicolon after the list of enum constants: 'enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }'", + "markdown": "Reports redundant semicolons (`;`) that can be safely removed.\n\n\nKotlin does not require a semicolon at the end of each statement or expression.\nA quick-fix is suggested to remove redundant semicolons.\n\n**Example:**\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};\n\nAfter the quick-fix is applied:\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}\n\nThere are two cases though where a semicolon is required:\n\n1. Several statements placed on a single line need to be separated with semicolons:\n\n\n map.forEach { val (key, value) = it; println(\"$key -> $value\") }\n\n2. `enum` classes that also declare properties or functions, require a semicolon after the list of enum constants:\n\n\n enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }\n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IntroduceWhenSubject", + "shortDescription": { + "text": "'when' that can be simplified by introducing an argument" + }, + "fullDescription": { + "text": "Reports a 'when' expression that can be simplified by introducing a subject argument. Example: 'fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }' The quick fix introduces a subject argument: 'fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }'", + "markdown": "Reports a `when` expression that can be simplified by introducing a subject argument.\n\n**Example:**\n\n\n fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n\nThe quick fix introduces a subject argument:\n\n\n fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedCallableAddReplaceWith", + "shortDescription": { + "text": "@Deprecated annotation without 'replaceWith' argument" + }, + "fullDescription": { + "text": "Reports deprecated functions and properties that do not have the 'kotlin.ReplaceWith' argument in its 'kotlin.deprecated' annotation and suggests to add one based on their body. Kotlin provides the 'ReplaceWith' argument to replace deprecated declarations automatically. It is recommended to use the argument to fix deprecation issues in code. Example: '@Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42' A quick-fix adds the 'ReplaceWith()' argument: '@Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42'", + "markdown": "Reports deprecated functions and properties that do not have the `kotlin.ReplaceWith` argument in its `kotlin.deprecated` annotation and suggests to add one based on their body.\n\n\nKotlin provides the `ReplaceWith` argument to replace deprecated declarations automatically.\nIt is recommended to use the argument to fix deprecation issues in code.\n\n**Example:**\n\n\n @Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42\n\nA quick-fix adds the `ReplaceWith()` argument:\n\n\n @Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ComplexRedundantLet", + "shortDescription": { + "text": "Redundant argument-based `let` call" + }, + "fullDescription": { + "text": "Reports a redundant argument-based 'let' call. 'let' is redundant when the lambda parameter is only used as a qualifier in a call expression. If you need to give a name to the qualifying expression, declare a local variable. Example: 'fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }' A quick-fix removes the extra 'let()' call: 'fun example() {\n \"1,2,3\".split(',')\n }' Alternative: 'fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }'", + "markdown": "Reports a redundant argument-based `let` call.\n\n`let` is redundant when the lambda parameter is only used as a qualifier in a call expression.\n\nIf you need to give a name to the qualifying expression, declare a local variable.\n\n**Example:**\n\n\n fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }\n\nA quick-fix removes the extra `let()` call:\n\n\n fun example() {\n \"1,2,3\".split(',')\n }\n\nAlternative:\n\n\n fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantSpreadOperator", + "shortDescription": { + "text": "Redundant spread operator" + }, + "fullDescription": { + "text": "Reports the use of a redundant spread operator for a family of 'arrayOf' function calls. Use the 'Remove redundant spread operator' quick-fix to clean up the code. Examples: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }' After the quick-fix is applied: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }'", + "markdown": "Reports the use of a redundant spread operator for a family of `arrayOf` function calls.\n\nUse the 'Remove redundant spread operator' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitJvmOverloadsOnConstructorsOfAnnotationClassesMigration", + "shortDescription": { + "text": "'@JvmOverloads' annotation cannot be used on constructors of annotation classes since 1.4" + }, + "fullDescription": { + "text": "Reports '@JvmOverloads' on constructors of annotation classes because it's meaningless. There is no footprint of '@JvmOverloads' in the generated bytecode and Kotlin metadata, so '@JvmOverloads' doesn't affect the generated bytecode and the code behavior. '@JvmOverloads' on constructors of annotation classes causes a compilation error since Kotlin 1.4. Example: 'annotation class A @JvmOverloads constructor(val x: Int = 1)' After the quick-fix is applied: 'annotation class A constructor(val x: Int = 1)'", + "markdown": "Reports `@JvmOverloads` on constructors of annotation classes because it's meaningless.\n\n\nThere is no footprint of `@JvmOverloads` in the generated bytecode and Kotlin metadata,\nso `@JvmOverloads` doesn't affect the generated bytecode and the code behavior.\n\n`@JvmOverloads` on constructors of annotation classes causes a compilation error since Kotlin 1.4.\n\n**Example:**\n\n\n annotation class A @JvmOverloads constructor(val x: Int = 1)\n\nAfter the quick-fix is applied:\n\n\n annotation class A constructor(val x: Int = 1)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveSetterParameterType", + "shortDescription": { + "text": "Redundant setter parameter type" + }, + "fullDescription": { + "text": "Reports explicitly specified parameter types in property setters. Setter parameter type always matches the property type, so it's not required to be explicit. The 'Remove explicit type specification' quick-fix allows amending the code accordingly. Examples: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted' After the quick-fix is applied: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)'", + "markdown": "Reports explicitly specified parameter types in property setters.\n\n\nSetter parameter type always matches the property type, so it's not required to be explicit.\nThe 'Remove explicit type specification' quick-fix allows amending the code accordingly.\n\n**Examples:**\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted\n\nAfter the quick-fix is applied:\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IfThenToElvis", + "shortDescription": { + "text": "If-Then foldable to '?:'" + }, + "fullDescription": { + "text": "Reports 'if-then' expressions that can be folded into elvis ('?:') expressions. Example: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo' The quick fix converts the 'if-then' expression into an elvis ('?:') expression: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"'", + "markdown": "Reports `if-then` expressions that can be folded into elvis (`?:`) expressions.\n\n**Example:**\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo\n\nThe quick fix converts the `if-then` expression into an elvis (`?:`) expression:\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WrapUnaryOperator", + "shortDescription": { + "text": "Ambiguous unary operator use with number constant" + }, + "fullDescription": { + "text": "Reports an unary operator followed by a dot qualifier such as '-1.inc()'. Code like '-1.inc()' can be misleading because '-' has a lower precedence than '.inc()'. As a result, '-1.inc()' evaluates to '-2' and not '0' as it might be expected. Wrap unary operator and value with () quick-fix can be used to amend the code automatically.", + "markdown": "Reports an unary operator followed by a dot qualifier such as `-1.inc()`.\n\nCode like `-1.inc()` can be misleading because `-` has a lower precedence than `.inc()`.\nAs a result, `-1.inc()` evaluates to `-2` and not `0` as it might be expected.\n\n**Wrap unary operator and value with ()** quick-fix can be used to amend the code automatically." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConflictingExtensionProperty", + "shortDescription": { + "text": "Extension property conflicting with synthetic one" + }, + "fullDescription": { + "text": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java 'get' or 'set' methods. Such properties should be either removed or renamed to avoid breaking code by future changes in the compiler. A quick-fix deletes an extention property. Example: 'val File.name: String\n get() = getName()' A quick-fix adds the '@Deprecated' annotation: '@Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()'", + "markdown": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java `get` or `set` methods.\n\nSuch properties should be either removed or renamed to avoid breaking code by future changes in the compiler.\n\nA quick-fix deletes an extention property.\n\n**Example:**\n\n\n val File.name: String\n get() = getName()\n\nA quick-fix adds the `@Deprecated` annotation:\n\n\n @Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceJavaStaticMethodWithKotlinAnalog", + "shortDescription": { + "text": "Java methods should be replaced with Kotlin analog" + }, + "fullDescription": { + "text": "Reports a Java method call that can be replaced with a Kotlin function, for example, 'System.out.println()'. Replacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code. The quick-fix replaces the Java method calls on the same Kotlin call. Example: 'import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }' After the quick-fix is applied: 'fun main() {\n val a = listOf(1, 3, null)\n }'", + "markdown": "Reports a Java method call that can be replaced with a Kotlin function, for example, `System.out.println()`.\n\nReplacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code.\n\nThe quick-fix replaces the Java method calls on the same Kotlin call.\n\n**Example:**\n\n\n import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = listOf(1, 3, null)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyParenthesesFromLambdaCall", + "shortDescription": { + "text": "Remove unnecessary parentheses from function call with lambda" + }, + "fullDescription": { + "text": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses. Use the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code. Examples: 'fun foo() {\n listOf(1).forEach() { }\n }' After the quick-fix is applied: 'fun foo() {\n listOf(1).forEach { }\n }'", + "markdown": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses.\n\nUse the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo() {\n listOf(1).forEach() { }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n listOf(1).forEach { }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveExplicitSuperQualifier", + "shortDescription": { + "text": "Unnecessary supertype qualification" + }, + "fullDescription": { + "text": "Reports 'super' member calls with redundant supertype qualification. Code in a derived class can call its superclass functions and property accessors implementations using the 'super' keyword. To specify the supertype from which the inherited implementation is taken, 'super' can be qualified by the supertype name in angle brackets, e.g. 'super'. Sometimes this qualification is redundant and can be omitted. Use the 'Remove explicit supertype qualification' quick-fix to clean up the code. Examples: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }' After the quick-fix is applied: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }'", + "markdown": "Reports `super` member calls with redundant supertype qualification.\n\n\nCode in a derived class can call its superclass functions and property accessors implementations using the `super` keyword.\nTo specify the supertype from which the inherited implementation is taken, `super` can be qualified by the supertype name in\nangle brackets, e.g. `super`. Sometimes this qualification is redundant and can be omitted.\nUse the 'Remove explicit supertype qualification' quick-fix to clean up the code.\n\n**Examples:**\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }\n\nAfter the quick-fix is applied:\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantExplicitType", + "shortDescription": { + "text": "Obvious explicit type" + }, + "fullDescription": { + "text": "Reports local variables' explicitly given types which are obvious and thus redundant, like 'val f: Foo = Foo()'. Example: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }' After the quick-fix is applied: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }'", + "markdown": "Reports local variables' explicitly given types which are obvious and thus redundant, like `val f: Foo = Foo()`.\n\n**Example:**\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }\n\nAfter the quick-fix is applied:\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousVarProperty", + "shortDescription": { + "text": "Suspicious 'var' property: its setter does not influence its getter result" + }, + "fullDescription": { + "text": "Reports 'var' properties with default setter and getter that do not reference backing field. Such properties do not affect calling its setter; therefore, it will be clearer to change such property to 'val' and delete the initializer. Change to val and delete initializer quick-fix can be used to amend the code automatically. Example: '// This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1'", + "markdown": "Reports `var` properties with default setter and getter that do not reference backing field.\n\n\nSuch properties do not affect calling its setter; therefore, it will be clearer to change such property to `val` and delete the initializer.\n\n**Change to val and delete initializer** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n // This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaCollectionsStaticMethod", + "shortDescription": { + "text": "Java Collections static method call can be replaced with Kotlin stdlib" + }, + "fullDescription": { + "text": "Reports a Java 'Collections' static method call that can be replaced with Kotlin stdlib. Example: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }' The quick fix replaces Java 'Collections' static method call with the corresponding Kotlin stdlib method call: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }'", + "markdown": "Reports a Java `Collections` static method call that can be replaced with Kotlin stdlib.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }\n\nThe quick fix replaces Java `Collections` static method call with the corresponding Kotlin stdlib method call:\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantAsync", + "shortDescription": { + "text": "Redundant 'async' call" + }, + "fullDescription": { + "text": "Reports 'async' calls that are immediately followed by 'await'. Such calls can be replaced with blocking calls. Example: 'suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n scope.async(ctx) { doSomeJob() }.await()\n }' After the quick-fix is applied: 'suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n withContext(scope.coroutineContext + ctx) { doSomeJob() }\n }'", + "markdown": "Reports `async` calls that are immediately followed by `await`.\nSuch calls can be replaced with blocking calls.\n\n**Example:**\n\n\n suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n scope.async(ctx) { doSomeJob() }.await()\n }\n\nAfter the quick-fix is applied:\n\n\n suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n withContext(scope.coroutineContext + ctx) { doSomeJob() }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MoveVariableDeclarationIntoWhen", + "shortDescription": { + "text": "Variable declaration could be moved inside `when`" + }, + "fullDescription": { + "text": "Reports variable declarations that can be moved inside a 'when' expression. Example: 'fun someCalc(x: Int) = x * 42\n\nfun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}' After the quick-fix is applied: 'fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}'", + "markdown": "Reports variable declarations that can be moved inside a `when` expression.\n\n**Example:**\n\n\n fun someCalc(x: Int) = x * 42\n\n fun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeferredIsResult", + "shortDescription": { + "text": "Function returning Deferred directly" + }, + "fullDescription": { + "text": "Reports functions with the 'kotlinx.coroutines.Deferred' return type. Functions that use 'Deferred' as return type should have a name with the 'Async' suffix. Otherwise, it's recommended to mark a function as 'suspend' and unwrap 'Deferred' inside it. Example: 'fun calcEverything(): Deferred {\n return CompletableDeferred(42)\n }' After the quick-fix that adds the 'Async' suffix applied: 'fun calcEverythingAsync(): Deferred {\n return CompletableDeferred(42)\n }' After the quick-fix that converts the function into a 'suspend' one applied: 'suspend fun calcEverything(): Int {\n return CompletableDeferred(42).await()\n }'", + "markdown": "Reports functions with the `kotlinx.coroutines.Deferred` return type.\n\n\nFunctions that use `Deferred` as return type should have a name with the `Async` suffix.\nOtherwise, it's recommended to mark a function as `suspend` and unwrap `Deferred` inside it.\n\n**Example:**\n\n\n fun calcEverything(): Deferred {\n return CompletableDeferred(42)\n }\n\nAfter the quick-fix that adds the `Async` suffix applied:\n\n\n fun calcEverythingAsync(): Deferred {\n return CompletableDeferred(42)\n }\n\nAfter the quick-fix that converts the function into a `suspend` one applied:\n\n\n suspend fun calcEverything(): Int {\n return CompletableDeferred(42).await()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyParenthesesFromAnnotationEntry", + "shortDescription": { + "text": "Remove unnecessary parentheses" + }, + "fullDescription": { + "text": "Reports redundant empty parentheses in annotation entries. Use the 'Remove unnecessary parentheses' quick-fix to clean up the code. Examples: 'annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }'", + "markdown": "Reports redundant empty parentheses in annotation entries.\n\nUse the 'Remove unnecessary parentheses' quick-fix to clean up the code.\n\n**Examples:**\n\n\n annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifiableCallChain", + "shortDescription": { + "text": "Call chain on collection type can be simplified" + }, + "fullDescription": { + "text": "Reports two-call chains replaceable by a single call. It can help you to avoid redundant code execution. The quick-fix replaces the call chain with a single call. Example: 'fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }' After the quick-fix is applied: 'fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }'", + "markdown": "Reports two-call chains replaceable by a single call.\n\nIt can help you to avoid redundant code execution.\n\nThe quick-fix replaces the call chain with a single call.\n\n**Example:**\n\n\n fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceCallWithBinaryOperator", + "shortDescription": { + "text": "Can be replaced with binary operator" + }, + "fullDescription": { + "text": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones. Example: 'fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }' After the quick-fix is applied: 'fun test(): Boolean {\n return 2 > 1\n }'", + "markdown": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones.\n\n**Example:**\n\n fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }\n\nAfter the quick-fix is applied:\n\n fun test(): Boolean {\n return 2 > 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedUnaryOperator", + "shortDescription": { + "text": "Unused unary operator" + }, + "fullDescription": { + "text": "Reports unary operators for number types on unused expressions. Unary operators break previous expression if they are used without braces. As a result, mathematical expressions spanning multi lines can be misleading. Example: 'fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }'", + "markdown": "Reports unary operators for number types on unused expressions.\n\nUnary operators break previous expression if they are used without braces.\nAs a result, mathematical expressions spanning multi lines can be misleading.\n\nExample:\n\n\n fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ClassName", + "shortDescription": { + "text": "Class naming convention" + }, + "fullDescription": { + "text": "Reports class names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, class names should start with an uppercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'class user(val name: String)' A quick-fix renames the class according to the Kotlin naming conventions: 'class User(val name: String)'", + "markdown": "Reports class names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nclass names should start with an uppercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n class user(val name: String)\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n class User(val name: String)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyPrimaryConstructor", + "shortDescription": { + "text": "Redundant empty primary constructor" + }, + "fullDescription": { + "text": "Reports empty primary constructors when they are implicitly available anyway. A primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers. Use the 'Remove empty primary constructor' quick-fix to clean up the code. Examples: 'class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier'", + "markdown": "Reports empty primary constructors when they are implicitly available anyway.\n\n\nA primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers.\nUse the 'Remove empty primary constructor' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptySecondaryConstructorBody", + "shortDescription": { + "text": "Redundant constructor body" + }, + "fullDescription": { + "text": "Reports empty bodies of secondary constructors.", + "markdown": "Reports empty bodies of secondary constructors." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FloatingPointLiteralPrecision", + "shortDescription": { + "text": "Floating-point literal exceeds the available precision" + }, + "fullDescription": { + "text": "Reports floating-point literals that cannot be represented with the required precision using IEEE 754 'Float' and 'Double' types. For example, '1.9999999999999999999' has too many significant digits, so its representation as a 'Double' will be rounded to '2.0'. Specifying excess digits may be misleading as it hides the fact that computations use rounded values instead. The quick-fix replaces the literal with a rounded value that matches the actual representation of the constant. Example: 'val x: Float = 3.14159265359f' After the quick-fix is applied: 'val x: Float = 3.1415927f'", + "markdown": "Reports floating-point literals that cannot be represented with the required precision using [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) `Float` and `Double` types.\n\n\nFor example, `1.9999999999999999999` has too many significant digits,\nso its representation as a `Double` will be rounded to `2.0`.\nSpecifying excess digits may be misleading as it hides the fact that computations\nuse rounded values instead.\n\n\nThe quick-fix replaces the literal with a rounded value that matches the actual representation\nof the constant.\n\n**Example:**\n\n\n val x: Float = 3.14159265359f\n\nAfter the quick-fix is applied:\n\n\n val x: Float = 3.1415927f\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertPairConstructorToToFunction", + "shortDescription": { + "text": "Convert Pair constructor to 'to' function" + }, + "fullDescription": { + "text": "Reports a 'Pair' constructor invocation that can be replaced with a 'to()' infix function call. Explicit constructor invocations may add verbosity, especially if they are used multiple times. Replacing constructor calls with 'to()' makes code easier to read and maintain. Example: 'val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )' After the quick-fix is applied: 'val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )'", + "markdown": "Reports a `Pair` constructor invocation that can be replaced with a `to()` infix function call.\n\n\nExplicit constructor invocations may add verbosity, especially if they are used multiple times.\nReplacing constructor calls with `to()` makes code easier to read and maintain.\n\n**Example:**\n\n\n val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )\n\nAfter the quick-fix is applied:\n\n\n val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantGetter", + "shortDescription": { + "text": "Redundant property getter" + }, + "fullDescription": { + "text": "Reports redundant property getters. Example: 'class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }' After the quick-fix is applied: 'class Test {\n val a = 1\n val b = 1\n }'", + "markdown": "Reports redundant property getters.\n\n**Example:**\n\n\n class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n val a = 1\n val b = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantIf", + "shortDescription": { + "text": "Redundant 'if' statement" + }, + "fullDescription": { + "text": "Reports 'if' statements which can be simplified to a single statement. Example: 'fun test() {\n if (foo()) {\n return true\n } else {\n return false\n }\n }' After the quick-fix is applied: 'fun test() {\n return foo()\n }'", + "markdown": "Reports `if` statements which can be simplified to a single statement.\n\n**Example:**\n\n\n fun test() {\n if (foo()) {\n return true\n } else {\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n return foo()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KDocMissingDocumentation", + "shortDescription": { + "text": "Missing KDoc comments for public declarations" + }, + "fullDescription": { + "text": "Reports public declarations that do not have KDoc comments. Example: 'class A' The quick fix generates the comment block above the declaration: '/**\n *\n */\n class A'", + "markdown": "Reports public declarations that do not have KDoc comments.\n\n**Example:**\n\n\n class A\n\nThe quick fix generates the comment block above the declaration:\n\n\n /**\n *\n */\n class A\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveExplicitTypeArguments", + "shortDescription": { + "text": "Unnecessary type argument" + }, + "fullDescription": { + "text": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted. Use the 'Remove explicit type arguments' quick-fix to clean up the code. Examples: '// 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()' After the quick-fix is applied: 'fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()'", + "markdown": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted.\n\nUse the 'Remove explicit type arguments' quick-fix to clean up the code.\n\n**Examples:**\n\n\n // 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()\n\nAfter the quick-fix is applied:\n\n\n fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantVisibilityModifier", + "shortDescription": { + "text": "Redundant visibility modifier" + }, + "fullDescription": { + "text": "Reports visibility modifiers that match the default visibility of an element ('public' for most elements, 'protected' for members that override a protected member).", + "markdown": "Reports visibility modifiers that match the default visibility of an element (`public` for most elements, `protected` for members that override a protected member)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UsePropertyAccessSyntax", + "shortDescription": { + "text": "Accessor call that can be replaced with property access syntax" + }, + "fullDescription": { + "text": "Reports Java 'get' and 'set' method calls that can be replaced with the Kotlin synthetic properties. Use property access syntax quick-fix can be used to amen the code automatically. Example: '// Java:\n public class JavaClassWithGetter {\n private final String expr = \"result\";\n\n // ...\n\n public String getExpr() {\n return expr;\n }\n }' '// Kotlin:\n fun test(j: JavaClassWithGetter) {\n // ...\n j.getExpr() // <== A quick-fix simplifies the expression to 'j.expr'\n }'", + "markdown": "Reports Java `get` and `set` method calls that can be replaced with the Kotlin synthetic properties.\n\n**Use property access syntax** quick-fix can be used to amen the code automatically.\n\nExample:\n\n\n // Java:\n public class JavaClassWithGetter {\n private final String expr = \"result\";\n\n // ...\n\n public String getExpr() {\n return expr;\n }\n }\n\n\n // Kotlin:\n fun test(j: JavaClassWithGetter) {\n // ...\n j.getExpr() // <== A quick-fix simplifies the expression to 'j.expr'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UseExpressionBody", + "shortDescription": { + "text": "Expression body syntax is preferable here" + }, + "fullDescription": { + "text": "Reports 'return' expressions (one-liners or 'when') that can be replaced with expression body syntax. Expression body syntax is recommended by the style guide. Convert to expression body quick-fix can be used to amend the code automatically. Example: 'fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }' After the quick-fix is applied: 'fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }'", + "markdown": "Reports `return` expressions (one-liners or `when`) that can be replaced with expression body syntax.\n\nExpression body syntax is recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#functions).\n\n**Convert to expression body** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MapGetWithNotNullAssertionOperator", + "shortDescription": { + "text": "'map.get()' with not-null assertion operator (!!)" + }, + "fullDescription": { + "text": "Reports 'map.get()!!' that can be replaced with 'map.getValue()', 'map.getOrElse()', and so on. Example: 'fun test(map: Map): String = map.get(0)!!' After the quick-fix is applied: 'fun test(map: Map): String = map.getValue(0)'", + "markdown": "Reports `map.get()!!` that can be replaced with `map.getValue()`, `map.getOrElse()`, and so on.\n\n**Example:**\n\n\n fun test(map: Map): String = map.get(0)!!\n\nAfter the quick-fix is applied:\n\n\n fun test(map: Map): String = map.getValue(0)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SortModifiers", + "shortDescription": { + "text": "Non-canonical modifier order" + }, + "fullDescription": { + "text": "Reports modifiers that do not follow the order recommended by the style guide. Sort modifiers quick-fix can be used to amend the code automatically. Examples: 'private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"'", + "markdown": "Reports modifiers that do not follow the order recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#modifiers-order).\n\n**Sort modifiers** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EnumEntryName", + "shortDescription": { + "text": "Enum entry naming convention" + }, + "fullDescription": { + "text": "Reports enum entry names that do not follow the recommended naming conventions. Example: 'enum class Foo {\n _Foo,\n foo\n }' To fix the problem rename enum entries to match the recommended naming conventions.", + "markdown": "Reports enum entry names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n enum class Foo {\n _Foo,\n foo\n }\n\nTo fix the problem rename enum entries to match the recommended naming conventions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithDropLast", + "shortDescription": { + "text": "'substring' call should be replaced with 'dropLast' call" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, s.length - x)' that can be replaced with 's.dropLast(x)'. Using corresponding functions makes your code simpler. The quick-fix replaces the 'substring' call with 'dropLast'. Example: 'fun foo(s: String) {\n s.substring(0, s.length - 5)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.dropLast(5)\n }'", + "markdown": "Reports calls like `s.substring(0, s.length - x)` that can be replaced with `s.dropLast(x)`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `dropLast`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.length - 5)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.dropLast(5)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SetterBackingFieldAssignment", + "shortDescription": { + "text": "Existing backing field without assignment" + }, + "fullDescription": { + "text": "Reports property setters that don't update the backing field. The quick-fix adds an assignment to the backing field. Example: 'class Test {\n var foo: Int = 1\n set(value) {\n }\n }' After the quick-fix is applied: 'class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }'", + "markdown": "Reports property setters that don't update the backing field.\n\nThe quick-fix adds an assignment to the backing field.\n\n**Example:**\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CopyWithoutNamedArguments", + "shortDescription": { + "text": "'copy' method of data class is called without named arguments" + }, + "fullDescription": { + "text": "Reports calls to a data class' 'copy()' method without named arguments. As all arguments of the 'copy()' function are optional, it might be hard to understand what properties are modified. Providing parameter names explicitly makes code easy to understand without navigating to the 'data class' declaration. Example: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }' A quick-fix provides parameter names to all 'copy()' arguments: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }'", + "markdown": "Reports calls to a data class' `copy()` method without named arguments.\n\n\nAs all arguments of the `copy()` function are optional, it might be hard to understand what properties are modified.\nProviding parameter names explicitly makes code easy to understand without navigating to the `data class` declaration.\n\n**Example:**\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }\n\nA quick-fix provides parameter names to all `copy()` arguments:\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinDeprecation", + "shortDescription": { + "text": "Usage of redundant or deprecated syntax or deprecated symbols" + }, + "fullDescription": { + "text": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (Code | Code Cleanup). A quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax. It also replaces deprecated symbols with their proposed substitutions.", + "markdown": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (**Code \\| Code Cleanup** ).\n\n\nA quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax.\n\n\nIt also replaces deprecated symbols with their proposed substitutions." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithTake", + "shortDescription": { + "text": "'substring' call should be replaced with 'take' call" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, x)' that can be replaced with 's.take(x)'. Using 'take()' makes your code simpler. The quick-fix replaces the 'substring' call with 'take()'. Example: 'fun foo(s: String) {\n s.substring(0, 10)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.take(10)\n }'", + "markdown": "Reports calls like `s.substring(0, x)` that can be replaced with `s.take(x)`.\n\nUsing `take()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `take()`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, 10)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.take(10)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertCallChainIntoSequence", + "shortDescription": { + "text": "Call chain on collection could be converted into 'Sequence' to improve performance" + }, + "fullDescription": { + "text": "Reports call chain on a 'Collection' that should be converted into Sequence. Each 'Collection' transforming function (such as 'map()' or 'filter()') creates a new 'Collection' (typically 'List' or 'Set') under the hood. In case of multiple consequent calls, and a huge number of items in 'Collection', memory traffic might be significant. In such a case, using 'Sequence' is preferred. Example: 'class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }' A quick-fix wraps call chain into 'asSequence()' and 'toList()': 'class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()'", + "markdown": "Reports call chain on a `Collection` that should be converted into **Sequence** .\n\nEach `Collection` transforming function (such as `map()` or `filter()`) creates a new\n`Collection` (typically `List` or `Set`) under the hood.\nIn case of multiple consequent calls, and a huge number of items in `Collection`, memory traffic might be significant.\nIn such a case, using `Sequence` is preferred.\n\n**Example:**\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n\nA quick-fix wraps call chain into `asSequence()` and `toList()`:\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AddOperatorModifier", + "shortDescription": { + "text": "Function should have 'operator' modifier" + }, + "fullDescription": { + "text": "Reports a function that matches one of the operator conventions but lacks the 'operator' keyword. By adding the 'operator' modifier, you might allow function consumers to write idiomatic Kotlin code. Example: 'class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }' A quick-fix adds the 'operator' modifier keyword: 'class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }'", + "markdown": "Reports a function that matches one of the operator conventions but lacks the `operator` keyword.\n\nBy adding the `operator` modifier, you might allow function consumers to write idiomatic Kotlin code.\n\n**Example:**\n\n\n class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }\n\nA quick-fix adds the `operator` modifier keyword:\n\n\n class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MayBeConstant", + "shortDescription": { + "text": "Might be 'const'" + }, + "fullDescription": { + "text": "Reports top-level 'val' properties in objects that might be declared as 'const' for better performance and Java interoperability. Example: 'object A {\n val foo = 1\n }' After the quick-fix is applied: 'object A {\n const val foo = 1\n }'", + "markdown": "Reports top-level `val` properties in objects that might be declared as `const` for better performance and Java interoperability.\n\n**Example:**\n\n\n object A {\n val foo = 1\n }\n\nAfter the quick-fix is applied:\n\n\n object A {\n const val foo = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceIsEmptyWithIfEmpty", + "shortDescription": { + "text": "'if' condition can be replaced with lambda call" + }, + "fullDescription": { + "text": "Reports 'isEmpty', 'isBlank', 'isNotEmpty', or 'isNotBlank' calls in an 'if' statement to assign a default value. The quick-fix replaces the 'if' condition with 'ifEmpty' or 'ifBlank' calls. Example: 'fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }' After the quick-fix is applied: 'fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }' This inspection only reports if the Kotlin language version of the project or module is 1.3 or higher.", + "markdown": "Reports `isEmpty`, `isBlank`, `isNotEmpty`, or `isNotBlank` calls in an `if` statement to assign a default value.\n\nThe quick-fix replaces the `if` condition with `ifEmpty` or `ifBlank` calls.\n\n**Example:**\n\n\n fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }\n\nThis inspection only reports if the Kotlin language version of the project or module is 1.3 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithImportAlias", + "shortDescription": { + "text": "Fully qualified name can be replaced with existing import alias" + }, + "fullDescription": { + "text": "Reports fully qualified names that can be replaced with an existing import alias. Example: 'import foo.Foo as Bar\nfun main() {\n foo.Foo()\n}' After the quick-fix is applied: 'import foo.Foo as Bar\nfun main() {\n Bar()\n}'", + "markdown": "Reports fully qualified names that can be replaced with an existing import alias.\n\n**Example:**\n\n\n import foo.Foo as Bar\n fun main() {\n foo.Foo()\n }\n\nAfter the quick-fix is applied:\n\n\n import foo.Foo as Bar\n fun main() {\n Bar()\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyBooleanWithConstants", + "shortDescription": { + "text": "Boolean expression can be simplified" + }, + "fullDescription": { + "text": "Reports boolean expression parts that can be reduced to constants. The quick-fix simplifies the condition. Example: 'fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }' After the quick-fix is applied: 'fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }'", + "markdown": "Reports boolean expression parts that can be reduced to constants.\n\nThe quick-fix simplifies the condition.\n\n**Example:**\n\n\n fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantModalityModifier", + "shortDescription": { + "text": "Redundant modality modifier" + }, + "fullDescription": { + "text": "Reports the modality modifiers that match the default modality of an element ('final' for most elements, 'open' for members with an 'override'). Example: 'final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }' After the quick-fix is applied: 'class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }'", + "markdown": "Reports the modality modifiers that match the default modality of an element (`final` for most elements, `open` for members with an `override`).\n\n**Example:**\n\n\n final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyAssertNotNull", + "shortDescription": { + "text": "'assert' call can be replaced with '!!' or '?:'" + }, + "fullDescription": { + "text": "Reports 'assert' calls that check a not null value of the declared variable. Using '!!' or '?:' makes your code simpler. The quick-fix replaces 'assert' with '!!' or '?:' operator in the variable initializer. Example: 'fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }' After the quick-fix is applied: 'fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }'", + "markdown": "Reports `assert` calls that check a not null value of the declared variable.\n\nUsing `!!` or `?:` makes your code simpler.\n\nThe quick-fix replaces `assert` with `!!` or `?:` operator in the variable initializer.\n\n**Example:**\n\n\n fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertNaNEquality", + "shortDescription": { + "text": "Convert equality check with 'NaN' to 'isNaN' call" + }, + "fullDescription": { + "text": "Reports an equality check with 'Float.NaN' or 'Double.NaN' that should be replaced with an 'isNaN()' check. According to IEEE 754, equality check against NaN always returns 'false', even for 'NaN == NaN'. Therefore, such a check is likely to be a mistake. A quick-fix replaces comparison with 'isNaN()' check that uses a different comparison technique and handles 'NaN' values correctly. Example: 'fun check(value: Double): Boolean {\n return Double.NaN == value\n }' After the fix is applied: 'fun check(value: Double): Boolean {\n return value.isNaN()\n }'", + "markdown": "Reports an equality check with `Float.NaN` or `Double.NaN` that should be replaced with an `isNaN()` check.\n\n\nAccording to IEEE 754, equality check against NaN always returns `false`, even for `NaN == NaN`.\nTherefore, such a check is likely to be a mistake.\n\nA quick-fix replaces comparison with `isNaN()` check that uses a different comparison technique and handles `NaN` values correctly.\n\n**Example:**\n\n\n fun check(value: Double): Boolean {\n return Double.NaN == value\n }\n\nAfter the fix is applied:\n\n\n fun check(value: Double): Boolean {\n return value.isNaN()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceManualRangeWithIndicesCalls", + "shortDescription": { + "text": "Range can be converted to indices or iteration" + }, + "fullDescription": { + "text": "Reports 'until' and 'rangeTo' operators that can be replaced with 'Collection.indices' or iteration over collection inside 'for' loop. Using syntactic sugar makes your code simpler. The quick-fix replaces the manual range with the corresponding construction. Example: 'fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }' After the quick-fix is applied: 'fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }'", + "markdown": "Reports `until` and `rangeTo` operators that can be replaced with `Collection.indices` or iteration over collection inside `for` loop.\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces the manual range with the corresponding construction.\n\n**Example:**\n\n\n fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinLoggerInitializedWithForeignClass", + "shortDescription": { + "text": "Logger initialized with foreign class" + }, + "fullDescription": { + "text": "Reports 'Logger' instances initialized with a class literal other than the class the 'Logger' resides in. This can happen when copy-pasting from another class. It may result in logging events under an unexpected category and incorrect filtering. Use the inspection options to specify the logger factory classes and methods recognized by this inspection. Example: 'class AnotherService\nclass MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n}' After the quick-fix is applied: 'class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n}'", + "markdown": "Reports `Logger` instances initialized with a class literal other than the class the `Logger` resides in.\n\n\nThis can happen when copy-pasting from another class.\nIt may result in logging events under an unexpected category and incorrect filtering.\n\n\nUse the inspection options to specify the logger factory classes and methods recognized by this inspection.\n\n**Example:**\n\n\n class AnotherService\n class MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n }\n\nAfter the quick-fix is applied:\n\n\n class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Logging", + "index": 158, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantAsSequence", + "shortDescription": { + "text": "Redundant 'asSequence' call" + }, + "fullDescription": { + "text": "Reports redundant 'asSequence()' call that can never have a positive performance effect. 'asSequence()' speeds up collection processing that includes multiple operations because it performs operations lazily and doesn't create intermediate collections. However, if a terminal operation (such as 'toList()') is used right after 'asSequence()', this doesn't give you any positive performance effect. Example: 'fun test(list: List) {\n list.asSequence().last()\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.last()\n }'", + "markdown": "Reports redundant `asSequence()` call that can never have a positive performance effect.\n\n\n`asSequence()` speeds up collection processing that includes multiple operations because it performs operations lazily\nand doesn't create intermediate collections.\n\n\nHowever, if a terminal operation (such as `toList()`) is used right after `asSequence()`, this doesn't give\nyou any positive performance effect.\n\n**Example:**\n\n\n fun test(list: List) {\n list.asSequence().last()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.last()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveToStringInStringTemplate", + "shortDescription": { + "text": "Redundant call to 'toString()' in string template" + }, + "fullDescription": { + "text": "Reports calls to 'toString()' in string templates that can be safely removed. Example: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }'", + "markdown": "Reports calls to `toString()` in string templates that can be safely removed.\n\n**Example:**\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }\n\nAfter the quick-fix is applied:\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinUnusedImport", + "shortDescription": { + "text": "Unused import directive" + }, + "fullDescription": { + "text": "Reports redundant 'import' statements. Default and unused imports can be safely removed. Example: 'import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }'", + "markdown": "Reports redundant `import` statements.\n\nDefault and unused imports can be safely removed.\n\n**Example:**\n\n\n import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBePrimaryConstructorProperty", + "shortDescription": { + "text": "Property is explicitly assigned to constructor parameter" + }, + "fullDescription": { + "text": "Reports properties that are explicitly assigned to primary constructor parameters. Properties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability. Example: 'class User(name: String) {\n val name = name\n }' A quick-fix joins the parameter and property declaration into a primary constructor parameter: 'class User(val name: String) {\n }'", + "markdown": "Reports properties that are explicitly assigned to primary constructor parameters.\n\nProperties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability.\n\n**Example:**\n\n\n class User(name: String) {\n val name = name\n }\n\nA quick-fix joins the parameter and property declaration into a primary constructor parameter:\n\n\n class User(val name: String) {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaMapForEach", + "shortDescription": { + "text": "Java Map.forEach method call should be replaced with Kotlin's forEach" + }, + "fullDescription": { + "text": "Reports a Java Map.'forEach' method call that can be replaced with Kotlin's forEach. Example: 'fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}' The quick fix removes parentheses: 'fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}'", + "markdown": "Reports a Java Map.`forEach` method call that can be replaced with Kotlin's **forEach** .\n\n**Example:**\n\n\n fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n\nThe quick fix removes parentheses:\n\n\n fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantObjectTypeCheck", + "shortDescription": { + "text": "Non-idiomatic 'is' type check for an object" + }, + "fullDescription": { + "text": "Reports non-idiomatic 'is' type checks for an object. It's recommended to replace such checks with reference comparison. Example: 'object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }' After the quick-fix is applied: 'object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }'", + "markdown": "Reports non-idiomatic `is` type checks for an object.\n\nIt's recommended to replace such checks with reference comparison.\n\n**Example:**\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }\n\nAfter the quick-fix is applied:\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspendFunctionOnCoroutineScope", + "shortDescription": { + "text": "Ambiguous coroutineContext due to CoroutineScope receiver of suspend function" + }, + "fullDescription": { + "text": "Reports calls and accesses of 'CoroutineScope' extensions or members inside suspend functions with 'CoroutineScope' receiver. When a function is 'suspend' and has 'CoroutineScope' receiver, it has ambiguous access to 'CoroutineContext' via 'kotlin.coroutines.coroutineContext' and via 'CoroutineScope.coroutineContext', and two these contexts are different in general. To improve this situation, one can wrap suspicious call inside 'coroutineScope { ... }' or get rid of 'CoroutineScope' function receiver.", + "markdown": "Reports calls and accesses of `CoroutineScope` extensions or members inside suspend functions with `CoroutineScope` receiver.\n\nWhen a function is `suspend` and has `CoroutineScope` receiver,\nit has ambiguous access to `CoroutineContext` via `kotlin.coroutines.coroutineContext` and via `CoroutineScope.coroutineContext`,\nand two these contexts are different in general.\n\n\nTo improve this situation, one can wrap suspicious call inside `coroutineScope { ... }` or\nget rid of `CoroutineScope` function receiver." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentMavenStdlibVersion", + "shortDescription": { + "text": "Library and maven plugin versions are different" + }, + "fullDescription": { + "text": "Reports different Kotlin stdlib and compiler versions. Using different versions of the Kotlin compiler and the standard library can lead to unpredictable runtime problems and should be avoided.", + "markdown": "Reports different Kotlin stdlib and compiler versions.\n\nUsing different versions of the Kotlin compiler and the standard library can lead to unpredictable\nruntime problems and should be avoided." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ImplicitNullableNothingType", + "shortDescription": { + "text": "Implicit `Nothing?` type" + }, + "fullDescription": { + "text": "Reports variables and functions with the implicit Nothing? type. Example: 'fun foo() = null' The quick fix specifies the return type explicitly: 'fun foo(): Nothing? = null'", + "markdown": "Reports variables and functions with the implicit **Nothing?** type.\n\n**Example:**\n\n\n fun foo() = null\n\nThe quick fix specifies the return type explicitly:\n\n\n fun foo(): Nothing? = null\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceAssociateFunction", + "shortDescription": { + "text": "'associate' can be replaced with 'associateBy' or 'associateWith'" + }, + "fullDescription": { + "text": "Reports calls to 'associate()' and 'associateTo()' that can be replaced with 'associateBy()' or 'associateWith()'. Both functions accept a transformer function applied to elements of a given sequence or collection (as a receiver). The pairs are then used to build the resulting 'Map'. Given the transformer refers to 'it', the 'associate[To]()' call can be replaced with more performant 'associateBy()' or 'associateWith()'. Examples: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }' After the quick-fix is applied: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }'", + "markdown": "Reports calls to `associate()` and `associateTo()` that can be replaced with `associateBy()` or `associateWith()`.\n\n\nBoth functions accept a transformer function applied to elements of a given sequence or collection (as a receiver).\nThe pairs are then used to build the resulting `Map`.\n\n\nGiven the transformer refers to `it`, the `associate[To]()` call can be replaced with more performant `associateBy()`\nor `associateWith()`.\n\n**Examples:**\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }\n\nAfter the quick-fix is applied:\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObsoleteExperimentalCoroutines", + "shortDescription": { + "text": "Experimental coroutines usages are deprecated since 1.3" + }, + "fullDescription": { + "text": "Reports code that uses experimental coroutines. Such usages are incompatible with Kotlin 1.3+ and should be updated.", + "markdown": "Reports code that uses experimental coroutines.\n\nSuch usages are incompatible with Kotlin 1.3+ and should be updated." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LiftReturnOrAssignment", + "shortDescription": { + "text": "Return or assignment can be lifted out" + }, + "fullDescription": { + "text": "Reports 'if', 'when', and 'try' statements that can be converted to expressions by lifting the 'return' statement or an assignment out. Example: 'fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }' After the quick-fix is applied: 'fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }'", + "markdown": "Reports `if`, `when`, and `try` statements that can be converted to expressions by lifting the `return` statement or an assignment out.\n\n**Example:**\n\n\n fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyWhenWithBooleanConstantCondition", + "shortDescription": { + "text": "Simplifiable 'when'" + }, + "fullDescription": { + "text": "Reports 'when' expressions with the constant 'true' or 'false' branches. Simplify \"when\" quick-fix can be used to amend the code automatically. Examples: 'fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }'", + "markdown": "Reports `when` expressions with the constant `true` or `false` branches.\n\n**Simplify \"when\"** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinConstantConditions", + "shortDescription": { + "text": "Constant conditions" + }, + "fullDescription": { + "text": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable 'when' branches and some expressions that are statically known to fail always. Examples: 'fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n}\nfun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n}' New in 2021.3", + "markdown": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable `when` branches and some expressions that are statically known to fail always.\n\nExamples:\n\n\n fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n }\n fun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n }\n\nNew in 2021.3" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ForEachParameterNotUsed", + "shortDescription": { + "text": "Iterated elements are not used in forEach" + }, + "fullDescription": { + "text": "Reports 'forEach' loops that do not use iterable values. Example: 'listOf(1, 2, 3).forEach { }' The quick fix introduces anonymous parameter in the 'forEach' section: 'listOf(1, 2, 3).forEach { _ -> }'", + "markdown": "Reports `forEach` loops that do not use iterable values.\n\n**Example:**\n\n\n listOf(1, 2, 3).forEach { }\n\nThe quick fix introduces anonymous parameter in the `forEach` section:\n\n\n listOf(1, 2, 3).forEach { _ -> }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LeakingThis", + "shortDescription": { + "text": "Leaking 'this' in constructor" + }, + "fullDescription": { + "text": "Reports unsafe operations with 'this' during object construction including: Accessing a non-final property during class initialization: from a constructor or property initialization Calling a non-final function during class initialization Using 'this' as a function argument in a constructor of a non-final class If other classes inherit from the given class, they may not be fully initialized at the moment when an unsafe operation is carried out. Example: 'abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }'", + "markdown": "Reports unsafe operations with `this` during object construction including:\n\n* Accessing a non-final property during class initialization: from a constructor or property initialization\n* Calling a non-final function during class initialization\n* Using `this` as a function argument in a constructor of a non-final class\n\n\nIf other classes inherit from the given class,\nthey may not be fully initialized at the moment when an unsafe operation is carried out.\n\n**Example:**\n\n\n abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AddVarianceModifier", + "shortDescription": { + "text": "Type parameter can have 'in' or 'out' variance" + }, + "fullDescription": { + "text": "Reports type parameters that can have 'in' or 'out' variance. Using 'in' and 'out' variance provides more precise type inference in Kotlin and clearer code semantics. Example: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }' A quick-fix adds the matching variance modifier: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }'", + "markdown": "Reports type parameters that can have `in` or `out` variance.\n\nUsing `in` and `out` variance provides more precise type inference in Kotlin and clearer code semantics.\n\n**Example:**\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }\n\nA quick-fix adds the matching variance modifier:\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveForLoopIndices", + "shortDescription": { + "text": "Unused loop index" + }, + "fullDescription": { + "text": "Reports 'for' loops iterating over a collection using the 'withIndex()' function and not using the index variable. Use the \"Remove indices in 'for' loop\" quick-fix to clean up the code. Examples: 'fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }' After the quick-fix is applied: 'fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }'", + "markdown": "Reports `for` loops iterating over a collection using the `withIndex()` function and not using the index variable.\n\nUse the \"Remove indices in 'for' loop\" quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSuspendModifier", + "shortDescription": { + "text": "Redundant 'suspend' modifier" + }, + "fullDescription": { + "text": "Reports 'suspend' modifier as redundant if no other suspending functions are called inside.", + "markdown": "Reports `suspend` modifier as redundant if no other suspending functions are called inside." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousAsDynamic", + "shortDescription": { + "text": "Suspicious 'asDynamic' member invocation" + }, + "fullDescription": { + "text": "Reports usages of 'asDynamic' function on a receiver of dynamic type. 'asDynamic' function has no effect for expressions of dynamic type. 'asDynamic' function on a receiver of dynamic type can lead to runtime problems because 'asDynamic' will be executed in JavaScript environment, and such function may not be present at runtime. The intended way is to use this function on usual Kotlin type. Remove \"asDynamic\" invocation quick-fix can be used to amend the code automatically. Example: 'fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }'", + "markdown": "Reports usages of `asDynamic` function on a receiver of dynamic type.\n\n`asDynamic` function has no effect for expressions of dynamic type.\n\n`asDynamic` function on a receiver of dynamic type can lead to runtime problems because `asDynamic`\nwill be executed in JavaScript environment, and such function may not be present at runtime.\nThe intended way is to use this function on usual Kotlin type.\n\n**Remove \"asDynamic\" invocation** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FromClosedRangeMigration", + "shortDescription": { + "text": "MIN_VALUE step in fromClosedRange() since 1.3" + }, + "fullDescription": { + "text": "Reports 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. It is prohibited to call 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. All such calls should be checked during migration to Kotlin 1.3+. Example: 'IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)' To fix the problem change the step of the progression.", + "markdown": "Reports `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with `MIN_VALUE` step.\n\n\nIt is prohibited to call `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with\n`MIN_VALUE` step. All such calls should be checked during migration to Kotlin 1.3+.\n\n**Example:**\n\n\n IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)\n\nTo fix the problem change the step of the progression." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantBackticks", + "shortDescription": { + "text": "Redundant backticks" + }, + "fullDescription": { + "text": "Reports redundant backticks in references. Some of the Kotlin keywords are valid identifiers in Java, for example: 'in', 'object', 'is'. If a Java library uses a Kotlin keyword for a method, you can still call the method escaping it with the backtick character ('`'), for example, 'foo.`is`(bar)'. Sometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is paired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code. Examples: 'fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks'", + "markdown": "Reports redundant backticks in references.\n\n\nSome of the Kotlin keywords are valid identifiers in Java, for example: `in`, `object`, `is`.\nIf a Java library uses a Kotlin keyword for a method, you can still call the method escaping it\nwith the backtick character (`````), for example, ``foo.`is`(bar)``.\nSometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is\npaired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code.\n\n**Examples:**\n\n\n fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyNestedEachInScopeFunction", + "shortDescription": { + "text": "Scope function with nested forEach can be simplified" + }, + "fullDescription": { + "text": "Reports 'forEach' functions in the scope functions such as 'also' or 'apply' that can be simplified. Convert forEach call to onEach quick-fix can be used to amend the code automatically. Examples: 'fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }' After the quick-fix is applied: 'fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }'", + "markdown": "Reports `forEach` functions in the scope functions such as `also` or `apply` that can be simplified.\n\n**Convert forEach call to onEach** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnsafeCastFromDynamic", + "shortDescription": { + "text": "Implicit (unsafe) cast from dynamic type" + }, + "fullDescription": { + "text": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type.", + "markdown": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PublicApiImplicitType", + "shortDescription": { + "text": "Public API declaration with implicit return type" + }, + "fullDescription": { + "text": "Reports 'public' and 'protected' functions and properties that have an implicit return type. For API stability reasons, it's recommended to specify such types explicitly. Example: 'fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()' After the quick-fix is applied: 'fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()'", + "markdown": "Reports `public` and `protected` functions and properties that have an implicit return type.\nFor API stability reasons, it's recommended to specify such types explicitly.\n\n**Example:**\n\n\n fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n\nAfter the quick-fix is applied:\n\n\n fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceMapIndexedWithListGenerator", + "shortDescription": { + "text": "Replace 'mapIndexed' with List generator" + }, + "fullDescription": { + "text": "Reports a 'mapIndexed' call that can be replaced by 'List' generator. Example: 'val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }' After the quick-fix is applied: 'val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }'", + "markdown": "Reports a `mapIndexed` call that can be replaced by `List` generator.\n\n**Example:**\n\n\n val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }\n\nAfter the quick-fix is applied:\n\n\n val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ControlFlowWithEmptyBody", + "shortDescription": { + "text": "Control flow with empty body" + }, + "fullDescription": { + "text": "Reports 'if', 'while', 'do' or 'for' statements with empty bodies. While occasionally intended, this construction is confusing and often the result of a typo. A quick-fix removes a statement. Example: 'if (a > b) {}'", + "markdown": "Reports `if`, `while`, `do` or `for` statements with empty bodies.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo.\n\nA quick-fix removes a statement.\n\n**Example:**\n\n\n if (a > b) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LoopToCallChain", + "shortDescription": { + "text": "Loop can be replaced with stdlib operations" + }, + "fullDescription": { + "text": "Reports 'for' loops that can be replaced with a sequence of stdlib operations (like 'map', 'filter', and so on). Example: 'fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n}' After the quick-fix is applied: 'fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n}'", + "markdown": "Reports `for` loops that can be replaced with a sequence of stdlib operations (like `map`, `filter`, and so on).\n\n**Example:**\n\n\n fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyClassBody", + "shortDescription": { + "text": "Replace empty class body" + }, + "fullDescription": { + "text": "Reports declarations of classes and objects with an empty body. Use the 'Remove redundant empty class body' quick-fix to clean up the code. Examples: 'class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }' After the quick fix is applied: 'class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }'", + "markdown": "Reports declarations of classes and objects with an empty body.\n\nUse the 'Remove redundant empty class body' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }\n\nAfter the quick fix is applied:\n\n\n class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBeParameter", + "shortDescription": { + "text": "Constructor parameter is never used as a property" + }, + "fullDescription": { + "text": "Reports primary constructor parameters that can have 'val' or 'var' removed. Class properties declared in the constructor increase memory consumption. If the parameter value is only used in the constructor, you can omit them. Note that the referenced object might be garbage-collected earlier. Example: 'class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }' A quick-fix removes the extra 'val' or 'var' keyword: 'class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }'", + "markdown": "Reports primary constructor parameters that can have `val` or `var` removed.\n\n\nClass properties declared in the constructor increase memory consumption.\nIf the parameter value is only used in the constructor, you can omit them.\n\nNote that the referenced object might be garbage-collected earlier.\n\n**Example:**\n\n\n class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n\nA quick-fix removes the extra `val` or `var` keyword:\n\n\n class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantReturnLabel", + "shortDescription": { + "text": "Redundant 'return' label" + }, + "fullDescription": { + "text": "Reports redundant return labels outside of lambda expressions. Example: 'fun test() {\n return@test\n }' After the quick-fix is applied: 'fun test() {\n return\n }'", + "markdown": "Reports redundant return labels outside of lambda expressions.\n\n**Example:**\n\n\n fun test() {\n return@test\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n return\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PackageName", + "shortDescription": { + "text": "Package naming convention" + }, + "fullDescription": { + "text": "Reports package names that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: names of packages are always lowercase and should not contain underscores. Example: 'org.example.project' Using multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case Example: 'org.example.myProject'", + "markdown": "Reports package names that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): names of packages are always lowercase and should not contain underscores.\n\n**Example:**\n`org.example.project`\n\nUsing multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case\n\n**Example:**\n`org.example.myProject`" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitUseSiteTargetAnnotationsOnSuperTypesMigration", + "shortDescription": { + "text": "Meaningless annotations targets on superclass" + }, + "fullDescription": { + "text": "Reports meaningless annotation targets on superclasses since Kotlin 1.4. Annotation targets such as '@get:' are meaningless on superclasses and are prohibited. Example: 'interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo' After the quick-fix is applied: 'interface Foo\n\n annotation class Ann\n\n class E : Foo' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports meaningless annotation targets on superclasses since Kotlin 1.4.\n\nAnnotation targets such as `@get:` are meaningless on superclasses and are prohibited.\n\n**Example:**\n\n\n interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo\n\nAfter the quick-fix is applied:\n\n\n interface Foo\n\n annotation class Ann\n\n class E : Foo\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithEnumMap", + "shortDescription": { + "text": "'HashMap' can be replaced with 'EnumMap'" + }, + "fullDescription": { + "text": "Reports 'hashMapOf' function or 'HashMap' constructor calls that can be replaced with an 'EnumMap' constructor call. Using 'EnumMap' constructor makes your code simpler. The quick-fix replaces the function call with the 'EnumMap' constructor call. Example: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()' After the quick-fix is applied: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)'", + "markdown": "Reports `hashMapOf` function or `HashMap` constructor calls that can be replaced with an `EnumMap` constructor call.\n\nUsing `EnumMap` constructor makes your code simpler.\n\nThe quick-fix replaces the function call with the `EnumMap` constructor call.\n\n**Example:**\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()\n\nAfter the quick-fix is applied:\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousCollectionReassignment", + "shortDescription": { + "text": "Augmented assignment creates a new collection under the hood" + }, + "fullDescription": { + "text": "Reports augmented assignment ('+=') expressions on read-only 'Collection'. Augment assignment ('+=') expression on read-only 'Collection' doesn't modify the target collection, it creates a new one under the hood which can be misleading and lead to performance issues. Change type to mutable quick-fix can be used to amend the code automatically. Example: 'fun test() {\n var list = listOf(0)\n list += 42 // new list is created, variable 'list' still contains only '0'\n }' After the quick-fix is applied: 'fun test() {\n val list = mutableListOf(0)\n list += 42\n }'", + "markdown": "Reports augmented assignment (`+=`) expressions on read-only `Collection`.\n\nAugment assignment (`+=`) expression on read-only `Collection` doesn't modify the target collection,\nit creates a new one under the hood which can be misleading and lead to performance issues.\n\n**Change type to mutable** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test() {\n var list = listOf(0)\n list += 42 // new list is created, variable 'list' still contains only '0'\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n val list = mutableListOf(0)\n list += 42\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantNotNullExtensionReceiverOfInline", + "shortDescription": { + "text": "'inline fun' extension receiver can be explicitly nullable until Kotlin 1.2" + }, + "fullDescription": { + "text": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). Thus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's recommended to make such functions to have nullable receiver. Example: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' After the quick-fix is applied: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", + "markdown": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nThus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's\nrecommended to make such functions to have nullable receiver.\n\n**Example:**\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantElvisReturnNull", + "shortDescription": { + "text": "Redundant '?: return null'" + }, + "fullDescription": { + "text": "Reports redundant '?: return null' Example: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }' After the quick-fix is applied: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }'", + "markdown": "Reports redundant `?: return null`\n\n**Example:**\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PrivatePropertyName", + "shortDescription": { + "text": "Private property naming convention" + }, + "fullDescription": { + "text": "Reports private property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, private property names should start with a lowercase letter and use camel case. Optionally, underscore prefix is allowed but only for private properties. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val _My_Cool_Property = \"\"' A quick-fix renames the class according to the Kotlin naming conventions: 'val _myCoolProperty = \"\"'", + "markdown": "Reports private property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nprivate property names should start with a lowercase letter and use camel case.\nOptionally, underscore prefix is allowed but only for **private** properties.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val _My_Cool_Property = \"\"\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val _myCoolProperty = \"\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObsoleteKotlinJsPackages", + "shortDescription": { + "text": "'kotlin.browser' and 'kotlin.dom' packages are deprecated since 1.4" + }, + "fullDescription": { + "text": "Reports usages of 'kotlin.dom' and 'kotlin.browser' packages. These packages were moved to 'kotlinx.dom' and 'kotlinx.browser' respectively in Kotlin 1.4+.", + "markdown": "Reports usages of `kotlin.dom` and `kotlin.browser` packages.\n\nThese packages were moved to `kotlinx.dom` and `kotlinx.browser`\nrespectively in Kotlin 1.4+." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CascadeIf", + "shortDescription": { + "text": "Cascade if can be replaced with when" + }, + "fullDescription": { + "text": "Reports 'if' statements with three or more branches that can be replaced with the 'when' expression. Example: 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }' A quick-fix converts the 'if' expression to 'when': 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }'", + "markdown": "Reports `if` statements with three or more branches that can be replaced with the `when` expression.\n\n**Example:**\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n\nA quick-fix converts the `if` expression to `when`:\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EmptyRange", + "shortDescription": { + "text": "Range with start greater than endInclusive is empty" + }, + "fullDescription": { + "text": "Reports ranges that are empty because the 'start' value is greater than the 'endInclusive' value. Example: 'val range = 2..1' The quick-fix changes the '..' operator to 'downTo': 'val range = 2 downTo 1'", + "markdown": "Reports ranges that are empty because the `start` value is greater than the `endInclusive` value.\n\n**Example:**\n\n\n val range = 2..1\n\nThe quick-fix changes the `..` operator to `downTo`:\n\n\n val range = 2 downTo 1\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OptionalExpectation", + "shortDescription": { + "text": "Optionally expected annotation has no actual annotation" + }, + "fullDescription": { + "text": "Reports optionally expected annotations without actual annotation in some platform modules. Example: '// common code\n@OptionalExpectation\nexpect annotation class JvmName(val name: String)\n\n@JvmName(name = \"JvmFoo\")\nfun foo() { }\n\n// jvm code\nactual annotation class JvmName(val name: String)' The inspection also reports cases when 'actual annotation class JvmName' is omitted for non-JVM platforms (for example, Native).", + "markdown": "Reports optionally expected annotations without actual annotation in some platform modules.\n\n**Example:**\n\n // common code\n @OptionalExpectation\n expect annotation class JvmName(val name: String)\n\n @JvmName(name = \"JvmFoo\")\n fun foo() { }\n\n // jvm code\n actual annotation class JvmName(val name: String)\n\nThe inspection also reports cases when `actual annotation class JvmName` is omitted for non-JVM platforms (for example, Native)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DestructuringWrongName", + "shortDescription": { + "text": "Variable in destructuring declaration uses name of a wrong data class property" + }, + "fullDescription": { + "text": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class. Example: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }' The quick-fix changes variable's name to match the name of the corresponding class field: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }'", + "markdown": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class.\n\n**Example:**\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }\n\nThe quick-fix changes variable's name to match the name of the corresponding class field:\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IfThenToSafeAccess", + "shortDescription": { + "text": "If-Then foldable to '?.'" + }, + "fullDescription": { + "text": "Reports 'if-then' expressions that can be folded into safe-access ('?.') expressions. Example: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }' The quick fix converts the 'if-then' expression into a safe-access ('?.') expression: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }'", + "markdown": "Reports `if-then` expressions that can be folded into safe-access (`?.`) expressions.\n\n**Example:**\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }\n\nThe quick fix converts the `if-then` expression into a safe-access (`?.`) expression:\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RestrictReturnStatementTargetMigration", + "shortDescription": { + "text": "Target label does not denote a function since 1.4" + }, + "fullDescription": { + "text": "Reports labels that don't points to a functions. It's forbidden to declare a target label that does not denote a function. The quick-fix removes the label. Example: 'fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }' After the quick-fix is applied: 'fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }' This inspection only reports if the language level of the project or module is 1.4 or higher.", + "markdown": "Reports labels that don't points to a functions.\n\nIt's forbidden to declare a target label that does not denote a function.\n\nThe quick-fix removes the label.\n\n**Example:**\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }\n\nAfter the quick-fix is applied:\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }\n\nThis inspection only reports if the language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MigrateDiagnosticSuppression", + "shortDescription": { + "text": "Diagnostic name should be replaced" + }, + "fullDescription": { + "text": "Reports suppressions with old diagnostic names, for example '@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")'. Some of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant. Example: '@Suppress(\"HEADER_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}' After the quick-fix is applied: '@Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}'", + "markdown": "Reports suppressions with old diagnostic names, for example `@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")`.\n\n\nSome of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant.\n\n**Example:**\n\n\n @Suppress(\"HEADER_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n\nAfter the quick-fix is applied:\n\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeferredResultUnused", + "shortDescription": { + "text": "'@Deferred' result is unused" + }, + "fullDescription": { + "text": "Reports function calls with the 'Deferred' result type if the return value is not used. If the 'Deferred' return value is not used, the call site would not wait to complete this function. Example: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }' A quick-fix provides a variable with the 'Deferred' initializer: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }'", + "markdown": "Reports function calls with the `Deferred` result type if the return value is not used.\n\nIf the `Deferred` return value is not used, the call site would not wait to complete this function.\n\n**Example:**\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }\n\nA quick-fix provides a variable with the `Deferred` initializer:\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SelfReferenceConstructorParameter", + "shortDescription": { + "text": "Constructor can never be complete" + }, + "fullDescription": { + "text": "Reports constructors with a non-null self-reference parameter. Such constructors never instantiate a class. The quick-fix converts the parameter type to nullable. Example: 'class SelfRef(val ref: SelfRef)' After the quick-fix is applied: 'class SelfRef(val ref: SelfRef?)'", + "markdown": "Reports constructors with a non-null self-reference parameter.\n\nSuch constructors never instantiate a class.\n\nThe quick-fix converts the parameter type to nullable.\n\n**Example:**\n\n\n class SelfRef(val ref: SelfRef)\n\nAfter the quick-fix is applied:\n\n\n class SelfRef(val ref: SelfRef?)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MainFunctionReturnUnit", + "shortDescription": { + "text": "Entry point function should return Unit" + }, + "fullDescription": { + "text": "Reports entry point functions with an incorrect return type (should be 'Unit'). Example: 'fun main() = \"Hello world!\"'", + "markdown": "Reports entry point functions with an incorrect return type (should be `Unit`).\n\n**Example:**\n`fun main() = \"Hello world!\"`" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousCallableReferenceInLambda", + "shortDescription": { + "text": "Suspicious callable reference used as lambda result" + }, + "fullDescription": { + "text": "Reports lambda expressions with one callable reference. It is a common error to replace a lambda with a callable reference without changing curly braces to parentheses. Example: 'listOf(1,2,3).map { it::toString }' After the quick-fix is applied: 'listOf(1,2,3).map(Int::toString)'", + "markdown": "Reports lambda expressions with one callable reference.\n\nIt is a common error to replace a lambda with a callable reference without changing curly braces to parentheses.\n\n**Example:**\n\n listOf(1,2,3).map { it::toString }\n\nAfter the quick-fix is applied:\n\n listOf(1,2,3).map(Int::toString)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertSecondaryConstructorToPrimary", + "shortDescription": { + "text": "Convert to primary constructor" + }, + "fullDescription": { + "text": "Reports a secondary constructor that can be replaced with a more concise primary constructor. Example: 'class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }' A quick-fix converts code automatically: 'class User(val name: String) {\n }'", + "markdown": "Reports a secondary constructor that can be replaced with a more concise primary constructor.\n\n**Example:**\n\n\n class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }\n\nA quick-fix converts code automatically:\n\n\n class User(val name: String) {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceGetOrSet", + "shortDescription": { + "text": "Explicit 'get' or 'set' call" + }, + "fullDescription": { + "text": "Reports explicit calls to 'get' or 'set' functions which can be replaced by an indexing operator '[]'. Kotlin allows custom implementations for the predefined set of operators on types. To overload an operator, you can mark the corresponding function with the 'operator' modifier: 'operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}' The functions above correspond to the indexing operator. Example: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }' After the quick-fix is applied: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }'", + "markdown": "Reports explicit calls to `get` or `set` functions which can be replaced by an indexing operator `[]`.\n\n\nKotlin allows custom implementations for the predefined set of operators on types.\nTo overload an operator, you can mark the corresponding function with the `operator` modifier:\n\n\n operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}\n \nThe functions above correspond to the indexing operator.\n\n**Example:**\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }\n\nAfter the quick-fix is applied:\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitRepeatedUseSiteTargetAnnotationsMigration", + "shortDescription": { + "text": "Repeated annotation which is not marked as '@Repeatable'" + }, + "fullDescription": { + "text": "Reports the repeated use of a non-'@Repeatable' annotation on property accessors. As a result of using non-'@Repeatable' annotation multiple times, both annotation usages will appear in the bytecode leading to an ambiguity in reflection calls. Since Kotlin 1.4 it's mandatory to either mark annotation as '@Repeatable' or not repeat the annotation, otherwise it will lead to compilation error. Example: 'annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports the repeated use of a non-`@Repeatable` annotation on property accessors.\n\n\nAs a result of using non-`@Repeatable` annotation multiple times, both annotation usages\nwill appear in the bytecode leading to an ambiguity in reflection calls.\n\n\nSince Kotlin 1.4 it's mandatory to either mark annotation as `@Repeatable` or not\nrepeat the annotation, otherwise it will lead to compilation error.\n\n**Example:**\n\n\n annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Destructure", + "shortDescription": { + "text": "Use destructuring declaration" + }, + "fullDescription": { + "text": "Reports declarations that can be destructured. Example: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }' The quick-fix destructures the declaration and introduces new variables with names from the corresponding class: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }'", + "markdown": "Reports declarations that can be destructured.\n\n**Example:**\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }\n\nThe quick-fix destructures the declaration and introduces new variables with names from the corresponding class:\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedReceiverParameter", + "shortDescription": { + "text": "Unused receiver parameter" + }, + "fullDescription": { + "text": "Reports receiver parameter of extension functions and properties that is not used. Remove redundant receiver parameter can be used to amend the code automatically.", + "markdown": "Reports receiver parameter of extension functions and properties that is not used.\n\n**Remove redundant receiver parameter** can be used to amend the code automatically." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertTryFinallyToUseCall", + "shortDescription": { + "text": "Convert try / finally to use() call" + }, + "fullDescription": { + "text": "Reports a 'try-finally' block with 'resource.close()' in 'finally' which can be converted to a 'resource.use()' call. 'use()' is easier to read and less error-prone as there is no need in explicit 'close()' call. Example: 'fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }' After the quick-fix applied: 'fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }'", + "markdown": "Reports a `try-finally` block with `resource.close()` in `finally` which can be converted to a `resource.use()` call.\n\n`use()` is easier to read and less error-prone as there is no need in explicit `close()` call.\n\n**Example:**\n\n\n fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }\n\nAfter the quick-fix applied:\n\n\n fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinRedundantOverride", + "shortDescription": { + "text": "Redundant overriding method" + }, + "fullDescription": { + "text": "Reports redundant overriding declarations. An override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility. Example: 'open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }' After the quick-fix is applied: 'class Bar : Foo() {\n }'", + "markdown": "Reports redundant overriding declarations.\n\n\nAn override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility.\n\n**Example:**\n\n\n open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }\n\nAfter the quick-fix is applied:\n\n\n class Bar : Foo() {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceArrayOfWithLiteral", + "shortDescription": { + "text": "'arrayOf' call can be replaced with array literal [...]" + }, + "fullDescription": { + "text": "Reports 'arrayOf' calls that can be replaced with array literals '[...]'. Examples: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass' After the quick-fix is applied: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass'", + "markdown": "Reports `arrayOf` calls that can be replaced with array literals `[...]`.\n\n**Examples:**\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass\n\nAfter the quick-fix is applied:\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceToWithInfixForm", + "shortDescription": { + "text": "'to' call should be replaced with infix form" + }, + "fullDescription": { + "text": "Reports 'to' function calls that can be replaced with the infix form. Using the infix form makes your code simpler. The quick-fix replaces 'to' with the infix form. Example: 'fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) {\n val pair = a to b\n }'", + "markdown": "Reports `to` function calls that can be replaced with the infix form.\n\nUsing the infix form makes your code simpler.\n\nThe quick-fix replaces `to` with the infix form.\n\n**Example:**\n\n\n fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int, b: Int) {\n val pair = a to b\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstPropertyName", + "shortDescription": { + "text": "Const property naming convention" + }, + "fullDescription": { + "text": "Reports 'const' property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, 'const' properties should use uppercase underscore-separated names. Example: 'const val Planck: Double = 6.62607015E-34' A quick-fix renames the property: 'const val PLANCK: Double = 6.62607015E-34'", + "markdown": "Reports `const` property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#property-names),\n`const` properties should use uppercase underscore-separated names.\n\n**Example:**\n\n\n const val Planck: Double = 6.62607015E-34\n\nA quick-fix renames the property:\n\n\n const val PLANCK: Double = 6.62607015E-34\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantNullableReturnType", + "shortDescription": { + "text": "Redundant nullable return type" + }, + "fullDescription": { + "text": "Reports functions and variables with nullable return type which never return or become 'null'. Example: 'fun greeting(user: String): String? = \"Hello, $user!\"' After the quick-fix is applied: 'fun greeting(user: String): String = \"Hello, $user!\"'", + "markdown": "Reports functions and variables with nullable return type which never return or become `null`.\n\n**Example:**\n\n\n fun greeting(user: String): String? = \"Hello, $user!\"\n\nAfter the quick-fix is applied:\n\n\n fun greeting(user: String): String = \"Hello, $user!\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UselessCallOnNotNull", + "shortDescription": { + "text": "Useless call on not-null type" + }, + "fullDescription": { + "text": "Reports calls on not-null receiver that make sense only for nullable receiver. Several functions from the standard library such as 'orEmpty()' or 'isNullOrEmpty' have sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same. Remove redundant call and Change call to … quick-fixes can be used to amend the code automatically. Examples: 'fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }'", + "markdown": "Reports calls on not-null receiver that make sense only for nullable receiver.\n\nSeveral functions from the standard library such as `orEmpty()` or `isNullOrEmpty`\nhave sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same.\n\n**Remove redundant call** and **Change call to ...** quick-fixes can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RiderSolutionErrorsInspection", + "shortDescription": { + "text": "Rider toolset and environment errors" + }, + "fullDescription": { + "text": "Reports toolset and environment errors detected by Rider.", + "markdown": "Reports toolset and environment errors detected by Rider." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "RiderSolutionErrorsInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "Rider/General", + "index": 134, + "toolComponent": { + "name": "QDNET" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EqualsOrHashCode", + "shortDescription": { + "text": "'equals()' and 'hashCode()' not paired" + }, + "fullDescription": { + "text": "Reports classes that override 'equals()' but do not override 'hashCode()', or vice versa. It also reports object declarations that override either 'equals()' or 'hashCode()'. This can lead to undesired behavior when a class is added to a 'Collection' Example: 'class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }' The quick-fix overrides 'equals()' or 'hashCode()' for classes and deletes these methods for objects: 'class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }'", + "markdown": "Reports classes that override `equals()` but do not override `hashCode()`, or vice versa. It also reports object declarations that override either `equals()` or `hashCode()`.\n\nThis can lead to undesired behavior when a class is added to a `Collection`\n\n**Example:**\n\n\n class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }\n\nThe quick-fix overrides `equals()` or `hashCode()` for classes and deletes these methods for objects:\n\n\n class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + } + ] + }, + "invocations": [ + { + "exitCode": 0, + "toolExecutionNotifications": [], + "executionSuccessful": true + } + ], + "language": "en-US", + "results": [ + { + "ruleId": "ControlFlowWithEmptyBody", + "kind": "fail", + "level": "error", + "message": { + "text": "'while' has empty body", + "markdown": "'while' has empty body" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "dokker/src/main/kotlin/io/github/tiulpin/Dokker.kt", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 271, + "startColumn": 5, + "charOffset": 6917, + "charLength": 5, + "snippet": { + "text": "while" + }, + "sourceLanguage": "kotlin" + }, + "contextRegion": { + "startLine": 269, + "startColumn": 1, + "charOffset": 6885, + "charLength": 71, + "snippet": { + "text": " println(null)\n }\n while (false) {\n }\n if (update) {" + } + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "dokker.dokker.main", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f0b3b16328b5e11f45afdc0ae3fe79aa989b8909330a81d810ae499b347aca32" + }, + "properties": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + { + "ruleId": "ConstantConditionIf", + "kind": "fail", + "level": "warning", + "message": { + "text": "Condition is always 'true'", + "markdown": "Condition is always 'true'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "dokker/src/main/kotlin/io/github/tiulpin/Dokker.kt", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 268, + "startColumn": 9, + "charOffset": 6877, + "charLength": 4, + "snippet": { + "text": "true" + }, + "sourceLanguage": "kotlin" + }, + "contextRegion": { + "startLine": 266, + "startColumn": 1, + "charOffset": 6685, + "charLength": 227, + "snippet": { + "text": " val installPackages = packages.joinToString(INSTALL_SEP)\n var command = \"DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $INSTALL_SEP$installPackages\"\n if (true) {\n println(null)\n }" + } + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "dokker.dokker.main", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "eba2d761291ee6bda42bf3ff0a3856509e0140a940f297ba99450b51d0f7905e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + { + "ruleId": "RiderSolutionErrorsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "[NU1101] Unable to find package PrivatePackage. No packages exist with this id in source(s): github at (0:0) Target: ResolvePackageAssets Task: ResolvePackageAssets", + "markdown": "\\[[NU1101](http://www.google.com/search?q=NU1101)\\] Unable to find package PrivatePackage. No packages exist with this id in source(s): github at (0:0) \n\nTarget: ResolvePackageAssets \nTask: ResolvePackageAssets" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "LibraryReferencingPackage/LibraryReferencingPackage.csproj", + "uriBaseId": "SRCROOT" + } + } + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2eb5998cec5651ad1ad36262cf210caa653ab138d3c22e4338d3eea704104bf6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + { + "ruleId": "MayBeConstant", + "kind": "fail", + "level": "note", + "message": { + "text": "Might be 'const'", + "markdown": "Might be 'const'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "dokker/src/main/kotlin/io/github/tiulpin/Dokker.kt", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 283, + "startColumn": 5, + "charOffset": 7206, + "charLength": 4, + "snippet": { + "text": "help" + }, + "sourceLanguage": "kotlin" + }, + "contextRegion": { + "startLine": 281, + "startColumn": 1, + "charOffset": 7199, + "charLength": 17, + "snippet": { + "text": "}\n\nval help = \"\"\n" + } + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "dokker.dokker.main", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "54ac5fc68d708d7ae0f4fc0732dc3173126a76a86ec9f429bd133a5fb9a8f8fa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + } + ], + "automationDetails": { + "id": "project - 12/13/21, 3:48 PM", + "guid": "d0a57b70-6936-41ab-bf04-97c58449a43d" + }, + "newlineSequences": [ + "\r\n", + "\n" + ], + "properties": { + "qodanaFailureConditions": { + "testCoverageThresholds": { + "totalCoverage": 40, + "freshCoverage": 30 + } + }, + "coverage": { + "totalCoverage": 45.0, + "totalLines": 124.0, + "totalCoveredLines": 56.0, + "freshCoverage": 33.0, + "freshLines": 9.0, + "freshCoveredLines": 3.0 + } + } + } + ] +} \ No newline at end of file diff --git a/common/__tests__/main.test.ts b/common/__tests__/main.test.ts new file mode 100644 index 00000000..76c41e99 --- /dev/null +++ b/common/__tests__/main.test.ts @@ -0,0 +1,113 @@ +/* + * Copyright 2021-2024 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {expect, test} from '@jest/globals' +import {getCoverageFromSarif, QODANA_OPEN_IN_IDE_NAME, QODANA_REPORT_URL_NAME} from "../qodana"; +import { + getCoverageStats, + getReportURL +} from "../output"; +import * as fs from 'fs' +import * as path from 'path' +import * as os from 'os' + +test('test passed coverage output', () => { + const result = getCoverageStats( + getCoverageFromSarif('__tests__/data/some.sarif.json') + ) + expect(result).toEqual(passedCoverageFixture()) +}) + +test('test failed coverage output', () => { + const result = getCoverageStats( + getCoverageFromSarif('__tests__/data/empty.sarif.json') + ) + expect(result).toEqual(failedCoverageFixture()) +}) + +describe('getReportURL', () => { + let tempDir: string + + beforeEach(async () => { + // create a unique temporary directory for each test + tempDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'jest-')) + }) + + afterEach(async () => { + // cleanup - remove temporary directory + await fs.promises.rm(tempDir, {recursive: true}) + }) + + it('returns cloud URL if open in IDE file exists', async () => { + const url = 'http://cloud.url' + const data = {cloud: {url}} + const filepath = path.join(tempDir, QODANA_OPEN_IN_IDE_NAME) + await fs.promises.writeFile(filepath, JSON.stringify(data)) + console.log(JSON.stringify(data)) + + const result = getReportURL(tempDir) + + expect(result).toBe(url) + }) + + it('returns report URL if open in IDE file does not exist but report file exists', async () => { + const url = 'http://report.url' + const filepath = path.join(tempDir, QODANA_REPORT_URL_NAME) + await fs.promises.writeFile(filepath, url) + + const result = getReportURL(tempDir) + + expect(result).toBe(url) + }) + + it('returns empty string if no file exists', () => { + const result = getReportURL(tempDir) + + expect(result).toBe('') + }) + + it('returns empty string if open in IDE file exists but does not contain url', async () => { + const data = {cloud: {}} + const filepath = path.join(tempDir, QODANA_OPEN_IN_IDE_NAME) + await fs.promises.writeFile(filepath, JSON.stringify(data)) + + const result = getReportURL(tempDir) + + expect(result).toBe('') + }) +}) + +function passedCoverageFixture(): string { + return `\`\`\`diff +@@ Code coverage @@ ++ 45% total lines covered +124 lines analyzed, 56 lines covered ++ 33% fresh lines covered +9 lines analyzed, 3 lines covered +# Calculated according to the filters of your coverage tool +\`\`\`` +} + +function failedCoverageFixture(): string { + return `\`\`\`diff +@@ Code coverage @@ +- 0% total lines covered +100 lines analyzed, 0 lines covered +- 0% fresh lines covered +100 lines analyzed, 0 lines covered +# Calculated according to the filters of your coverage tool +\`\`\`` +} \ No newline at end of file diff --git a/common/jest.config.js b/common/jest.config.js new file mode 100644 index 00000000..d3527986 --- /dev/null +++ b/common/jest.config.js @@ -0,0 +1,30 @@ +/* + * Copyright 2021-2024 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = { + clearMocks: true, + moduleFileExtensions: ['js', 'ts'], + testMatch: ['**/*.test.ts'], + transform: { + '^.+\\.ts$': 'ts-jest' + }, + verbose: false, + testTimeout: 400000, + collectCoverage: true, + collectCoverageFrom: ['src/**/*.ts'], + coverageReporters: ['html', ['lcovonly', { projectRoot: '../' }], 'text-summary'], + coveragePathIgnorePatterns: ['node_modules', 'src/utils.ts', 'src/main.ts'], +} \ No newline at end of file diff --git a/common/output.ts b/common/output.ts new file mode 100644 index 00000000..a348a69d --- /dev/null +++ b/common/output.ts @@ -0,0 +1,337 @@ +/* + * Copyright 2021-2024 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { + Coverage, + QODANA_LICENSES_JSON, + QODANA_LICENSES_MD, + QODANA_OPEN_IN_IDE_NAME, + QODANA_REPORT_URL_NAME, +} from "./qodana"; +import * as fs from "fs"; +import type {Result} from 'sarif' +import {Rule} from './utils' + +export const COMMIT_USER = 'qodana-bot' +export const COMMIT_EMAIL = 'qodana-support@jetbrains.com' +export const QODANA_CHECK_NAME = 'Qodana' +const UNKNOWN_RULE_ID = 'Unknown' +const SUMMARY_TABLE_HEADER = '| Inspection name | Severity | Problems |' +const SUMMARY_TABLE_SEP = '| --- | --- | --- |' +const SUMMARY_MISC = `Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com) + - Or via our issue tracker: https://jb.gg/qodana-issue + - Or share your feedback: https://jb.gg/qodana-discussions` + +const SUMMARY_PR_MODE = `πŸ’‘ Qodana analysis was run in the pull request mode: only the changed files were checked` + +export const FAILURE_LEVEL = 'failure' +export const WARNING_LEVEL = 'warning' +export const NOTICE_LEVEL = 'notice' + +export interface ProblemDescriptor { + title: string | undefined + level: 'failure' | 'warning' | 'notice' +} + +interface CloudData { + url?: string +} + +interface OpenInIDEData { + cloud?: CloudData +} + +export interface LicenseEntry { + name?: string + version?: string + license?: string +} + +export interface LicenseInfo { + licenses: string, + packages: number +} + +export function parseResult( + result: Result, + rules: Map +): ProblemDescriptor | null { + if ( + !result.locations || + result.locations.length === 0 || + !result.locations[0].physicalLocation + ) { + return null + } + return { + title: rules.get(result.ruleId!)?.shortDescription, + level: (() => { + switch (result.level) { + case 'error': + return FAILURE_LEVEL + case 'warning': + return WARNING_LEVEL + default: + return NOTICE_LEVEL + } + })() + } +} + +function wrapToDiffBlock(message: string): string { + return `\`\`\`diff +${message} +\`\`\`` +} + +function makeConclusion( + conclusion: string, + failedByThreshold: boolean +): string { + if (failedByThreshold) { + return `- ${conclusion}` + } else { + return `+ ${conclusion}` + } +} + +export function getCoverageStats(c: Coverage): string { + if (c.totalLines === 0 && c.totalCoveredLines === 0) { + return '' + } + + let stats = '' + if (c.totalLines !== 0) { + const conclusion = `${c.totalCoverage}% total lines covered` + stats += `${makeConclusion(conclusion, c.totalCoverage < c.totalCoverageThreshold)} +${c.totalLines} lines analyzed, ${c.totalCoveredLines} lines covered` + } + + if (c.freshLines !== 0) { + const conclusion = `${c.freshCoverage}% fresh lines covered` + stats += ` +${makeConclusion(conclusion, c.freshCoverage < c.freshCoverageThreshold)} +${c.freshLines} lines analyzed, ${c.freshCoveredLines} lines covered` + } + + return wrapToDiffBlock( + [ + `@@ Code coverage @@`, + `${stats}`, + `# Calculated according to the filters of your coverage tool` + ].join('\n') + ) +} + +export function getLicenseInfo( + resultsDir: string, +): LicenseInfo { + let licensesInfo = '' + let packages = 0 + const licensesJson = `${resultsDir}/projectStructure/${QODANA_LICENSES_JSON}` + if (fs.existsSync(licensesJson)) { + const licenses = JSON.parse( + fs.readFileSync(licensesJson, {encoding: 'utf8'}) + ) as LicenseEntry[] + if (licenses.length > 0) { + packages = licenses.length + licensesInfo = fs.readFileSync( + `${resultsDir}/projectStructure/${QODANA_LICENSES_MD}`, + {encoding: 'utf8'} + ) + } + } + return { licenses: licensesInfo, packages: packages } +} + +export function getReportURL(resultsDir: string): string { + let reportUrlFile = `${resultsDir}/${QODANA_OPEN_IN_IDE_NAME}` + if (fs.existsSync(reportUrlFile)) { + const rawData = fs.readFileSync(reportUrlFile, {encoding: 'utf8'}) + const data = JSON.parse(rawData) as OpenInIDEData + if (data?.cloud?.url) { + return data.cloud.url + } + } else { + reportUrlFile = `${resultsDir}/${QODANA_REPORT_URL_NAME}` + if (fs.existsSync(reportUrlFile)) { + return fs.readFileSync(reportUrlFile, {encoding: 'utf8'}) + } + } + return '' +} + +function wrapToToggleBlock(header: string, body: string): string { + return `
+${header} + +${body} +
` +} + +function getViewReportText(reportUrl: string, viewReportOptions: string): string { + if (reportUrl !== '') { + return `☁️ [View the detailed Qodana report](${reportUrl})` + } + return wrapToToggleBlock( + 'View the detailed Qodana report', + viewReportOptions + ) +} + +/** + * Generates a table row for a given level. + * @param annotations The annotations to generate the table row from. + * @param level The level to generate the table row for. + */ +function getRowsByLevel(annotations: ProblemDescriptor[], level: string): string { + const problems = annotations.reduce( + (map: Map, e) => + map.set( + e.title ?? UNKNOWN_RULE_ID, + map.get(e.title ?? UNKNOWN_RULE_ID) !== undefined + ? map.get(e.title ?? UNKNOWN_RULE_ID)! + 1 + : 1 + ), + new Map() + ) + return Array.from(problems.entries()) + .sort((a, b) => b[1] - a[1]) + .map(([title, count]) => `| \`${title}\` | ${level} | ${count} |`) + .join('\n') +} + +/** + * Generates action summary string of annotations. + * @param toolName The name of the tool to generate the summary from. + * @param projectDir The path to the project. + * @param sourceDir The path to analyzed directory inside the project. + * @param problemsDescriptors The descriptions of problems to generate the summary from. + * @param coverageInfo The coverage is a Markdown text to generate the summary from. + * @param packages The number of dependencies in the analyzed project. + * @param licensesInfo The licenses a Markdown text to generate the summary from. + * @param reportUrl The URL to the Qodana report. + * @param prMode Whether the analysis was run in the pull request mode. + * @param dependencyCharsLimit Limit on how many characters can be included in comment + * @param reportViewOptionsHelp Instructions of how to configure a report viewing for tool + */ +export function getSummary( + toolName: string, + projectDir: string, + sourceDir: string, + problemsDescriptors: ProblemDescriptor[], + coverageInfo: string, + packages: number, + licensesInfo: string, + reportUrl: string, + prMode: boolean, + dependencyCharsLimit: number, + reportViewOptionsHelp: string +): string { + const contactBlock = wrapToToggleBlock('Contact Qodana team', SUMMARY_MISC) + let licensesBlock = '' + if (licensesInfo !== '' && licensesInfo.length < dependencyCharsLimit) { + licensesBlock = wrapToToggleBlock( + `Detected ${packages} ${getDepencencyPlural(packages)}`, + licensesInfo + ) + } + let prModeBlock = '' + if (prMode) { + prModeBlock = SUMMARY_PR_MODE + } + if (reportUrl !== '') { + const firstToolName = toolName.split(' ')[0] + toolName = toolName.replace( + firstToolName, + `[${firstToolName}](${reportUrl})` + ) + } + const analysisScope = ( + projectDir === '' + ? '' + : ['Analyzed project: `', projectDir, '/`\n'].join('') + ).concat( + sourceDir === '' + ? '' + : ['Analyzed directory: `', sourceDir, '/`\n'].join('') + ) + if (problemsDescriptors.length === 0) { + return [ + `# ${toolName}`, + analysisScope, + '**It seems all right πŸ‘Œ**', + '', + 'No new problems were found according to the checks applied', + coverageInfo, + prModeBlock, + getViewReportText(reportUrl, reportViewOptionsHelp), + licensesBlock, + contactBlock + ].join('\n') + } + + return [ + `# ${toolName}`, + analysisScope, + `**${problemsDescriptors.length} ${getProblemPlural( + problemsDescriptors.length + )}** were found`, + '', + SUMMARY_TABLE_HEADER, + SUMMARY_TABLE_SEP, + [ + getRowsByLevel( + problemsDescriptors.filter(a => a.level === FAILURE_LEVEL), + 'πŸ”΄ Failure' + ), + getRowsByLevel( + problemsDescriptors.filter(a => a.level === WARNING_LEVEL), + 'πŸ”Ά Warning' + ), + getRowsByLevel( + problemsDescriptors.filter(a => a.level === NOTICE_LEVEL), + '◽️ Notice' + ) + ] + .filter(e => e !== '') + .join('\n'), + '', + coverageInfo, + prModeBlock, + getViewReportText(reportUrl, reportViewOptionsHelp), + licensesBlock, + contactBlock + ].join('\n') +} + +/** + * Generates a plural form of the word "problem" depending on the given count. + * @param count A number representing the count of problems + * @returns A formatted string with the correct plural form of "problem" + */ +export function getProblemPlural(count: number): string { + return `new problem${count !== 1 ? 's' : ''}` +} + +/** + * Generates a plural form of the word "dependency" depending on the given count. + * @param count A number representing the count of dependencies + * @returns A formatted string with the correct plural form of "dependency" + */ +export function getDepencencyPlural(count: number): string { + return `dependenc${count !== 1 ? 'ies' : 'y'}` +} \ No newline at end of file diff --git a/common/package.json b/common/package.json index 37e335da..c1b06869 100644 --- a/common/package.json +++ b/common/package.json @@ -7,10 +7,13 @@ "url": "git+https://github.com/JetBrains/qodana-cli.git" }, "scripts": { - "lint": "eslint --fix **/*.ts -c ../.github/linters/.eslintrc.yml" + "lint": "eslint --fix **/*.ts -c ../.github/linters/.eslintrc.yml", + "test": "jest --config jest.config.js" }, "files": [ "qodana.ts", + "output.ts", + "utils.ts", "cli.json" ], "devDependencies": { @@ -22,6 +25,8 @@ "js-yaml": "^4.1.0", "prettier": "3.4.2", "ts-jest": "^29.2.5", - "typescript": "^5.7.3" + "typescript": "^5.7.3", + "@types/sarif": "^2.1.7", + "jszip": "^3.10.1" } } diff --git a/common/tsconfig.json b/common/tsconfig.json index 73cafe4a..97611c8d 100644 --- a/common/tsconfig.json +++ b/common/tsconfig.json @@ -5,5 +5,10 @@ "rootDir": ".", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ }, "types": ".qodana.d.ts", - "files": ["cli.json", "qodana.ts"] + "files": [ + "cli.json", + "qodana.ts", + "output.ts", + "utils.ts" + ] } diff --git a/common/utils.ts b/common/utils.ts new file mode 100644 index 00000000..1c2b3bc0 --- /dev/null +++ b/common/utils.ts @@ -0,0 +1,49 @@ +/* + * Copyright 2021-2024 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type {Tool} from 'sarif' + +export interface Rule { + shortDescription: string + fullDescription: string +} + +/** + * Extracts the rules descriptions from SARIF tool field. + * @param tool the SARIF tool field. + * @returns The map of SARIF rule IDs to their descriptions. + */ +export function parseRules(tool: Tool): Map { + const rules = new Map() + tool.driver.rules?.forEach(rule => { + rules.set(rule.id, { + shortDescription: rule.shortDescription!.text, + fullDescription: + rule.fullDescription!.markdown || rule.fullDescription!.text + }) + }) + + tool?.extensions?.forEach(ext => { + ext?.rules?.forEach(rule => { + rules.set(rule.id, { + shortDescription: rule.shortDescription!.text, + fullDescription: + rule.fullDescription!.markdown || rule.fullDescription!.text + }) + }) + }) + return rules +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7d5896e8..a81261ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,11 +30,13 @@ "license": "Apache-2.0", "devDependencies": { "@types/node": "^22.10.5", + "@types/sarif": "^2.1.7", "@typescript-eslint/parser": "^8.19.1", "eslint": "^8.57.1", "eslint-plugin-jest": "^28.10.0", "jest": "^29.7.0", "js-yaml": "^4.1.0", + "jszip": "^3.10.1", "prettier": "3.4.2", "ts-jest": "^29.2.5", "typescript": "^5.7.3" @@ -3642,6 +3644,35 @@ "node": ">= 6" } }, + "node_modules/azure-devops-node-api": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-14.1.0.tgz", + "integrity": "sha512-QhpgjH1LQ+vgDJ7oBwcmsZ3+o4ZpjLVilw0D3oJQpYpRzN+L39lk5jZDLJ464hLUgsDzWn/Ksv7zLLMKLfoBzA==", + "license": "MIT", + "dependencies": { + "tunnel": "0.0.6", + "typed-rest-client": "2.1.0" + }, + "engines": { + "node": ">= 16.0.0" + } + }, + "node_modules/azure-devops-node-api/node_modules/typed-rest-client": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-2.1.0.tgz", + "integrity": "sha512-Nel9aPbgSzRxfs1+4GoSB4wexCF+4Axlk7OSGVQCMa+4fWcyxIsN/YNmkp0xTT2iQzMD98h8yFLav/cNaULmRA==", + "license": "MIT", + "dependencies": { + "des.js": "^1.1.0", + "js-md4": "^0.3.2", + "qs": "^6.10.3", + "tunnel": "0.0.6", + "underscore": "^1.12.1" + }, + "engines": { + "node": ">= 16.0.0" + } + }, "node_modules/azure-pipelines-task-lib": { "version": "4.17.3", "resolved": "https://registry.npmjs.org/azure-pipelines-task-lib/-/azure-pipelines-task-lib-4.17.3.tgz", @@ -10037,6 +10068,8 @@ "version": "1.0.0", "license": "Apache-2.0", "dependencies": { + "@types/sarif": "^2.1.7", + "azure-devops-node-api": "^14.1.0", "azure-pipelines-task-lib": "^4.17.3", "azure-pipelines-tasks-utility-common": "^3.246.0", "azure-pipelines-tool-lib": "^2.0.8" diff --git a/package.json b/package.json index d289a285..095972bb 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "scripts": { "lint": "npm run -w common lint && npm run -w scan lint && npm run -w vsts lint", "build": "tsc -b common scan vsts --force", - "test": "npm run -w scan test", + "test": "npm run test --workspaces", "package": "npm run -w scan package && npm run -w vsts package", "all": "npm run lint && npm run build && npm run test && npm run package" }, diff --git a/scan/__tests__/main.test.ts b/scan/__tests__/main.test.ts index a83e9ed8..e049e8bc 100644 --- a/scan/__tests__/main.test.ts +++ b/scan/__tests__/main.test.ts @@ -17,11 +17,8 @@ import {expect, test} from '@jest/globals' import {AnnotationProperties} from '@actions/core' import { - getCoverageFromSarif, getQodanaScanArgs, Inputs, - QODANA_OPEN_IN_IDE_NAME, - QODANA_REPORT_URL_NAME, validateBranchName } from '../../common/qodana' import { @@ -30,10 +27,46 @@ import { parseSarif, toAnnotationProperties } from '../src/annotations' -import {getSummary, getCoverageStats, getReportURL} from '../src/output' -import * as fs from 'fs' -import * as path from 'path' -import * as os from 'os' +import {getSummary} from '../../common/output' +import { + annotationsToProblemDescriptors, + VIEW_REPORT_OPTIONS, + DEPENDENCY_CHARS_LIMIT +} from '../src/output' + +test('test typical summary output', () => { + const result = getSummary( + 'Qodana for JS', + 'frontend', + 'web', + annotationsToProblemDescriptors(annotationsDefaultFixture()).reverse(), // reversed for testing the correct sorting in output + '', + 0, + 'There is no licenses information available', + 'https://example.com/report', + true, + DEPENDENCY_CHARS_LIMIT, + VIEW_REPORT_OPTIONS + ) + expect(result).toEqual(markdownSummaryFixture()) +}) + +test('test empty summary output', () => { + const result = getSummary( + 'Qodana for JS', + '', + '', + annotationsToProblemDescriptors(outputEmptyFixture()), + '', + 0, + '', + '', + false, + DEPENDENCY_CHARS_LIMIT, + VIEW_REPORT_OPTIONS + ) + expect(result).toEqual(markdownEmptySummaryFixture()) +}) test('validate branch names', () => { let validBranchNames = [ @@ -77,50 +110,6 @@ test('test sarif with no problems to output annotations', () => { expect(result.annotations).toEqual(output) }) -test('test typical summary output', () => { - const result = getSummary( - 'Qodana for JS', - 'frontend', - 'web', - annotationsDefaultFixture().reverse(), // reversed for testing the correct sorting in output - '', - 0, - 'There is no licenses information available', - 'https://example.com/report', - true - ) - expect(result).toEqual(markdownSummaryFixture()) -}) - -test('test empty summary output', () => { - const result = getSummary( - 'Qodana for JS', - '', - '', - outputEmptyFixture(), - '', - 0, - '', - '', - false - ) - expect(result).toEqual(markdownEmptySummaryFixture()) -}) - -test('test passed coverage output', () => { - const result = getCoverageStats( - getCoverageFromSarif('__tests__/data/some.sarif.json') - ) - expect(result).toEqual(passedCoverageFixture()) -}) - -test('test failed coverage output', () => { - const result = getCoverageStats( - getCoverageFromSarif('__tests__/data/empty.sarif.json') - ) - expect(result).toEqual(failedCoverageFixture()) -}) - test('check conversion from Checks API Annotations to actions/core AnnotationProperty', () => { const result = toAnnotationProperties(annotationsDefaultFixture()[0]) expect(result).toEqual(annotationPropertyDefaultFixture()) @@ -141,58 +130,6 @@ test('check success conclusion for the Check', () => { expect(result).toEqual('success') }) -describe('getReportURL', () => { - let tempDir: string - - beforeEach(async () => { - // create a unique temporary directory for each test - tempDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'jest-')) - }) - - afterEach(async () => { - // cleanup - remove temporary directory - await fs.promises.rm(tempDir, {recursive: true}) - }) - - it('returns cloud URL if open in IDE file exists', async () => { - const url = 'http://cloud.url' - const data = {cloud: {url}} - const filepath = path.join(tempDir, QODANA_OPEN_IN_IDE_NAME) - await fs.promises.writeFile(filepath, JSON.stringify(data)) - console.log(JSON.stringify(data)) - - const result = getReportURL(tempDir) - - expect(result).toBe(url) - }) - - it('returns report URL if open in IDE file does not exist but report file exists', async () => { - const url = 'http://report.url' - const filepath = path.join(tempDir, QODANA_REPORT_URL_NAME) - await fs.promises.writeFile(filepath, url) - - const result = getReportURL(tempDir) - - expect(result).toBe(url) - }) - - it('returns empty string if no file exists', () => { - const result = getReportURL(tempDir) - - expect(result).toBe('') - }) - - it('returns empty string if open in IDE file exists but does not contain url', async () => { - const data = {cloud: {}} - const filepath = path.join(tempDir, QODANA_OPEN_IN_IDE_NAME) - await fs.promises.writeFile(filepath, JSON.stringify(data)) - - const result = getReportURL(tempDir) - - expect(result).toBe('') - }) -}) - export function outputEmptyFixture(): Annotation[] { return [] } @@ -356,25 +293,3 @@ Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com - Or share your feedback: https://jb.gg/qodana-discussions ` } - -function passedCoverageFixture(): string { - return `\`\`\`diff -@@ Code coverage @@ -+ 45% total lines covered -124 lines analyzed, 56 lines covered -+ 33% fresh lines covered -9 lines analyzed, 3 lines covered -# Calculated according to the filters of your coverage tool -\`\`\`` -} - -function failedCoverageFixture(): string { - return `\`\`\`diff -@@ Code coverage @@ -- 0% total lines covered -100 lines analyzed, 0 lines covered -- 0% fresh lines covered -100 lines analyzed, 0 lines covered -# Calculated according to the filters of your coverage tool -\`\`\`` -} diff --git a/scan/dist/index.js b/scan/dist/index.js index a06b2e94..600e71b7 100644 --- a/scan/dist/index.js +++ b/scan/dist/index.js @@ -195,7 +195,7 @@ var require_file_command = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.prepareKeyValueMessage = exports2.issueFileCommand = void 0; var crypto4 = __importStar3(require("crypto")); - var fs2 = __importStar3(require("fs")); + var fs3 = __importStar3(require("fs")); var os = __importStar3(require("os")); var utils_12 = require_utils(); function issueFileCommand(command, message) { @@ -203,10 +203,10 @@ var require_file_command = __commonJS({ if (!filePath) { throw new Error(`Unable to find environment variable for file command ${command}`); } - if (!fs2.existsSync(filePath)) { + if (!fs3.existsSync(filePath)) { throw new Error(`Missing file at path: ${filePath}`); } - fs2.appendFileSync(filePath, `${(0, utils_12.toCommandValue)(message)}${os.EOL}`, { + fs3.appendFileSync(filePath, `${(0, utils_12.toCommandValue)(message)}${os.EOL}`, { encoding: "utf8" }); } @@ -19088,12 +19088,12 @@ var require_io_util = __commonJS({ var _a; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getCmdPath = exports2.tryGetExecutablePath = exports2.isRooted = exports2.isDirectory = exports2.exists = exports2.READONLY = exports2.UV_FS_O_EXLOCK = exports2.IS_WINDOWS = exports2.unlink = exports2.symlink = exports2.stat = exports2.rmdir = exports2.rm = exports2.rename = exports2.readlink = exports2.readdir = exports2.open = exports2.mkdir = exports2.lstat = exports2.copyFile = exports2.chmod = void 0; - var fs2 = __importStar3(require("fs")); + var fs3 = __importStar3(require("fs")); var path2 = __importStar3(require("path")); - _a = fs2.promises, exports2.chmod = _a.chmod, exports2.copyFile = _a.copyFile, exports2.lstat = _a.lstat, exports2.mkdir = _a.mkdir, exports2.open = _a.open, exports2.readdir = _a.readdir, exports2.readlink = _a.readlink, exports2.rename = _a.rename, exports2.rm = _a.rm, exports2.rmdir = _a.rmdir, exports2.stat = _a.stat, exports2.symlink = _a.symlink, exports2.unlink = _a.unlink; + _a = fs3.promises, exports2.chmod = _a.chmod, exports2.copyFile = _a.copyFile, exports2.lstat = _a.lstat, exports2.mkdir = _a.mkdir, exports2.open = _a.open, exports2.readdir = _a.readdir, exports2.readlink = _a.readlink, exports2.rename = _a.rename, exports2.rm = _a.rm, exports2.rmdir = _a.rmdir, exports2.stat = _a.stat, exports2.symlink = _a.symlink, exports2.unlink = _a.unlink; exports2.IS_WINDOWS = process.platform === "win32"; exports2.UV_FS_O_EXLOCK = 268435456; - exports2.READONLY = fs2.constants.O_RDONLY; + exports2.READONLY = fs3.constants.O_RDONLY; function exists(fsPath) { return __awaiter3(this, void 0, void 0, function* () { try { @@ -32275,7 +32275,7 @@ var require_internal_globber = __commonJS({ Object.defineProperty(exports2, "__esModule", { value: true }); exports2.DefaultGlobber = void 0; var core2 = __importStar3(require_core()); - var fs2 = __importStar3(require("fs")); + var fs3 = __importStar3(require("fs")); var globOptionsHelper = __importStar3(require_internal_glob_options_helper()); var path2 = __importStar3(require("path")); var patternHelper = __importStar3(require_internal_pattern_helper()); @@ -32330,7 +32330,7 @@ var require_internal_globber = __commonJS({ for (const searchPath of patternHelper.getSearchPaths(patterns)) { core2.debug(`Search path '${searchPath}'`); try { - yield __await2(fs2.promises.lstat(searchPath)); + yield __await2(fs3.promises.lstat(searchPath)); } catch (err) { if (err.code === "ENOENT") { continue; @@ -32361,7 +32361,7 @@ var require_internal_globber = __commonJS({ continue; } const childLevel = item.level + 1; - const childItems = (yield __await2(fs2.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path2.join(item.path, x), childLevel)); + const childItems = (yield __await2(fs3.promises.readdir(item.path))).map((x) => new internal_search_state_1.SearchState(path2.join(item.path, x), childLevel)); stack.push(...childItems.reverse()); } else if (match & internal_match_kind_1.MatchKind.File) { yield yield __await2(item.path); @@ -32396,7 +32396,7 @@ var require_internal_globber = __commonJS({ let stats; if (options.followSymbolicLinks) { try { - stats = yield fs2.promises.stat(item.path); + stats = yield fs3.promises.stat(item.path); } catch (err) { if (err.code === "ENOENT") { if (options.omitBrokenSymbolicLinks) { @@ -32408,10 +32408,10 @@ var require_internal_globber = __commonJS({ throw err; } } else { - stats = yield fs2.promises.lstat(item.path); + stats = yield fs3.promises.lstat(item.path); } if (stats.isDirectory() && options.followSymbolicLinks) { - const realPath = yield fs2.promises.realpath(item.path); + const realPath = yield fs3.promises.realpath(item.path); while (traversalChain.length >= item.level) { traversalChain.pop(); } @@ -33808,7 +33808,7 @@ var require_cacheUtils = __commonJS({ var glob = __importStar3(require_glob()); var io2 = __importStar3(require_io()); var crypto4 = __importStar3(require("crypto")); - var fs2 = __importStar3(require("fs")); + var fs3 = __importStar3(require("fs")); var path2 = __importStar3(require("path")); var semver = __importStar3(require_semver()); var util = __importStar3(require("util")); @@ -33839,7 +33839,7 @@ var require_cacheUtils = __commonJS({ __name(createTempDirectory, "createTempDirectory"); exports2.createTempDirectory = createTempDirectory; function getArchiveFileSizeInBytes(filePath) { - return fs2.statSync(filePath).size; + return fs3.statSync(filePath).size; } __name(getArchiveFileSizeInBytes, "getArchiveFileSizeInBytes"); exports2.getArchiveFileSizeInBytes = getArchiveFileSizeInBytes; @@ -33881,7 +33881,7 @@ var require_cacheUtils = __commonJS({ exports2.resolvePaths = resolvePaths; function unlinkFile(filePath) { return __awaiter3(this, void 0, void 0, function* () { - return util.promisify(fs2.unlink)(filePath); + return util.promisify(fs3.unlink)(filePath); }); } __name(unlinkFile, "unlinkFile"); @@ -33930,7 +33930,7 @@ var require_cacheUtils = __commonJS({ exports2.getCacheFileName = getCacheFileName; function getGnuTarPathOnWindows() { return __awaiter3(this, void 0, void 0, function* () { - if (fs2.existsSync(constants_1.GnuTarPathOnWindows)) { + if (fs3.existsSync(constants_1.GnuTarPathOnWindows)) { return constants_1.GnuTarPathOnWindows; } const versionOutput = yield getVersion("tar"); @@ -50923,7 +50923,7 @@ var require_form_data = __commonJS({ var http = require("http"); var https = require("https"); var parseUrl = require("url").parse; - var fs2 = require("fs"); + var fs3 = require("fs"); var Stream = require("stream").Stream; var mime = require_mime_types(); var asynckit = require_asynckit(); @@ -50989,7 +50989,7 @@ var require_form_data = __commonJS({ if (value.end != void 0 && value.end != Infinity && value.start != void 0) { callback(null, value.end + 1 - (value.start ? value.start : 0)); } else { - fs2.stat(value.path, function(err, stat3) { + fs3.stat(value.path, function(err, stat3) { var fileSize; if (err) { callback(err); @@ -61968,7 +61968,7 @@ var require_dist4 = __commonJS({ require_commonjs5(); var coreLro = require_commonjs6(); var events = require("events"); - var fs2 = require("fs"); + var fs3 = require("fs"); var util = require("util"); function _interopNamespace(e) { if (e && e.__esModule) return e; @@ -61992,7 +61992,7 @@ var require_dist4 = __commonJS({ __name(_interopNamespace, "_interopNamespace"); var coreHttp__namespace = /* @__PURE__ */ _interopNamespace(coreHttp); var os__namespace = /* @__PURE__ */ _interopNamespace(os); - var fs__namespace = /* @__PURE__ */ _interopNamespace(fs2); + var fs__namespace = /* @__PURE__ */ _interopNamespace(fs3); var util__namespace = /* @__PURE__ */ _interopNamespace(util); var BlobServiceProperties = { serializedName: "BlobServiceProperties", @@ -85933,7 +85933,7 @@ var require_downloadUtils = __commonJS({ var http_client_1 = require_lib(); var storage_blob_1 = require_dist4(); var buffer = __importStar3(require("buffer")); - var fs2 = __importStar3(require("fs")); + var fs3 = __importStar3(require("fs")); var stream = __importStar3(require("stream")); var util = __importStar3(require("util")); var utils = __importStar3(require_cacheUtils()); @@ -86048,7 +86048,7 @@ var require_downloadUtils = __commonJS({ exports2.DownloadProgress = DownloadProgress; function downloadCacheHttpClient(archiveLocation, archivePath) { return __awaiter3(this, void 0, void 0, function* () { - const writeStream = fs2.createWriteStream(archivePath); + const writeStream = fs3.createWriteStream(archivePath); const httpClient = new http_client_1.HttpClient("actions/cache"); const downloadResponse = yield (0, requestUtils_1.retryHttpClientResponse)("downloadCache", () => __awaiter3(this, void 0, void 0, function* () { return httpClient.get(archiveLocation); @@ -86075,7 +86075,7 @@ var require_downloadUtils = __commonJS({ function downloadCacheHttpClientConcurrent(archiveLocation, archivePath, options) { var _a; return __awaiter3(this, void 0, void 0, function* () { - const archiveDescriptor = yield fs2.promises.open(archivePath, "w"); + const archiveDescriptor = yield fs3.promises.open(archivePath, "w"); const httpClient = new http_client_1.HttpClient("actions/cache", void 0, { socketTimeout: options.timeoutInMs, keepAlive: true @@ -86195,7 +86195,7 @@ var require_downloadUtils = __commonJS({ } else { const maxSegmentSize = Math.min(134217728, buffer.constants.MAX_LENGTH); const downloadProgress = new DownloadProgress(contentLength); - const fd = fs2.openSync(archivePath, "w"); + const fd = fs3.openSync(archivePath, "w"); try { downloadProgress.startDisplayTimer(); const controller = new abort_controller_1.AbortController(); @@ -86213,12 +86213,12 @@ var require_downloadUtils = __commonJS({ controller.abort(); throw new Error("Aborting cache download as the download time exceeded the timeout."); } else if (Buffer.isBuffer(result)) { - fs2.writeFileSync(fd, result); + fs3.writeFileSync(fd, result); } } } finally { downloadProgress.stopDisplayTimer(); - fs2.closeSync(fd); + fs3.closeSync(fd); } } }); @@ -86527,7 +86527,7 @@ var require_cacheHttpClient = __commonJS({ var core2 = __importStar3(require_core()); var http_client_1 = require_lib(); var auth_1 = require_auth(); - var fs2 = __importStar3(require("fs")); + var fs3 = __importStar3(require("fs")); var url_1 = require("url"); var utils = __importStar3(require_cacheUtils()); var uploadUtils_1 = require_uploadUtils(); @@ -86675,7 +86675,7 @@ Other caches with similar key:`); return __awaiter3(this, void 0, void 0, function* () { const fileSize = utils.getArchiveFileSizeInBytes(archivePath); const resourceUrl = getCacheApiUrl(`caches/${cacheId.toString()}`); - const fd = fs2.openSync(archivePath, "r"); + const fd = fs3.openSync(archivePath, "r"); const uploadOptions = (0, options_1.getUploadOptions)(options); const concurrency = utils.assertDefined("uploadConcurrency", uploadOptions.uploadConcurrency); const maxChunkSize = utils.assertDefined("uploadChunkSize", uploadOptions.uploadChunkSize); @@ -86689,7 +86689,7 @@ Other caches with similar key:`); const start = offset; const end = offset + chunkSize - 1; offset += maxChunkSize; - yield uploadChunk(httpClient, resourceUrl, () => fs2.createReadStream(archivePath, { + yield uploadChunk(httpClient, resourceUrl, () => fs3.createReadStream(archivePath, { fd, start, end, @@ -86700,7 +86700,7 @@ Other caches with similar key:`); } }))); } finally { - fs2.closeSync(fd); + fs3.closeSync(fd); } return; }); @@ -100841,7 +100841,7 @@ var require_manifest = __commonJS({ var core_1 = require_core(); var os = require("os"); var cp = require("child_process"); - var fs2 = require("fs"); + var fs3 = require("fs"); function _findMatch(versionSpec, stable, candidates, archFilter) { return __awaiter3(this, void 0, void 0, function* () { const platFilter = os.platform(); @@ -100907,10 +100907,10 @@ var require_manifest = __commonJS({ const lsbReleaseFile = "/etc/lsb-release"; const osReleaseFile = "/etc/os-release"; let contents = ""; - if (fs2.existsSync(lsbReleaseFile)) { - contents = fs2.readFileSync(lsbReleaseFile).toString(); - } else if (fs2.existsSync(osReleaseFile)) { - contents = fs2.readFileSync(osReleaseFile).toString(); + if (fs3.existsSync(lsbReleaseFile)) { + contents = fs3.readFileSync(lsbReleaseFile).toString(); + } else if (fs3.existsSync(osReleaseFile)) { + contents = fs3.readFileSync(osReleaseFile).toString(); } return contents; } @@ -101169,7 +101169,7 @@ var require_tool_cache = __commonJS({ exports2.evaluateVersions = exports2.isExplicitVersion = exports2.findFromManifest = exports2.getManifestFromRepo = exports2.findAllVersions = exports2.find = exports2.cacheFile = exports2.cacheDir = exports2.extractZip = exports2.extractXar = exports2.extractTar = exports2.extract7z = exports2.downloadTool = exports2.HTTPError = void 0; var core2 = __importStar3(require_core()); var io2 = __importStar3(require_io()); - var fs2 = __importStar3(require("fs")); + var fs3 = __importStar3(require("fs")); var mm = __importStar3(require_manifest()); var os = __importStar3(require("os")); var path2 = __importStar3(require("path")); @@ -101221,7 +101221,7 @@ var require_tool_cache = __commonJS({ exports2.downloadTool = downloadTool; function downloadToolAttempt(url, dest, auth, headers) { return __awaiter3(this, void 0, void 0, function* () { - if (fs2.existsSync(dest)) { + if (fs3.existsSync(dest)) { throw new Error(`Destination file path ${dest} already exists`); } const http = new httpm.HttpClient(userAgent, [], { @@ -101245,7 +101245,7 @@ var require_tool_cache = __commonJS({ const readStream = responseMessageFactory(); let succeeded = false; try { - yield pipeline(readStream, fs2.createWriteStream(dest)); + yield pipeline(readStream, fs3.createWriteStream(dest)); core2.debug("download complete"); succeeded = true; return dest; @@ -101464,11 +101464,11 @@ var require_tool_cache = __commonJS({ arch = arch || os.arch(); core2.debug(`Caching tool ${tool} ${version3} ${arch}`); core2.debug(`source dir: ${sourceDir}`); - if (!fs2.statSync(sourceDir).isDirectory()) { + if (!fs3.statSync(sourceDir).isDirectory()) { throw new Error("sourceDir is not a directory"); } const destPath = yield _createToolPath(tool, version3, arch); - for (const itemName of fs2.readdirSync(sourceDir)) { + for (const itemName of fs3.readdirSync(sourceDir)) { const s = path2.join(sourceDir, itemName); yield io2.cp(s, destPath, { recursive: true }); } @@ -101484,7 +101484,7 @@ var require_tool_cache = __commonJS({ arch = arch || os.arch(); core2.debug(`Caching tool ${tool} ${version3} ${arch}`); core2.debug(`source file: ${sourceFile}`); - if (!fs2.statSync(sourceFile).isFile()) { + if (!fs3.statSync(sourceFile).isFile()) { throw new Error("sourceFile is not a file"); } const destFolder = yield _createToolPath(tool, version3, arch); @@ -101515,7 +101515,7 @@ var require_tool_cache = __commonJS({ versionSpec = semver.clean(versionSpec) || ""; const cachePath = path2.join(_getCacheDirectory(), toolName, versionSpec, arch); core2.debug(`checking cache: ${cachePath}`); - if (fs2.existsSync(cachePath) && fs2.existsSync(`${cachePath}.complete`)) { + if (fs3.existsSync(cachePath) && fs3.existsSync(`${cachePath}.complete`)) { core2.debug(`Found tool in cache ${toolName} ${versionSpec} ${arch}`); toolPath = cachePath; } else { @@ -101530,12 +101530,12 @@ var require_tool_cache = __commonJS({ const versions = []; arch = arch || os.arch(); const toolPath = path2.join(_getCacheDirectory(), toolName); - if (fs2.existsSync(toolPath)) { - const children2 = fs2.readdirSync(toolPath); + if (fs3.existsSync(toolPath)) { + const children2 = fs3.readdirSync(toolPath); for (const child of children2) { if (isExplicitVersion(child)) { const fullPath = path2.join(toolPath, child, arch || ""); - if (fs2.existsSync(fullPath) && fs2.existsSync(`${fullPath}.complete`)) { + if (fs3.existsSync(fullPath) && fs3.existsSync(`${fullPath}.complete`)) { versions.push(child); } } @@ -101614,7 +101614,7 @@ var require_tool_cache = __commonJS({ function _completeToolPath(tool, version3, arch) { const folderPath = path2.join(_getCacheDirectory(), tool, semver.clean(version3) || version3, arch || ""); const markerPath = `${folderPath}.complete`; - fs2.writeFileSync(markerPath, ""); + fs3.writeFileSync(markerPath, ""); core2.debug("finished caching tool"); } __name(_completeToolPath, "_completeToolPath"); @@ -104485,15 +104485,15 @@ var require_upload_zip_specification = __commonJS({ }; Object.defineProperty(exports2, "__esModule", { value: true }); exports2.getUploadZipSpecification = exports2.validateRootDirectory = void 0; - var fs2 = __importStar3(require("fs")); + var fs3 = __importStar3(require("fs")); var core_1 = require_core(); var path_1 = require("path"); var path_and_artifact_name_validation_1 = require_path_and_artifact_name_validation(); function validateRootDirectory(rootDirectory) { - if (!fs2.existsSync(rootDirectory)) { + if (!fs3.existsSync(rootDirectory)) { throw new Error(`The provided rootDirectory ${rootDirectory} does not exist`); } - if (!fs2.statSync(rootDirectory).isDirectory()) { + if (!fs3.statSync(rootDirectory).isDirectory()) { throw new Error(`The provided rootDirectory ${rootDirectory} is not a valid directory`); } (0, core_1.info)(`Root directory input is valid!`); @@ -104505,7 +104505,7 @@ var require_upload_zip_specification = __commonJS({ rootDirectory = (0, path_1.normalize)(rootDirectory); rootDirectory = (0, path_1.resolve)(rootDirectory); for (let file of filesToZip) { - const stats = fs2.lstatSync(file, { throwIfNoEntry: false }); + const stats = fs3.lstatSync(file, { throwIfNoEntry: false }); if (!stats) { throw new Error(`File ${file} does not exist`); } @@ -105547,13 +105547,13 @@ var require_minimatch2 = __commonJS({ var require_readdir_glob = __commonJS({ "../node_modules/readdir-glob/index.js"(exports2, module2) { module2.exports = readdirGlob; - var fs2 = require("fs"); + var fs3 = require("fs"); var { EventEmitter } = require("events"); var { Minimatch } = require_minimatch2(); var { resolve } = require("path"); function readdir3(dir, strict) { return new Promise((resolve2, reject) => { - fs2.readdir(dir, { withFileTypes: true }, (err, files) => { + fs3.readdir(dir, { withFileTypes: true }, (err, files) => { if (err) { switch (err.code) { case "ENOTDIR": @@ -105587,7 +105587,7 @@ var require_readdir_glob = __commonJS({ __name(readdir3, "readdir"); function stat3(file, followSymlinks) { return new Promise((resolve2, reject) => { - const statFunc = followSymlinks ? fs2.stat : fs2.lstat; + const statFunc = followSymlinks ? fs3.stat : fs3.lstat; statFunc(file, (err, stats) => { if (err) { switch (err.code) { @@ -107815,54 +107815,54 @@ var require_polyfills = __commonJS({ } var chdir; module2.exports = patch; - function patch(fs2) { + function patch(fs3) { if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { - patchLchmod(fs2); - } - if (!fs2.lutimes) { - patchLutimes(fs2); - } - fs2.chown = chownFix(fs2.chown); - fs2.fchown = chownFix(fs2.fchown); - fs2.lchown = chownFix(fs2.lchown); - fs2.chmod = chmodFix(fs2.chmod); - fs2.fchmod = chmodFix(fs2.fchmod); - fs2.lchmod = chmodFix(fs2.lchmod); - fs2.chownSync = chownFixSync(fs2.chownSync); - fs2.fchownSync = chownFixSync(fs2.fchownSync); - fs2.lchownSync = chownFixSync(fs2.lchownSync); - fs2.chmodSync = chmodFixSync(fs2.chmodSync); - fs2.fchmodSync = chmodFixSync(fs2.fchmodSync); - fs2.lchmodSync = chmodFixSync(fs2.lchmodSync); - fs2.stat = statFix(fs2.stat); - fs2.fstat = statFix(fs2.fstat); - fs2.lstat = statFix(fs2.lstat); - fs2.statSync = statFixSync(fs2.statSync); - fs2.fstatSync = statFixSync(fs2.fstatSync); - fs2.lstatSync = statFixSync(fs2.lstatSync); - if (fs2.chmod && !fs2.lchmod) { - fs2.lchmod = function(path2, mode, cb) { + patchLchmod(fs3); + } + if (!fs3.lutimes) { + patchLutimes(fs3); + } + fs3.chown = chownFix(fs3.chown); + fs3.fchown = chownFix(fs3.fchown); + fs3.lchown = chownFix(fs3.lchown); + fs3.chmod = chmodFix(fs3.chmod); + fs3.fchmod = chmodFix(fs3.fchmod); + fs3.lchmod = chmodFix(fs3.lchmod); + fs3.chownSync = chownFixSync(fs3.chownSync); + fs3.fchownSync = chownFixSync(fs3.fchownSync); + fs3.lchownSync = chownFixSync(fs3.lchownSync); + fs3.chmodSync = chmodFixSync(fs3.chmodSync); + fs3.fchmodSync = chmodFixSync(fs3.fchmodSync); + fs3.lchmodSync = chmodFixSync(fs3.lchmodSync); + fs3.stat = statFix(fs3.stat); + fs3.fstat = statFix(fs3.fstat); + fs3.lstat = statFix(fs3.lstat); + fs3.statSync = statFixSync(fs3.statSync); + fs3.fstatSync = statFixSync(fs3.fstatSync); + fs3.lstatSync = statFixSync(fs3.lstatSync); + if (fs3.chmod && !fs3.lchmod) { + fs3.lchmod = function(path2, mode, cb) { if (cb) process.nextTick(cb); }; - fs2.lchmodSync = function() { + fs3.lchmodSync = function() { }; } - if (fs2.chown && !fs2.lchown) { - fs2.lchown = function(path2, uid, gid, cb) { + if (fs3.chown && !fs3.lchown) { + fs3.lchown = function(path2, uid, gid, cb) { if (cb) process.nextTick(cb); }; - fs2.lchownSync = function() { + fs3.lchownSync = function() { }; } if (platform === "win32") { - fs2.rename = typeof fs2.rename !== "function" ? fs2.rename : function(fs$rename) { + fs3.rename = typeof fs3.rename !== "function" ? fs3.rename : function(fs$rename) { function rename(from, to, cb) { var start = Date.now(); var backoff = 0; fs$rename(from, to, /* @__PURE__ */ __name(function CB(er) { if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) { setTimeout(function() { - fs2.stat(to, function(stater, st) { + fs3.stat(to, function(stater, st) { if (stater && stater.code === "ENOENT") fs$rename(from, to, CB); else @@ -107879,9 +107879,9 @@ var require_polyfills = __commonJS({ __name(rename, "rename"); if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename); return rename; - }(fs2.rename); + }(fs3.rename); } - fs2.read = typeof fs2.read !== "function" ? fs2.read : function(fs$read) { + fs3.read = typeof fs3.read !== "function" ? fs3.read : function(fs$read) { function read(fd, buffer, offset, length, position, callback_) { var callback; if (callback_ && typeof callback_ === "function") { @@ -107889,23 +107889,23 @@ var require_polyfills = __commonJS({ callback = /* @__PURE__ */ __name(function(er, _2, __) { if (er && er.code === "EAGAIN" && eagCounter < 10) { eagCounter++; - return fs$read.call(fs2, fd, buffer, offset, length, position, callback); + return fs$read.call(fs3, fd, buffer, offset, length, position, callback); } callback_.apply(this, arguments); }, "callback"); } - return fs$read.call(fs2, fd, buffer, offset, length, position, callback); + return fs$read.call(fs3, fd, buffer, offset, length, position, callback); } __name(read, "read"); if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read); return read; - }(fs2.read); - fs2.readSync = typeof fs2.readSync !== "function" ? fs2.readSync : /* @__PURE__ */ function(fs$readSync) { + }(fs3.read); + fs3.readSync = typeof fs3.readSync !== "function" ? fs3.readSync : /* @__PURE__ */ function(fs$readSync) { return function(fd, buffer, offset, length, position) { var eagCounter = 0; while (true) { try { - return fs$readSync.call(fs2, fd, buffer, offset, length, position); + return fs$readSync.call(fs3, fd, buffer, offset, length, position); } catch (er) { if (er.code === "EAGAIN" && eagCounter < 10) { eagCounter++; @@ -107915,10 +107915,10 @@ var require_polyfills = __commonJS({ } } }; - }(fs2.readSync); - function patchLchmod(fs3) { - fs3.lchmod = function(path2, mode, callback) { - fs3.open( + }(fs3.readSync); + function patchLchmod(fs4) { + fs4.lchmod = function(path2, mode, callback) { + fs4.open( path2, constants.O_WRONLY | constants.O_SYMLINK, mode, @@ -107927,74 +107927,74 @@ var require_polyfills = __commonJS({ if (callback) callback(err); return; } - fs3.fchmod(fd, mode, function(err2) { - fs3.close(fd, function(err22) { + fs4.fchmod(fd, mode, function(err2) { + fs4.close(fd, function(err22) { if (callback) callback(err2 || err22); }); }); } ); }; - fs3.lchmodSync = function(path2, mode) { - var fd = fs3.openSync(path2, constants.O_WRONLY | constants.O_SYMLINK, mode); + fs4.lchmodSync = function(path2, mode) { + var fd = fs4.openSync(path2, constants.O_WRONLY | constants.O_SYMLINK, mode); var threw = true; var ret; try { - ret = fs3.fchmodSync(fd, mode); + ret = fs4.fchmodSync(fd, mode); threw = false; } finally { if (threw) { try { - fs3.closeSync(fd); + fs4.closeSync(fd); } catch (er) { } } else { - fs3.closeSync(fd); + fs4.closeSync(fd); } } return ret; }; } __name(patchLchmod, "patchLchmod"); - function patchLutimes(fs3) { - if (constants.hasOwnProperty("O_SYMLINK") && fs3.futimes) { - fs3.lutimes = function(path2, at, mt, cb) { - fs3.open(path2, constants.O_SYMLINK, function(er, fd) { + function patchLutimes(fs4) { + if (constants.hasOwnProperty("O_SYMLINK") && fs4.futimes) { + fs4.lutimes = function(path2, at, mt, cb) { + fs4.open(path2, constants.O_SYMLINK, function(er, fd) { if (er) { if (cb) cb(er); return; } - fs3.futimes(fd, at, mt, function(er2) { - fs3.close(fd, function(er22) { + fs4.futimes(fd, at, mt, function(er2) { + fs4.close(fd, function(er22) { if (cb) cb(er2 || er22); }); }); }); }; - fs3.lutimesSync = function(path2, at, mt) { - var fd = fs3.openSync(path2, constants.O_SYMLINK); + fs4.lutimesSync = function(path2, at, mt) { + var fd = fs4.openSync(path2, constants.O_SYMLINK); var ret; var threw = true; try { - ret = fs3.futimesSync(fd, at, mt); + ret = fs4.futimesSync(fd, at, mt); threw = false; } finally { if (threw) { try { - fs3.closeSync(fd); + fs4.closeSync(fd); } catch (er) { } } else { - fs3.closeSync(fd); + fs4.closeSync(fd); } } return ret; }; - } else if (fs3.futimes) { - fs3.lutimes = function(_a, _b, _c, cb) { + } else if (fs4.futimes) { + fs4.lutimes = function(_a, _b, _c, cb) { if (cb) process.nextTick(cb); }; - fs3.lutimesSync = function() { + fs4.lutimesSync = function() { }; } } @@ -108002,7 +108002,7 @@ var require_polyfills = __commonJS({ function chmodFix(orig) { if (!orig) return orig; return function(target, mode, cb) { - return orig.call(fs2, target, mode, function(er) { + return orig.call(fs3, target, mode, function(er) { if (chownErOk(er)) er = null; if (cb) cb.apply(this, arguments); }); @@ -108013,7 +108013,7 @@ var require_polyfills = __commonJS({ if (!orig) return orig; return function(target, mode) { try { - return orig.call(fs2, target, mode); + return orig.call(fs3, target, mode); } catch (er) { if (!chownErOk(er)) throw er; } @@ -108023,7 +108023,7 @@ var require_polyfills = __commonJS({ function chownFix(orig) { if (!orig) return orig; return function(target, uid, gid, cb) { - return orig.call(fs2, target, uid, gid, function(er) { + return orig.call(fs3, target, uid, gid, function(er) { if (chownErOk(er)) er = null; if (cb) cb.apply(this, arguments); }); @@ -108034,7 +108034,7 @@ var require_polyfills = __commonJS({ if (!orig) return orig; return function(target, uid, gid) { try { - return orig.call(fs2, target, uid, gid); + return orig.call(fs3, target, uid, gid); } catch (er) { if (!chownErOk(er)) throw er; } @@ -108056,14 +108056,14 @@ var require_polyfills = __commonJS({ if (cb) cb.apply(this, arguments); } __name(callback, "callback"); - return options ? orig.call(fs2, target, options, callback) : orig.call(fs2, target, callback); + return options ? orig.call(fs3, target, options, callback) : orig.call(fs3, target, callback); }; } __name(statFix, "statFix"); function statFixSync(orig) { if (!orig) return orig; return function(target, options) { - var stats = options ? orig.call(fs2, target, options) : orig.call(fs2, target); + var stats = options ? orig.call(fs3, target, options) : orig.call(fs3, target); if (stats) { if (stats.uid < 0) stats.uid += 4294967296; if (stats.gid < 0) stats.gid += 4294967296; @@ -108095,7 +108095,7 @@ var require_legacy_streams = __commonJS({ "../node_modules/graceful-fs/legacy-streams.js"(exports2, module2) { var Stream = require("stream").Stream; module2.exports = legacy; - function legacy(fs2) { + function legacy(fs3) { return { ReadStream, WriteStream @@ -108138,7 +108138,7 @@ var require_legacy_streams = __commonJS({ }); return; } - fs2.open(this.path, this.flags, this.mode, function(err, fd) { + fs3.open(this.path, this.flags, this.mode, function(err, fd) { if (err) { self2.emit("error", err); self2.readable = false; @@ -108178,7 +108178,7 @@ var require_legacy_streams = __commonJS({ this.busy = false; this._queue = []; if (this.fd === null) { - this._open = fs2.open; + this._open = fs3.open; this._queue.push([this._open, this.path, this.flags, this.mode, void 0]); this.flush(); } @@ -108216,7 +108216,7 @@ var require_clone = __commonJS({ // ../node_modules/graceful-fs/graceful-fs.js var require_graceful_fs = __commonJS({ "../node_modules/graceful-fs/graceful-fs.js"(exports2, module2) { - var fs2 = require("fs"); + var fs3 = require("fs"); var polyfills = require_polyfills(); var legacy = require_legacy_streams(); var clone = require_clone(); @@ -108250,12 +108250,12 @@ var require_graceful_fs = __commonJS({ m = "GFS4: " + m.split(/\n/).join("\nGFS4: "); console.error(m); }, "debug"); - if (!fs2[gracefulQueue]) { + if (!fs3[gracefulQueue]) { queue = global[gracefulQueue] || []; - publishQueue(fs2, queue); - fs2.close = function(fs$close) { + publishQueue(fs3, queue); + fs3.close = function(fs$close) { function close(fd, cb) { - return fs$close.call(fs2, fd, function(err) { + return fs$close.call(fs3, fd, function(err) { if (!err) { resetQueue(); } @@ -108268,10 +108268,10 @@ var require_graceful_fs = __commonJS({ value: fs$close }); return close; - }(fs2.close); - fs2.closeSync = function(fs$closeSync) { + }(fs3.close); + fs3.closeSync = function(fs$closeSync) { function closeSync(fd) { - fs$closeSync.apply(fs2, arguments); + fs$closeSync.apply(fs3, arguments); resetQueue(); } __name(closeSync, "closeSync"); @@ -108279,30 +108279,30 @@ var require_graceful_fs = __commonJS({ value: fs$closeSync }); return closeSync; - }(fs2.closeSync); + }(fs3.closeSync); if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) { process.on("exit", function() { - debug(fs2[gracefulQueue]); - require("assert").equal(fs2[gracefulQueue].length, 0); + debug(fs3[gracefulQueue]); + require("assert").equal(fs3[gracefulQueue].length, 0); }); } } var queue; if (!global[gracefulQueue]) { - publishQueue(global, fs2[gracefulQueue]); - } - module2.exports = patch(clone(fs2)); - if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs2.__patched) { - module2.exports = patch(fs2); - fs2.__patched = true; - } - function patch(fs3) { - polyfills(fs3); - fs3.gracefulify = patch; - fs3.createReadStream = createReadStream2; - fs3.createWriteStream = createWriteStream2; - var fs$readFile = fs3.readFile; - fs3.readFile = readFile; + publishQueue(global, fs3[gracefulQueue]); + } + module2.exports = patch(clone(fs3)); + if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs3.__patched) { + module2.exports = patch(fs3); + fs3.__patched = true; + } + function patch(fs4) { + polyfills(fs4); + fs4.gracefulify = patch; + fs4.createReadStream = createReadStream2; + fs4.createWriteStream = createWriteStream2; + var fs$readFile = fs4.readFile; + fs4.readFile = readFile; function readFile(path2, options, cb) { if (typeof options === "function") cb = options, options = null; @@ -108320,8 +108320,8 @@ var require_graceful_fs = __commonJS({ __name(go$readFile, "go$readFile"); } __name(readFile, "readFile"); - var fs$writeFile = fs3.writeFile; - fs3.writeFile = writeFile; + var fs$writeFile = fs4.writeFile; + fs4.writeFile = writeFile; function writeFile(path2, data, options, cb) { if (typeof options === "function") cb = options, options = null; @@ -108339,9 +108339,9 @@ var require_graceful_fs = __commonJS({ __name(go$writeFile, "go$writeFile"); } __name(writeFile, "writeFile"); - var fs$appendFile = fs3.appendFile; + var fs$appendFile = fs4.appendFile; if (fs$appendFile) - fs3.appendFile = appendFile; + fs4.appendFile = appendFile; function appendFile(path2, data, options, cb) { if (typeof options === "function") cb = options, options = null; @@ -108359,9 +108359,9 @@ var require_graceful_fs = __commonJS({ __name(go$appendFile, "go$appendFile"); } __name(appendFile, "appendFile"); - var fs$copyFile = fs3.copyFile; + var fs$copyFile = fs4.copyFile; if (fs$copyFile) - fs3.copyFile = copyFile; + fs4.copyFile = copyFile; function copyFile(src, dest, flags, cb) { if (typeof flags === "function") { cb = flags; @@ -108381,8 +108381,8 @@ var require_graceful_fs = __commonJS({ __name(go$copyFile, "go$copyFile"); } __name(copyFile, "copyFile"); - var fs$readdir = fs3.readdir; - fs3.readdir = readdir3; + var fs$readdir = fs4.readdir; + fs4.readdir = readdir3; var noReaddirOptionVersions = /^v[0-5]\./; function readdir3(path2, options, cb) { if (typeof options === "function") @@ -108425,21 +108425,21 @@ var require_graceful_fs = __commonJS({ } __name(readdir3, "readdir"); if (process.version.substr(0, 4) === "v0.8") { - var legStreams = legacy(fs3); + var legStreams = legacy(fs4); ReadStream = legStreams.ReadStream; WriteStream = legStreams.WriteStream; } - var fs$ReadStream = fs3.ReadStream; + var fs$ReadStream = fs4.ReadStream; if (fs$ReadStream) { ReadStream.prototype = Object.create(fs$ReadStream.prototype); ReadStream.prototype.open = ReadStream$open; } - var fs$WriteStream = fs3.WriteStream; + var fs$WriteStream = fs4.WriteStream; if (fs$WriteStream) { WriteStream.prototype = Object.create(fs$WriteStream.prototype); WriteStream.prototype.open = WriteStream$open; } - Object.defineProperty(fs3, "ReadStream", { + Object.defineProperty(fs4, "ReadStream", { get: /* @__PURE__ */ __name(function() { return ReadStream; }, "get"), @@ -108449,7 +108449,7 @@ var require_graceful_fs = __commonJS({ enumerable: true, configurable: true }); - Object.defineProperty(fs3, "WriteStream", { + Object.defineProperty(fs4, "WriteStream", { get: /* @__PURE__ */ __name(function() { return WriteStream; }, "get"), @@ -108460,7 +108460,7 @@ var require_graceful_fs = __commonJS({ configurable: true }); var FileReadStream = ReadStream; - Object.defineProperty(fs3, "FileReadStream", { + Object.defineProperty(fs4, "FileReadStream", { get: /* @__PURE__ */ __name(function() { return FileReadStream; }, "get"), @@ -108471,7 +108471,7 @@ var require_graceful_fs = __commonJS({ configurable: true }); var FileWriteStream = WriteStream; - Object.defineProperty(fs3, "FileWriteStream", { + Object.defineProperty(fs4, "FileWriteStream", { get: /* @__PURE__ */ __name(function() { return FileWriteStream; }, "get"), @@ -108524,15 +108524,15 @@ var require_graceful_fs = __commonJS({ } __name(WriteStream$open, "WriteStream$open"); function createReadStream2(path2, options) { - return new fs3.ReadStream(path2, options); + return new fs4.ReadStream(path2, options); } __name(createReadStream2, "createReadStream"); function createWriteStream2(path2, options) { - return new fs3.WriteStream(path2, options); + return new fs4.WriteStream(path2, options); } __name(createWriteStream2, "createWriteStream"); - var fs$open = fs3.open; - fs3.open = open; + var fs$open = fs4.open; + fs4.open = open; function open(path2, flags, mode, cb) { if (typeof mode === "function") cb = mode, mode = null; @@ -108550,22 +108550,22 @@ var require_graceful_fs = __commonJS({ __name(go$open, "go$open"); } __name(open, "open"); - return fs3; + return fs4; } __name(patch, "patch"); function enqueue(elem) { debug("ENQUEUE", elem[0].name, elem[1]); - fs2[gracefulQueue].push(elem); + fs3[gracefulQueue].push(elem); retry(); } __name(enqueue, "enqueue"); var retryTimer; function resetQueue() { var now = Date.now(); - for (var i = 0; i < fs2[gracefulQueue].length; ++i) { - if (fs2[gracefulQueue][i].length > 2) { - fs2[gracefulQueue][i][3] = now; - fs2[gracefulQueue][i][4] = now; + for (var i = 0; i < fs3[gracefulQueue].length; ++i) { + if (fs3[gracefulQueue][i].length > 2) { + fs3[gracefulQueue][i][3] = now; + fs3[gracefulQueue][i][4] = now; } } retry(); @@ -108574,9 +108574,9 @@ var require_graceful_fs = __commonJS({ function retry() { clearTimeout(retryTimer); retryTimer = void 0; - if (fs2[gracefulQueue].length === 0) + if (fs3[gracefulQueue].length === 0) return; - var elem = fs2[gracefulQueue].shift(); + var elem = fs3[gracefulQueue].shift(); var fn = elem[0]; var args = elem[1]; var err = elem[2]; @@ -108598,7 +108598,7 @@ var require_graceful_fs = __commonJS({ debug("RETRY", fn.name, args); fn.apply(null, args.concat([startTime])); } else { - fs2[gracefulQueue].push(elem); + fs3[gracefulQueue].push(elem); } } if (retryTimer === void 0) { @@ -123496,8 +123496,8 @@ var require_commonjs12 = __commonJS({ * * @internal */ - constructor(cwd = process.cwd(), pathImpl, sep, { nocase, childrenCacheSize = 16 * 1024, fs: fs2 = defaultFS } = {}) { - this.#fs = fsFromOption(fs2); + constructor(cwd = process.cwd(), pathImpl, sep, { nocase, childrenCacheSize = 16 * 1024, fs: fs3 = defaultFS } = {}) { + this.#fs = fsFromOption(fs3); if (cwd instanceof URL || cwd.startsWith("file://")) { cwd = (0, url_1.fileURLToPath)(cwd); } @@ -124059,8 +124059,8 @@ var require_commonjs12 = __commonJS({ /** * @internal */ - newRoot(fs2) { - return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs2 }); + newRoot(fs3) { + return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs3 }); } /** * Return true if the provided path string is an absolute path @@ -124092,8 +124092,8 @@ var require_commonjs12 = __commonJS({ /** * @internal */ - newRoot(fs2) { - return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs2 }); + newRoot(fs3) { + return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs3 }); } /** * Return true if the provided path string is an absolute path @@ -125293,7 +125293,7 @@ var require_commonjs13 = __commonJS({ // ../node_modules/archiver-utils/file.js var require_file2 = __commonJS({ "../node_modules/archiver-utils/file.js"(exports2, module2) { - var fs2 = require_graceful_fs(); + var fs3 = require_graceful_fs(); var path2 = require("path"); var flatten = require_flatten(); var difference = require_difference(); @@ -125320,7 +125320,7 @@ var require_file2 = __commonJS({ }, "processPatterns"); file.exists = function() { var filepath = path2.join.apply(path2, arguments); - return fs2.existsSync(filepath); + return fs3.existsSync(filepath); }; file.expand = function(...args) { var options = isPlainObject(args[0]) ? args.shift() : {}; @@ -125338,7 +125338,7 @@ var require_file2 = __commonJS({ if (typeof options.filter === "function") { return options.filter(filepath); } else { - return fs2.statSync(filepath)[options.filter](); + return fs3.statSync(filepath)[options.filter](); } } catch (e) { return false; @@ -125446,7 +125446,7 @@ var require_file2 = __commonJS({ // ../node_modules/archiver-utils/index.js var require_archiver_utils = __commonJS({ "../node_modules/archiver-utils/index.js"(exports2, module2) { - var fs2 = require_graceful_fs(); + var fs3 = require_graceful_fs(); var path2 = require("path"); var isStream = require_is_stream(); var lazystream = require_lazystream(); @@ -125495,7 +125495,7 @@ var require_archiver_utils = __commonJS({ }; utils.lazyReadStream = function(filepath) { return new lazystream.Readable(function() { - return fs2.createReadStream(filepath); + return fs3.createReadStream(filepath); }); }; utils.normalizeInputSource = function(source) { @@ -125523,7 +125523,7 @@ var require_archiver_utils = __commonJS({ callback = base; base = dirpath; } - fs2.readdir(dirpath, function(err, list) { + fs3.readdir(dirpath, function(err, list) { var i = 0; var file; var filepath; @@ -125536,7 +125536,7 @@ var require_archiver_utils = __commonJS({ return callback(null, results); } filepath = path2.join(dirpath, file); - fs2.stat(filepath, function(err2, stats) { + fs3.stat(filepath, function(err2, stats) { results.push({ path: filepath, relative: path2.relative(base, filepath).replace(/\\/g, "/"), @@ -125599,7 +125599,7 @@ var require_error2 = __commonJS({ // ../node_modules/archiver/lib/core.js var require_core2 = __commonJS({ "../node_modules/archiver/lib/core.js"(exports2, module2) { - var fs2 = require("fs"); + var fs3 = require("fs"); var glob = require_readdir_glob(); var async = require_async2(); var path2 = require("path"); @@ -125663,7 +125663,7 @@ var require_core2 = __commonJS({ data.sourcePath = filepath; task.data = data; this._entriesCount++; - if (data.stats && data.stats instanceof fs2.Stats) { + if (data.stats && data.stats instanceof fs3.Stats) { task = this._updateQueueTaskWithStats(task, data.stats); if (task) { if (data.stats.size) { @@ -125834,7 +125834,7 @@ var require_core2 = __commonJS({ callback(); return; } - fs2.lstat(task.filepath, function(err, stats) { + fs3.lstat(task.filepath, function(err, stats) { if (this._state.aborted) { setImmediate(callback); return; @@ -125877,7 +125877,7 @@ var require_core2 = __commonJS({ task.data.sourceType = "buffer"; task.source = Buffer.concat([]); } else if (stats.isSymbolicLink() && this._moduleSupports("symlink")) { - var linkPath = fs2.readlinkSync(task.filepath); + var linkPath = fs3.readlinkSync(task.filepath); var dirName = path2.dirname(task.filepath); task.data.type = "symlink"; task.data.linkname = path2.relative(dirName, path2.resolve(dirName, linkPath)); @@ -134438,7 +134438,7 @@ var require_parser_stream = __commonJS({ var require_mkdirp = __commonJS({ "../node_modules/mkdirp/index.js"(exports2, module2) { var path2 = require("path"); - var fs2 = require("fs"); + var fs3 = require("fs"); var _0777 = parseInt("0777", 8); module2.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; function mkdirP(p, opts, f, made) { @@ -134449,7 +134449,7 @@ var require_mkdirp = __commonJS({ opts = { mode: opts }; } var mode = opts.mode; - var xfs = opts.fs || fs2; + var xfs = opts.fs || fs3; if (mode === void 0) { mode = _0777; } @@ -134489,7 +134489,7 @@ var require_mkdirp = __commonJS({ opts = { mode: opts }; } var mode = opts.mode; - var xfs = opts.fs || fs2; + var xfs = opts.fs || fs3; if (mode === void 0) { mode = _0777; } @@ -134526,7 +134526,7 @@ var require_mkdirp = __commonJS({ // ../node_modules/unzip-stream/lib/extract.js var require_extract2 = __commonJS({ "../node_modules/unzip-stream/lib/extract.js"(exports2, module2) { - var fs2 = require("fs"); + var fs3 = require("fs"); var path2 = require("path"); var util = require("util"); var mkdirp = require_mkdirp(); @@ -134574,7 +134574,7 @@ var require_extract2 = __commonJS({ var directory = entry.isDirectory ? destPath : path2.dirname(destPath); this.unfinishedEntries++; var writeFileFn = /* @__PURE__ */ __name(function() { - var pipedStream = fs2.createWriteStream(destPath); + var pipedStream = fs3.createWriteStream(destPath); pipedStream.on("close", function() { self2.unfinishedEntries--; self2._notifyAwaiter(); @@ -136976,303 +136976,272 @@ var require_artifact2 = __commonJS({ } }); -// lib/output.js -var require_output = __commonJS({ - "lib/output.js"(exports2) { - "use strict"; - var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: /* @__PURE__ */ __name(function() { - return m[k]; - }, "get") }; - } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - }); - var __setModuleDefault3 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; - }); - var __importStar3 = exports2 && exports2.__importStar || /* @__PURE__ */ function() { - var ownKeys = /* @__PURE__ */ __name(function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }, "ownKeys"); - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding3(result, mod, k[i]); - } - __setModuleDefault3(result, mod); - return result; - }; - }(); - var __awaiter3 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); +// ../common/output.ts +var output_exports = {}; +__export(output_exports, { + COMMIT_EMAIL: () => COMMIT_EMAIL, + COMMIT_USER: () => COMMIT_USER, + FAILURE_LEVEL: () => FAILURE_LEVEL, + NOTICE_LEVEL: () => NOTICE_LEVEL, + QODANA_CHECK_NAME: () => QODANA_CHECK_NAME, + WARNING_LEVEL: () => WARNING_LEVEL, + getCoverageStats: () => getCoverageStats, + getDepencencyPlural: () => getDepencencyPlural, + getLicenseInfo: () => getLicenseInfo, + getProblemPlural: () => getProblemPlural, + getReportURL: () => getReportURL, + getSummary: () => getSummary, + parseResult: () => parseResult +}); +function parseResult(result, rules) { + if (!result.locations || result.locations.length === 0 || !result.locations[0].physicalLocation) { + return null; + } + return { + title: rules.get(result.ruleId)?.shortDescription, + level: (() => { + switch (result.level) { + case "error": + return FAILURE_LEVEL; + case "warning": + return WARNING_LEVEL; + default: + return NOTICE_LEVEL; } - __name(adopt, "adopt"); - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - __name(fulfilled, "fulfilled"); - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - __name(rejected, "rejected"); - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - __name(step, "step"); - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; - Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.COMMIT_EMAIL = exports2.COMMIT_USER = void 0; - exports2.getCoverageStats = getCoverageStats; - exports2.getReportURL = getReportURL; - exports2.publishOutput = publishOutput; - exports2.getSummary = getSummary; - exports2.getProblemPlural = getProblemPlural; - exports2.getDepencencyPlural = getDepencencyPlural; - exports2.prFixesBody = prFixesBody; - var core2 = __importStar3(require_core()); - var fs2 = __importStar3(require("fs")); - var qodana_12 = (init_qodana(), __toCommonJS(qodana_exports)); - var utils_12 = require_utils10(); - var annotations_1 = require_annotations(); - exports2.COMMIT_USER = "qodana-bot"; - exports2.COMMIT_EMAIL = "qodana-support@jetbrains.com"; - var QODANA_CHECK_NAME = "Qodana"; - var UNKNOWN_RULE_ID = "Unknown"; - var SUMMARY_TABLE_HEADER = "| Inspection name | Severity | Problems |"; - var SUMMARY_TABLE_SEP = "| --- | --- | --- |"; - var SUMMARY_MISC = `Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com) - - Or via our issue tracker: https://jb.gg/qodana-issue - - Or share your feedback: https://jb.gg/qodana-discussions`; - var VIEW_REPORT_OPTIONS = `To be able to view the detailed Qodana report, you can either: - - Register at [Qodana Cloud](https://qodana.cloud/) and [configure the action](https://github.com/jetbrains/qodana-action#qodana-cloud) - - Use [GitHub Code Scanning with Qodana](https://github.com/jetbrains/qodana-action#github-code-scanning) - - Host [Qodana report at GitHub Pages](https://github.com/JetBrains/qodana-action/blob/3a8e25f5caad8d8b01c1435f1ef7b19fe8b039a0/README.md#github-pages) - - Inspect and use \`qodana.sarif.json\` (see [the Qodana SARIF format](https://www.jetbrains.com/help/qodana/qodana-sarif-output.html#Report+structure) for details) - -To get \`*.log\` files or any other Qodana artifacts, run the action with \`upload-result\` option set to \`true\`, -so that the action will upload the files as the job artifacts: -\`\`\`yaml - - name: 'Qodana Scan' - uses: JetBrains/qodana-action@v${qodana_12.VERSION} - with: - upload-result: true -\`\`\` -`; - var SUMMARY_PR_MODE = `\u{1F4A1} Qodana analysis was run in the pull request mode: only the changed files were checked`; - var DEPENDENCY_CHARS_LIMIT = 65e3; - function wrapToDiffBlock(message) { - return `\`\`\`diff + })() + }; +} +function wrapToDiffBlock(message) { + return `\`\`\`diff ${message} \`\`\``; - } - __name(wrapToDiffBlock, "wrapToDiffBlock"); - function makeConclusion(conclusion, failedByThreshold) { - if (failedByThreshold) { - return `- ${conclusion}`; - } else { - return `+ ${conclusion}`; - } - } - __name(makeConclusion, "makeConclusion"); - function getCoverageStats(c) { - if (c.totalLines === 0 && c.totalCoveredLines === 0) { - return ""; - } - let stats = ""; - if (c.totalLines !== 0) { - const conclusion = `${c.totalCoverage}% total lines covered`; - stats += `${makeConclusion(conclusion, c.totalCoverage < c.totalCoverageThreshold)} +} +function makeConclusion(conclusion, failedByThreshold) { + if (failedByThreshold) { + return `- ${conclusion}`; + } else { + return `+ ${conclusion}`; + } +} +function getCoverageStats(c) { + if (c.totalLines === 0 && c.totalCoveredLines === 0) { + return ""; + } + let stats = ""; + if (c.totalLines !== 0) { + const conclusion = `${c.totalCoverage}% total lines covered`; + stats += `${makeConclusion(conclusion, c.totalCoverage < c.totalCoverageThreshold)} ${c.totalLines} lines analyzed, ${c.totalCoveredLines} lines covered`; - } - if (c.freshLines !== 0) { - const conclusion = `${c.freshCoverage}% fresh lines covered`; - stats += ` + } + if (c.freshLines !== 0) { + const conclusion = `${c.freshCoverage}% fresh lines covered`; + stats += ` ${makeConclusion(conclusion, c.freshCoverage < c.freshCoverageThreshold)} ${c.freshLines} lines analyzed, ${c.freshCoveredLines} lines covered`; - } - return wrapToDiffBlock([ - `@@ Code coverage @@`, - `${stats}`, - `# Calculated according to the filters of your coverage tool` - ].join("\n")); + } + return wrapToDiffBlock( + [ + `@@ Code coverage @@`, + `${stats}`, + `# Calculated according to the filters of your coverage tool` + ].join("\n") + ); +} +function getLicenseInfo(resultsDir) { + let licensesInfo = ""; + let packages = 0; + const licensesJson = `${resultsDir}/projectStructure/${QODANA_LICENSES_JSON}`; + if (fs2.existsSync(licensesJson)) { + const licenses = JSON.parse( + fs2.readFileSync(licensesJson, { encoding: "utf8" }) + ); + if (licenses.length > 0) { + packages = licenses.length; + licensesInfo = fs2.readFileSync( + `${resultsDir}/projectStructure/${QODANA_LICENSES_MD}`, + { encoding: "utf8" } + ); } - __name(getCoverageStats, "getCoverageStats"); - function getReportURL(resultsDir) { - var _a; - let reportUrlFile = `${resultsDir}/${qodana_12.QODANA_OPEN_IN_IDE_NAME}`; - if (fs2.existsSync(reportUrlFile)) { - const rawData = fs2.readFileSync(reportUrlFile, { encoding: "utf8" }); - const data = JSON.parse(rawData); - if ((_a = data === null || data === void 0 ? void 0 : data.cloud) === null || _a === void 0 ? void 0 : _a.url) { - return data.cloud.url; - } - } else { - reportUrlFile = `${resultsDir}/${qodana_12.QODANA_REPORT_URL_NAME}`; - if (fs2.existsSync(reportUrlFile)) { - return fs2.readFileSync(reportUrlFile, { encoding: "utf8" }); - } - } - return ""; + } + return { licenses: licensesInfo, packages }; +} +function getReportURL(resultsDir) { + let reportUrlFile = `${resultsDir}/${QODANA_OPEN_IN_IDE_NAME}`; + if (fs2.existsSync(reportUrlFile)) { + const rawData = fs2.readFileSync(reportUrlFile, { encoding: "utf8" }); + const data = JSON.parse(rawData); + if (data?.cloud?.url) { + return data.cloud.url; } - __name(getReportURL, "getReportURL"); - function publishOutput(failedByThreshold, projectDir, sourceDir, resultsDir, useAnnotations, postComment, isPrMode, execute) { - return __awaiter3(this, void 0, void 0, function* () { - var _a, _b; - if (!execute) { - return; - } - try { - const problems = (0, annotations_1.parseSarif)(`${resultsDir}/${qodana_12.QODANA_SARIF_NAME}`); - const reportUrl = getReportURL(resultsDir); - const coverageInfo = getCoverageStats((0, qodana_12.getCoverageFromSarif)(`${resultsDir}/${qodana_12.QODANA_SHORT_SARIF_NAME}`)); - let licensesInfo = ""; - let packages = 0; - const licensesJson = `${resultsDir}/projectStructure/${qodana_12.QODANA_LICENSES_JSON}`; - if (fs2.existsSync(licensesJson)) { - const licenses = JSON.parse(fs2.readFileSync(licensesJson, { encoding: "utf8" })); - if (licenses.length > 0) { - packages = licenses.length; - licensesInfo = fs2.readFileSync(`${resultsDir}/projectStructure/${qodana_12.QODANA_LICENSES_MD}`, { encoding: "utf8" }); - } - } - const annotations = (_a = problems.annotations) !== null && _a !== void 0 ? _a : []; - const toolName = (_b = problems.title.split("found by ")[1]) !== null && _b !== void 0 ? _b : QODANA_CHECK_NAME; - problems.summary = getSummary(toolName, projectDir, sourceDir, annotations, coverageInfo, packages, licensesInfo, reportUrl, isPrMode); - yield Promise.all([ - (0, utils_12.putReaction)(utils_12.ANALYSIS_FINISHED_REACTION, utils_12.ANALYSIS_STARTED_REACTION), - (0, utils_12.postResultsToPRComments)(toolName, problems.summary, sourceDir, postComment), - core2.summary.addRaw(problems.summary).write(), - (0, annotations_1.publishAnnotations)(toolName, problems, failedByThreshold, useAnnotations) - ]); - } catch (error) { - core2.warning(`Qodana has problems with publishing results to GitHub \u2013 ${error.message}`); - } - }); + } else { + reportUrlFile = `${resultsDir}/${QODANA_REPORT_URL_NAME}`; + if (fs2.existsSync(reportUrlFile)) { + return fs2.readFileSync(reportUrlFile, { encoding: "utf8" }); } - __name(publishOutput, "publishOutput"); - function wrapToToggleBlock(header, body) { - return `
+ } + return ""; +} +function wrapToToggleBlock(header, body) { + return `
${header} ${body}
`; - } +} +function getViewReportText(reportUrl, viewReportOptions) { + if (reportUrl !== "") { + return `\u2601\uFE0F [View the detailed Qodana report](${reportUrl})`; + } + return wrapToToggleBlock( + "View the detailed Qodana report", + viewReportOptions + ); +} +function getRowsByLevel(annotations, level) { + const problems = annotations.reduce( + (map, e) => map.set( + e.title ?? UNKNOWN_RULE_ID, + map.get(e.title ?? UNKNOWN_RULE_ID) !== void 0 ? map.get(e.title ?? UNKNOWN_RULE_ID) + 1 : 1 + ), + /* @__PURE__ */ new Map() + ); + return Array.from(problems.entries()).sort((a, b) => b[1] - a[1]).map(([title, count]) => `| \`${title}\` | ${level} | ${count} |`).join("\n"); +} +function getSummary(toolName, projectDir, sourceDir, problemsDescriptors, coverageInfo, packages, licensesInfo, reportUrl, prMode, dependencyCharsLimit, reportViewOptionsHelp) { + const contactBlock = wrapToToggleBlock("Contact Qodana team", SUMMARY_MISC); + let licensesBlock = ""; + if (licensesInfo !== "" && licensesInfo.length < dependencyCharsLimit) { + licensesBlock = wrapToToggleBlock( + `Detected ${packages} ${getDepencencyPlural(packages)}`, + licensesInfo + ); + } + let prModeBlock = ""; + if (prMode) { + prModeBlock = SUMMARY_PR_MODE; + } + if (reportUrl !== "") { + const firstToolName = toolName.split(" ")[0]; + toolName = toolName.replace( + firstToolName, + `[${firstToolName}](${reportUrl})` + ); + } + const analysisScope = (projectDir === "" ? "" : ["Analyzed project: `", projectDir, "/`\n"].join("")).concat( + sourceDir === "" ? "" : ["Analyzed directory: `", sourceDir, "/`\n"].join("") + ); + if (problemsDescriptors.length === 0) { + return [ + `# ${toolName}`, + analysisScope, + "**It seems all right \u{1F44C}**", + "", + "No new problems were found according to the checks applied", + coverageInfo, + prModeBlock, + getViewReportText(reportUrl, reportViewOptionsHelp), + licensesBlock, + contactBlock + ].join("\n"); + } + return [ + `# ${toolName}`, + analysisScope, + `**${problemsDescriptors.length} ${getProblemPlural( + problemsDescriptors.length + )}** were found`, + "", + SUMMARY_TABLE_HEADER, + SUMMARY_TABLE_SEP, + [ + getRowsByLevel( + problemsDescriptors.filter((a) => a.level === FAILURE_LEVEL), + "\u{1F534} Failure" + ), + getRowsByLevel( + problemsDescriptors.filter((a) => a.level === WARNING_LEVEL), + "\u{1F536} Warning" + ), + getRowsByLevel( + problemsDescriptors.filter((a) => a.level === NOTICE_LEVEL), + "\u25FD\uFE0F Notice" + ) + ].filter((e) => e !== "").join("\n"), + "", + coverageInfo, + prModeBlock, + getViewReportText(reportUrl, reportViewOptionsHelp), + licensesBlock, + contactBlock + ].join("\n"); +} +function getProblemPlural(count) { + return `new problem${count !== 1 ? "s" : ""}`; +} +function getDepencencyPlural(count) { + return `dependenc${count !== 1 ? "ies" : "y"}`; +} +var fs2, COMMIT_USER, COMMIT_EMAIL, QODANA_CHECK_NAME, UNKNOWN_RULE_ID, SUMMARY_TABLE_HEADER, SUMMARY_TABLE_SEP, SUMMARY_MISC, SUMMARY_PR_MODE, FAILURE_LEVEL, WARNING_LEVEL, NOTICE_LEVEL; +var init_output = __esm({ + "../common/output.ts"() { + "use strict"; + init_qodana(); + fs2 = __toESM(require("fs")); + COMMIT_USER = "qodana-bot"; + COMMIT_EMAIL = "qodana-support@jetbrains.com"; + QODANA_CHECK_NAME = "Qodana"; + UNKNOWN_RULE_ID = "Unknown"; + SUMMARY_TABLE_HEADER = "| Inspection name | Severity | Problems |"; + SUMMARY_TABLE_SEP = "| --- | --- | --- |"; + SUMMARY_MISC = `Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com) + - Or via our issue tracker: https://jb.gg/qodana-issue + - Or share your feedback: https://jb.gg/qodana-discussions`; + SUMMARY_PR_MODE = `\u{1F4A1} Qodana analysis was run in the pull request mode: only the changed files were checked`; + FAILURE_LEVEL = "failure"; + WARNING_LEVEL = "warning"; + NOTICE_LEVEL = "notice"; + __name(parseResult, "parseResult"); + __name(wrapToDiffBlock, "wrapToDiffBlock"); + __name(makeConclusion, "makeConclusion"); + __name(getCoverageStats, "getCoverageStats"); + __name(getLicenseInfo, "getLicenseInfo"); + __name(getReportURL, "getReportURL"); __name(wrapToToggleBlock, "wrapToToggleBlock"); - function getViewReportText(reportUrl) { - if (reportUrl !== "") { - return `\u2601\uFE0F [View the detailed Qodana report](${reportUrl})`; - } - return wrapToToggleBlock("View the detailed Qodana report", VIEW_REPORT_OPTIONS); - } __name(getViewReportText, "getViewReportText"); - function getRowsByLevel(annotations, level) { - const problems = annotations.reduce((map, e) => { - var _a, _b, _c; - return map.set((_a = e.title) !== null && _a !== void 0 ? _a : UNKNOWN_RULE_ID, map.get((_b = e.title) !== null && _b !== void 0 ? _b : UNKNOWN_RULE_ID) !== void 0 ? map.get((_c = e.title) !== null && _c !== void 0 ? _c : UNKNOWN_RULE_ID) + 1 : 1); - }, /* @__PURE__ */ new Map()); - return Array.from(problems.entries()).sort((a, b) => b[1] - a[1]).map(([title, count]) => `| \`${title}\` | ${level} | ${count} |`).join("\n"); - } __name(getRowsByLevel, "getRowsByLevel"); - function getSummary(toolName, projectDir, sourceDir, annotations, coverageInfo, packages, licensesInfo, reportUrl, prMode) { - const contactBlock = wrapToToggleBlock("Contact Qodana team", SUMMARY_MISC); - let licensesBlock = ""; - if (licensesInfo !== "" && licensesInfo.length < DEPENDENCY_CHARS_LIMIT) { - licensesBlock = wrapToToggleBlock(`Detected ${packages} ${getDepencencyPlural(packages)}`, licensesInfo); - } - let prModeBlock = ""; - if (prMode) { - prModeBlock = SUMMARY_PR_MODE; - } - if (reportUrl !== "") { - const firstToolName = toolName.split(" ")[0]; - toolName = toolName.replace(firstToolName, `[${firstToolName}](${reportUrl})`); - } - const analysisScope = (projectDir === "" ? "" : ["Analyzed project: `", projectDir, "/`\n"].join("")).concat(sourceDir === "" ? "" : ["Analyzed directory: `", sourceDir, "/`\n"].join("")); - if (annotations.length === 0) { - return [ - `# ${toolName}`, - analysisScope, - "**It seems all right \u{1F44C}**", - "", - "No new problems were found according to the checks applied", - coverageInfo, - prModeBlock, - getViewReportText(reportUrl), - licensesBlock, - contactBlock - ].join("\n"); - } - return [ - `# ${toolName}`, - analysisScope, - `**${annotations.length} ${getProblemPlural(annotations.length)}** were found`, - "", - SUMMARY_TABLE_HEADER, - SUMMARY_TABLE_SEP, - [ - getRowsByLevel(annotations.filter((a) => a.annotation_level === annotations_1.ANNOTATION_FAILURE), "\u{1F534} Failure"), - getRowsByLevel(annotations.filter((a) => a.annotation_level === annotations_1.ANNOTATION_WARNING), "\u{1F536} Warning"), - getRowsByLevel(annotations.filter((a) => a.annotation_level === annotations_1.ANNOTATION_NOTICE), "\u25FD\uFE0F Notice") - ].filter((e) => e !== "").join("\n"), - "", - coverageInfo, - prModeBlock, - getViewReportText(reportUrl), - licensesBlock, - contactBlock - ].join("\n"); - } __name(getSummary, "getSummary"); - function getProblemPlural(count) { - return `new problem${count !== 1 ? "s" : ""}`; - } __name(getProblemPlural, "getProblemPlural"); - function getDepencencyPlural(count) { - return `dependenc${count !== 1 ? "ies" : "y"}`; - } __name(getDepencencyPlural, "getDepencencyPlural"); - function prFixesBody(jobUrl) { - return ` \u{1F590} Hey there! - -This pull request has been auto-generated by the [Qodana Scan workflow](${jobUrl}) configured in your repository. -It has performed code analysis and applied some suggested fixes to improve your code quality \u{1F9F9}\u2728 - -> **Warning** -> It's crucial to review these changes to ensure everything shipshape manually. Please take a moment to examine the changes here. Remember to run your integration tests against this PR to validate the fixes and ensure everything's functioning as expected. + } +}); -_\u{1F4BB}\u{1F50D} Happy reviewing and testing! -Best, -[Qodana Scan \u{1F916}](https://github.com/marketplace/actions/qodana-scan)_`; - } - __name(prFixesBody, "prFixesBody"); +// ../common/utils.ts +var utils_exports = {}; +__export(utils_exports, { + parseRules: () => parseRules +}); +function parseRules(tool) { + const rules = /* @__PURE__ */ new Map(); + tool.driver.rules?.forEach((rule) => { + rules.set(rule.id, { + shortDescription: rule.shortDescription.text, + fullDescription: rule.fullDescription.markdown || rule.fullDescription.text + }); + }); + tool?.extensions?.forEach((ext) => { + ext?.rules?.forEach((rule) => { + rules.set(rule.id, { + shortDescription: rule.shortDescription.text, + fullDescription: rule.fullDescription.markdown || rule.fullDescription.text + }); + }); + }); + return rules; +} +var init_utils3 = __esm({ + "../common/utils.ts"() { + "use strict"; + __name(parseRules, "parseRules"); } }); @@ -137355,9 +137324,10 @@ var require_annotations = __commonJS({ exports2.getGitHubCheckConclusion = getGitHubCheckConclusion; exports2.toAnnotationProperties = toAnnotationProperties; var core2 = __importStar3(require_core()); - var fs2 = __importStar3(require("fs")); + var fs3 = __importStar3(require("fs")); var utils_12 = require_utils10(); - var output_12 = require_output(); + var output_12 = (init_output(), __toCommonJS(output_exports)); + var utils_2 = (init_utils3(), __toCommonJS(utils_exports)); function getQodanaHelpString() { return `This result was published with [Qodana GitHub Action](${(0, utils_12.getWorkflowRunUrl)()})`; } @@ -137407,7 +137377,7 @@ var require_annotations = __commonJS({ }); } __name(publishAnnotations, "publishAnnotations"); - function parseResult(result, rules) { + function parseResult2(result, rules) { var _a, _b; if (!result.locations || result.locations.length === 0 || !result.locations[0].physicalLocation) { return null; @@ -137434,38 +137404,17 @@ var require_annotations = __commonJS({ })() }; } - __name(parseResult, "parseResult"); - function parseRules(tool) { - var _a, _b; - const rules = /* @__PURE__ */ new Map(); - (_a = tool.driver.rules) === null || _a === void 0 ? void 0 : _a.forEach((rule) => { - rules.set(rule.id, { - shortDescription: rule.shortDescription.text, - fullDescription: rule.fullDescription.markdown || rule.fullDescription.text - }); - }); - (_b = tool === null || tool === void 0 ? void 0 : tool.extensions) === null || _b === void 0 ? void 0 : _b.forEach((ext) => { - var _a2; - (_a2 = ext === null || ext === void 0 ? void 0 : ext.rules) === null || _a2 === void 0 ? void 0 : _a2.forEach((rule) => { - rules.set(rule.id, { - shortDescription: rule.shortDescription.text, - fullDescription: rule.fullDescription.markdown || rule.fullDescription.text - }); - }); - }); - return rules; - } - __name(parseRules, "parseRules"); + __name(parseResult2, "parseResult"); function parseSarif(path2) { var _a; - const sarif = JSON.parse(fs2.readFileSync(path2, { encoding: "utf8" })); + const sarif = JSON.parse(fs3.readFileSync(path2, { encoding: "utf8" })); const run = sarif.runs[0]; - const rules = parseRules(run.tool); + const rules = (0, utils_2.parseRules)(run.tool); let title = "No new problems found by "; let annotations = []; if ((_a = run.results) === null || _a === void 0 ? void 0 : _a.length) { title = `${run.results.length} ${(0, output_12.getProblemPlural)(run.results.length)} found by `; - annotations = run.results.filter((result) => result.baselineState !== "unchanged" && result.baselineState !== "absent").map((result) => parseResult(result, rules)).filter((a) => a !== null && a !== void 0); + annotations = run.results.filter((result) => result.baselineState !== "unchanged" && result.baselineState !== "absent").map((result) => parseResult2(result, rules)).filter((a) => a !== null && a !== void 0); } const name = run.tool.driver.fullName || "Qodana"; title += name; @@ -137502,6 +137451,166 @@ var require_annotations = __commonJS({ } }); +// lib/output.js +var require_output = __commonJS({ + "lib/output.js"(exports2) { + "use strict"; + var __createBinding3 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: /* @__PURE__ */ __name(function() { + return m[k]; + }, "get") }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault3 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar3 = exports2 && exports2.__importStar || /* @__PURE__ */ function() { + var ownKeys = /* @__PURE__ */ __name(function(o) { + ownKeys = Object.getOwnPropertyNames || function(o2) { + var ar = []; + for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }, "ownKeys"); + return function(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) { + for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding3(result, mod, k[i]); + } + __setModuleDefault3(result, mod); + return result; + }; + }(); + var __awaiter3 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + __name(adopt, "adopt"); + return new (P || (P = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + __name(fulfilled, "fulfilled"); + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + __name(rejected, "rejected"); + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + __name(step, "step"); + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.VIEW_REPORT_OPTIONS = exports2.DEPENDENCY_CHARS_LIMIT = void 0; + exports2.publishOutput = publishOutput; + exports2.annotationsToProblemDescriptors = annotationsToProblemDescriptors; + exports2.prFixesBody = prFixesBody; + var core2 = __importStar3(require_core()); + var qodana_12 = (init_qodana(), __toCommonJS(qodana_exports)); + var utils_12 = require_utils10(); + var annotations_1 = require_annotations(); + var output_12 = (init_output(), __toCommonJS(output_exports)); + exports2.DEPENDENCY_CHARS_LIMIT = 65e3; + exports2.VIEW_REPORT_OPTIONS = `To be able to view the detailed Qodana report, you can either: + - Register at [Qodana Cloud](https://qodana.cloud/) and [configure the action](https://github.com/jetbrains/qodana-action#qodana-cloud) + - Use [GitHub Code Scanning with Qodana](https://github.com/jetbrains/qodana-action#github-code-scanning) + - Host [Qodana report at GitHub Pages](https://github.com/JetBrains/qodana-action/blob/3a8e25f5caad8d8b01c1435f1ef7b19fe8b039a0/README.md#github-pages) + - Inspect and use \`qodana.sarif.json\` (see [the Qodana SARIF format](https://www.jetbrains.com/help/qodana/qodana-sarif-output.html#Report+structure) for details) + +To get \`*.log\` files or any other Qodana artifacts, run the action with \`upload-result\` option set to \`true\`, +so that the action will upload the files as the job artifacts: +\`\`\`yaml + - name: 'Qodana Scan' + uses: JetBrains/qodana-action@v${qodana_12.VERSION} + with: + upload-result: true +\`\`\` +`; + function publishOutput(failedByThreshold, projectDir, sourceDir, resultsDir, useAnnotations, postComment, isPrMode, execute) { + return __awaiter3(this, void 0, void 0, function* () { + var _a; + if (!execute) { + return; + } + try { + const problems = (0, annotations_1.parseSarif)(`${resultsDir}/${qodana_12.QODANA_SARIF_NAME}`); + const reportUrl = (0, output_12.getReportURL)(resultsDir); + const coverageInfo = (0, output_12.getCoverageStats)((0, qodana_12.getCoverageFromSarif)(`${resultsDir}/${qodana_12.QODANA_SHORT_SARIF_NAME}`)); + const licensesInfo = (0, output_12.getLicenseInfo)(resultsDir); + const problemsDescriptions = annotationsToProblemDescriptors(problems.annotations); + const toolName = (_a = problems.title.split("found by ")[1]) !== null && _a !== void 0 ? _a : output_12.QODANA_CHECK_NAME; + problems.summary = (0, output_12.getSummary)(toolName, projectDir, sourceDir, problemsDescriptions, coverageInfo, licensesInfo.packages, licensesInfo.licenses, reportUrl, isPrMode, exports2.DEPENDENCY_CHARS_LIMIT, exports2.VIEW_REPORT_OPTIONS); + yield Promise.all([ + (0, utils_12.putReaction)(utils_12.ANALYSIS_FINISHED_REACTION, utils_12.ANALYSIS_STARTED_REACTION), + (0, utils_12.postResultsToPRComments)(toolName, problems.summary, sourceDir, postComment), + core2.summary.addRaw(problems.summary).write(), + (0, annotations_1.publishAnnotations)(toolName, problems, failedByThreshold, useAnnotations) + ]); + } catch (error) { + core2.warning(`Qodana has problems with publishing results to GitHub \u2013 ${error.message}`); + } + }); + } + __name(publishOutput, "publishOutput"); + function annotationsToProblemDescriptors(annotations) { + var _a; + return (_a = annotations === null || annotations === void 0 ? void 0 : annotations.map((annotation) => { + return { + title: annotation.title, + level: (() => { + switch (annotation.annotation_level) { + case annotations_1.ANNOTATION_FAILURE: + return output_12.FAILURE_LEVEL; + case annotations_1.ANNOTATION_WARNING: + return output_12.WARNING_LEVEL; + default: + return output_12.NOTICE_LEVEL; + } + })() + }; + })) !== null && _a !== void 0 ? _a : []; + } + __name(annotationsToProblemDescriptors, "annotationsToProblemDescriptors"); + function prFixesBody(jobUrl) { + return ` \u{1F590} Hey there! + +This pull request has been auto-generated by the [Qodana Scan workflow](${jobUrl}) configured in your repository. +It has performed code analysis and applied some suggested fixes to improve your code quality \u{1F9F9}\u2728 + +> **Warning** +> It's crucial to review these changes to ensure everything shipshape manually. Please take a moment to examine the changes here. Remember to run your integration tests against this PR to validate the fixes and ensure everything's functioning as expected. + +_\u{1F4BB}\u{1F50D} Happy reviewing and testing! +Best, +[Qodana Scan \u{1F916}](https://github.com/marketplace/actions/qodana-scan)_`; + } + __name(prFixesBody, "prFixesBody"); + } +}); + // lib/utils.js var require_utils10 = __commonJS({ "lib/utils.js"(exports2) { @@ -137603,9 +137712,10 @@ var require_utils10 = __commonJS({ var annotations_1 = require_annotations(); var qodana_12 = (init_qodana(), __toCommonJS(qodana_exports)); var path_1 = __importDefault2(require("path")); - var fs2 = __importStar3(require("fs")); + var fs3 = __importStar3(require("fs")); var os = __importStar3(require("os")); var output_12 = require_output(); + var output_2 = (init_output(), __toCommonJS(output_exports)); exports2.ANALYSIS_FINISHED_REACTION = "+1"; exports2.ANALYSIS_STARTED_REACTION = "eyes"; exports2.ENABLE_USE_CACHE_OPTION_WARNING = 'Turn on "use-cache" option to use "cache-default-branch-only"'; @@ -137700,8 +137810,8 @@ var require_utils10 = __commonJS({ } const currentCommit = (yield exec.getExecOutput("git", ["rev-parse", "HEAD"])).stdout.trim(); currentBranch = (0, qodana_12.validateBranchName)(currentBranch); - yield git(["config", "user.name", output_12.COMMIT_USER]); - yield git(["config", "user.email", output_12.COMMIT_EMAIL]); + yield git(["config", "user.name", output_2.COMMIT_USER]); + yield git(["config", "user.email", output_2.COMMIT_EMAIL]); yield git(["add", "."]); let exitCode = yield git(["commit", "-m", commitMessage], { ignoreReturnCode: true @@ -137996,7 +138106,7 @@ ${comment_tag_pattern}`; function createPr(title, repo, base, head) { return __awaiter3(this, void 0, void 0, function* () { const prBodyFile = path_1.default.join(os.tmpdir(), "pr-body.txt"); - fs2.writeFileSync(prBodyFile, (0, output_12.prFixesBody)(getWorkflowRunUrl())); + fs3.writeFileSync(prBodyFile, (0, output_12.prFixesBody)(getWorkflowRunUrl())); yield exec.getExecOutput("gh", [ "pr", "create", diff --git a/scan/src/annotations.ts b/scan/src/annotations.ts index d3c8c4d4..4306a4eb 100644 --- a/scan/src/annotations.ts +++ b/scan/src/annotations.ts @@ -18,9 +18,10 @@ import * as core from '@actions/core' import {AnnotationProperties} from '@actions/core' import * as fs from 'fs' -import type {Log, Result, Tool} from 'sarif' +import type {Log, Result} from 'sarif' import {getWorkflowRunUrl, publishGitHubCheck} from './utils' -import {getProblemPlural} from './output' +import {getProblemPlural} from '../../common/output' +import {parseRules, Rule} from '../../common/utils' function getQodanaHelpString(): string { return `This result was published with [Qodana GitHub Action](${getWorkflowRunUrl()})` @@ -101,11 +102,6 @@ export interface Output { annotations: Annotation[] } -export interface Rule { - shortDescription: string - fullDescription: string -} - export interface Annotation { title: string | undefined path: string @@ -159,33 +155,6 @@ function parseResult( } } -/** - * Extracts the rules descriptions from SARIF tool field. - * @param tool the SARIF tool field. - * @returns The map of SARIF rule IDs to their descriptions. - */ -function parseRules(tool: Tool): Map { - const rules = new Map() - tool.driver.rules?.forEach(rule => { - rules.set(rule.id, { - shortDescription: rule.shortDescription!.text, - fullDescription: - rule.fullDescription!.markdown || rule.fullDescription!.text - }) - }) - - tool?.extensions?.forEach(ext => { - ext?.rules?.forEach(rule => { - rules.set(rule.id, { - shortDescription: rule.shortDescription!.text, - fullDescription: - rule.fullDescription!.markdown || rule.fullDescription!.text - }) - }) - }) - return rules -} - /** * Converts a SARIF from the given path to a GitHub Check Output. * @param path The SARIF path to convert. diff --git a/scan/src/output.ts b/scan/src/output.ts index e03e8c54..5b2ab26b 100644 --- a/scan/src/output.ts +++ b/scan/src/output.ts @@ -16,14 +16,8 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import * as core from '@actions/core' -import * as fs from 'fs' import { - Coverage, getCoverageFromSarif, - QODANA_LICENSES_JSON, - QODANA_LICENSES_MD, - QODANA_OPEN_IN_IDE_NAME, - QODANA_REPORT_URL_NAME, QODANA_SARIF_NAME, QODANA_SHORT_SARIF_NAME, VERSION @@ -37,22 +31,25 @@ import { import { Annotation, ANNOTATION_FAILURE, - ANNOTATION_NOTICE, ANNOTATION_WARNING, parseSarif, publishAnnotations } from './annotations' - -export const COMMIT_USER = 'qodana-bot' -export const COMMIT_EMAIL = 'qodana-support@jetbrains.com' -const QODANA_CHECK_NAME = 'Qodana' -const UNKNOWN_RULE_ID = 'Unknown' -const SUMMARY_TABLE_HEADER = '| Inspection name | Severity | Problems |' -const SUMMARY_TABLE_SEP = '| --- | --- | --- |' -const SUMMARY_MISC = `Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com) - - Or via our issue tracker: https://jb.gg/qodana-issue - - Or share your feedback: https://jb.gg/qodana-discussions` -const VIEW_REPORT_OPTIONS = `To be able to view the detailed Qodana report, you can either: +import { + FAILURE_LEVEL, + getCoverageStats, + getLicenseInfo, + getReportURL, + getSummary, + LicenseInfo, + NOTICE_LEVEL, + ProblemDescriptor, + QODANA_CHECK_NAME, + WARNING_LEVEL +} from '../../common/output' + +export const DEPENDENCY_CHARS_LIMIT = 65000 // 65k chars is the GitHub limit for a comment +export const VIEW_REPORT_OPTIONS = `To be able to view the detailed Qodana report, you can either: - Register at [Qodana Cloud](https://qodana.cloud/) and [configure the action](https://github.com/jetbrains/qodana-action#qodana-cloud) - Use [GitHub Code Scanning with Qodana](https://github.com/jetbrains/qodana-action#github-code-scanning) - Host [Qodana report at GitHub Pages](https://github.com/JetBrains/qodana-action/blob/3a8e25f5caad8d8b01c1435f1ef7b19fe8b039a0/README.md#github-pages) @@ -67,84 +64,6 @@ so that the action will upload the files as the job artifacts: upload-result: true \`\`\` ` -const SUMMARY_PR_MODE = `πŸ’‘ Qodana analysis was run in the pull request mode: only the changed files were checked` -const DEPENDENCY_CHARS_LIMIT = 65000 // 65k chars is the GitHub limit for a comment - -interface CloudData { - url?: string -} - -interface OpenInIDEData { - cloud?: CloudData -} - -interface LicenseEntry { - name?: string - version?: string - license?: string -} - -function wrapToDiffBlock(message: string): string { - return `\`\`\`diff -${message} -\`\`\`` -} - -function makeConclusion( - conclusion: string, - failedByThreshold: boolean -): string { - if (failedByThreshold) { - return `- ${conclusion}` - } else { - return `+ ${conclusion}` - } -} - -export function getCoverageStats(c: Coverage): string { - if (c.totalLines === 0 && c.totalCoveredLines === 0) { - return '' - } - - let stats = '' - if (c.totalLines !== 0) { - const conclusion = `${c.totalCoverage}% total lines covered` - stats += `${makeConclusion(conclusion, c.totalCoverage < c.totalCoverageThreshold)} -${c.totalLines} lines analyzed, ${c.totalCoveredLines} lines covered` - } - - if (c.freshLines !== 0) { - const conclusion = `${c.freshCoverage}% fresh lines covered` - stats += ` -${makeConclusion(conclusion, c.freshCoverage < c.freshCoverageThreshold)} -${c.freshLines} lines analyzed, ${c.freshCoveredLines} lines covered` - } - - return wrapToDiffBlock( - [ - `@@ Code coverage @@`, - `${stats}`, - `# Calculated according to the filters of your coverage tool` - ].join('\n') - ) -} - -export function getReportURL(resultsDir: string): string { - let reportUrlFile = `${resultsDir}/${QODANA_OPEN_IN_IDE_NAME}` - if (fs.existsSync(reportUrlFile)) { - const rawData = fs.readFileSync(reportUrlFile, {encoding: 'utf8'}) - const data = JSON.parse(rawData) as OpenInIDEData - if (data?.cloud?.url) { - return data.cloud.url - } - } else { - reportUrlFile = `${resultsDir}/${QODANA_REPORT_URL_NAME}` - if (fs.existsSync(reportUrlFile)) { - return fs.readFileSync(reportUrlFile, {encoding: 'utf8'}) - } - } - return '' -} /** * Publish Qodana results to GitHub: comment, job summary, annotations. @@ -177,34 +96,24 @@ export async function publishOutput( getCoverageFromSarif(`${resultsDir}/${QODANA_SHORT_SARIF_NAME}`) ) - let licensesInfo = '' - let packages = 0 - const licensesJson = `${resultsDir}/projectStructure/${QODANA_LICENSES_JSON}` - if (fs.existsSync(licensesJson)) { - const licenses = JSON.parse( - fs.readFileSync(licensesJson, {encoding: 'utf8'}) - ) as LicenseEntry[] - if (licenses.length > 0) { - packages = licenses.length - licensesInfo = fs.readFileSync( - `${resultsDir}/projectStructure/${QODANA_LICENSES_MD}`, - {encoding: 'utf8'} - ) - } - } + const licensesInfo: LicenseInfo = getLicenseInfo(resultsDir) - const annotations: Annotation[] = problems.annotations ?? [] + const problemsDescriptions = annotationsToProblemDescriptors( + problems.annotations + ) const toolName = problems.title.split('found by ')[1] ?? QODANA_CHECK_NAME problems.summary = getSummary( toolName, projectDir, sourceDir, - annotations, + problemsDescriptions, coverageInfo, - packages, - licensesInfo, + licensesInfo.packages, + licensesInfo.licenses, reportUrl, - isPrMode + isPrMode, + DEPENDENCY_CHARS_LIMIT, + VIEW_REPORT_OPTIONS ) await Promise.all([ @@ -227,162 +136,26 @@ export async function publishOutput( } } -function wrapToToggleBlock(header: string, body: string): string { - return `
-${header} - -${body} -
` -} - -function getViewReportText(reportUrl: string): string { - if (reportUrl !== '') { - return `☁️ [View the detailed Qodana report](${reportUrl})` - } - return wrapToToggleBlock( - 'View the detailed Qodana report', - VIEW_REPORT_OPTIONS - ) -} - -/** - * Generates a table row for a given level. - * @param annotations The annotations to generate the table row from. - * @param level The level to generate the table row for. - */ -function getRowsByLevel(annotations: Annotation[], level: string): string { - const problems = annotations.reduce( - (map: Map, e) => - map.set( - e.title ?? UNKNOWN_RULE_ID, - map.get(e.title ?? UNKNOWN_RULE_ID) !== undefined - ? map.get(e.title ?? UNKNOWN_RULE_ID)! + 1 - : 1 - ), - new Map() - ) - return Array.from(problems.entries()) - .sort((a, b) => b[1] - a[1]) - .map(([title, count]) => `| \`${title}\` | ${level} | ${count} |`) - .join('\n') -} - -/** - * Generates action summary string of annotations. - * @param toolName The name of the tool to generate the summary from. - * @param projectDir The path to the project. - * @param sourceDir The path to analyzed directory inside the project. - * @param annotations The annotations to generate the summary from. - * @param coverageInfo The coverage is a Markdown text to generate the summary from. - * @param packages The number of dependencies in the analyzed project. - * @param licensesInfo The licenses a Markdown text to generate the summary from. - * @param reportUrl The URL to the Qodana report. - * @param prMode Whether the analysis was run in the pull request mode. - */ -export function getSummary( - toolName: string, - projectDir: string, - sourceDir: string, - annotations: Annotation[], - coverageInfo: string, - packages: number, - licensesInfo: string, - reportUrl: string, - prMode: boolean -): string { - const contactBlock = wrapToToggleBlock('Contact Qodana team', SUMMARY_MISC) - let licensesBlock = '' - if (licensesInfo !== '' && licensesInfo.length < DEPENDENCY_CHARS_LIMIT) { - licensesBlock = wrapToToggleBlock( - `Detected ${packages} ${getDepencencyPlural(packages)}`, - licensesInfo - ) - } - let prModeBlock = '' - if (prMode) { - prModeBlock = SUMMARY_PR_MODE - } - if (reportUrl !== '') { - const firstToolName = toolName.split(' ')[0] - toolName = toolName.replace( - firstToolName, - `[${firstToolName}](${reportUrl})` - ) - } - const analysisScope = ( - projectDir === '' - ? '' - : ['Analyzed project: `', projectDir, '/`\n'].join('') - ).concat( - sourceDir === '' - ? '' - : ['Analyzed directory: `', sourceDir, '/`\n'].join('') +export function annotationsToProblemDescriptors( + annotations: Annotation[] | undefined +): ProblemDescriptor[] { + return ( + annotations?.map(annotation => { + return { + title: annotation.title, + level: (() => { + switch (annotation.annotation_level) { + case ANNOTATION_FAILURE: + return FAILURE_LEVEL + case ANNOTATION_WARNING: + return WARNING_LEVEL + default: + return NOTICE_LEVEL + } + })() + } + }) ?? [] ) - if (annotations.length === 0) { - return [ - `# ${toolName}`, - analysisScope, - '**It seems all right πŸ‘Œ**', - '', - 'No new problems were found according to the checks applied', - coverageInfo, - prModeBlock, - getViewReportText(reportUrl), - licensesBlock, - contactBlock - ].join('\n') - } - - return [ - `# ${toolName}`, - analysisScope, - `**${annotations.length} ${getProblemPlural( - annotations.length - )}** were found`, - '', - SUMMARY_TABLE_HEADER, - SUMMARY_TABLE_SEP, - [ - getRowsByLevel( - annotations.filter(a => a.annotation_level === ANNOTATION_FAILURE), - 'πŸ”΄ Failure' - ), - getRowsByLevel( - annotations.filter(a => a.annotation_level === ANNOTATION_WARNING), - 'πŸ”Ά Warning' - ), - getRowsByLevel( - annotations.filter(a => a.annotation_level === ANNOTATION_NOTICE), - '◽️ Notice' - ) - ] - .filter(e => e !== '') - .join('\n'), - '', - coverageInfo, - prModeBlock, - getViewReportText(reportUrl), - licensesBlock, - contactBlock - ].join('\n') -} - -/** - * Generates a plural form of the word "problem" depending on the given count. - * @param count A number representing the count of problems - * @returns A formatted string with the correct plural form of "problem" - */ -export function getProblemPlural(count: number): string { - return `new problem${count !== 1 ? 's' : ''}` -} - -/** - * Generates a plural form of the word "dependency" depending on the given count. - * @param count A number representing the count of dependencies - * @returns A formatted string with the correct plural form of "dependency" - */ -export function getDepencencyPlural(count: number): string { - return `dependenc${count !== 1 ? 'ies' : 'y'}` } /* diff --git a/scan/src/utils.ts b/scan/src/utils.ts index b813d7dc..cfa97cda 100644 --- a/scan/src/utils.ts +++ b/scan/src/utils.ts @@ -46,7 +46,8 @@ import { import path from 'path' import * as fs from 'fs' import * as os from 'os' -import {COMMIT_EMAIL, COMMIT_USER, prFixesBody} from './output' +import {prFixesBody} from './output' +import {COMMIT_EMAIL, COMMIT_USER} from '../../common/output' export const ANALYSIS_FINISHED_REACTION = '+1' export const ANALYSIS_STARTED_REACTION = 'eyes' diff --git a/vsts/QodanaScan/index.js b/vsts/QodanaScan/index.js index 20cd3289..ec7c3a99 100644 --- a/vsts/QodanaScan/index.js +++ b/vsts/QodanaScan/index.js @@ -8,8 +8,8 @@ var __hasOwnProp = Object.prototype.hasOwnProperty; var __esm = (fn, res) => function __init() { return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; }; -var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; +var __commonJS = (cb2, mod) => function __require() { + return mod || (0, cb2[__getOwnPropNames(cb2)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) @@ -97,9 +97,9 @@ var require_process_nextick_args = __commonJS({ // ../node_modules/jszip/node_modules/isarray/index.js var require_isarray = __commonJS({ "../node_modules/jszip/node_modules/isarray/index.js"(exports2, module2) { - var toString = {}.toString; + var toString2 = {}.toString; module2.exports = Array.isArray || function(arr) { - return toString.call(arr) == "[object Array]"; + return toString2.call(arr) == "[object Array]"; }; } }); @@ -137,11 +137,11 @@ var require_safe_buffer = __commonJS({ } return Buffer2(arg, encodingOrOffset, length); }; - SafeBuffer.alloc = function(size, fill, encoding) { - if (typeof size !== "number") { + SafeBuffer.alloc = function(size2, fill, encoding) { + if (typeof size2 !== "number") { throw new TypeError("Argument must be a number"); } - var buf = Buffer2(size); + var buf = Buffer2(size2); if (fill !== void 0) { if (typeof encoding === "string") { buf.fill(fill, encoding); @@ -153,17 +153,17 @@ var require_safe_buffer = __commonJS({ } return buf; }; - SafeBuffer.allocUnsafe = function(size) { - if (typeof size !== "number") { + SafeBuffer.allocUnsafe = function(size2) { + if (typeof size2 !== "number") { throw new TypeError("Argument must be a number"); } - return Buffer2(size); + return Buffer2(size2); }; - SafeBuffer.allocUnsafeSlow = function(size) { - if (typeof size !== "number") { + SafeBuffer.allocUnsafeSlow = function(size2) { + if (typeof size2 !== "number") { throw new TypeError("Argument must be a number"); } - return buffer.SlowBuffer(size); + return buffer.SlowBuffer(size2); }; } }); @@ -178,14 +178,14 @@ var require_util = __commonJS({ return objectToString(arg) === "[object Array]"; } exports2.isArray = isArray; - function isBoolean(arg) { + function isBoolean2(arg) { return typeof arg === "boolean"; } - exports2.isBoolean = isBoolean; - function isNull(arg) { + exports2.isBoolean = isBoolean2; + function isNull2(arg) { return arg === null; } - exports2.isNull = isNull; + exports2.isNull = isNull2; function isNullOrUndefined(arg) { return arg == null; } @@ -202,18 +202,18 @@ var require_util = __commonJS({ return typeof arg === "symbol"; } exports2.isSymbol = isSymbol; - function isUndefined(arg) { + function isUndefined2(arg) { return arg === void 0; } - exports2.isUndefined = isUndefined; + exports2.isUndefined = isUndefined2; function isRegExp(re) { return objectToString(re) === "[object RegExp]"; } exports2.isRegExp = isRegExp; - function isObject(arg) { + function isObject2(arg) { return typeof arg === "object" && arg !== null; } - exports2.isObject = isObject; + exports2.isObject = isObject2; function isDate(d) { return objectToString(d) === "[object Date]"; } @@ -222,10 +222,10 @@ var require_util = __commonJS({ return objectToString(e) === "[object Error]" || e instanceof Error; } exports2.isError = isError; - function isFunction(arg) { + function isFunction2(arg) { return typeof arg === "function"; } - exports2.isFunction = isFunction; + exports2.isFunction = isFunction2; function isPrimitive(arg) { return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol typeof arg === "undefined"; @@ -242,12 +242,12 @@ var require_util = __commonJS({ var require_inherits_browser = __commonJS({ "../node_modules/inherits/inherits_browser.js"(exports2, module2) { if (typeof Object.create === "function") { - module2.exports = function inherits(ctor, superCtor) { + module2.exports = function inherits(ctor2, superCtor) { if (superCtor) { - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { + ctor2.super_ = superCtor; + ctor2.prototype = Object.create(superCtor.prototype, { constructor: { - value: ctor, + value: ctor2, enumerable: false, writable: true, configurable: true @@ -256,14 +256,14 @@ var require_inherits_browser = __commonJS({ } }; } else { - module2.exports = function inherits(ctor, superCtor) { + module2.exports = function inherits(ctor2, superCtor) { if (superCtor) { - ctor.super_ = superCtor; + ctor2.super_ = superCtor; var TempCtor = function() { }; TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; + ctor2.prototype = new TempCtor(); + ctor2.prototype.constructor = ctor2; } }; } @@ -305,7 +305,7 @@ var require_BufferList = __commonJS({ this.tail = null; this.length = 0; } - BufferList.prototype.push = function push(v) { + BufferList.prototype.push = function push2(v) { var entry = { data: v, next: null }; if (this.length > 0) this.tail.next = entry; else this.head = entry; @@ -367,13 +367,13 @@ var require_destroy = __commonJS({ "../node_modules/jszip/node_modules/readable-stream/lib/internal/streams/destroy.js"(exports2, module2) { "use strict"; var pna = require_process_nextick_args(); - function destroy(err, cb) { + function destroy(err, cb2) { var _this = this; var readableDestroyed = this._readableState && this._readableState.destroyed; var writableDestroyed = this._writableState && this._writableState.destroyed; if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); + if (cb2) { + cb2(err); } else if (err) { if (!this._writableState) { pna.nextTick(emitErrorNT, this, err); @@ -391,15 +391,15 @@ var require_destroy = __commonJS({ this._writableState.destroyed = true; } this._destroy(err || null, function(err2) { - if (!cb && err2) { + if (!cb2 && err2) { if (!_this._writableState) { pna.nextTick(emitErrorNT, _this, err2); } else if (!_this._writableState.errorEmitted) { _this._writableState.errorEmitted = true; pna.nextTick(emitErrorNT, _this, err2); } - } else if (cb) { - cb(err2); + } else if (cb2) { + cb2(err2); } }); return this; @@ -464,8 +464,8 @@ var require_stream_writable = __commonJS({ var Buffer2 = require_safe_buffer().Buffer; var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() { }; - function _uint8ArrayToBuffer(chunk) { - return Buffer2.from(chunk); + function _uint8ArrayToBuffer(chunk2) { + return Buffer2.from(chunk2); } function _isUint8Array(obj) { return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array; @@ -530,22 +530,22 @@ var require_stream_writable = __commonJS({ return this.getBuffer(); }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.", "DEP0003") }); - } catch (_) { + } catch (_3) { } })(); var realHasInstance; if (typeof Symbol === "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === "function") { realHasInstance = Function.prototype[Symbol.hasInstance]; Object.defineProperty(Writable, Symbol.hasInstance, { - value: function(object) { - if (realHasInstance.call(this, object)) return true; + value: function(object2) { + if (realHasInstance.call(this, object2)) return true; if (this !== Writable) return false; - return object && object._writableState instanceof WritableState; + return object2 && object2._writableState instanceof WritableState; } }); } else { - realHasInstance = function(object) { - return object instanceof this; + realHasInstance = function(object2) { + return object2 instanceof this; }; } function Writable(options) { @@ -566,44 +566,44 @@ var require_stream_writable = __commonJS({ Writable.prototype.pipe = function() { this.emit("error", new Error("Cannot pipe, not readable")); }; - function writeAfterEnd(stream, cb) { + function writeAfterEnd(stream, cb2) { var er = new Error("write after end"); stream.emit("error", er); - pna.nextTick(cb, er); + pna.nextTick(cb2, er); } - function validChunk(stream, state, chunk, cb) { + function validChunk(stream, state, chunk2, cb2) { var valid = true; var er = false; - if (chunk === null) { + if (chunk2 === null) { er = new TypeError("May not write null values to stream"); - } else if (typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) { + } else if (typeof chunk2 !== "string" && chunk2 !== void 0 && !state.objectMode) { er = new TypeError("Invalid non-string/buffer chunk"); } if (er) { stream.emit("error", er); - pna.nextTick(cb, er); + pna.nextTick(cb2, er); valid = false; } return valid; } - Writable.prototype.write = function(chunk, encoding, cb) { + Writable.prototype.write = function(chunk2, encoding, cb2) { var state = this._writableState; var ret = false; - var isBuf = !state.objectMode && _isUint8Array(chunk); - if (isBuf && !Buffer2.isBuffer(chunk)) { - chunk = _uint8ArrayToBuffer(chunk); + var isBuf = !state.objectMode && _isUint8Array(chunk2); + if (isBuf && !Buffer2.isBuffer(chunk2)) { + chunk2 = _uint8ArrayToBuffer(chunk2); } if (typeof encoding === "function") { - cb = encoding; + cb2 = encoding; encoding = null; } if (isBuf) encoding = "buffer"; else if (!encoding) encoding = state.defaultEncoding; - if (typeof cb !== "function") cb = nop; - if (state.ended) writeAfterEnd(this, cb); - else if (isBuf || validChunk(this, state, chunk, cb)) { + if (typeof cb2 !== "function") cb2 = nop; + if (state.ended) writeAfterEnd(this, cb2); + else if (isBuf || validChunk(this, state, chunk2, cb2)) { state.pendingcb++; - ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + ret = writeOrBuffer(this, state, isBuf, chunk2, encoding, cb2); } return ret; }; @@ -624,11 +624,11 @@ var require_stream_writable = __commonJS({ this._writableState.defaultEncoding = encoding; return this; }; - function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === "string") { - chunk = Buffer2.from(chunk, encoding); + function decodeChunk(state, chunk2, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk2 === "string") { + chunk2 = Buffer2.from(chunk2, encoding); } - return chunk; + return chunk2; } Object.defineProperty(Writable.prototype, "writableHighWaterMark", { // making it explicit this property is not enumerable @@ -639,57 +639,57 @@ var require_stream_writable = __commonJS({ return this._writableState.highWaterMark; } }); - function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + function writeOrBuffer(stream, state, isBuf, chunk2, encoding, cb2) { if (!isBuf) { - var newChunk = decodeChunk(state, chunk, encoding); - if (chunk !== newChunk) { + var newChunk = decodeChunk(state, chunk2, encoding); + if (chunk2 !== newChunk) { isBuf = true; encoding = "buffer"; - chunk = newChunk; + chunk2 = newChunk; } } - var len = state.objectMode ? 1 : chunk.length; + var len = state.objectMode ? 1 : chunk2.length; state.length += len; var ret = state.length < state.highWaterMark; if (!ret) state.needDrain = true; if (state.writing || state.corked) { - var last = state.lastBufferedRequest; + var last2 = state.lastBufferedRequest; state.lastBufferedRequest = { - chunk, + chunk: chunk2, encoding, isBuf, - callback: cb, + callback: cb2, next: null }; - if (last) { - last.next = state.lastBufferedRequest; + if (last2) { + last2.next = state.lastBufferedRequest; } else { state.bufferedRequest = state.lastBufferedRequest; } state.bufferedRequestCount += 1; } else { - doWrite(stream, state, false, len, chunk, encoding, cb); + doWrite(stream, state, false, len, chunk2, encoding, cb2); } return ret; } - function doWrite(stream, state, writev, len, chunk, encoding, cb) { + function doWrite(stream, state, writev, len, chunk2, encoding, cb2) { state.writelen = len; - state.writecb = cb; + state.writecb = cb2; state.writing = true; state.sync = true; - if (writev) stream._writev(chunk, state.onwrite); - else stream._write(chunk, encoding, state.onwrite); + if (writev) stream._writev(chunk2, state.onwrite); + else stream._write(chunk2, encoding, state.onwrite); state.sync = false; } - function onwriteError(stream, state, sync, er, cb) { + function onwriteError(stream, state, sync, er, cb2) { --state.pendingcb; if (sync) { - pna.nextTick(cb, er); + pna.nextTick(cb2, er); pna.nextTick(finishMaybe, stream, state); stream._writableState.errorEmitted = true; stream.emit("error", er); } else { - cb(er); + cb2(er); stream._writableState.errorEmitted = true; stream.emit("error", er); finishMaybe(stream, state); @@ -704,25 +704,25 @@ var require_stream_writable = __commonJS({ function onwrite(stream, er) { var state = stream._writableState; var sync = state.sync; - var cb = state.writecb; + var cb2 = state.writecb; onwriteStateUpdate(state); - if (er) onwriteError(stream, state, sync, er, cb); + if (er) onwriteError(stream, state, sync, er, cb2); else { var finished = needFinish(state); if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { clearBuffer(stream, state); } if (sync) { - asyncWrite(afterWrite, stream, state, finished, cb); + asyncWrite(afterWrite, stream, state, finished, cb2); } else { - afterWrite(stream, state, finished, cb); + afterWrite(stream, state, finished, cb2); } } } - function afterWrite(stream, state, finished, cb) { + function afterWrite(stream, state, finished, cb2) { if (!finished) onwriteDrain(stream, state); state.pendingcb--; - cb(); + cb2(); finishMaybe(stream, state); } function onwriteDrain(stream, state) { @@ -760,11 +760,11 @@ var require_stream_writable = __commonJS({ state.bufferedRequestCount = 0; } else { while (entry) { - var chunk = entry.chunk; + var chunk2 = entry.chunk; var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - doWrite(stream, state, false, len, chunk, encoding, cb); + var cb2 = entry.callback; + var len = state.objectMode ? 1 : chunk2.length; + doWrite(stream, state, false, len, chunk2, encoding, cb2); entry = entry.next; state.bufferedRequestCount--; if (state.writing) { @@ -776,26 +776,26 @@ var require_stream_writable = __commonJS({ state.bufferedRequest = entry; state.bufferProcessing = false; } - Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error("_write() is not implemented")); + Writable.prototype._write = function(chunk2, encoding, cb2) { + cb2(new Error("_write() is not implemented")); }; Writable.prototype._writev = null; - Writable.prototype.end = function(chunk, encoding, cb) { + Writable.prototype.end = function(chunk2, encoding, cb2) { var state = this._writableState; - if (typeof chunk === "function") { - cb = chunk; - chunk = null; + if (typeof chunk2 === "function") { + cb2 = chunk2; + chunk2 = null; encoding = null; } else if (typeof encoding === "function") { - cb = encoding; + cb2 = encoding; encoding = null; } - if (chunk !== null && chunk !== void 0) this.write(chunk, encoding); + if (chunk2 !== null && chunk2 !== void 0) this.write(chunk2, encoding); if (state.corked) { state.corked = 1; this.uncork(); } - if (!state.ending) endWritable(this, state, cb); + if (!state.ending) endWritable(this, state, cb2); }; function needFinish(state) { return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; @@ -834,12 +834,12 @@ var require_stream_writable = __commonJS({ } return need; } - function endWritable(stream, state, cb) { + function endWritable(stream, state, cb2) { state.ending = true; finishMaybe(stream, state); - if (cb) { - if (state.finished) pna.nextTick(cb); - else stream.once("finish", cb); + if (cb2) { + if (state.finished) pna.nextTick(cb2); + else stream.once("finish", cb2); } state.ended = true; stream.writable = false; @@ -848,9 +848,9 @@ var require_stream_writable = __commonJS({ var entry = corkReq.entry; corkReq.entry = null; while (entry) { - var cb = entry.callback; + var cb2 = entry.callback; state.pendingcb--; - cb(err); + cb2(err); entry = entry.next; } state.corkedRequestsFree.next = corkReq; @@ -871,9 +871,9 @@ var require_stream_writable = __commonJS({ }); Writable.prototype.destroy = destroyImpl.destroy; Writable.prototype._undestroy = destroyImpl.undestroy; - Writable.prototype._destroy = function(err, cb) { + Writable.prototype._destroy = function(err, cb2) { this.end(); - cb(err); + cb2(err); }; } }); @@ -884,11 +884,11 @@ var require_stream_duplex = __commonJS({ "use strict"; var pna = require_process_nextick_args(); var objectKeys = Object.keys || function(obj) { - var keys2 = []; + var keys3 = []; for (var key in obj) { - keys2.push(key); + keys3.push(key); } - return keys2; + return keys3; }; module2.exports = Duplex; var util = Object.create(require_util()); @@ -897,13 +897,13 @@ var require_stream_duplex = __commonJS({ var Writable = require_stream_writable(); util.inherits(Duplex, Readable); { - keys = objectKeys(Writable.prototype); - for (v = 0; v < keys.length; v++) { - method = keys[v]; + keys2 = objectKeys(Writable.prototype); + for (v = 0; v < keys2.length; v++) { + method = keys2[v]; if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; } } - var keys; + var keys2; var method; var v; function Duplex(options) { @@ -947,10 +947,10 @@ var require_stream_duplex = __commonJS({ this._writableState.destroyed = value; } }); - Duplex.prototype._destroy = function(err, cb) { + Duplex.prototype._destroy = function(err, cb2) { this.push(null); this.end(); - pna.nextTick(cb, err); + pna.nextTick(cb2, err); }; } }); @@ -1210,8 +1210,8 @@ var require_stream_readable = __commonJS({ var Buffer2 = require_safe_buffer().Buffer; var OurUint8Array = (typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : typeof self !== "undefined" ? self : {}).Uint8Array || function() { }; - function _uint8ArrayToBuffer(chunk) { - return Buffer2.from(chunk); + function _uint8ArrayToBuffer(chunk2) { + return Buffer2.from(chunk2); } function _isUint8Array(obj) { return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array; @@ -1302,18 +1302,18 @@ var require_stream_readable = __commonJS({ }); Readable.prototype.destroy = destroyImpl.destroy; Readable.prototype._undestroy = destroyImpl.undestroy; - Readable.prototype._destroy = function(err, cb) { + Readable.prototype._destroy = function(err, cb2) { this.push(null); - cb(err); + cb2(err); }; - Readable.prototype.push = function(chunk, encoding) { + Readable.prototype.push = function(chunk2, encoding) { var state = this._readableState; var skipChunkCheck; if (!state.objectMode) { - if (typeof chunk === "string") { + if (typeof chunk2 === "string") { encoding = encoding || state.defaultEncoding; if (encoding !== state.encoding) { - chunk = Buffer2.from(chunk, encoding); + chunk2 = Buffer2.from(chunk2, encoding); encoding = ""; } skipChunkCheck = true; @@ -1321,38 +1321,38 @@ var require_stream_readable = __commonJS({ } else { skipChunkCheck = true; } - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); + return readableAddChunk(this, chunk2, encoding, false, skipChunkCheck); }; - Readable.prototype.unshift = function(chunk) { - return readableAddChunk(this, chunk, null, true, false); + Readable.prototype.unshift = function(chunk2) { + return readableAddChunk(this, chunk2, null, true, false); }; - function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + function readableAddChunk(stream, chunk2, encoding, addToFront, skipChunkCheck) { var state = stream._readableState; - if (chunk === null) { + if (chunk2 === null) { state.reading = false; onEofChunk(stream, state); } else { var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (!skipChunkCheck) er = chunkInvalid(state, chunk2); if (er) { stream.emit("error", er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== "string" && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer2.prototype) { - chunk = _uint8ArrayToBuffer(chunk); + } else if (state.objectMode || chunk2 && chunk2.length > 0) { + if (typeof chunk2 !== "string" && !state.objectMode && Object.getPrototypeOf(chunk2) !== Buffer2.prototype) { + chunk2 = _uint8ArrayToBuffer(chunk2); } if (addToFront) { if (state.endEmitted) stream.emit("error", new Error("stream.unshift() after end event")); - else addChunk(stream, state, chunk, true); + else addChunk(stream, state, chunk2, true); } else if (state.ended) { stream.emit("error", new Error("stream.push() after EOF")); } else { state.reading = false; if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false); + chunk2 = state.decoder.write(chunk2); + if (state.objectMode || chunk2.length !== 0) addChunk(stream, state, chunk2, false); else maybeReadMore(stream, state); } else { - addChunk(stream, state, chunk, false); + addChunk(stream, state, chunk2, false); } } } else if (!addToFront) { @@ -1361,21 +1361,21 @@ var require_stream_readable = __commonJS({ } return needMoreData(state); } - function addChunk(stream, state, chunk, addToFront) { + function addChunk(stream, state, chunk2, addToFront) { if (state.flowing && state.length === 0 && !state.sync) { - stream.emit("data", chunk); + stream.emit("data", chunk2); stream.read(0); } else { - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk); - else state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk2.length; + if (addToFront) state.buffer.unshift(chunk2); + else state.buffer.push(chunk2); if (state.needReadable) emitReadable(stream); } maybeReadMore(stream, state); } - function chunkInvalid(state, chunk) { + function chunkInvalid(state, chunk2) { var er; - if (!_isUint8Array(chunk) && typeof chunk !== "string" && chunk !== void 0 && !state.objectMode) { + if (!_isUint8Array(chunk2) && typeof chunk2 !== "string" && chunk2 !== void 0 && !state.objectMode) { er = new TypeError("Invalid non-string/buffer chunk"); } return er; @@ -1476,10 +1476,10 @@ var require_stream_readable = __commonJS({ function onEofChunk(stream, state) { if (state.ended) return; if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; + var chunk2 = state.decoder.end(); + if (chunk2 && chunk2.length) { + state.buffer.push(chunk2); + state.length += state.objectMode ? 1 : chunk2.length; } } state.ended = true; @@ -1572,10 +1572,10 @@ var require_stream_readable = __commonJS({ } var increasedAwaitDrain = false; src.on("data", ondata); - function ondata(chunk) { + function ondata(chunk2) { debug("ondata"); increasedAwaitDrain = false; - var ret = dest.write(chunk); + var ret = dest.write(chunk2); if (false === ret && !increasedAwaitDrain) { if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { debug("false write response, pause", state.awaitDrain); @@ -1728,17 +1728,17 @@ var require_stream_readable = __commonJS({ stream.on("end", function() { debug("wrapped end"); if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); + var chunk2 = state.decoder.end(); + if (chunk2 && chunk2.length) _this.push(chunk2); } _this.push(null); }); - stream.on("data", function(chunk) { + stream.on("data", function(chunk2) { debug("wrapped data"); - if (state.decoder) chunk = state.decoder.write(chunk); - if (state.objectMode && (chunk === null || chunk === void 0)) return; - else if (!state.objectMode && (!chunk || !chunk.length)) return; - var ret = _this.push(chunk); + if (state.decoder) chunk2 = state.decoder.write(chunk2); + if (state.objectMode && (chunk2 === null || chunk2 === void 0)) return; + else if (!state.objectMode && (!chunk2 || !chunk2.length)) return; + var ret = _this.push(chunk2); if (!ret) { paused = true; stream.pause(); @@ -1891,15 +1891,15 @@ var require_stream_transform = __commonJS({ function afterTransform(er, data) { var ts = this._transformState; ts.transforming = false; - var cb = ts.writecb; - if (!cb) { + var cb2 = ts.writecb; + if (!cb2) { return this.emit("error", new Error("write callback called multiple times")); } ts.writechunk = null; ts.writecb = null; if (data != null) this.push(data); - cb(er); + cb2(er); var rs = this._readableState; rs.reading = false; if (rs.needReadable || rs.length < rs.highWaterMark) { @@ -1935,17 +1935,17 @@ var require_stream_transform = __commonJS({ done(this, null, null); } } - Transform.prototype.push = function(chunk, encoding) { + Transform.prototype.push = function(chunk2, encoding) { this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); + return Duplex.prototype.push.call(this, chunk2, encoding); }; - Transform.prototype._transform = function(chunk, encoding, cb) { + Transform.prototype._transform = function(chunk2, encoding, cb2) { throw new Error("_transform() is not implemented"); }; - Transform.prototype._write = function(chunk, encoding, cb) { + Transform.prototype._write = function(chunk2, encoding, cb2) { var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; + ts.writecb = cb2; + ts.writechunk = chunk2; ts.writeencoding = encoding; if (!ts.transforming) { var rs = this._readableState; @@ -1961,10 +1961,10 @@ var require_stream_transform = __commonJS({ ts.needTransform = true; } }; - Transform.prototype._destroy = function(err, cb) { + Transform.prototype._destroy = function(err, cb2) { var _this2 = this; Duplex.prototype._destroy.call(this, err, function(err2) { - cb(err2); + cb2(err2); _this2.emit("close"); }); }; @@ -1992,8 +1992,8 @@ var require_stream_passthrough = __commonJS({ if (!(this instanceof PassThrough)) return new PassThrough(options); Transform.call(this, options); } - PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); + PassThrough.prototype._transform = function(chunk2, encoding, cb2) { + cb2(null, chunk2); }; } }); @@ -2172,11 +2172,11 @@ var require_nodejsUtils = __commonJS({ * @param {Integer} size the size of the buffer. * @return {Buffer} a new Buffer. */ - allocBuffer: function(size) { + allocBuffer: function(size2) { if (Buffer.alloc) { - return Buffer.alloc(size); + return Buffer.alloc(size2); } else { - var buf = new Buffer(size); + var buf = new Buffer(size2); buf.fill(0); return buf; } @@ -2305,14 +2305,14 @@ var require_lib2 = __commonJS({ return this; } var p = this.constructor; - return this.then(resolve2, reject2); + return this.then(resolve2, reject3); function resolve2(value) { function yes() { return value; } return p.resolve(callback()).then(yes); } - function reject2(reason) { + function reject3(reason) { function no() { throw reason; } @@ -2379,11 +2379,11 @@ var require_lib2 = __commonJS({ }); } handlers.resolve = function(self2, value) { - var result = tryCatch(getThen, value); - if (result.status === "error") { - return handlers.reject(self2, result.value); + var result2 = tryCatch(getThen, value); + if (result2.status === "error") { + return handlers.reject(self2, result2.value); } - var thenable = result.value; + var thenable = result2.value; if (thenable) { safelyResolveThenable(self2, thenable); } else { @@ -2443,9 +2443,9 @@ var require_lib2 = __commonJS({ function tryToUnwrap() { thenable(onSuccess, onError); } - var result = tryCatch(tryToUnwrap); - if (result.status === "error") { - onError(result.value); + var result2 = tryCatch(tryToUnwrap); + if (result2.status === "error") { + onError(result2.value); } } function tryCatch(func, value) { @@ -2466,8 +2466,8 @@ var require_lib2 = __commonJS({ } return handlers.resolve(new this(INTERNAL), value); } - Promise2.reject = reject; - function reject(reason) { + Promise2.reject = reject2; + function reject2(reason) { var promise = new this(INTERNAL); return handlers.reject(promise, reason); } @@ -2482,7 +2482,7 @@ var require_lib2 = __commonJS({ if (!len) { return this.resolve([]); } - var values = new Array(len); + var values2 = new Array(len); var resolved = 0; var i = -1; var promise = new this(INTERNAL); @@ -2498,10 +2498,10 @@ var require_lib2 = __commonJS({ } }); function resolveFromAll(outValue) { - values[i2] = outValue; + values2[i2] = outValue; if (++resolved === len && !called) { called = true; - handlers.resolve(promise, values); + handlers.resolve(promise, values2); } } } @@ -2714,13 +2714,13 @@ var require_utils = __commonJS({ var external = require_external(); require_setImmediate(); function string2binary(str) { - var result = null; + var result2 = null; if (support.uint8array) { - result = new Uint8Array(str.length); + result2 = new Uint8Array(str.length); } else { - result = new Array(str.length); + result2 = new Array(str.length); } - return stringToArrayLike(str, result); + return stringToArrayLike(str, result2); } exports2.newBlob = function(part, type) { exports2.checkSupport("blob"); @@ -2739,7 +2739,7 @@ var require_utils = __commonJS({ } } }; - function identity(input) { + function identity2(input) { return input; } function stringToArrayLike(str, array) { @@ -2758,20 +2758,20 @@ var require_utils = __commonJS({ * @return {String} the resulting string. * @throws Error if the chunk is too big for the stack. */ - stringifyByChunk: function(array, type, chunk) { - var result = [], k = 0, len = array.length; - if (len <= chunk) { + stringifyByChunk: function(array, type, chunk2) { + var result2 = [], k = 0, len = array.length; + if (len <= chunk2) { return String.fromCharCode.apply(null, array); } while (k < len) { if (type === "array" || type === "nodebuffer") { - result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))); + result2.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk2, len)))); } else { - result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))); + result2.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk2, len)))); } - k += chunk; + k += chunk2; } - return result.join(""); + return result2.join(""); }, /** * Call String.fromCharCode on every item in the array. @@ -2811,18 +2811,18 @@ var require_utils = __commonJS({ } }; function arrayLikeToString(array) { - var chunk = 65536, type = exports2.getTypeOf(array), canUseApply = true; + var chunk2 = 65536, type = exports2.getTypeOf(array), canUseApply = true; if (type === "uint8array") { canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array; } else if (type === "nodebuffer") { canUseApply = arrayToStringHelper.applyCanBeUsed.nodebuffer; } if (canUseApply) { - while (chunk > 1) { + while (chunk2 > 1) { try { - return arrayToStringHelper.stringifyByChunk(array, type, chunk); + return arrayToStringHelper.stringifyByChunk(array, type, chunk2); } catch (e) { - chunk = Math.floor(chunk / 2); + chunk2 = Math.floor(chunk2 / 2); } } } @@ -2837,7 +2837,7 @@ var require_utils = __commonJS({ } var transform = {}; transform["string"] = { - "string": identity, + "string": identity2, "array": function(input) { return stringToArrayLike(input, new Array(input.length)); }, @@ -2853,7 +2853,7 @@ var require_utils = __commonJS({ }; transform["array"] = { "string": arrayLikeToString, - "array": identity, + "array": identity2, "arraybuffer": function(input) { return new Uint8Array(input).buffer; }, @@ -2871,7 +2871,7 @@ var require_utils = __commonJS({ "array": function(input) { return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength)); }, - "arraybuffer": identity, + "arraybuffer": identity2, "uint8array": function(input) { return new Uint8Array(input); }, @@ -2887,7 +2887,7 @@ var require_utils = __commonJS({ "arraybuffer": function(input) { return input.buffer; }, - "uint8array": identity, + "uint8array": identity2, "nodebuffer": function(input) { return nodejsUtils.newBufferFrom(input); } @@ -2903,7 +2903,7 @@ var require_utils = __commonJS({ "uint8array": function(input) { return arrayLikeToArrayLike(input, new Uint8Array(input.length)); }, - "nodebuffer": identity + "nodebuffer": identity2 }; exports2.transformTo = function(outputType, input) { if (!input) { @@ -2914,23 +2914,23 @@ var require_utils = __commonJS({ } exports2.checkSupport(outputType); var inputType = exports2.getTypeOf(input); - var result = transform[inputType][outputType](input); - return result; + var result2 = transform[inputType][outputType](input); + return result2; }; exports2.resolve = function(path2) { var parts = path2.split("/"); - var result = []; + var result2 = []; for (var index = 0; index < parts.length; index++) { var part = parts[index]; if (part === "." || part === "" && index !== 0 && index !== parts.length - 1) { continue; } else if (part === "..") { - result.pop(); + result2.pop(); } else { - result.push(part); + result2.push(part); } } - return result.join("/"); + return result2.join("/"); }; exports2.getTypeOf = function(input) { if (typeof input === "string") { @@ -2970,34 +2970,34 @@ var require_utils = __commonJS({ callback.apply(self2 || null, args || []); }); }; - exports2.inherits = function(ctor, superCtor) { + exports2.inherits = function(ctor2, superCtor) { var Obj = function() { }; Obj.prototype = superCtor.prototype; - ctor.prototype = new Obj(); + ctor2.prototype = new Obj(); }; exports2.extend = function() { - var result = {}, i, attr; + var result2 = {}, i, attr; for (i = 0; i < arguments.length; i++) { for (attr in arguments[i]) { - if (Object.prototype.hasOwnProperty.call(arguments[i], attr) && typeof result[attr] === "undefined") { - result[attr] = arguments[i][attr]; + if (Object.prototype.hasOwnProperty.call(arguments[i], attr) && typeof result2[attr] === "undefined") { + result2[attr] = arguments[i][attr]; } } } - return result; + return result2; }; exports2.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) { var promise = external.Promise.resolve(inputData).then(function(data) { var isBlob = support.blob && (data instanceof Blob || ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(data)) !== -1); if (isBlob && typeof FileReader !== "undefined") { - return new external.Promise(function(resolve, reject) { + return new external.Promise(function(resolve, reject2) { var reader = new FileReader(); reader.onload = function(e) { resolve(e.target.result); }; reader.onerror = function(e) { - reject(e.target.error); + reject2(e.target.error); }; reader.readAsArrayBuffer(data); }); @@ -3053,8 +3053,8 @@ var require_GenericWorker = __commonJS({ * Push a chunk to the next workers. * @param {Object} chunk the chunk to push */ - push: function(chunk) { - this.emit("data", chunk); + push: function(chunk2) { + this.emit("data", chunk2); }, /** * End the stream. @@ -3148,8 +3148,8 @@ var require_GenericWorker = __commonJS({ this.mergeStreamInfo(); this.previous = previous; var self2 = this; - previous.on("data", function(chunk) { - self2.processChunk(chunk); + previous.on("data", function(chunk2) { + self2.processChunk(chunk2); }); previous.on("end", function() { self2.end(); @@ -3201,8 +3201,8 @@ var require_GenericWorker = __commonJS({ * Process a chunk. This is usually the method overridden. * @param {Object} chunk the chunk to process. */ - processChunk: function(chunk) { - this.push(chunk); + processChunk: function(chunk2) { + this.push(chunk2); }, /** * Add a key/value to be added in the workers chain streamInfo once activated. @@ -3315,23 +3315,23 @@ var require_utf8 = __commonJS({ } return buf; }; - var utf8border = function(buf, max) { + var utf8border = function(buf, max2) { var pos; - max = max || buf.length; - if (max > buf.length) { - max = buf.length; + max2 = max2 || buf.length; + if (max2 > buf.length) { + max2 = buf.length; } - pos = max - 1; + pos = max2 - 1; while (pos >= 0 && (buf[pos] & 192) === 128) { pos--; } if (pos < 0) { - return max; + return max2; } if (pos === 0) { - return max; + return max2; } - return pos + _utf8len[buf[pos]] > max ? pos : max; + return pos + _utf8len[buf[pos]] > max2 ? pos : max2; }; var buf2string = function(buf) { var i2, out, c, c_len; @@ -3393,8 +3393,8 @@ var require_utf8 = __commonJS({ this.leftOver = null; } utils.inherits(Utf8DecodeWorker, GenericWorker); - Utf8DecodeWorker.prototype.processChunk = function(chunk) { - var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data); + Utf8DecodeWorker.prototype.processChunk = function(chunk2) { + var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk2.data); if (this.leftOver && this.leftOver.length) { if (support.uint8array) { var previousData = data; @@ -3419,7 +3419,7 @@ var require_utf8 = __commonJS({ } this.push({ data: exports2.utf8decode(usableData), - meta: chunk.meta + meta: chunk2.meta }); }; Utf8DecodeWorker.prototype.flush = function() { @@ -3436,10 +3436,10 @@ var require_utf8 = __commonJS({ GenericWorker.call(this, "utf-8 encode"); } utils.inherits(Utf8EncodeWorker, GenericWorker); - Utf8EncodeWorker.prototype.processChunk = function(chunk) { + Utf8EncodeWorker.prototype.processChunk = function(chunk2) { this.push({ - data: exports2.utf8encode(chunk.data), - meta: chunk.meta + data: exports2.utf8encode(chunk2.data), + meta: chunk2.meta }); }; exports2.Utf8EncodeWorker = Utf8EncodeWorker; @@ -3457,10 +3457,10 @@ var require_ConvertWorker = __commonJS({ this.destType = destType; } utils.inherits(ConvertWorker, GenericWorker); - ConvertWorker.prototype.processChunk = function(chunk) { + ConvertWorker.prototype.processChunk = function(chunk2) { this.push({ - data: utils.transformTo(this.destType, chunk.data), - meta: chunk.meta + data: utils.transformTo(this.destType, chunk2.data), + meta: chunk2.meta }); }; module2.exports = ConvertWorker; @@ -3549,7 +3549,7 @@ var require_StreamHelper = __commonJS({ } } function accumulate(helper, updateCallback) { - return new external.Promise(function(resolve, reject) { + return new external.Promise(function(resolve, reject2) { var dataArray = []; var chunkType = helper._internalType, resultType = helper._outputType, mimeType = helper._mimeType; helper.on("data", function(data, meta) { @@ -3559,13 +3559,13 @@ var require_StreamHelper = __commonJS({ } }).on("error", function(err) { dataArray = []; - reject(err); + reject2(err); }).on("end", function() { try { - var result = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType); - resolve(result); + var result2 = transformZipOutput(resultType, concat(chunkType, dataArray), mimeType); + resolve(result2); } catch (e) { - reject(e); + reject2(e); } dataArray = []; }).resume(); @@ -3613,8 +3613,8 @@ var require_StreamHelper = __commonJS({ on: function(evt, fn) { var self2 = this; if (evt === "data") { - this._worker.on(evt, function(chunk) { - fn.call(self2, chunk.data, chunk.meta); + this._worker.on(evt, function(chunk2) { + fn.call(self2, chunk2.data, chunk2.meta); }); } else { this._worker.on(evt, function() { @@ -3733,8 +3733,8 @@ var require_DataWorker = __commonJS({ if (this.isPaused || this.isFinished) { return false; } - var size = DEFAULT_BLOCK_SIZE; - var data = null, nextIndex = Math.min(this.max, this.index + size); + var size2 = DEFAULT_BLOCK_SIZE; + var data = null, nextIndex = Math.min(this.max, this.index + size2); if (this.index >= this.max) { return this.end(); } else { @@ -3822,9 +3822,9 @@ var require_Crc32Probe = __commonJS({ this.withStreamInfo("crc32", 0); } utils.inherits(Crc32Probe, GenericWorker); - Crc32Probe.prototype.processChunk = function(chunk) { - this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0); - this.push(chunk); + Crc32Probe.prototype.processChunk = function(chunk2) { + this.streamInfo.crc32 = crc32(chunk2.data, this.streamInfo.crc32 || 0); + this.push(chunk2); }; module2.exports = Crc32Probe; } @@ -3842,12 +3842,12 @@ var require_DataLengthProbe = __commonJS({ this.withStreamInfo(propName, 0); } utils.inherits(DataLengthProbe, GenericWorker); - DataLengthProbe.prototype.processChunk = function(chunk) { - if (chunk) { + DataLengthProbe.prototype.processChunk = function(chunk2) { + if (chunk2) { var length = this.streamInfo[this.propName] || 0; - this.streamInfo[this.propName] = length + chunk.data.length; + this.streamInfo[this.propName] = length + chunk2.data.length; } - GenericWorker.prototype.processChunk.call(this, chunk); + GenericWorker.prototype.processChunk.call(this, chunk2); }; module2.exports = DataLengthProbe; } @@ -3928,7 +3928,7 @@ var require_zipObject = __commonJS({ * @return StreamHelper the stream. */ internalStream: function(type) { - var result = null, outputType = "string"; + var result2 = null, outputType = "string"; try { if (!type) { throw new Error("No output type specified."); @@ -3938,19 +3938,19 @@ var require_zipObject = __commonJS({ if (outputType === "binarystring" || outputType === "text") { outputType = "string"; } - result = this._decompressWorker(); + result2 = this._decompressWorker(); var isUnicodeString = !this._dataBinary; if (isUnicodeString && !askUnicodeString) { - result = result.pipe(new utf8.Utf8EncodeWorker()); + result2 = result2.pipe(new utf8.Utf8EncodeWorker()); } if (!isUnicodeString && askUnicodeString) { - result = result.pipe(new utf8.Utf8DecodeWorker()); + result2 = result2.pipe(new utf8.Utf8DecodeWorker()); } } catch (e) { - result = new GenericWorker("error"); - result.error(e); + result2 = new GenericWorker("error"); + result2.error(e); } - return new StreamHelper(result, outputType, ""); + return new StreamHelper(result2, outputType, ""); }, /** * Prepare the content in the asked type. @@ -3981,11 +3981,11 @@ var require_zipObject = __commonJS({ if (this._data instanceof CompressedObject && this._data.compression.magic === compression.magic) { return this._data.getCompressedWorker(); } else { - var result = this._decompressWorker(); + var result2 = this._decompressWorker(); if (!this._dataBinary) { - result = result.pipe(new utf8.Utf8EncodeWorker()); + result2 = result2.pipe(new utf8.Utf8EncodeWorker()); } - return CompressedObject.createWorkerFrom(result, compression, compressionOptions); + return CompressedObject.createWorkerFrom(result2, compression, compressionOptions); } }, /** @@ -4041,14 +4041,14 @@ var require_common = __commonJS({ } return obj; }; - exports2.shrinkBuf = function(buf, size) { - if (buf.length === size) { + exports2.shrinkBuf = function(buf, size2) { + if (buf.length === size2) { return buf; } if (buf.subarray) { - return buf.subarray(0, size); + return buf.subarray(0, size2); } - buf.length = size; + buf.length = size2; return buf; }; var fnTyped = { @@ -4063,19 +4063,19 @@ var require_common = __commonJS({ }, // Join array of chunks to single array. flattenChunks: function(chunks) { - var i, l, len, pos, chunk, result; + var i, l, len, pos, chunk2, result2; len = 0; for (i = 0, l = chunks.length; i < l; i++) { len += chunks[i].length; } - result = new Uint8Array(len); + result2 = new Uint8Array(len); pos = 0; for (i = 0, l = chunks.length; i < l; i++) { - chunk = chunks[i]; - result.set(chunk, pos); - pos += chunk.length; + chunk2 = chunks[i]; + result2.set(chunk2, pos); + pos += chunk2.length; } - return result; + return result2; } }; var fnUntyped = { @@ -4683,8 +4683,8 @@ var require_trees = __commonJS({ s.bi_valid = 0; init_block(s); } - function _tr_stored_block(s, buf, stored_len, last) { - send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); + function _tr_stored_block(s, buf, stored_len, last2) { + send_bits(s, (STORED_BLOCK << 1) + (last2 ? 1 : 0), 3); copy_block(s, buf, stored_len, true); } function _tr_align(s) { @@ -4692,7 +4692,7 @@ var require_trees = __commonJS({ send_code(s, END_BLOCK, static_ltree); bi_flush(s); } - function _tr_flush_block(s, buf, stored_len, last) { + function _tr_flush_block(s, buf, stored_len, last2) { var opt_lenb, static_lenb; var max_blindex = 0; if (s.level > 0) { @@ -4711,17 +4711,17 @@ var require_trees = __commonJS({ opt_lenb = static_lenb = stored_len + 5; } if (stored_len + 4 <= opt_lenb && buf !== -1) { - _tr_stored_block(s, buf, stored_len, last); + _tr_stored_block(s, buf, stored_len, last2); } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { - send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); + send_bits(s, (STATIC_TREES << 1) + (last2 ? 1 : 0), 3); compress_block(s, static_ltree, static_dtree); } else { - send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); + send_bits(s, (DYN_TREES << 1) + (last2 ? 1 : 0), 3); send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); compress_block(s, s.dyn_ltree, s.dyn_dtree); } init_block(s); - if (last) { + if (last2) { bi_windup(s); } } @@ -4910,8 +4910,8 @@ var require_deflate = __commonJS({ s.pending_out = 0; } } - function flush_block_only(s, last) { - trees._tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last); + function flush_block_only(s, last2) { + trees._tr_flush_block(s, s.block_start >= 0 ? s.block_start : -1, s.strstart - s.block_start, last2); s.block_start = s.strstart; flush_pending(s.strm); } @@ -4922,10 +4922,10 @@ var require_deflate = __commonJS({ s.pending_buf[s.pending++] = b >>> 8 & 255; s.pending_buf[s.pending++] = b & 255; } - function read_buf(strm, buf, start, size) { + function read_buf(strm, buf, start, size2) { var len = strm.avail_in; - if (len > size) { - len = size; + if (len > size2) { + len = size2; } if (len === 0) { return 0; @@ -5488,15 +5488,15 @@ var require_deflate = __commonJS({ if (!strm) { return Z_STREAM_ERROR; } - var wrap = 1; + var wrap2 = 1; if (level === Z_DEFAULT_COMPRESSION) { level = 6; } if (windowBits < 0) { - wrap = 0; + wrap2 = 0; windowBits = -windowBits; } else if (windowBits > 15) { - wrap = 2; + wrap2 = 2; windowBits -= 16; } if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { @@ -5508,7 +5508,7 @@ var require_deflate = __commonJS({ var s = new DeflateState(); strm.state = s; s.strm = strm; - s.wrap = wrap; + s.wrap = wrap2; s.gzhead = null; s.w_bits = windowBits; s.w_size = 1 << s.w_bits; @@ -5801,7 +5801,7 @@ var require_deflate = __commonJS({ var dictLength = dictionary.length; var s; var str, n; - var wrap; + var wrap2; var avail; var next; var input; @@ -5810,16 +5810,16 @@ var require_deflate = __commonJS({ return Z_STREAM_ERROR; } s = strm.state; - wrap = s.wrap; - if (wrap === 2 || wrap === 1 && s.status !== INIT_STATE || s.lookahead) { + wrap2 = s.wrap; + if (wrap2 === 2 || wrap2 === 1 && s.status !== INIT_STATE || s.lookahead) { return Z_STREAM_ERROR; } - if (wrap === 1) { + if (wrap2 === 1) { strm.adler = adler32(strm.adler, dictionary, dictLength, 0); } s.wrap = 0; if (dictLength >= s.w_size) { - if (wrap === 0) { + if (wrap2 === 0) { zero(s.head); s.strstart = 0; s.block_start = 0; @@ -5859,7 +5859,7 @@ var require_deflate = __commonJS({ strm.next_in = next; strm.input = input; strm.avail_in = avail; - s.wrap = wrap; + s.wrap = wrap2; return Z_OK; } exports2.deflateInit = deflateInit; @@ -5944,11 +5944,11 @@ var require_strings = __commonJS({ return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); } } - var result = ""; + var result2 = ""; for (var i = 0; i < len; i++) { - result += String.fromCharCode(buf[i]); + result2 += String.fromCharCode(buf[i]); } - return result; + return result2; } exports2.buf2binstring = function(buf) { return buf2binstring(buf, buf.length); @@ -5960,9 +5960,9 @@ var require_strings = __commonJS({ } return buf; }; - exports2.buf2string = function(buf, max) { + exports2.buf2string = function(buf, max2) { var i, out, c, c_len; - var len = max || buf.length; + var len = max2 || buf.length; var utf16buf = new Array(len * 2); for (out = 0, i = 0; i < len; ) { c = buf[i++]; @@ -5995,23 +5995,23 @@ var require_strings = __commonJS({ } return buf2binstring(utf16buf, out); }; - exports2.utf8border = function(buf, max) { + exports2.utf8border = function(buf, max2) { var pos; - max = max || buf.length; - if (max > buf.length) { - max = buf.length; + max2 = max2 || buf.length; + if (max2 > buf.length) { + max2 = buf.length; } - pos = max - 1; + pos = max2 - 1; while (pos >= 0 && (buf[pos] & 192) === 128) { pos--; } if (pos < 0) { - return max; + return max2; } if (pos === 0) { - return max; + return max2; } - return pos + _utf8len[buf[pos]] > max ? pos : max; + return pos + _utf8len[buf[pos]] > max2 ? pos : max2; }; } }); @@ -6047,7 +6047,7 @@ var require_deflate2 = __commonJS({ var strings = require_strings(); var msg = require_messages(); var ZStream = require_zstream(); - var toString = Object.prototype.toString; + var toString2 = Object.prototype.toString; var Z_NO_FLUSH = 0; var Z_FINISH = 4; var Z_OK = 0; @@ -6097,7 +6097,7 @@ var require_deflate2 = __commonJS({ var dict; if (typeof opt.dictionary === "string") { dict = strings.string2buf(opt.dictionary); - } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") { + } else if (toString2.call(opt.dictionary) === "[object ArrayBuffer]") { dict = new Uint8Array(opt.dictionary); } else { dict = opt.dictionary; @@ -6119,7 +6119,7 @@ var require_deflate2 = __commonJS({ _mode = mode === ~~mode ? mode : mode === true ? Z_FINISH : Z_NO_FLUSH; if (typeof data === "string") { strm.input = strings.string2buf(data); - } else if (toString.call(data) === "[object ArrayBuffer]") { + } else if (toString2.call(data) === "[object ArrayBuffer]") { strm.input = new Uint8Array(data); } else { strm.input = data; @@ -6159,8 +6159,8 @@ var require_deflate2 = __commonJS({ } return true; }; - Deflate.prototype.onData = function(chunk) { - this.chunks.push(chunk); + Deflate.prototype.onData = function(chunk2) { + this.chunks.push(chunk2); }; Deflate.prototype.onEnd = function(status) { if (status === Z_OK) { @@ -6208,7 +6208,7 @@ var require_inffast = __commonJS({ module2.exports = function inflate_fast(strm, start) { var state; var _in; - var last; + var last2; var _out; var beg; var end; @@ -6233,7 +6233,7 @@ var require_inffast = __commonJS({ state = strm.state; _in = strm.next_in; input = strm.input; - last = _in + (strm.avail_in - 5); + last2 = _in + (strm.avail_in - 5); _out = strm.next_out; output = strm.output; beg = _out - (start - strm.avail_out); @@ -6412,14 +6412,14 @@ var require_inffast = __commonJS({ } break; } - } while (_in < last && _out < end); + } while (_in < last2 && _out < end); len = bits >> 3; _in -= len; bits -= len << 3; hold &= (1 << bits) - 1; strm.next_in = _in; strm.next_out = _out; - strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last); + strm.avail_in = _in < last2 ? 5 + (last2 - _in) : 5 - (_in - last2); strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end); state.hold = hold; state.bits = bits; @@ -6581,8 +6581,8 @@ var require_inftrees = __commonJS({ var bits = opts.bits; var len = 0; var sym = 0; - var min = 0, max = 0; - var root = 0; + var min2 = 0, max2 = 0; + var root2 = 0; var curr = 0; var drop = 0; var left = 0; @@ -6607,28 +6607,28 @@ var require_inftrees = __commonJS({ for (sym = 0; sym < codes; sym++) { count[lens[lens_index + sym]]++; } - root = bits; - for (max = MAXBITS; max >= 1; max--) { - if (count[max] !== 0) { + root2 = bits; + for (max2 = MAXBITS; max2 >= 1; max2--) { + if (count[max2] !== 0) { break; } } - if (root > max) { - root = max; + if (root2 > max2) { + root2 = max2; } - if (max === 0) { + if (max2 === 0) { table[table_index++] = 1 << 24 | 64 << 16 | 0; table[table_index++] = 1 << 24 | 64 << 16 | 0; opts.bits = 1; return 0; } - for (min = 1; min < max; min++) { - if (count[min] !== 0) { + for (min2 = 1; min2 < max2; min2++) { + if (count[min2] !== 0) { break; } } - if (root < min) { - root = min; + if (root2 < min2) { + root2 = min2; } left = 1; for (len = 1; len <= MAXBITS; len++) { @@ -6638,7 +6638,7 @@ var require_inftrees = __commonJS({ return -1; } } - if (left > 0 && (type === CODES || max !== 1)) { + if (left > 0 && (type === CODES || max2 !== 1)) { return -1; } offs[1] = 0; @@ -6666,12 +6666,12 @@ var require_inftrees = __commonJS({ } huff = 0; sym = 0; - len = min; + len = min2; next = table_index; - curr = root; + curr = root2; drop = 0; low = -1; - used = 1 << root; + used = 1 << root2; mask = used - 1; if (type === LENS && used > ENOUGH_LENS || type === DISTS && used > ENOUGH_DISTS) { return 1; @@ -6690,7 +6690,7 @@ var require_inftrees = __commonJS({ } incr = 1 << len - drop; fill = 1 << curr; - min = fill; + min2 = fill; do { fill -= incr; table[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0; @@ -6707,19 +6707,19 @@ var require_inftrees = __commonJS({ } sym++; if (--count[len] === 0) { - if (len === max) { + if (len === max2) { break; } len = lens[lens_index + work[sym]]; } - if (len > root && (huff & mask) !== low) { + if (len > root2 && (huff & mask) !== low) { if (drop === 0) { - drop = root; + drop = root2; } - next += min; + next += min2; curr = len - drop; left = 1 << curr; - while (curr + drop < max) { + while (curr + drop < max2) { left -= count[curr + drop]; if (left <= 0) { break; @@ -6732,13 +6732,13 @@ var require_inftrees = __commonJS({ return 1; } low = huff & mask; - table[low] = root << 24 | curr << 16 | next - table_index | 0; + table[low] = root2 << 24 | curr << 16 | next - table_index | 0; } } if (huff !== 0) { table[next + huff] = len - drop << 24 | 64 << 16 | 0; } - opts.bits = root; + opts.bits = root2; return 0; }; } @@ -6879,17 +6879,17 @@ var require_inflate = __commonJS({ return inflateResetKeep(strm); } function inflateReset2(strm, windowBits) { - var wrap; + var wrap2; var state; if (!strm || !strm.state) { return Z_STREAM_ERROR; } state = strm.state; if (windowBits < 0) { - wrap = 0; + wrap2 = 0; windowBits = -windowBits; } else { - wrap = (windowBits >> 4) + 1; + wrap2 = (windowBits >> 4) + 1; if (windowBits < 48) { windowBits &= 15; } @@ -6900,7 +6900,7 @@ var require_inflate = __commonJS({ if (state.window !== null && state.wbits !== windowBits) { state.window = null; } - state.wrap = wrap; + state.wrap = wrap2; state.wbits = windowBits; return inflateReset(strm); } @@ -8061,7 +8061,7 @@ var require_inflate2 = __commonJS({ var msg = require_messages(); var ZStream = require_zstream(); var GZheader = require_gzheader(); - var toString = Object.prototype.toString; + var toString2 = Object.prototype.toString; function Inflate(options) { if (!(this instanceof Inflate)) return new Inflate(options); this.options = utils.assign({ @@ -8102,7 +8102,7 @@ var require_inflate2 = __commonJS({ if (opt.dictionary) { if (typeof opt.dictionary === "string") { opt.dictionary = strings.string2buf(opt.dictionary); - } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") { + } else if (toString2.call(opt.dictionary) === "[object ArrayBuffer]") { opt.dictionary = new Uint8Array(opt.dictionary); } if (opt.raw) { @@ -8126,7 +8126,7 @@ var require_inflate2 = __commonJS({ _mode = mode === ~~mode ? mode : mode === true ? c.Z_FINISH : c.Z_NO_FLUSH; if (typeof data === "string") { strm.input = strings.binstring2buf(data); - } else if (toString.call(data) === "[object ArrayBuffer]") { + } else if (toString2.call(data) === "[object ArrayBuffer]") { strm.input = new Uint8Array(data); } else { strm.input = data; @@ -8189,8 +8189,8 @@ var require_inflate2 = __commonJS({ } return true; }; - Inflate.prototype.onData = function(chunk) { - this.chunks.push(chunk); + Inflate.prototype.onData = function(chunk2) { + this.chunks.push(chunk2); }; Inflate.prototype.onEnd = function(status) { if (status === c.Z_OK) { @@ -8256,12 +8256,12 @@ var require_flate = __commonJS({ this.meta = {}; } utils.inherits(FlateWorker, GenericWorker); - FlateWorker.prototype.processChunk = function(chunk) { - this.meta = chunk.meta; + FlateWorker.prototype.processChunk = function(chunk2) { + this.meta = chunk2.meta; if (this._pako === null) { this._createPako(); } - this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), false); + this._pako.push(utils.transformTo(ARRAY_TYPE, chunk2.data), false); }; FlateWorker.prototype.flush = function() { GenericWorker.prototype.flush.call(this); @@ -8346,11 +8346,11 @@ var require_ZipFileWorker = __commonJS({ return hex; }; var generateUnixExternalFileAttr = function(unixPermissions, isDir) { - var result = unixPermissions; + var result2 = unixPermissions; if (!unixPermissions) { - result = isDir ? 16893 : 33204; + result2 = isDir ? 16893 : 33204; } - return (result & 65535) << 16; + return (result2 & 65535) << 16; }; var generateDosExternalFileAttr = function(dosPermissions) { return (dosPermissions || 0) & 63; @@ -8480,16 +8480,16 @@ var require_ZipFileWorker = __commonJS({ this._sources = []; } utils.inherits(ZipFileWorker, GenericWorker); - ZipFileWorker.prototype.push = function(chunk) { - var currentFilePercent = chunk.meta.percent || 0; + ZipFileWorker.prototype.push = function(chunk2) { + var currentFilePercent = chunk2.meta.percent || 0; var entriesCount = this.entriesCount; var remainingFiles = this._sources.length; if (this.accumulate) { - this.contentBuffer.push(chunk); + this.contentBuffer.push(chunk2); } else { - this.bytesWritten += chunk.data.length; + this.bytesWritten += chunk2.data.length; GenericWorker.prototype.push.call(this, { - data: chunk.data, + data: chunk2.data, meta: { currentFile: this.currentFile, percent: entriesCount ? (currentFilePercent + 100 * (entriesCount - remainingFiles - 1)) / entriesCount : 100 @@ -8559,8 +8559,8 @@ var require_ZipFileWorker = __commonJS({ ZipFileWorker.prototype.registerPrevious = function(previous) { this._sources.push(previous); var self2 = this; - previous.on("data", function(chunk) { - self2.processChunk(chunk); + previous.on("data", function(chunk2) { + self2.processChunk(chunk2); }); previous.on("end", function() { self2.closedSource(self2.previous.streamInfo); @@ -8669,9 +8669,9 @@ var require_NodejsStreamInputAdapter = __commonJS({ var self2 = this; this._stream = stream; stream.pause(); - stream.on("data", function(chunk) { + stream.on("data", function(chunk2) { self2.push({ - data: chunk, + data: chunk2, meta: { percent: 0 } @@ -8768,8 +8768,8 @@ var require_object = __commonJS({ } else { zipObjectContent = utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64); } - var object = new ZipObject(name, zipObjectContent, o); - this.files[name] = object; + var object2 = new ZipObject(name, zipObjectContent, o); + this.files[name] = object2; }; var parentFolder = function(path2) { if (path2.slice(-1) === "/") { @@ -8795,8 +8795,8 @@ var require_object = __commonJS({ } return this.files[name]; }; - function isRegExp(object) { - return Object.prototype.toString.call(object) === "[object RegExp]"; + function isRegExp(object2) { + return Object.prototype.toString.call(object2) === "[object RegExp]"; } var out = { /** @@ -8811,13 +8811,13 @@ var require_object = __commonJS({ * function (relativePath, file) {...} * It takes 2 arguments : the relative path and the file. */ - forEach: function(cb) { + forEach: function(cb2) { var filename, relativePath, file; for (filename in this.files) { file = this.files[filename]; relativePath = filename.slice(this.root.length, filename.length); if (relativePath && filename.slice(0, this.root.length) === this.root) { - cb(relativePath, file); + cb2(relativePath, file); } } }, @@ -8829,13 +8829,13 @@ var require_object = __commonJS({ * @return {Array} An array of matching elements. */ filter: function(search) { - var result = []; + var result2 = []; this.forEach(function(relativePath, entry) { if (search(relativePath, entry)) { - result.push(entry); + result2.push(entry); } }); - return result; + return result2; }, /** * Add a file to the zip file, or search a file. @@ -9044,22 +9044,22 @@ var require_DataReader = __commonJS({ * @param {number} size the number of bytes to read. * @return {number} the corresponding number. */ - readInt: function(size) { - var result = 0, i; - this.checkOffset(size); - for (i = this.index + size - 1; i >= this.index; i--) { - result = (result << 8) + this.byteAt(i); + readInt: function(size2) { + var result2 = 0, i; + this.checkOffset(size2); + for (i = this.index + size2 - 1; i >= this.index; i--) { + result2 = (result2 << 8) + this.byteAt(i); } - this.index += size; - return result; + this.index += size2; + return result2; }, /** * Get the next string with a given byte size. * @param {number} size the number of bytes to read. * @return {string} the corresponding string. */ - readString: function(size) { - return utils.transformTo("string", this.readData(size)); + readString: function(size2) { + return utils.transformTo("string", this.readData(size2)); }, /** * Get raw data without conversion, bytes. @@ -9136,14 +9136,14 @@ var require_ArrayReader = __commonJS({ var sig0 = sig.charCodeAt(0), sig1 = sig.charCodeAt(1), sig2 = sig.charCodeAt(2), sig3 = sig.charCodeAt(3), data = this.readData(4); return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3]; }; - ArrayReader.prototype.readData = function(size) { - this.checkOffset(size); - if (size === 0) { + ArrayReader.prototype.readData = function(size2) { + this.checkOffset(size2); + if (size2 === 0) { return []; } - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; + var result2 = this.data.slice(this.zero + this.index, this.zero + this.index + size2); + this.index += size2; + return result2; }; module2.exports = ArrayReader; } @@ -9169,11 +9169,11 @@ var require_StringReader = __commonJS({ var data = this.readData(4); return sig === data; }; - StringReader.prototype.readData = function(size) { - this.checkOffset(size); - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; + StringReader.prototype.readData = function(size2) { + this.checkOffset(size2); + var result2 = this.data.slice(this.zero + this.index, this.zero + this.index + size2); + this.index += size2; + return result2; }; module2.exports = StringReader; } @@ -9189,14 +9189,14 @@ var require_Uint8ArrayReader = __commonJS({ ArrayReader.call(this, data); } utils.inherits(Uint8ArrayReader, ArrayReader); - Uint8ArrayReader.prototype.readData = function(size) { - this.checkOffset(size); - if (size === 0) { + Uint8ArrayReader.prototype.readData = function(size2) { + this.checkOffset(size2); + if (size2 === 0) { return new Uint8Array(0); } - var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; + var result2 = this.data.subarray(this.zero + this.index, this.zero + this.index + size2); + this.index += size2; + return result2; }; module2.exports = Uint8ArrayReader; } @@ -9212,11 +9212,11 @@ var require_NodeBufferReader = __commonJS({ Uint8ArrayReader.call(this, data); } utils.inherits(NodeBufferReader, Uint8ArrayReader); - NodeBufferReader.prototype.readData = function(size) { - this.checkOffset(size); - var result = this.data.slice(this.zero + this.index, this.zero + this.index + size); - this.index += size; - return result; + NodeBufferReader.prototype.readData = function(size2) { + this.checkOffset(size2); + var result2 = this.data.slice(this.zero + this.index, this.zero + this.index + size2); + this.index += size2; + return result2; }; module2.exports = NodeBufferReader; } @@ -9503,9 +9503,9 @@ var require_zipEntries = __commonJS({ var currentIndex = this.reader.index; this.reader.setIndex(askedIndex); var signature = this.reader.readString(4); - var result = signature === expectedSignature; + var result2 = signature === expectedSignature; this.reader.setIndex(currentIndex); - return result; + return result2; }, /** * Read the end of the central directory. @@ -9676,13 +9676,13 @@ var require_load = __commonJS({ var Crc32Probe = require_Crc32Probe(); var nodejsUtils = require_nodejsUtils(); function checkEntryCRC32(zipEntry) { - return new external.Promise(function(resolve, reject) { + return new external.Promise(function(resolve, reject2) { var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe()); worker.on("error", function(e) { - reject(e); + reject2(e); }).on("end", function() { if (worker.streamInfo.crc32 !== zipEntry.decompressed.crc32) { - reject(new Error("Corrupted zip : CRC32 mismatch")); + reject2(new Error("Corrupted zip : CRC32 mismatch")); } else { resolve(); } @@ -9977,8 +9977,8 @@ async function createZipFromFolder(dir) { async function compressFolder(srcDir, destFile) { await mkdir2(import_path.default.dirname(destFile), { recursive: true }); const zip = await createZipFromFolder(srcDir); - await new Promise((resolve, reject) => { - zip.generateNodeStream({ streamFiles: true, compression: "DEFLATE" }).pipe(fs.createWriteStream(destFile)).on("error", (err) => reject(err)).on("finish", resolve); + await new Promise((resolve, reject2) => { + zip.generateNodeStream({ streamFiles: true, compression: "DEFLATE" }).pipe(fs.createWriteStream(destFile)).on("error", (err) => reject2(err)).on("finish", resolve); }); } var import_crypto, fs, import_path, import_jszip, import_util, readdir2, stat2, mkdir2, SUPPORTED_PLATFORMS, SUPPORTED_ARCHS, FAIL_THRESHOLD_OUTPUT, QODANA_SARIF_NAME, QODANA_SHORT_SARIF_NAME, QODANA_REPORT_URL_NAME, QODANA_OPEN_IN_IDE_NAME, QODANA_LICENSES_MD, QODANA_LICENSES_JSON, EXECUTABLE, VERSION, COVERAGE_THRESHOLD, QodanaExitCode, NONE, BRANCH, PULL_REQUEST; @@ -10170,7 +10170,7 @@ var require_implementation = __commonJS({ "use strict"; var ERROR_MESSAGE = "Function.prototype.bind called on incompatible "; var toStr = Object.prototype.toString; - var max = Math.max; + var max2 = Math.max; var funcType = "[object Function]"; var concatty = function concatty2(a, b) { var arr = []; @@ -10208,12 +10208,12 @@ var require_implementation = __commonJS({ var bound; var binder = function() { if (this instanceof bound) { - var result = target.apply( + var result2 = target.apply( this, concatty(args, arguments) ); - if (Object(result) === result) { - return result; + if (Object(result2) === result2) { + return result2; } return this; } @@ -10222,7 +10222,7 @@ var require_implementation = __commonJS({ concatty(args, arguments) ); }; - var boundLength = max(0, target.length - args.length); + var boundLength = max2(0, target.length - args.length); var boundArgs = []; for (var i = 0; i < boundLength; i++) { boundArgs[i] = "$" + i; @@ -10474,18 +10474,18 @@ var require_get_intrinsic = __commonJS({ var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; var reEscapeChar = /\\(\\)?/g; var stringToPath = function stringToPath2(string) { - var first = $strSlice(string, 0, 1); - var last = $strSlice(string, -1); - if (first === "%" && last !== "%") { + var first2 = $strSlice(string, 0, 1); + var last2 = $strSlice(string, -1); + if (first2 === "%" && last2 !== "%") { throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`"); - } else if (last === "%" && first !== "%") { + } else if (last2 === "%" && first2 !== "%") { throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`"); } - var result = []; + var result2 = []; $replace(string, rePropName, function(match, number, quote, subString) { - result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match; + result2[result2.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match; }); - return result; + return result2; }; var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) { var intrinsicName = name; @@ -10533,9 +10533,9 @@ var require_get_intrinsic = __commonJS({ } for (var i = 1, isOwn = true; i < parts.length; i += 1) { var part = parts[i]; - var first = $strSlice(part, 0, 1); - var last = $strSlice(part, -1); - if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) { + var first2 = $strSlice(part, 0, 1); + var last2 = $strSlice(part, -1); + if ((first2 === '"' || first2 === "'" || first2 === "`" || (last2 === '"' || last2 === "'" || last2 === "`")) && first2 !== last2) { throw new $SyntaxError("property names with quotes must have matching quotes"); } if (part === "constructor" || !isOwn) { @@ -10616,11 +10616,11 @@ var require_define_data_property = __commonJS({ var $SyntaxError = require_syntax(); var $TypeError = require_type(); var gopd = require_gopd(); - module2.exports = function defineDataProperty(obj, property, value) { + module2.exports = function defineDataProperty(obj, property2, value) { if (!obj || typeof obj !== "object" && typeof obj !== "function") { throw new $TypeError("`obj` must be an object or a function`"); } - if (typeof property !== "string" && typeof property !== "symbol") { + if (typeof property2 !== "string" && typeof property2 !== "symbol") { throw new $TypeError("`property` must be a string or a symbol`"); } if (arguments.length > 3 && typeof arguments[3] !== "boolean" && arguments[3] !== null) { @@ -10639,16 +10639,16 @@ var require_define_data_property = __commonJS({ var nonWritable = arguments.length > 4 ? arguments[4] : null; var nonConfigurable = arguments.length > 5 ? arguments[5] : null; var loose = arguments.length > 6 ? arguments[6] : false; - var desc = !!gopd && gopd(obj, property); + var desc = !!gopd && gopd(obj, property2); if ($defineProperty) { - $defineProperty(obj, property, { + $defineProperty(obj, property2, { configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, value, writable: nonWritable === null && desc ? desc.writable : !nonWritable }); } else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) { - obj[property] = value; + obj[property2] = value; } else { throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable."); } @@ -10683,7 +10683,7 @@ var require_set_function_length = __commonJS({ "../node_modules/set-function-length/index.js"(exports2, module2) { "use strict"; var GetIntrinsic = require_get_intrinsic(); - var define = require_define_data_property(); + var define2 = require_define_data_property(); var hasDescriptors = require_has_property_descriptors()(); var gOPD = require_gopd(); var $TypeError = require_type(); @@ -10709,7 +10709,7 @@ var require_set_function_length = __commonJS({ } if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { if (hasDescriptors) { - define( + define2( /** @type {Parameters[0]} */ fn, "length", @@ -10718,7 +10718,7 @@ var require_set_function_length = __commonJS({ true ); } else { - define( + define2( /** @type {Parameters[0]} */ fn, "length", @@ -10849,20 +10849,20 @@ var require_object_inspect = __commonJS({ var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null; module2.exports = function inspect_(obj, options, depth, seen) { var opts = options || {}; - if (has(opts, "quoteStyle") && (opts.quoteStyle !== "single" && opts.quoteStyle !== "double")) { + if (has3(opts, "quoteStyle") && (opts.quoteStyle !== "single" && opts.quoteStyle !== "double")) { throw new TypeError('option "quoteStyle" must be "single" or "double"'); } - if (has(opts, "maxStringLength") && (typeof opts.maxStringLength === "number" ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null)) { + if (has3(opts, "maxStringLength") && (typeof opts.maxStringLength === "number" ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity : opts.maxStringLength !== null)) { throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`'); } - var customInspect = has(opts, "customInspect") ? opts.customInspect : true; + var customInspect = has3(opts, "customInspect") ? opts.customInspect : true; if (typeof customInspect !== "boolean" && customInspect !== "symbol") { throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`"); } - if (has(opts, "indent") && opts.indent !== null && opts.indent !== " " && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) { + if (has3(opts, "indent") && opts.indent !== null && opts.indent !== " " && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)) { throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`'); } - if (has(opts, "numericSeparator") && typeof opts.numericSeparator !== "boolean") { + if (has3(opts, "numericSeparator") && typeof opts.numericSeparator !== "boolean") { throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`'); } var numericSeparator = opts.numericSeparator; @@ -10911,7 +10911,7 @@ var require_object_inspect = __commonJS({ var newOpts = { depth: opts.depth }; - if (has(opts, "quoteStyle")) { + if (has3(opts, "quoteStyle")) { newOpts.quoteStyle = opts.quoteStyle; } return inspect_(value, newOpts, depth + 1, seen); @@ -10920,14 +10920,14 @@ var require_object_inspect = __commonJS({ } if (typeof obj === "function" && !isRegExp(obj)) { var name = nameOf(obj); - var keys = arrObjKeys(obj, inspect); - return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (keys.length > 0 ? " { " + $join.call(keys, ", ") + " }" : ""); + var keys2 = arrObjKeys(obj, inspect); + return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (keys2.length > 0 ? " { " + $join.call(keys2, ", ") + " }" : ""); } if (isSymbol(obj)) { var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, "$1") : symToString.call(obj); return typeof obj === "object" && !hasShammedSymbols ? markBoxed(symString) : symString; } - if (isElement(obj)) { + if (isElement2(obj)) { var s = "<" + $toLowerCase.call(String(obj.nodeName)); var attrs = obj.attributes || []; for (var i = 0; i < attrs.length; i++) { @@ -11000,7 +11000,7 @@ var require_object_inspect = __commonJS({ if (isBigInt(obj)) { return markBoxed(inspect(bigIntValueOf.call(obj))); } - if (isBoolean(obj)) { + if (isBoolean2(obj)) { return markBoxed(booleanValueOf.call(obj)); } if (isString(obj)) { @@ -11054,7 +11054,7 @@ var require_object_inspect = __commonJS({ function isNumber(obj) { return toStr(obj) === "[object Number]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj)); } - function isBoolean(obj) { + function isBoolean2(obj) { return toStr(obj) === "[object Boolean]" && (!toStringTag || !(typeof obj === "object" && toStringTag in obj)); } function isSymbol(obj) { @@ -11088,7 +11088,7 @@ var require_object_inspect = __commonJS({ var hasOwn = Object.prototype.hasOwnProperty || function(key) { return key in this; }; - function has(obj, key) { + function has3(obj, key) { return hasOwn.call(obj, key); } function toStr(obj) { @@ -11190,7 +11190,7 @@ var require_object_inspect = __commonJS({ } return false; } - function isElement(x) { + function isElement2(x) { if (!x || typeof x !== "object") { return false; } @@ -11228,9 +11228,9 @@ var require_object_inspect = __commonJS({ function weakCollectionOf(type) { return type + " { ? }"; } - function collectionOf(type, size, entries, indent) { + function collectionOf(type, size2, entries, indent) { var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ", "); - return type + " (" + size + ") {" + joinedEntries + "}"; + return type + " (" + size2 + ") {" + joinedEntries + "}"; } function singleLineValues(xs) { for (var i = 0; i < xs.length; i++) { @@ -11267,7 +11267,7 @@ var require_object_inspect = __commonJS({ if (isArr) { xs.length = obj.length; for (var i = 0; i < obj.length; i++) { - xs[i] = has(obj, i) ? inspect(obj[i], obj) : ""; + xs[i] = has3(obj, i) ? inspect(obj[i], obj) : ""; } } var syms = typeof gOPS === "function" ? gOPS(obj) : []; @@ -11279,7 +11279,7 @@ var require_object_inspect = __commonJS({ } } for (var key in obj) { - if (!has(obj, key)) { + if (!has3(obj, key)) { continue; } if (isArr && String(Number(key)) === key && key < obj.length) { @@ -11451,7 +11451,7 @@ var require_utils2 = __commonJS({ "../node_modules/qs/lib/utils.js"(exports2, module2) { "use strict"; var formats = require_formats(); - var has = Object.prototype.hasOwnProperty; + var has3 = Object.prototype.hasOwnProperty; var isArray = Array.isArray; var hexTable = function() { var array = []; @@ -11492,7 +11492,7 @@ var require_utils2 = __commonJS({ if (isArray(target)) { target.push(source); } else if (target && typeof target === "object") { - if (options && (options.plainObjects || options.allowPrototypes) || !has.call(Object.prototype, source)) { + if (options && (options.plainObjects || options.allowPrototypes) || !has3.call(Object.prototype, source)) { target[source] = true; } } else { @@ -11509,7 +11509,7 @@ var require_utils2 = __commonJS({ } if (isArray(target) && isArray(source)) { source.forEach(function(item, i) { - if (has.call(target, i)) { + if (has3.call(target, i)) { var targetItem = target[i]; if (targetItem && typeof targetItem === "object" && item && typeof item === "object") { target[i] = merge2(targetItem, item, options); @@ -11524,7 +11524,7 @@ var require_utils2 = __commonJS({ } return Object.keys(source).reduce(function(acc, key) { var value = source[key]; - if (has.call(acc, key)) { + if (has3.call(acc, key)) { acc[key] = merge2(acc[key], value, options); } else { acc[key] = value; @@ -11595,15 +11595,15 @@ var require_utils2 = __commonJS({ } return out; }; - var compact = function compact2(value) { + var compact2 = function compact3(value) { var queue = [{ obj: { o: value }, prop: "o" }]; var refs = []; for (var i = 0; i < queue.length; ++i) { var item = queue[i]; var obj = item.obj[item.prop]; - var keys = Object.keys(obj); - for (var j = 0; j < keys.length; ++j) { - var key = keys[j]; + var keys2 = Object.keys(obj); + for (var j = 0; j < keys2.length; ++j) { + var key = keys2[j]; var val = obj[key]; if (typeof val === "object" && val !== null && refs.indexOf(val) === -1) { queue.push({ obj, prop: key }); @@ -11640,7 +11640,7 @@ var require_utils2 = __commonJS({ arrayToObject, assign, combine, - compact, + compact: compact2, decode, encode, isBuffer, @@ -11658,7 +11658,7 @@ var require_stringify = __commonJS({ var getSideChannel = require_side_channel(); var utils = require_utils2(); var formats = require_formats(); - var has = Object.prototype.hasOwnProperty; + var has3 = Object.prototype.hasOwnProperty; var arrayPrefixGenerators = { brackets: function brackets(prefix) { return prefix + "[]"; @@ -11672,9 +11672,9 @@ var require_stringify = __commonJS({ } }; var isArray = Array.isArray; - var push = Array.prototype.push; + var push2 = Array.prototype.push; var pushToArray = function(arr, valueOrArray) { - push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]); + push2.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]); }; var toISO = Date.prototype.toISOString; var defaultFormat = formats["default"]; @@ -11704,13 +11704,13 @@ var require_stringify = __commonJS({ return typeof v === "string" || typeof v === "number" || typeof v === "boolean" || typeof v === "symbol" || typeof v === "bigint"; }; var sentinel = {}; - var stringify = function stringify2(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) { - var obj = object; + var stringify = function stringify2(object2, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter2, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) { + var obj = object2; var tmpSc = sideChannel; var step = 0; var findFlag = false; while ((tmpSc = tmpSc.get(sentinel)) !== void 0 && !findFlag) { - var pos = tmpSc.get(object); + var pos = tmpSc.get(object2); step += 1; if (typeof pos !== "undefined") { if (pos === step) { @@ -11723,8 +11723,8 @@ var require_stringify = __commonJS({ step = 0; } } - if (typeof filter === "function") { - obj = filter(prefix, obj); + if (typeof filter2 === "function") { + obj = filter2(prefix, obj); } else if (obj instanceof Date) { obj = serializeDate(obj); } else if (generateArrayPrefix === "comma" && isArray(obj)) { @@ -11748,9 +11748,9 @@ var require_stringify = __commonJS({ } return [formatter(prefix) + "=" + formatter(String(obj))]; } - var values = []; + var values2 = []; if (typeof obj === "undefined") { - return values; + return values2; } var objKeys; if (generateArrayPrefix === "comma" && isArray(obj)) { @@ -11758,11 +11758,11 @@ var require_stringify = __commonJS({ obj = utils.maybeMap(obj, encoder); } objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }]; - } else if (isArray(filter)) { - objKeys = filter; + } else if (isArray(filter2)) { + objKeys = filter2; } else { - var keys = Object.keys(obj); - objKeys = sort ? keys.sort(sort) : keys; + var keys2 = Object.keys(obj); + objKeys = sort ? keys2.sort(sort) : keys2; } var encodedPrefix = encodeDotInKeys ? prefix.replace(/\./g, "%2E") : prefix; var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? encodedPrefix + "[]" : encodedPrefix; @@ -11777,10 +11777,10 @@ var require_stringify = __commonJS({ } var encodedKey = allowDots && encodeDotInKeys ? key.replace(/\./g, "%2E") : key; var keyPrefix = isArray(obj) ? typeof generateArrayPrefix === "function" ? generateArrayPrefix(adjustedPrefix, encodedKey) : adjustedPrefix : adjustedPrefix + (allowDots ? "." + encodedKey : "[" + encodedKey + "]"); - sideChannel.set(object, step); + sideChannel.set(object2, step); var valueSideChannel = getSideChannel(); valueSideChannel.set(sentinel, sideChannel); - pushToArray(values, stringify2( + pushToArray(values2, stringify2( value, keyPrefix, generateArrayPrefix, @@ -11790,7 +11790,7 @@ var require_stringify = __commonJS({ skipNulls, encodeDotInKeys, generateArrayPrefix === "comma" && encodeValuesOnly && isArray(obj) ? null : encoder, - filter, + filter2, sort, allowDots, serializeDate, @@ -11801,7 +11801,7 @@ var require_stringify = __commonJS({ valueSideChannel )); } - return values; + return values2; }; var normalizeStringifyOptions = function normalizeStringifyOptions2(opts) { if (!opts) { @@ -11822,15 +11822,15 @@ var require_stringify = __commonJS({ } var format = formats["default"]; if (typeof opts.format !== "undefined") { - if (!has.call(formats.formatters, opts.format)) { + if (!has3.call(formats.formatters, opts.format)) { throw new TypeError("Unknown format option provided."); } format = opts.format; } var formatter = formats.formatters[format]; - var filter = defaults.filter; + var filter2 = defaults.filter; if (typeof opts.filter === "function" || isArray(opts.filter)) { - filter = opts.filter; + filter2 = opts.filter; } var arrayFormat; if (opts.arrayFormat in arrayPrefixGenerators) { @@ -11857,7 +11857,7 @@ var require_stringify = __commonJS({ encodeDotInKeys: typeof opts.encodeDotInKeys === "boolean" ? opts.encodeDotInKeys : defaults.encodeDotInKeys, encoder: typeof opts.encoder === "function" ? opts.encoder : defaults.encoder, encodeValuesOnly: typeof opts.encodeValuesOnly === "boolean" ? opts.encodeValuesOnly : defaults.encodeValuesOnly, - filter, + filter: filter2, format, formatter, serializeDate: typeof opts.serializeDate === "function" ? opts.serializeDate : defaults.serializeDate, @@ -11866,19 +11866,19 @@ var require_stringify = __commonJS({ strictNullHandling: typeof opts.strictNullHandling === "boolean" ? opts.strictNullHandling : defaults.strictNullHandling }; }; - module2.exports = function(object, opts) { - var obj = object; + module2.exports = function(object2, opts) { + var obj = object2; var options = normalizeStringifyOptions(opts); var objKeys; - var filter; + var filter2; if (typeof options.filter === "function") { - filter = options.filter; - obj = filter("", obj); + filter2 = options.filter; + obj = filter2("", obj); } else if (isArray(options.filter)) { - filter = options.filter; - objKeys = filter; + filter2 = options.filter; + objKeys = filter2; } - var keys = []; + var keys2 = []; if (typeof obj !== "object" || obj === null) { return ""; } @@ -11896,7 +11896,7 @@ var require_stringify = __commonJS({ if (options.skipNulls && obj[key] === null) { continue; } - pushToArray(keys, stringify( + pushToArray(keys2, stringify( obj[key], key, generateArrayPrefix, @@ -11917,7 +11917,7 @@ var require_stringify = __commonJS({ sideChannel )); } - var joined = keys.join(options.delimiter); + var joined = keys2.join(options.delimiter); var prefix = options.addQueryPrefix === true ? "?" : ""; if (options.charsetSentinel) { if (options.charset === "iso-8859-1") { @@ -11936,7 +11936,7 @@ var require_parse = __commonJS({ "../node_modules/qs/lib/parse.js"(exports2, module2) { "use strict"; var utils = require_utils2(); - var has = Object.prototype.hasOwnProperty; + var has3 = Object.prototype.hasOwnProperty; var isArray = Array.isArray; var defaults = { allowDots: false, @@ -12019,7 +12019,7 @@ var require_parse = __commonJS({ if (part.indexOf("[]=") > -1) { val = isArray(val) ? [val] : val; } - var existing = has.call(obj, key); + var existing = has3.call(obj, key); if (existing && options.duplicates === "combine") { obj[key] = utils.combine(obj[key], val); } else if (!existing || options.duplicates === "last") { @@ -12028,21 +12028,21 @@ var require_parse = __commonJS({ } return obj; }; - var parseObject = function(chain, val, options, valuesParsed) { + var parseObject = function(chain2, val, options, valuesParsed) { var leaf = valuesParsed ? val : parseArrayValue(val, options); - for (var i = chain.length - 1; i >= 0; --i) { + for (var i = chain2.length - 1; i >= 0; --i) { var obj; - var root = chain[i]; - if (root === "[]" && options.parseArrays) { + var root2 = chain2[i]; + if (root2 === "[]" && options.parseArrays) { obj = options.allowEmptyArrays && leaf === "" ? [] : [].concat(leaf); } else { obj = options.plainObjects ? /* @__PURE__ */ Object.create(null) : {}; - var cleanRoot = root.charAt(0) === "[" && root.charAt(root.length - 1) === "]" ? root.slice(1, -1) : root; + var cleanRoot = root2.charAt(0) === "[" && root2.charAt(root2.length - 1) === "]" ? root2.slice(1, -1) : root2; var decodedRoot = options.decodeDotInKeys ? cleanRoot.replace(/%2E/g, ".") : cleanRoot; var index = parseInt(decodedRoot, 10); if (!options.parseArrays && decodedRoot === "") { obj = { 0: leaf }; - } else if (!isNaN(index) && root !== decodedRoot && String(index) === decodedRoot && index >= 0 && (options.parseArrays && index <= options.arrayLimit)) { + } else if (!isNaN(index) && root2 !== decodedRoot && String(index) === decodedRoot && index >= 0 && (options.parseArrays && index <= options.arrayLimit)) { obj = []; obj[index] = leaf; } else if (decodedRoot !== "__proto__") { @@ -12062,29 +12062,29 @@ var require_parse = __commonJS({ var child = /(\[[^[\]]*])/g; var segment = options.depth > 0 && brackets.exec(key); var parent = segment ? key.slice(0, segment.index) : key; - var keys = []; + var keys2 = []; if (parent) { - if (!options.plainObjects && has.call(Object.prototype, parent)) { + if (!options.plainObjects && has3.call(Object.prototype, parent)) { if (!options.allowPrototypes) { return; } } - keys.push(parent); + keys2.push(parent); } var i = 0; while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) { i += 1; - if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { + if (!options.plainObjects && has3.call(Object.prototype, segment[1].slice(1, -1))) { if (!options.allowPrototypes) { return; } } - keys.push(segment[1]); + keys2.push(segment[1]); } if (segment) { - keys.push("[" + key.slice(segment.index) + "]"); + keys2.push("[" + key.slice(segment.index) + "]"); } - return parseObject(keys, val, options, valuesParsed); + return parseObject(keys2, val, options, valuesParsed); }; var normalizeParseOptions = function normalizeParseOptions2(opts) { if (!opts) { @@ -12138,9 +12138,9 @@ var require_parse = __commonJS({ } var tempObj = typeof str === "string" ? parseValues(str, options) : str; var obj = options.plainObjects ? /* @__PURE__ */ Object.create(null) : {}; - var keys = Object.keys(tempObj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; + var keys2 = Object.keys(tempObj); + for (var i = 0; i < keys2.length; ++i) { + var key = keys2[i]; var newObj = parseKeys(key, tempObj[key], options, typeof str === "string"); obj = utils.merge(obj, newObj, options); } @@ -12172,24 +12172,24 @@ var require_Util = __commonJS({ "../node_modules/typed-rest-client/Util.js"(exports2) { "use strict"; var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function(resolve, reject) { + return new (P || (P = Promise))(function(resolve, reject2) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { - reject(e); + reject2(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { - reject(e); + reject2(e); } } - function step(result) { - result.done ? resolve(result.value) : new P(function(resolve2) { - resolve2(result.value); + function step(result2) { + result2.done ? resolve(result2.value) : new P(function(resolve2) { + resolve2(result2.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); @@ -12239,10 +12239,10 @@ var require_Util = __commonJS({ } function decompressGzippedContent(buffer, charset) { return __awaiter2(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { zlib.gunzip(buffer, function(error, buffer2) { if (error) { - reject(error); + reject2(error); } else { resolve(buffer2.toString(charset || "utf-8")); } @@ -12357,7 +12357,7 @@ var require_tunnel = __commonJS({ } }); }; - TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { + TunnelingAgent.prototype.createSocket = function createSocket(options, cb2) { var self2 = this; var placeholder = {}; self2.sockets.push(placeholder); @@ -12418,7 +12418,7 @@ var require_tunnel = __commonJS({ } debug("tunneling connection has established"); self2.sockets[self2.sockets.indexOf(placeholder)] = socket; - return cb(socket); + return cb2(socket); } function onError(cause) { connectReq.removeAllListeners(); @@ -12446,7 +12446,7 @@ var require_tunnel = __commonJS({ }); } }; - function createSecureSocket(options, cb) { + function createSecureSocket(options, cb2) { var self2 = this; TunnelingAgent.prototype.createSocket.call(self2, options, function(socket) { var hostHeader = options.request.getHeader("host"); @@ -12456,7 +12456,7 @@ var require_tunnel = __commonJS({ }); var secureSocket = tls.connect(0, tlsOptions); self2.sockets[self2.sockets.indexOf(socket)] = secureSocket; - cb(secureSocket); + cb2(secureSocket); }); } function toOptions(host, port, localAddress) { @@ -12473,9 +12473,9 @@ var require_tunnel = __commonJS({ for (var i = 1, len = arguments.length; i < len; ++i) { var overrides = arguments[i]; if (typeof overrides === "object") { - var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; + var keys2 = Object.keys(overrides); + for (var j = 0, keyLen = keys2.length; j < keyLen; ++j) { + var k = keys2[j]; if (overrides[k] !== void 0) { target[k] = overrides[k]; } @@ -12515,24 +12515,24 @@ var require_HttpClient = __commonJS({ "../node_modules/typed-rest-client/HttpClient.js"(exports2) { "use strict"; var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function(resolve, reject) { + return new (P || (P = Promise))(function(resolve, reject2) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { - reject(e); + reject2(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { - reject(e); + reject2(e); } } - function step(result) { - result.done ? resolve(result.value) : new P(function(resolve2) { - resolve2(result.value); + function step(result2) { + result2.done ? resolve(result2.value) : new P(function(resolve2) { + resolve2(result2.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); @@ -12543,7 +12543,7 @@ var require_HttpClient = __commonJS({ var http = require("http"); var https = require("https"); var util = require_Util(); - var fs2; + var fs3; var tunnel; var HttpCodes; (function(HttpCodes2) { @@ -12586,14 +12586,14 @@ var require_HttpClient = __commonJS({ this.message = message; } readBody() { - return new Promise((resolve, reject) => __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { const chunks = []; const encodingCharset = util.obtainContentCharset(this); const contentEncoding = this.message.headers["content-encoding"] || ""; const isGzippedEncoded = new RegExp("(gzip$)|(gzip, *deflate)").test(contentEncoding); this.message.on("data", function(data) { - const chunk = typeof data === "string" ? Buffer.from(data, encodingCharset) : data; - chunks.push(chunk); + const chunk2 = typeof data === "string" ? Buffer.from(data, encodingCharset) : data; + chunks.push(chunk2); }).on("end", function() { return __awaiter2(this, void 0, void 0, function* () { const buffer = Buffer.concat(chunks); @@ -12605,7 +12605,7 @@ var require_HttpClient = __commonJS({ } }); }).on("error", function(err) { - reject(err); + reject2(err); }); })); } @@ -12656,15 +12656,15 @@ var require_HttpClient = __commonJS({ } this._certConfig = requestOptions.cert; if (this._certConfig) { - fs2 = require("fs"); - if (this._certConfig.caFile && fs2.existsSync(this._certConfig.caFile)) { - this._ca = fs2.readFileSync(this._certConfig.caFile, "utf8"); + fs3 = require("fs"); + if (this._certConfig.caFile && fs3.existsSync(this._certConfig.caFile)) { + this._ca = fs3.readFileSync(this._certConfig.caFile, "utf8"); } - if (this._certConfig.certFile && fs2.existsSync(this._certConfig.certFile)) { - this._cert = fs2.readFileSync(this._certConfig.certFile, "utf8"); + if (this._certConfig.certFile && fs3.existsSync(this._certConfig.certFile)) { + this._cert = fs3.readFileSync(this._certConfig.certFile, "utf8"); } - if (this._certConfig.keyFile && fs2.existsSync(this._certConfig.keyFile)) { - this._key = fs2.readFileSync(this._certConfig.keyFile, "utf8"); + if (this._certConfig.keyFile && fs3.existsSync(this._certConfig.keyFile)) { + this._key = fs3.readFileSync(this._certConfig.keyFile, "utf8"); } } if (requestOptions.allowRedirects != null) { @@ -12793,10 +12793,10 @@ var require_HttpClient = __commonJS({ * @param data */ requestRaw(info, data) { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject2) => { let callbackForResult = function(err, res) { if (err) { - reject(err); + reject2(err); } resolve(res); }; @@ -13033,8 +13033,8 @@ var require_semver = __commonJS({ function makeSafeRe(value) { for (var i2 = 0; i2 < safeRegexReplacements.length; i2++) { var token = safeRegexReplacements[i2][0]; - var max = safeRegexReplacements[i2][1]; - value = value.split(token + "*").join(token + "{0," + max + "}").split(token + "+").join(token + "{1," + max + "}"); + var max2 = safeRegexReplacements[i2][1]; + value = value.split(token + "*").join(token + "{0," + max2 + "}").split(token + "+").join(token + "{1," + max2 + "}"); } return value; } @@ -13372,7 +13372,7 @@ var require_semver = __commonJS({ } exports2.diff = diff; function diff(version1, version2) { - if (eq(version1, version2)) { + if (eq2(version1, version2)) { return null; } else { var v1 = parse(version1); @@ -13451,8 +13451,8 @@ var require_semver = __commonJS({ function lt(a, b, loose) { return compare(a, b, loose) < 0; } - exports2.eq = eq; - function eq(a, b, loose) { + exports2.eq = eq2; + function eq2(a, b, loose) { return compare(a, b, loose) === 0; } exports2.neq = neq; @@ -13485,7 +13485,7 @@ var require_semver = __commonJS({ case "": case "=": case "==": - return eq(a, b, loose); + return eq2(a, b, loose); case "!=": return neq(a, b, loose); case ">": @@ -13587,32 +13587,32 @@ var require_semver = __commonJS({ return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; }; exports2.Range = Range; - function Range(range, options) { + function Range(range2, options) { if (!options || typeof options !== "object") { options = { loose: !!options, includePrerelease: false }; } - if (range instanceof Range) { - if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { - return range; + if (range2 instanceof Range) { + if (range2.loose === !!options.loose && range2.includePrerelease === !!options.includePrerelease) { + return range2; } else { - return new Range(range.raw, options); + return new Range(range2.raw, options); } } - if (range instanceof Comparator) { - return new Range(range.value, options); + if (range2 instanceof Comparator) { + return new Range(range2.value, options); } if (!(this instanceof Range)) { - return new Range(range, options); + return new Range(range2, options); } this.options = options; this.loose = !!options.loose; this.includePrerelease = !!options.includePrerelease; - this.raw = range.trim().split(/\s+/).join(" "); - this.set = this.raw.split("||").map(function(range2) { - return this.parseRange(range2.trim()); + this.raw = range2.trim().split(/\s+/).join(" "); + this.set = this.raw.split("||").map(function(range3) { + return this.parseRange(range3.trim()); }, this).filter(function(c) { return c.length; }); @@ -13630,17 +13630,17 @@ var require_semver = __commonJS({ Range.prototype.toString = function() { return this.range; }; - Range.prototype.parseRange = function(range) { + Range.prototype.parseRange = function(range2) { var loose = this.options.loose; var hr = loose ? safeRe[HYPHENRANGELOOSE] : safeRe[HYPHENRANGE]; - range = range.replace(hr, hyphenReplace); - debug("hyphen replace", range); - range = range.replace(safeRe[COMPARATORTRIM], comparatorTrimReplace); - debug("comparator trim", range, safeRe[COMPARATORTRIM]); - range = range.replace(safeRe[TILDETRIM], tildeTrimReplace); - range = range.replace(safeRe[CARETTRIM], caretTrimReplace); + range2 = range2.replace(hr, hyphenReplace); + debug("hyphen replace", range2); + range2 = range2.replace(safeRe[COMPARATORTRIM], comparatorTrimReplace); + debug("comparator trim", range2, safeRe[COMPARATORTRIM]); + range2 = range2.replace(safeRe[TILDETRIM], tildeTrimReplace); + range2 = range2.replace(safeRe[CARETTRIM], caretTrimReplace); var compRe = loose ? safeRe[COMPARATORLOOSE] : safeRe[COMPARATOR]; - var set = range.split(" ").map(function(comp) { + var set = range2.split(" ").map(function(comp) { return parseComparator(comp, this.options); }, this).join(" ").split(/\s+/); if (this.options.loose) { @@ -13653,13 +13653,13 @@ var require_semver = __commonJS({ }, this); return set; }; - Range.prototype.intersects = function(range, options) { - if (!(range instanceof Range)) { + Range.prototype.intersects = function(range2, options) { + if (!(range2 instanceof Range)) { throw new TypeError("a Range is required"); } return this.set.some(function(thisComparators) { return thisComparators.every(function(thisComparator) { - return range.set.some(function(rangeComparators) { + return range2.set.some(function(rangeComparators) { return rangeComparators.every(function(rangeComparator) { return thisComparator.intersects(rangeComparator, options); }); @@ -13668,8 +13668,8 @@ var require_semver = __commonJS({ }); }; exports2.toComparators = toComparators; - function toComparators(range, options) { - return new Range(range, options).set.map(function(comp) { + function toComparators(range2, options) { + return new Range(range2, options).set.map(function(comp) { return comp.map(function(c) { return c.value; }).join(" ").trim().split(" "); @@ -13697,8 +13697,8 @@ var require_semver = __commonJS({ } function replaceTilde(comp, options) { var r = options.loose ? safeRe[TILDELOOSE] : safeRe[TILDE]; - return comp.replace(r, function(_, M, m, p, pr) { - debug("tilde", comp, _, M, m, p, pr); + return comp.replace(r, function(_3, M, m, p, pr) { + debug("tilde", comp, _3, M, m, p, pr); var ret; if (isX(M)) { ret = ""; @@ -13724,8 +13724,8 @@ var require_semver = __commonJS({ function replaceCaret(comp, options) { debug("caret", comp, options); var r = options.loose ? safeRe[CARETLOOSE] : safeRe[CARET]; - return comp.replace(r, function(_, M, m, p, pr) { - debug("caret", comp, _, M, m, p, pr); + return comp.replace(r, function(_3, M, m, p, pr) { + debug("caret", comp, _3, M, m, p, pr); var ret; if (isX(M)) { ret = ""; @@ -13886,66 +13886,66 @@ var require_semver = __commonJS({ return true; } exports2.satisfies = satisfies; - function satisfies(version2, range, options) { + function satisfies(version2, range2, options) { try { - range = new Range(range, options); + range2 = new Range(range2, options); } catch (er) { return false; } - return range.test(version2); + return range2.test(version2); } exports2.maxSatisfying = maxSatisfying; - function maxSatisfying(versions, range, options) { - var max = null; + function maxSatisfying(versions, range2, options) { + var max2 = null; var maxSV = null; try { - var rangeObj = new Range(range, options); + var rangeObj = new Range(range2, options); } catch (er) { return null; } versions.forEach(function(v) { if (rangeObj.test(v)) { - if (!max || maxSV.compare(v) === -1) { - max = v; - maxSV = new SemVer(max, options); + if (!max2 || maxSV.compare(v) === -1) { + max2 = v; + maxSV = new SemVer(max2, options); } } }); - return max; + return max2; } exports2.minSatisfying = minSatisfying; - function minSatisfying(versions, range, options) { - var min = null; + function minSatisfying(versions, range2, options) { + var min2 = null; var minSV = null; try { - var rangeObj = new Range(range, options); + var rangeObj = new Range(range2, options); } catch (er) { return null; } versions.forEach(function(v) { if (rangeObj.test(v)) { - if (!min || minSV.compare(v) === 1) { - min = v; - minSV = new SemVer(min, options); + if (!min2 || minSV.compare(v) === 1) { + min2 = v; + minSV = new SemVer(min2, options); } } }); - return min; + return min2; } exports2.minVersion = minVersion; - function minVersion(range, loose) { - range = new Range(range, loose); + function minVersion(range2, loose) { + range2 = new Range(range2, loose); var minver = new SemVer("0.0.0"); - if (range.test(minver)) { + if (range2.test(minver)) { return minver; } minver = new SemVer("0.0.0-0"); - if (range.test(minver)) { + if (range2.test(minver)) { return minver; } minver = null; - for (var i2 = 0; i2 < range.set.length; ++i2) { - var comparators = range.set[i2]; + for (var i2 = 0; i2 < range2.set.length; ++i2) { + var comparators = range2.set[i2]; comparators.forEach(function(comparator) { var compver = new SemVer(comparator.semver.version); switch (comparator.operator) { @@ -13972,31 +13972,31 @@ var require_semver = __commonJS({ } }); } - if (minver && range.test(minver)) { + if (minver && range2.test(minver)) { return minver; } return null; } exports2.validRange = validRange; - function validRange(range, options) { + function validRange(range2, options) { try { - return new Range(range, options).range || "*"; + return new Range(range2, options).range || "*"; } catch (er) { return null; } } exports2.ltr = ltr; - function ltr(version2, range, options) { - return outside(version2, range, "<", options); + function ltr(version2, range2, options) { + return outside(version2, range2, "<", options); } exports2.gtr = gtr; - function gtr(version2, range, options) { - return outside(version2, range, ">", options); + function gtr(version2, range2, options) { + return outside(version2, range2, ">", options); } exports2.outside = outside; - function outside(version2, range, hilo, options) { + function outside(version2, range2, hilo, options) { version2 = new SemVer(version2, options); - range = new Range(range, options); + range2 = new Range(range2, options); var gtfn, ltefn, ltfn, comp, ecomp; switch (hilo) { case ">": @@ -14016,11 +14016,11 @@ var require_semver = __commonJS({ default: throw new TypeError('Must provide a hilo val of "<" or ">"'); } - if (satisfies(version2, range, options)) { + if (satisfies(version2, range2, options)) { return false; } - for (var i2 = 0; i2 < range.set.length; ++i2) { - var comparators = range.set[i2]; + for (var i2 = 0; i2 < range2.set.length; ++i2) { + var comparators = range2.set[i2]; var high = null; var low = null; comparators.forEach(function(comparator) { @@ -14177,23 +14177,23 @@ var require_tool = __commonJS({ resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P || (P = Promise))(function(resolve, reject2) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { - reject(e); + reject2(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { - reject(e); + reject2(e); } } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); @@ -14204,7 +14204,7 @@ var require_tool = __commonJS({ var path2 = require("path"); var os = require("os"); var process2 = require("process"); - var fs2 = require("fs"); + var fs3 = require("fs"); var semver = require_semver(); var tl2 = require("azure-pipelines-task-lib/task"); var cmp = require_semver_compare(); @@ -14323,7 +14323,7 @@ var require_tool = __commonJS({ exports2.findLocalToolVersions = findLocalToolVersions; function downloadTool(url, fileName, handlers, additionalHeaders) { return __awaiter2(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { try { handlers = handlers || null; let http = new httpm.HttpClient(userAgent, handlers, requestOptions); @@ -14338,7 +14338,7 @@ var require_tool = __commonJS({ tl2.mkdirP(path2.dirname(destPath)); console.log(tl2.loc("TOOL_LIB_Downloading", url.replace(/sig=[^&]*/, "sig=-REDACTED-"))); tl2.debug("destination " + destPath); - if (fs2.existsSync(destPath)) { + if (fs3.existsSync(destPath)) { throw new Error("Destination file path already exists"); } tl2.debug("downloading"); @@ -14356,26 +14356,26 @@ var require_tool = __commonJS({ tl2.debug(`Content-Length header missing`); } tl2.debug("creating stream"); - const file = fs2.createWriteStream(destPath); + const file = fs3.createWriteStream(destPath); file.on("open", (fd) => __awaiter2(this, void 0, void 0, function* () { tl2.debug("file write stream opened. fd: " + fd); const messageStream = response.message; if (messageStream.aborted || messageStream.destroyed) { file.end(); - reject(new Error("Incoming message read stream was Aborted or Destroyed before download was complete")); + reject2(new Error("Incoming message read stream was Aborted or Destroyed before download was complete")); return; } tl2.debug("subscribing to message read stream events..."); try { messageStream.on("error", (err) => { file.end(); - reject(err); + reject2(err); }).on("aborted", () => { file.end(); - reject(new Error("Aborted")); + reject2(new Error("Aborted")); }).pipe(file); } catch (err) { - reject(err); + reject2(err); } tl2.debug("successfully subscribed to message read stream events"); })).on("close", () => { @@ -14398,10 +14398,10 @@ var require_tool = __commonJS({ resolve(destPath); }).on("error", (err) => { file.end(); - reject(err); + reject2(err); }); } catch (error) { - reject(error); + reject2(error); } })); }); @@ -14433,7 +14433,7 @@ var require_tool = __commonJS({ return parsedContentLength; } function _getFileSizeOnDisk(filePath) { - let fileStats = fs2.statSync(filePath); + let fileStats = fs3.statSync(filePath); let fileSizeInBytes = fileStats.size; return fileSizeInBytes; } @@ -14462,7 +14462,7 @@ var require_tool = __commonJS({ throw new Error("sourceDir is not a directory"); } let destPath = _createToolPath(tool, version2, arch); - for (let itemName of fs2.readdirSync(sourceDir)) { + for (let itemName of fs3.readdirSync(sourceDir)) { let s = path2.join(sourceDir, itemName); tl2.cp(s, destPath + "/", "-r"); } @@ -14559,8 +14559,8 @@ var require_tool = __commonJS({ let powershell = tl2.tool("powershell").line("-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command").arg(command); yield powershell.exec(); } else { - let unzip = tl2.tool("unzip").arg(file); - yield unzip.exec({ cwd: dest }); + let unzip2 = tl2.tool("unzip").arg(file); + yield unzip2.exec({ cwd: dest }); } return dest; }); @@ -14611,265 +14611,64933 @@ var require_tool = __commonJS({ } }); -// lib/utils.js -var require_utils3 = __commonJS({ - "lib/utils.js"(exports2) { +// ../node_modules/azure-devops-node-api/interfaces/PolicyInterfaces.js +var require_PolicyInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/PolicyInterfaces.js"(exports2) { "use strict"; - var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); - } : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; - }); - var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); - } : function(o, v) { - o["default"] = v; - }); - var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ function() { - var ownKeys = function(o) { - ownKeys = Object.getOwnPropertyNames || function(o2) { - var ar = []; - for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; - return ar; - }; - return ownKeys(o); - }; - return function(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.PolicyEvaluationStatus = void 0; + var PolicyEvaluationStatus; + (function(PolicyEvaluationStatus2) { + PolicyEvaluationStatus2[PolicyEvaluationStatus2["Queued"] = 0] = "Queued"; + PolicyEvaluationStatus2[PolicyEvaluationStatus2["Running"] = 1] = "Running"; + PolicyEvaluationStatus2[PolicyEvaluationStatus2["Approved"] = 2] = "Approved"; + PolicyEvaluationStatus2[PolicyEvaluationStatus2["Rejected"] = 3] = "Rejected"; + PolicyEvaluationStatus2[PolicyEvaluationStatus2["NotApplicable"] = 4] = "NotApplicable"; + PolicyEvaluationStatus2[PolicyEvaluationStatus2["Broken"] = 5] = "Broken"; + })(PolicyEvaluationStatus = exports2.PolicyEvaluationStatus || (exports2.PolicyEvaluationStatus = {})); + exports2.TypeInfo = { + PolicyConfiguration: {}, + PolicyEvaluationRecord: {}, + PolicyEvaluationStatus: { + enumValues: { + "queued": 0, + "running": 1, + "approved": 2, + "rejected": 3, + "notApplicable": 4, + "broken": 5 } - __setModuleDefault2(result, mod); - return result; - }; - }(); - var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P ? value : new P(function(resolve) { - resolve(value); - }); } - return new (P || (P = Promise))(function(resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator["throw"](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); }; + exports2.TypeInfo.PolicyConfiguration.fields = { + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.PolicyEvaluationRecord.fields = { + completedDate: { + isDate: true + }, + configuration: { + typeInfo: exports2.TypeInfo.PolicyConfiguration + }, + startedDate: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.PolicyEvaluationStatus + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/CoreInterfaces.js +var require_CoreInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/CoreInterfaces.js"(exports2) { + "use strict"; Object.defineProperty(exports2, "__esModule", { value: true }); - exports2.setFailed = setFailed; - exports2.getInputs = getInputs; - exports2.qodana = qodana; - exports2.prepareAgent = prepareAgent; - exports2.uploadArtifacts = uploadArtifacts; - exports2.uploadSarif = uploadSarif; - var tl2 = __importStar2(require("azure-pipelines-task-lib/task")); - var tool = __importStar2(require_tool()); - var qodana_12 = (init_qodana(), __toCommonJS(qodana_exports)); - var path2 = require("path"); - var node_stream_1 = require("node:stream"); - function setFailed(message) { - tl2.setResult(tl2.TaskResult.Failed, message); - } - function getInputs() { - const home = path2.join(process.env["AGENT_TEMPDIRECTORY"], "qodana"); - return { - args: (tl2.getInput("args", false) || "").split(",").map((arg) => arg.trim()), - resultsDir: tl2.getInput("resultsDir", false) || path2.join(home, "results"), - cacheDir: tl2.getInput("cacheDir", false) || path2.join(home, "cache"), - uploadResult: tl2.getBoolInput("uploadResult", false), - uploadSarif: tl2.getBoolInput("uploadSarif", false), - artifactName: tl2.getInput("artifactName", false) || "qodana-report", - useNightly: tl2.getBoolInput("useNightly", false), - prMode: tl2.getBoolInput("prMode", false), - // Not used by the Azure task - postComment: false, - additionalCacheKey: "", - primaryCacheKey: "", - useAnnotations: false, - useCaches: false, - cacheDefaultBranchOnly: false, - githubToken: "", - pushFixes: "none", - commitMessage: "" - }; - } - function qodana() { - return __awaiter2(this, arguments, void 0, function* (args = []) { - const env = Object.assign(Object.assign({}, process.env), { NONINTERACTIVE: "1" }); - if (args.length === 0) { - const inputs = getInputs(); - args = (0, qodana_12.getQodanaScanArgs)(inputs.args, inputs.resultsDir, inputs.cacheDir); - if (inputs.prMode && tl2.getVariable("Build.Reason") === "PullRequest") { - const sha = yield getPrSha(); - if (sha !== "") { - args.push("--commit", sha); - const sourceBranch = process.env.QODANA_BRANCH || getSourceAndTargetBranches().sourceBranch; - if (sourceBranch) { - env.QODANA_BRANCH = sourceBranch; - } - } - } + exports2.TypeInfo = exports2.SourceControlTypes = exports2.ProjectVisibility = exports2.ProjectChangeType = exports2.ProcessType = exports2.ProcessCustomizationType = exports2.ConnectedServiceKind = void 0; + var ConnectedServiceKind; + (function(ConnectedServiceKind2) { + ConnectedServiceKind2[ConnectedServiceKind2["Custom"] = 0] = "Custom"; + ConnectedServiceKind2[ConnectedServiceKind2["AzureSubscription"] = 1] = "AzureSubscription"; + ConnectedServiceKind2[ConnectedServiceKind2["Chef"] = 2] = "Chef"; + ConnectedServiceKind2[ConnectedServiceKind2["Generic"] = 3] = "Generic"; + })(ConnectedServiceKind = exports2.ConnectedServiceKind || (exports2.ConnectedServiceKind = {})); + var ProcessCustomizationType; + (function(ProcessCustomizationType2) { + ProcessCustomizationType2[ProcessCustomizationType2["Unknown"] = -1] = "Unknown"; + ProcessCustomizationType2[ProcessCustomizationType2["Xml"] = 0] = "Xml"; + ProcessCustomizationType2[ProcessCustomizationType2["Inherited"] = 1] = "Inherited"; + })(ProcessCustomizationType = exports2.ProcessCustomizationType || (exports2.ProcessCustomizationType = {})); + var ProcessType; + (function(ProcessType2) { + ProcessType2[ProcessType2["System"] = 0] = "System"; + ProcessType2[ProcessType2["Custom"] = 1] = "Custom"; + ProcessType2[ProcessType2["Inherited"] = 2] = "Inherited"; + })(ProcessType = exports2.ProcessType || (exports2.ProcessType = {})); + var ProjectChangeType; + (function(ProjectChangeType2) { + ProjectChangeType2[ProjectChangeType2["Modified"] = 0] = "Modified"; + ProjectChangeType2[ProjectChangeType2["Deleted"] = 1] = "Deleted"; + ProjectChangeType2[ProjectChangeType2["Added"] = 2] = "Added"; + })(ProjectChangeType = exports2.ProjectChangeType || (exports2.ProjectChangeType = {})); + var ProjectVisibility; + (function(ProjectVisibility2) { + ProjectVisibility2[ProjectVisibility2["Unchanged"] = -1] = "Unchanged"; + ProjectVisibility2[ProjectVisibility2["Private"] = 0] = "Private"; + ProjectVisibility2[ProjectVisibility2["Organization"] = 1] = "Organization"; + ProjectVisibility2[ProjectVisibility2["Public"] = 2] = "Public"; + ProjectVisibility2[ProjectVisibility2["SystemPrivate"] = 3] = "SystemPrivate"; + })(ProjectVisibility = exports2.ProjectVisibility || (exports2.ProjectVisibility = {})); + var SourceControlTypes; + (function(SourceControlTypes2) { + SourceControlTypes2[SourceControlTypes2["Tfvc"] = 1] = "Tfvc"; + SourceControlTypes2[SourceControlTypes2["Git"] = 2] = "Git"; + })(SourceControlTypes = exports2.SourceControlTypes || (exports2.SourceControlTypes = {})); + exports2.TypeInfo = { + ConnectedServiceKind: { + enumValues: { + "custom": 0, + "azureSubscription": 1, + "chef": 2, + "generic": 3 } - return yield tl2.execAsync(qodana_12.EXECUTABLE, args, { - ignoreReturnCode: true, - env - }); - }); - } - function prepareAgent(args_1) { - return __awaiter2(this, arguments, void 0, function* (args, useNightly = false) { - const arch = (0, qodana_12.getProcessArchName)(); - const platform = (0, qodana_12.getProcessPlatformName)(); - const temp = yield tool.downloadTool((0, qodana_12.getQodanaUrl)(arch, platform, useNightly)); - if (!useNightly) { - const expectedChecksum = (0, qodana_12.getQodanaSha256)(arch, platform); - const actualChecksum = (0, qodana_12.sha256sum)(temp); - if (expectedChecksum !== actualChecksum) { - setFailed((0, qodana_12.getQodanaSha256MismatchMessage)(expectedChecksum, actualChecksum)); - } + }, + Process: {}, + ProcessCustomizationType: { + enumValues: { + "unknown": -1, + "xml": 0, + "inherited": 1 } - let extractRoot; - if (process.platform === "win32") { - extractRoot = yield tool.extractZip(temp); - } else { - extractRoot = yield tool.extractTar(temp); + }, + ProcessType: { + enumValues: { + "system": 0, + "custom": 1, + "inherited": 2 } - tool.prependPath(yield tool.cacheDir(extractRoot, qodana_12.EXECUTABLE, qodana_12.VERSION)); - if (!(0, qodana_12.isNativeMode)(args)) { - const pull = yield qodana((0, qodana_12.getQodanaPullArgs)(args)); - if (pull !== 0) { - setFailed("Unable to run 'qodana pull'"); - } + }, + ProjectChangeType: { + enumValues: { + "modified": 0, + "deleted": 1, + "added": 2 } - }); - } - function uploadArtifacts(resultsDir, artifactName, execute) { - return __awaiter2(this, void 0, void 0, function* () { - if (!execute) { - return; + }, + ProjectInfo: {}, + ProjectMessage: {}, + ProjectVisibility: { + enumValues: { + "private": 0, + "organization": 1, + "public": 2 } - try { - const workingDir = path2.dirname(resultsDir); - const archivePath = path2.join(workingDir, `${artifactName}.zip`); - yield (0, qodana_12.compressFolder)(resultsDir, archivePath); - tl2.uploadArtifact("Qodana", archivePath, artifactName); - } catch (error) { - tl2.warning(`Failed to upload report \u2013 ${error.message}`); + }, + SourceControlTypes: { + enumValues: { + "tfvc": 1, + "git": 2 } - }); - } - function uploadSarif(resultsDir, execute) { - if (!execute) { - return; + }, + TeamProject: {}, + TeamProjectCollection: {}, + TeamProjectReference: {}, + TemporaryDataCreatedDTO: {}, + WebApiConnectedService: {}, + WebApiConnectedServiceDetails: {}, + WebApiProject: {} + }; + exports2.TypeInfo.Process.fields = { + type: { + enumType: exports2.TypeInfo.ProcessType } - try { - const parentDir = path2.dirname(resultsDir); - const qodanaSarif = path2.join(parentDir, "qodana.sarif"); - tl2.cp(path2.join(resultsDir, "qodana.sarif.json"), qodanaSarif); - tl2.uploadArtifact("CodeAnalysisLogs", qodanaSarif, "CodeAnalysisLogs"); - } catch (error) { - tl2.warning(`Failed to upload SARIF \u2013 ${error.message}`); + }; + exports2.TypeInfo.ProjectInfo.fields = { + lastUpdateTime: { + isDate: true + }, + visibility: { + enumType: exports2.TypeInfo.ProjectVisibility } - } - function getSourceAndTargetBranches() { - var _a, _b; - const sourceBranch = (_a = tl2.getVariable("System.PullRequest.SourceBranch")) === null || _a === void 0 ? void 0 : _a.replace("refs/heads/", ""); - const targetBranch = (_b = tl2.getVariable("System.PullRequest.TargetBranch")) === null || _b === void 0 ? void 0 : _b.replace("refs/heads/", ""); - return { sourceBranch, targetBranch }; - } - function getPrSha() { - return __awaiter2(this, void 0, void 0, function* () { - if (process.env.QODANA_PR_SHA) { - return process.env.QODANA_PR_SHA; - } - const { sourceBranch, targetBranch } = getSourceAndTargetBranches(); - if (sourceBranch && targetBranch) { - yield git(["fetch", "origin"]); - const output = yield gitOutput(["merge-base", "origin/" + sourceBranch, "origin/" + targetBranch], { - ignoreReturnCode: true - }); - if (output.exitCode === 0) { - const lines = output.stdout.trim().split("\n"); - if (lines.length > 1) { - return lines[1].trim(); - } - } - } - return ""; - }); - } - function git(args_1) { - return __awaiter2(this, arguments, void 0, function* (args, options = {}) { - return (yield gitOutput(args, options)).exitCode; - }); - } - function gitOutput(args_1) { - return __awaiter2(this, arguments, void 0, function* (args, options = {}) { - const result = { - exitCode: 0, - stdout: "", - stderr: "" - }; - const outStream = new node_stream_1.Writable({ - write(chunk, _, callback) { - result.stdout += chunk.toString("utf8"); - callback(); - } - }); - const errStream = new node_stream_1.Writable({ - write(chunk, _, callback) { - result.stderr += chunk.toString("utf8"); - callback(); - } - }); - options.outStream = outStream; - options.errStream = errStream; - result.exitCode = yield tl2.execAsync("git", args, options); - return result; - }); - } + }; + exports2.TypeInfo.ProjectMessage.fields = { + project: { + typeInfo: exports2.TypeInfo.ProjectInfo + }, + projectChangeType: { + enumType: exports2.TypeInfo.ProjectChangeType + } + }; + exports2.TypeInfo.TeamProject.fields = { + lastUpdateTime: { + isDate: true + }, + visibility: { + enumType: exports2.TypeInfo.ProjectVisibility + } + }; + exports2.TypeInfo.TeamProjectCollection.fields = { + processCustomizationType: { + enumType: exports2.TypeInfo.ProcessCustomizationType + } + }; + exports2.TypeInfo.TeamProjectReference.fields = { + lastUpdateTime: { + isDate: true + }, + visibility: { + enumType: exports2.TypeInfo.ProjectVisibility + } + }; + exports2.TypeInfo.TemporaryDataCreatedDTO.fields = { + expirationDate: { + isDate: true + } + }; + exports2.TypeInfo.WebApiConnectedService.fields = { + project: { + typeInfo: exports2.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.WebApiConnectedServiceDetails.fields = { + connectedServiceMetaData: { + typeInfo: exports2.TypeInfo.WebApiConnectedService + } + }; + exports2.TypeInfo.WebApiProject.fields = { + lastUpdateTime: { + isDate: true + }, + visibility: { + enumType: exports2.TypeInfo.ProjectVisibility + } + }; } }); -// lib/main.js -var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { - return m[k]; - } }; - } - Object.defineProperty(o, k2, desc); -} : function(o, m, k, k2) { - if (k2 === void 0) k2 = k; - o[k2] = m[k]; -}); -var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { +// ../node_modules/azure-devops-node-api/interfaces/GitInterfaces.js +var require_GitInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/GitInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.VersionControlRecursionType = exports2.VersionControlChangeType = exports2.TfvcVersionType = exports2.TfvcVersionOption = exports2.SupportedIdeType = exports2.RefFavoriteType = exports2.PullRequestTimeRangeType = exports2.PullRequestStatus = exports2.PullRequestMergeFailureType = exports2.PullRequestAsyncStatus = exports2.LineDiffBlockChangeType = exports2.IterationReason = exports2.ItemContentType = exports2.GitVersionType = exports2.GitVersionOptions = exports2.GitStatusState = exports2.GitResolutionWhichAction = exports2.GitResolutionStatus = exports2.GitResolutionRename1to2Action = exports2.GitResolutionPathConflictAction = exports2.GitResolutionMergeType = exports2.GitResolutionError = exports2.GitRefUpdateStatus = exports2.GitRefUpdateMode = exports2.GitRefSearchType = exports2.GitPullRequestReviewFileType = exports2.GitPullRequestQueryType = exports2.GitPullRequestMergeStrategy = exports2.GitPathActions = exports2.GitObjectType = exports2.GitHistoryMode = exports2.GitConflictUpdateStatus = exports2.GitConflictType = exports2.GitAsyncRefOperationFailureStatus = exports2.GitAsyncOperationStatus = exports2.CommentType = exports2.CommentThreadStatus = void 0; + var PolicyInterfaces = require_PolicyInterfaces(); + var TfsCoreInterfaces = require_CoreInterfaces(); + var CommentThreadStatus; + (function(CommentThreadStatus2) { + CommentThreadStatus2[CommentThreadStatus2["Unknown"] = 0] = "Unknown"; + CommentThreadStatus2[CommentThreadStatus2["Active"] = 1] = "Active"; + CommentThreadStatus2[CommentThreadStatus2["Fixed"] = 2] = "Fixed"; + CommentThreadStatus2[CommentThreadStatus2["WontFix"] = 3] = "WontFix"; + CommentThreadStatus2[CommentThreadStatus2["Closed"] = 4] = "Closed"; + CommentThreadStatus2[CommentThreadStatus2["ByDesign"] = 5] = "ByDesign"; + CommentThreadStatus2[CommentThreadStatus2["Pending"] = 6] = "Pending"; + })(CommentThreadStatus = exports2.CommentThreadStatus || (exports2.CommentThreadStatus = {})); + var CommentType; + (function(CommentType2) { + CommentType2[CommentType2["Unknown"] = 0] = "Unknown"; + CommentType2[CommentType2["Text"] = 1] = "Text"; + CommentType2[CommentType2["CodeChange"] = 2] = "CodeChange"; + CommentType2[CommentType2["System"] = 3] = "System"; + })(CommentType = exports2.CommentType || (exports2.CommentType = {})); + var GitAsyncOperationStatus; + (function(GitAsyncOperationStatus2) { + GitAsyncOperationStatus2[GitAsyncOperationStatus2["Queued"] = 1] = "Queued"; + GitAsyncOperationStatus2[GitAsyncOperationStatus2["InProgress"] = 2] = "InProgress"; + GitAsyncOperationStatus2[GitAsyncOperationStatus2["Completed"] = 3] = "Completed"; + GitAsyncOperationStatus2[GitAsyncOperationStatus2["Failed"] = 4] = "Failed"; + GitAsyncOperationStatus2[GitAsyncOperationStatus2["Abandoned"] = 5] = "Abandoned"; + })(GitAsyncOperationStatus = exports2.GitAsyncOperationStatus || (exports2.GitAsyncOperationStatus = {})); + var GitAsyncRefOperationFailureStatus; + (function(GitAsyncRefOperationFailureStatus2) { + GitAsyncRefOperationFailureStatus2[GitAsyncRefOperationFailureStatus2["None"] = 0] = "None"; + GitAsyncRefOperationFailureStatus2[GitAsyncRefOperationFailureStatus2["InvalidRefName"] = 1] = "InvalidRefName"; + GitAsyncRefOperationFailureStatus2[GitAsyncRefOperationFailureStatus2["RefNameConflict"] = 2] = "RefNameConflict"; + GitAsyncRefOperationFailureStatus2[GitAsyncRefOperationFailureStatus2["CreateBranchPermissionRequired"] = 3] = "CreateBranchPermissionRequired"; + GitAsyncRefOperationFailureStatus2[GitAsyncRefOperationFailureStatus2["WritePermissionRequired"] = 4] = "WritePermissionRequired"; + GitAsyncRefOperationFailureStatus2[GitAsyncRefOperationFailureStatus2["TargetBranchDeleted"] = 5] = "TargetBranchDeleted"; + GitAsyncRefOperationFailureStatus2[GitAsyncRefOperationFailureStatus2["GitObjectTooLarge"] = 6] = "GitObjectTooLarge"; + GitAsyncRefOperationFailureStatus2[GitAsyncRefOperationFailureStatus2["OperationIndentityNotFound"] = 7] = "OperationIndentityNotFound"; + GitAsyncRefOperationFailureStatus2[GitAsyncRefOperationFailureStatus2["AsyncOperationNotFound"] = 8] = "AsyncOperationNotFound"; + GitAsyncRefOperationFailureStatus2[GitAsyncRefOperationFailureStatus2["Other"] = 9] = "Other"; + GitAsyncRefOperationFailureStatus2[GitAsyncRefOperationFailureStatus2["EmptyCommitterSignature"] = 10] = "EmptyCommitterSignature"; + })(GitAsyncRefOperationFailureStatus = exports2.GitAsyncRefOperationFailureStatus || (exports2.GitAsyncRefOperationFailureStatus = {})); + var GitConflictType; + (function(GitConflictType2) { + GitConflictType2[GitConflictType2["None"] = 0] = "None"; + GitConflictType2[GitConflictType2["AddAdd"] = 1] = "AddAdd"; + GitConflictType2[GitConflictType2["AddRename"] = 2] = "AddRename"; + GitConflictType2[GitConflictType2["DeleteEdit"] = 3] = "DeleteEdit"; + GitConflictType2[GitConflictType2["DeleteRename"] = 4] = "DeleteRename"; + GitConflictType2[GitConflictType2["DirectoryFile"] = 5] = "DirectoryFile"; + GitConflictType2[GitConflictType2["DirectoryChild"] = 6] = "DirectoryChild"; + GitConflictType2[GitConflictType2["EditDelete"] = 7] = "EditDelete"; + GitConflictType2[GitConflictType2["EditEdit"] = 8] = "EditEdit"; + GitConflictType2[GitConflictType2["FileDirectory"] = 9] = "FileDirectory"; + GitConflictType2[GitConflictType2["Rename1to2"] = 10] = "Rename1to2"; + GitConflictType2[GitConflictType2["Rename2to1"] = 11] = "Rename2to1"; + GitConflictType2[GitConflictType2["RenameAdd"] = 12] = "RenameAdd"; + GitConflictType2[GitConflictType2["RenameDelete"] = 13] = "RenameDelete"; + GitConflictType2[GitConflictType2["RenameRename"] = 14] = "RenameRename"; + })(GitConflictType = exports2.GitConflictType || (exports2.GitConflictType = {})); + var GitConflictUpdateStatus; + (function(GitConflictUpdateStatus2) { + GitConflictUpdateStatus2[GitConflictUpdateStatus2["Succeeded"] = 0] = "Succeeded"; + GitConflictUpdateStatus2[GitConflictUpdateStatus2["BadRequest"] = 1] = "BadRequest"; + GitConflictUpdateStatus2[GitConflictUpdateStatus2["InvalidResolution"] = 2] = "InvalidResolution"; + GitConflictUpdateStatus2[GitConflictUpdateStatus2["UnsupportedConflictType"] = 3] = "UnsupportedConflictType"; + GitConflictUpdateStatus2[GitConflictUpdateStatus2["NotFound"] = 4] = "NotFound"; + })(GitConflictUpdateStatus = exports2.GitConflictUpdateStatus || (exports2.GitConflictUpdateStatus = {})); + var GitHistoryMode; + (function(GitHistoryMode2) { + GitHistoryMode2[GitHistoryMode2["SimplifiedHistory"] = 0] = "SimplifiedHistory"; + GitHistoryMode2[GitHistoryMode2["FirstParent"] = 1] = "FirstParent"; + GitHistoryMode2[GitHistoryMode2["FullHistory"] = 2] = "FullHistory"; + GitHistoryMode2[GitHistoryMode2["FullHistorySimplifyMerges"] = 3] = "FullHistorySimplifyMerges"; + })(GitHistoryMode = exports2.GitHistoryMode || (exports2.GitHistoryMode = {})); + var GitObjectType; + (function(GitObjectType2) { + GitObjectType2[GitObjectType2["Bad"] = 0] = "Bad"; + GitObjectType2[GitObjectType2["Commit"] = 1] = "Commit"; + GitObjectType2[GitObjectType2["Tree"] = 2] = "Tree"; + GitObjectType2[GitObjectType2["Blob"] = 3] = "Blob"; + GitObjectType2[GitObjectType2["Tag"] = 4] = "Tag"; + GitObjectType2[GitObjectType2["Ext2"] = 5] = "Ext2"; + GitObjectType2[GitObjectType2["OfsDelta"] = 6] = "OfsDelta"; + GitObjectType2[GitObjectType2["RefDelta"] = 7] = "RefDelta"; + })(GitObjectType = exports2.GitObjectType || (exports2.GitObjectType = {})); + var GitPathActions; + (function(GitPathActions2) { + GitPathActions2[GitPathActions2["None"] = 0] = "None"; + GitPathActions2[GitPathActions2["Edit"] = 1] = "Edit"; + GitPathActions2[GitPathActions2["Delete"] = 2] = "Delete"; + GitPathActions2[GitPathActions2["Add"] = 3] = "Add"; + GitPathActions2[GitPathActions2["Rename"] = 4] = "Rename"; + })(GitPathActions = exports2.GitPathActions || (exports2.GitPathActions = {})); + var GitPullRequestMergeStrategy; + (function(GitPullRequestMergeStrategy2) { + GitPullRequestMergeStrategy2[GitPullRequestMergeStrategy2["NoFastForward"] = 1] = "NoFastForward"; + GitPullRequestMergeStrategy2[GitPullRequestMergeStrategy2["Squash"] = 2] = "Squash"; + GitPullRequestMergeStrategy2[GitPullRequestMergeStrategy2["Rebase"] = 3] = "Rebase"; + GitPullRequestMergeStrategy2[GitPullRequestMergeStrategy2["RebaseMerge"] = 4] = "RebaseMerge"; + })(GitPullRequestMergeStrategy = exports2.GitPullRequestMergeStrategy || (exports2.GitPullRequestMergeStrategy = {})); + var GitPullRequestQueryType; + (function(GitPullRequestQueryType2) { + GitPullRequestQueryType2[GitPullRequestQueryType2["NotSet"] = 0] = "NotSet"; + GitPullRequestQueryType2[GitPullRequestQueryType2["LastMergeCommit"] = 1] = "LastMergeCommit"; + GitPullRequestQueryType2[GitPullRequestQueryType2["Commit"] = 2] = "Commit"; + })(GitPullRequestQueryType = exports2.GitPullRequestQueryType || (exports2.GitPullRequestQueryType = {})); + var GitPullRequestReviewFileType; + (function(GitPullRequestReviewFileType2) { + GitPullRequestReviewFileType2[GitPullRequestReviewFileType2["ChangeEntry"] = 0] = "ChangeEntry"; + GitPullRequestReviewFileType2[GitPullRequestReviewFileType2["Attachment"] = 1] = "Attachment"; + })(GitPullRequestReviewFileType = exports2.GitPullRequestReviewFileType || (exports2.GitPullRequestReviewFileType = {})); + var GitRefSearchType; + (function(GitRefSearchType2) { + GitRefSearchType2[GitRefSearchType2["Exact"] = 0] = "Exact"; + GitRefSearchType2[GitRefSearchType2["StartsWith"] = 1] = "StartsWith"; + GitRefSearchType2[GitRefSearchType2["Contains"] = 2] = "Contains"; + })(GitRefSearchType = exports2.GitRefSearchType || (exports2.GitRefSearchType = {})); + var GitRefUpdateMode; + (function(GitRefUpdateMode2) { + GitRefUpdateMode2[GitRefUpdateMode2["BestEffort"] = 0] = "BestEffort"; + GitRefUpdateMode2[GitRefUpdateMode2["AllOrNone"] = 1] = "AllOrNone"; + })(GitRefUpdateMode = exports2.GitRefUpdateMode || (exports2.GitRefUpdateMode = {})); + var GitRefUpdateStatus; + (function(GitRefUpdateStatus2) { + GitRefUpdateStatus2[GitRefUpdateStatus2["Succeeded"] = 0] = "Succeeded"; + GitRefUpdateStatus2[GitRefUpdateStatus2["ForcePushRequired"] = 1] = "ForcePushRequired"; + GitRefUpdateStatus2[GitRefUpdateStatus2["StaleOldObjectId"] = 2] = "StaleOldObjectId"; + GitRefUpdateStatus2[GitRefUpdateStatus2["InvalidRefName"] = 3] = "InvalidRefName"; + GitRefUpdateStatus2[GitRefUpdateStatus2["Unprocessed"] = 4] = "Unprocessed"; + GitRefUpdateStatus2[GitRefUpdateStatus2["UnresolvableToCommit"] = 5] = "UnresolvableToCommit"; + GitRefUpdateStatus2[GitRefUpdateStatus2["WritePermissionRequired"] = 6] = "WritePermissionRequired"; + GitRefUpdateStatus2[GitRefUpdateStatus2["ManageNotePermissionRequired"] = 7] = "ManageNotePermissionRequired"; + GitRefUpdateStatus2[GitRefUpdateStatus2["CreateBranchPermissionRequired"] = 8] = "CreateBranchPermissionRequired"; + GitRefUpdateStatus2[GitRefUpdateStatus2["CreateTagPermissionRequired"] = 9] = "CreateTagPermissionRequired"; + GitRefUpdateStatus2[GitRefUpdateStatus2["RejectedByPlugin"] = 10] = "RejectedByPlugin"; + GitRefUpdateStatus2[GitRefUpdateStatus2["Locked"] = 11] = "Locked"; + GitRefUpdateStatus2[GitRefUpdateStatus2["RefNameConflict"] = 12] = "RefNameConflict"; + GitRefUpdateStatus2[GitRefUpdateStatus2["RejectedByPolicy"] = 13] = "RejectedByPolicy"; + GitRefUpdateStatus2[GitRefUpdateStatus2["SucceededNonExistentRef"] = 14] = "SucceededNonExistentRef"; + GitRefUpdateStatus2[GitRefUpdateStatus2["SucceededCorruptRef"] = 15] = "SucceededCorruptRef"; + })(GitRefUpdateStatus = exports2.GitRefUpdateStatus || (exports2.GitRefUpdateStatus = {})); + var GitResolutionError; + (function(GitResolutionError2) { + GitResolutionError2[GitResolutionError2["None"] = 0] = "None"; + GitResolutionError2[GitResolutionError2["MergeContentNotFound"] = 1] = "MergeContentNotFound"; + GitResolutionError2[GitResolutionError2["PathInUse"] = 2] = "PathInUse"; + GitResolutionError2[GitResolutionError2["InvalidPath"] = 3] = "InvalidPath"; + GitResolutionError2[GitResolutionError2["UnknownAction"] = 4] = "UnknownAction"; + GitResolutionError2[GitResolutionError2["UnknownMergeType"] = 5] = "UnknownMergeType"; + GitResolutionError2[GitResolutionError2["OtherError"] = 255] = "OtherError"; + })(GitResolutionError = exports2.GitResolutionError || (exports2.GitResolutionError = {})); + var GitResolutionMergeType; + (function(GitResolutionMergeType2) { + GitResolutionMergeType2[GitResolutionMergeType2["Undecided"] = 0] = "Undecided"; + GitResolutionMergeType2[GitResolutionMergeType2["TakeSourceContent"] = 1] = "TakeSourceContent"; + GitResolutionMergeType2[GitResolutionMergeType2["TakeTargetContent"] = 2] = "TakeTargetContent"; + GitResolutionMergeType2[GitResolutionMergeType2["AutoMerged"] = 3] = "AutoMerged"; + GitResolutionMergeType2[GitResolutionMergeType2["UserMerged"] = 4] = "UserMerged"; + })(GitResolutionMergeType = exports2.GitResolutionMergeType || (exports2.GitResolutionMergeType = {})); + var GitResolutionPathConflictAction; + (function(GitResolutionPathConflictAction2) { + GitResolutionPathConflictAction2[GitResolutionPathConflictAction2["Undecided"] = 0] = "Undecided"; + GitResolutionPathConflictAction2[GitResolutionPathConflictAction2["KeepSourceRenameTarget"] = 1] = "KeepSourceRenameTarget"; + GitResolutionPathConflictAction2[GitResolutionPathConflictAction2["KeepSourceDeleteTarget"] = 2] = "KeepSourceDeleteTarget"; + GitResolutionPathConflictAction2[GitResolutionPathConflictAction2["KeepTargetRenameSource"] = 3] = "KeepTargetRenameSource"; + GitResolutionPathConflictAction2[GitResolutionPathConflictAction2["KeepTargetDeleteSource"] = 4] = "KeepTargetDeleteSource"; + })(GitResolutionPathConflictAction = exports2.GitResolutionPathConflictAction || (exports2.GitResolutionPathConflictAction = {})); + var GitResolutionRename1to2Action; + (function(GitResolutionRename1to2Action2) { + GitResolutionRename1to2Action2[GitResolutionRename1to2Action2["Undecided"] = 0] = "Undecided"; + GitResolutionRename1to2Action2[GitResolutionRename1to2Action2["KeepSourcePath"] = 1] = "KeepSourcePath"; + GitResolutionRename1to2Action2[GitResolutionRename1to2Action2["KeepTargetPath"] = 2] = "KeepTargetPath"; + GitResolutionRename1to2Action2[GitResolutionRename1to2Action2["KeepBothFiles"] = 3] = "KeepBothFiles"; + })(GitResolutionRename1to2Action = exports2.GitResolutionRename1to2Action || (exports2.GitResolutionRename1to2Action = {})); + var GitResolutionStatus; + (function(GitResolutionStatus2) { + GitResolutionStatus2[GitResolutionStatus2["Unresolved"] = 0] = "Unresolved"; + GitResolutionStatus2[GitResolutionStatus2["PartiallyResolved"] = 1] = "PartiallyResolved"; + GitResolutionStatus2[GitResolutionStatus2["Resolved"] = 2] = "Resolved"; + })(GitResolutionStatus = exports2.GitResolutionStatus || (exports2.GitResolutionStatus = {})); + var GitResolutionWhichAction; + (function(GitResolutionWhichAction2) { + GitResolutionWhichAction2[GitResolutionWhichAction2["Undecided"] = 0] = "Undecided"; + GitResolutionWhichAction2[GitResolutionWhichAction2["PickSourceAction"] = 1] = "PickSourceAction"; + GitResolutionWhichAction2[GitResolutionWhichAction2["PickTargetAction"] = 2] = "PickTargetAction"; + })(GitResolutionWhichAction = exports2.GitResolutionWhichAction || (exports2.GitResolutionWhichAction = {})); + var GitStatusState; + (function(GitStatusState2) { + GitStatusState2[GitStatusState2["NotSet"] = 0] = "NotSet"; + GitStatusState2[GitStatusState2["Pending"] = 1] = "Pending"; + GitStatusState2[GitStatusState2["Succeeded"] = 2] = "Succeeded"; + GitStatusState2[GitStatusState2["Failed"] = 3] = "Failed"; + GitStatusState2[GitStatusState2["Error"] = 4] = "Error"; + GitStatusState2[GitStatusState2["NotApplicable"] = 5] = "NotApplicable"; + GitStatusState2[GitStatusState2["PartiallySucceeded"] = 6] = "PartiallySucceeded"; + })(GitStatusState = exports2.GitStatusState || (exports2.GitStatusState = {})); + var GitVersionOptions; + (function(GitVersionOptions2) { + GitVersionOptions2[GitVersionOptions2["None"] = 0] = "None"; + GitVersionOptions2[GitVersionOptions2["PreviousChange"] = 1] = "PreviousChange"; + GitVersionOptions2[GitVersionOptions2["FirstParent"] = 2] = "FirstParent"; + })(GitVersionOptions = exports2.GitVersionOptions || (exports2.GitVersionOptions = {})); + var GitVersionType; + (function(GitVersionType2) { + GitVersionType2[GitVersionType2["Branch"] = 0] = "Branch"; + GitVersionType2[GitVersionType2["Tag"] = 1] = "Tag"; + GitVersionType2[GitVersionType2["Commit"] = 2] = "Commit"; + })(GitVersionType = exports2.GitVersionType || (exports2.GitVersionType = {})); + var ItemContentType; + (function(ItemContentType2) { + ItemContentType2[ItemContentType2["RawText"] = 0] = "RawText"; + ItemContentType2[ItemContentType2["Base64Encoded"] = 1] = "Base64Encoded"; + })(ItemContentType = exports2.ItemContentType || (exports2.ItemContentType = {})); + var IterationReason; + (function(IterationReason2) { + IterationReason2[IterationReason2["Push"] = 0] = "Push"; + IterationReason2[IterationReason2["ForcePush"] = 1] = "ForcePush"; + IterationReason2[IterationReason2["Create"] = 2] = "Create"; + IterationReason2[IterationReason2["Rebase"] = 4] = "Rebase"; + IterationReason2[IterationReason2["Unknown"] = 8] = "Unknown"; + IterationReason2[IterationReason2["Retarget"] = 16] = "Retarget"; + IterationReason2[IterationReason2["ResolveConflicts"] = 32] = "ResolveConflicts"; + })(IterationReason = exports2.IterationReason || (exports2.IterationReason = {})); + var LineDiffBlockChangeType; + (function(LineDiffBlockChangeType2) { + LineDiffBlockChangeType2[LineDiffBlockChangeType2["None"] = 0] = "None"; + LineDiffBlockChangeType2[LineDiffBlockChangeType2["Add"] = 1] = "Add"; + LineDiffBlockChangeType2[LineDiffBlockChangeType2["Delete"] = 2] = "Delete"; + LineDiffBlockChangeType2[LineDiffBlockChangeType2["Edit"] = 3] = "Edit"; + })(LineDiffBlockChangeType = exports2.LineDiffBlockChangeType || (exports2.LineDiffBlockChangeType = {})); + var PullRequestAsyncStatus; + (function(PullRequestAsyncStatus2) { + PullRequestAsyncStatus2[PullRequestAsyncStatus2["NotSet"] = 0] = "NotSet"; + PullRequestAsyncStatus2[PullRequestAsyncStatus2["Queued"] = 1] = "Queued"; + PullRequestAsyncStatus2[PullRequestAsyncStatus2["Conflicts"] = 2] = "Conflicts"; + PullRequestAsyncStatus2[PullRequestAsyncStatus2["Succeeded"] = 3] = "Succeeded"; + PullRequestAsyncStatus2[PullRequestAsyncStatus2["RejectedByPolicy"] = 4] = "RejectedByPolicy"; + PullRequestAsyncStatus2[PullRequestAsyncStatus2["Failure"] = 5] = "Failure"; + })(PullRequestAsyncStatus = exports2.PullRequestAsyncStatus || (exports2.PullRequestAsyncStatus = {})); + var PullRequestMergeFailureType; + (function(PullRequestMergeFailureType2) { + PullRequestMergeFailureType2[PullRequestMergeFailureType2["None"] = 0] = "None"; + PullRequestMergeFailureType2[PullRequestMergeFailureType2["Unknown"] = 1] = "Unknown"; + PullRequestMergeFailureType2[PullRequestMergeFailureType2["CaseSensitive"] = 2] = "CaseSensitive"; + PullRequestMergeFailureType2[PullRequestMergeFailureType2["ObjectTooLarge"] = 3] = "ObjectTooLarge"; + })(PullRequestMergeFailureType = exports2.PullRequestMergeFailureType || (exports2.PullRequestMergeFailureType = {})); + var PullRequestStatus; + (function(PullRequestStatus2) { + PullRequestStatus2[PullRequestStatus2["NotSet"] = 0] = "NotSet"; + PullRequestStatus2[PullRequestStatus2["Active"] = 1] = "Active"; + PullRequestStatus2[PullRequestStatus2["Abandoned"] = 2] = "Abandoned"; + PullRequestStatus2[PullRequestStatus2["Completed"] = 3] = "Completed"; + PullRequestStatus2[PullRequestStatus2["All"] = 4] = "All"; + })(PullRequestStatus = exports2.PullRequestStatus || (exports2.PullRequestStatus = {})); + var PullRequestTimeRangeType; + (function(PullRequestTimeRangeType2) { + PullRequestTimeRangeType2[PullRequestTimeRangeType2["Created"] = 1] = "Created"; + PullRequestTimeRangeType2[PullRequestTimeRangeType2["Closed"] = 2] = "Closed"; + })(PullRequestTimeRangeType = exports2.PullRequestTimeRangeType || (exports2.PullRequestTimeRangeType = {})); + var RefFavoriteType; + (function(RefFavoriteType2) { + RefFavoriteType2[RefFavoriteType2["Invalid"] = 0] = "Invalid"; + RefFavoriteType2[RefFavoriteType2["Folder"] = 1] = "Folder"; + RefFavoriteType2[RefFavoriteType2["Ref"] = 2] = "Ref"; + })(RefFavoriteType = exports2.RefFavoriteType || (exports2.RefFavoriteType = {})); + var SupportedIdeType; + (function(SupportedIdeType2) { + SupportedIdeType2[SupportedIdeType2["Unknown"] = 0] = "Unknown"; + SupportedIdeType2[SupportedIdeType2["AndroidStudio"] = 1] = "AndroidStudio"; + SupportedIdeType2[SupportedIdeType2["AppCode"] = 2] = "AppCode"; + SupportedIdeType2[SupportedIdeType2["CLion"] = 3] = "CLion"; + SupportedIdeType2[SupportedIdeType2["DataGrip"] = 4] = "DataGrip"; + SupportedIdeType2[SupportedIdeType2["Eclipse"] = 13] = "Eclipse"; + SupportedIdeType2[SupportedIdeType2["IntelliJ"] = 5] = "IntelliJ"; + SupportedIdeType2[SupportedIdeType2["MPS"] = 6] = "MPS"; + SupportedIdeType2[SupportedIdeType2["PhpStorm"] = 7] = "PhpStorm"; + SupportedIdeType2[SupportedIdeType2["PyCharm"] = 8] = "PyCharm"; + SupportedIdeType2[SupportedIdeType2["RubyMine"] = 9] = "RubyMine"; + SupportedIdeType2[SupportedIdeType2["Tower"] = 10] = "Tower"; + SupportedIdeType2[SupportedIdeType2["VisualStudio"] = 11] = "VisualStudio"; + SupportedIdeType2[SupportedIdeType2["VSCode"] = 14] = "VSCode"; + SupportedIdeType2[SupportedIdeType2["WebStorm"] = 12] = "WebStorm"; + })(SupportedIdeType = exports2.SupportedIdeType || (exports2.SupportedIdeType = {})); + var TfvcVersionOption; + (function(TfvcVersionOption2) { + TfvcVersionOption2[TfvcVersionOption2["None"] = 0] = "None"; + TfvcVersionOption2[TfvcVersionOption2["Previous"] = 1] = "Previous"; + TfvcVersionOption2[TfvcVersionOption2["UseRename"] = 2] = "UseRename"; + })(TfvcVersionOption = exports2.TfvcVersionOption || (exports2.TfvcVersionOption = {})); + var TfvcVersionType; + (function(TfvcVersionType2) { + TfvcVersionType2[TfvcVersionType2["None"] = 0] = "None"; + TfvcVersionType2[TfvcVersionType2["Changeset"] = 1] = "Changeset"; + TfvcVersionType2[TfvcVersionType2["Shelveset"] = 2] = "Shelveset"; + TfvcVersionType2[TfvcVersionType2["Change"] = 3] = "Change"; + TfvcVersionType2[TfvcVersionType2["Date"] = 4] = "Date"; + TfvcVersionType2[TfvcVersionType2["Latest"] = 5] = "Latest"; + TfvcVersionType2[TfvcVersionType2["Tip"] = 6] = "Tip"; + TfvcVersionType2[TfvcVersionType2["MergeSource"] = 7] = "MergeSource"; + })(TfvcVersionType = exports2.TfvcVersionType || (exports2.TfvcVersionType = {})); + var VersionControlChangeType; + (function(VersionControlChangeType2) { + VersionControlChangeType2[VersionControlChangeType2["None"] = 0] = "None"; + VersionControlChangeType2[VersionControlChangeType2["Add"] = 1] = "Add"; + VersionControlChangeType2[VersionControlChangeType2["Edit"] = 2] = "Edit"; + VersionControlChangeType2[VersionControlChangeType2["Encoding"] = 4] = "Encoding"; + VersionControlChangeType2[VersionControlChangeType2["Rename"] = 8] = "Rename"; + VersionControlChangeType2[VersionControlChangeType2["Delete"] = 16] = "Delete"; + VersionControlChangeType2[VersionControlChangeType2["Undelete"] = 32] = "Undelete"; + VersionControlChangeType2[VersionControlChangeType2["Branch"] = 64] = "Branch"; + VersionControlChangeType2[VersionControlChangeType2["Merge"] = 128] = "Merge"; + VersionControlChangeType2[VersionControlChangeType2["Lock"] = 256] = "Lock"; + VersionControlChangeType2[VersionControlChangeType2["Rollback"] = 512] = "Rollback"; + VersionControlChangeType2[VersionControlChangeType2["SourceRename"] = 1024] = "SourceRename"; + VersionControlChangeType2[VersionControlChangeType2["TargetRename"] = 2048] = "TargetRename"; + VersionControlChangeType2[VersionControlChangeType2["Property"] = 4096] = "Property"; + VersionControlChangeType2[VersionControlChangeType2["All"] = 8191] = "All"; + })(VersionControlChangeType = exports2.VersionControlChangeType || (exports2.VersionControlChangeType = {})); + var VersionControlRecursionType; + (function(VersionControlRecursionType2) { + VersionControlRecursionType2[VersionControlRecursionType2["None"] = 0] = "None"; + VersionControlRecursionType2[VersionControlRecursionType2["OneLevel"] = 1] = "OneLevel"; + VersionControlRecursionType2[VersionControlRecursionType2["OneLevelPlusNestedEmptyFolders"] = 4] = "OneLevelPlusNestedEmptyFolders"; + VersionControlRecursionType2[VersionControlRecursionType2["Full"] = 120] = "Full"; + })(VersionControlRecursionType = exports2.VersionControlRecursionType || (exports2.VersionControlRecursionType = {})); + exports2.TypeInfo = { + AdvSecEnablementStatus: {}, + Attachment: {}, + BillableCommitterDetail: {}, + Change: {}, + ChangeList: {}, + Comment: {}, + CommentThread: {}, + CommentThreadStatus: { + enumValues: { + "unknown": 0, + "active": 1, + "fixed": 2, + "wontFix": 3, + "closed": 4, + "byDesign": 5, + "pending": 6 + } + }, + CommentType: { + enumValues: { + "unknown": 0, + "text": 1, + "codeChange": 2, + "system": 3 + } + }, + FileDiff: {}, + GitAnnotatedTag: {}, + GitAsyncOperationStatus: { + enumValues: { + "queued": 1, + "inProgress": 2, + "completed": 3, + "failed": 4, + "abandoned": 5 + } + }, + GitAsyncRefOperation: {}, + GitAsyncRefOperationDetail: {}, + GitAsyncRefOperationFailureStatus: { + enumValues: { + "none": 0, + "invalidRefName": 1, + "refNameConflict": 2, + "createBranchPermissionRequired": 3, + "writePermissionRequired": 4, + "targetBranchDeleted": 5, + "gitObjectTooLarge": 6, + "operationIndentityNotFound": 7, + "asyncOperationNotFound": 8, + "other": 9, + "emptyCommitterSignature": 10 + } + }, + GitAsyncRefOperationParameters: {}, + GitAsyncRefOperationSource: {}, + GitBaseVersionDescriptor: {}, + GitBranchStats: {}, + GitChange: {}, + GitCherryPick: {}, + GitCommit: {}, + GitCommitChanges: {}, + GitCommitDiffs: {}, + GitCommitRef: {}, + GitCommitToCreate: {}, + GitConflict: {}, + GitConflictAddAdd: {}, + GitConflictAddRename: {}, + GitConflictDeleteEdit: {}, + GitConflictDeleteRename: {}, + GitConflictDirectoryFile: {}, + GitConflictEditDelete: {}, + GitConflictEditEdit: {}, + GitConflictFileDirectory: {}, + GitConflictRename1to2: {}, + GitConflictRename2to1: {}, + GitConflictRenameAdd: {}, + GitConflictRenameDelete: {}, + GitConflictRenameRename: {}, + GitConflictType: { + enumValues: { + "none": 0, + "addAdd": 1, + "addRename": 2, + "deleteEdit": 3, + "deleteRename": 4, + "directoryFile": 5, + "directoryChild": 6, + "editDelete": 7, + "editEdit": 8, + "fileDirectory": 9, + "rename1to2": 10, + "rename2to1": 11, + "renameAdd": 12, + "renameDelete": 13, + "renameRename": 14 + } + }, + GitConflictUpdateResult: {}, + GitConflictUpdateStatus: { + enumValues: { + "succeeded": 0, + "badRequest": 1, + "invalidResolution": 2, + "unsupportedConflictType": 3, + "notFound": 4 + } + }, + GitDeletedRepository: {}, + GitForkRef: {}, + GitForkSyncRequest: {}, + GitForkTeamProjectReference: {}, + GitHistoryMode: { + enumValues: { + "simplifiedHistory": 0, + "firstParent": 1, + "fullHistory": 2, + "fullHistorySimplifyMerges": 3 + } + }, + GitImportFailedEvent: {}, + GitImportRequest: {}, + GitImportSucceededEvent: {}, + GitItem: {}, + GitItemDescriptor: {}, + GitItemRequestData: {}, + GitLastChangeTreeItems: {}, + GitMerge: {}, + GitObject: {}, + GitObjectType: { + enumValues: { + "bad": 0, + "commit": 1, + "tree": 2, + "blob": 3, + "tag": 4, + "ext2": 5, + "ofsDelta": 6, + "refDelta": 7 + } + }, + GitPathAction: {}, + GitPathActions: { + enumValues: { + "none": 0, + "edit": 1, + "delete": 2, + "add": 3, + "rename": 4 + } + }, + GitPathToItemsCollection: {}, + GitPolicyConfigurationResponse: {}, + GitPullRequest: {}, + GitPullRequestChange: {}, + GitPullRequestCommentThread: {}, + GitPullRequestCompletionOptions: {}, + GitPullRequestIteration: {}, + GitPullRequestIterationChanges: {}, + GitPullRequestMergeStrategy: { + enumValues: { + "noFastForward": 1, + "squash": 2, + "rebase": 3, + "rebaseMerge": 4 + } + }, + GitPullRequestQuery: {}, + GitPullRequestQueryInput: {}, + GitPullRequestQueryType: { + enumValues: { + "notSet": 0, + "lastMergeCommit": 1, + "commit": 2 + } + }, + GitPullRequestReviewFileType: { + enumValues: { + "changeEntry": 0, + "attachment": 1 + } + }, + GitPullRequestSearchCriteria: {}, + GitPullRequestStatus: {}, + GitPush: {}, + GitPushEventData: {}, + GitPushRef: {}, + GitPushSearchCriteria: {}, + GitQueryBranchStatsCriteria: {}, + GitQueryCommitsCriteria: {}, + GitQueryRefsCriteria: {}, + GitRef: {}, + GitRefFavorite: {}, + GitRefSearchType: { + enumValues: { + "exact": 0, + "startsWith": 1, + "contains": 2 + } + }, + GitRefUpdateMode: { + enumValues: { + "bestEffort": 0, + "allOrNone": 1 + } + }, + GitRefUpdateResult: {}, + GitRefUpdateStatus: { + enumValues: { + "succeeded": 0, + "forcePushRequired": 1, + "staleOldObjectId": 2, + "invalidRefName": 3, + "unprocessed": 4, + "unresolvableToCommit": 5, + "writePermissionRequired": 6, + "manageNotePermissionRequired": 7, + "createBranchPermissionRequired": 8, + "createTagPermissionRequired": 9, + "rejectedByPlugin": 10, + "locked": 11, + "refNameConflict": 12, + "rejectedByPolicy": 13, + "succeededNonExistentRef": 14, + "succeededCorruptRef": 15 + } + }, + GitRepository: {}, + GitRepositoryCreateOptions: {}, + GitRepositoryRef: {}, + GitResolutionError: { + enumValues: { + "none": 0, + "mergeContentNotFound": 1, + "pathInUse": 2, + "invalidPath": 3, + "unknownAction": 4, + "unknownMergeType": 5, + "otherError": 255 + } + }, + GitResolutionMergeContent: {}, + GitResolutionMergeType: { + enumValues: { + "undecided": 0, + "takeSourceContent": 1, + "takeTargetContent": 2, + "autoMerged": 3, + "userMerged": 4 + } + }, + GitResolutionPathConflict: {}, + GitResolutionPathConflictAction: { + enumValues: { + "undecided": 0, + "keepSourceRenameTarget": 1, + "keepSourceDeleteTarget": 2, + "keepTargetRenameSource": 3, + "keepTargetDeleteSource": 4 + } + }, + GitResolutionPickOneAction: {}, + GitResolutionRename1to2: {}, + GitResolutionRename1to2Action: { + enumValues: { + "undecided": 0, + "keepSourcePath": 1, + "keepTargetPath": 2, + "keepBothFiles": 3 + } + }, + GitResolutionStatus: { + enumValues: { + "unresolved": 0, + "partiallyResolved": 1, + "resolved": 2 + } + }, + GitResolutionWhichAction: { + enumValues: { + "undecided": 0, + "pickSourceAction": 1, + "pickTargetAction": 2 + } + }, + GitRevert: {}, + GitStatus: {}, + GitStatusState: { + enumValues: { + "notSet": 0, + "pending": 1, + "succeeded": 2, + "failed": 3, + "error": 4, + "notApplicable": 5, + "partiallySucceeded": 6 + } + }, + GitTargetVersionDescriptor: {}, + GitTreeDiff: {}, + GitTreeDiffEntry: {}, + GitTreeDiffResponse: {}, + GitTreeEntryRef: {}, + GitTreeRef: {}, + GitUserDate: {}, + GitVersionDescriptor: {}, + GitVersionOptions: { + enumValues: { + "none": 0, + "previousChange": 1, + "firstParent": 2 + } + }, + GitVersionType: { + enumValues: { + "branch": 0, + "tag": 1, + "commit": 2 + } + }, + HistoryEntry: {}, + IncludedGitCommit: {}, + ItemContent: {}, + ItemContentType: { + enumValues: { + "rawText": 0, + "base64Encoded": 1 + } + }, + ItemDetailsOptions: {}, + IterationReason: { + enumValues: { + "push": 0, + "forcePush": 1, + "create": 2, + "rebase": 4, + "unknown": 8, + "retarget": 16, + "resolveConflicts": 32 + } + }, + LineDiffBlock: {}, + LineDiffBlockChangeType: { + enumValues: { + "none": 0, + "add": 1, + "delete": 2, + "edit": 3 + } + }, + PullRequestAsyncStatus: { + enumValues: { + "notSet": 0, + "queued": 1, + "conflicts": 2, + "succeeded": 3, + "rejectedByPolicy": 4, + "failure": 5 + } + }, + PullRequestMergeFailureType: { + enumValues: { + "none": 0, + "unknown": 1, + "caseSensitive": 2, + "objectTooLarge": 3 + } + }, + PullRequestStatus: { + enumValues: { + "notSet": 0, + "active": 1, + "abandoned": 2, + "completed": 3, + "all": 4 + } + }, + PullRequestTimeRangeType: { + enumValues: { + "created": 1, + "closed": 2 + } + }, + RefFavoriteType: { + enumValues: { + "invalid": 0, + "folder": 1, + "ref": 2 + } + }, + SupportedIde: {}, + SupportedIdeType: { + enumValues: { + "unknown": 0, + "androidStudio": 1, + "appCode": 2, + "cLion": 3, + "dataGrip": 4, + "eclipse": 13, + "intelliJ": 5, + "mps": 6, + "phpStorm": 7, + "pyCharm": 8, + "rubyMine": 9, + "tower": 10, + "visualStudio": 11, + "vsCode": 14, + "webStorm": 12 + } + }, + TfvcBranch: {}, + TfvcBranchRef: {}, + TfvcChange: {}, + TfvcChangeset: {}, + TfvcChangesetRef: {}, + TfvcCheckinEventData: {}, + TfvcHistoryEntry: {}, + TfvcItem: {}, + TfvcItemDescriptor: {}, + TfvcItemPreviousHash: {}, + TfvcItemRequestData: {}, + TfvcLabel: {}, + TfvcLabelRef: {}, + TfvcShelveset: {}, + TfvcShelvesetRef: {}, + TfvcVersionDescriptor: {}, + TfvcVersionOption: { + enumValues: { + "none": 0, + "previous": 1, + "useRename": 2 + } + }, + TfvcVersionType: { + enumValues: { + "none": 0, + "changeset": 1, + "shelveset": 2, + "change": 3, + "date": 4, + "latest": 5, + "tip": 6, + "mergeSource": 7 + } + }, + UpdateRefsRequest: {}, + VersionControlChangeType: { + enumValues: { + "none": 0, + "add": 1, + "edit": 2, + "encoding": 4, + "rename": 8, + "delete": 16, + "undelete": 32, + "branch": 64, + "merge": 128, + "lock": 256, + "rollback": 512, + "sourceRename": 1024, + "targetRename": 2048, + "property": 4096, + "all": 8191 + } + }, + VersionControlProjectInfo: {}, + VersionControlRecursionType: { + enumValues: { + "none": 0, + "oneLevel": 1, + "oneLevelPlusNestedEmptyFolders": 4, + "full": 120 + } + } + }; + exports2.TypeInfo.AdvSecEnablementStatus.fields = { + changedOnDate: { + isDate: true + } + }; + exports2.TypeInfo.Attachment.fields = { + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.BillableCommitterDetail.fields = { + commitTime: { + isDate: true + }, + pushedTime: { + isDate: true + } + }; + exports2.TypeInfo.Change.fields = { + changeType: { + enumType: exports2.TypeInfo.VersionControlChangeType + }, + newContent: { + typeInfo: exports2.TypeInfo.ItemContent + } + }; + exports2.TypeInfo.ChangeList.fields = { + changeCounts: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.VersionControlChangeType + }, + creationDate: { + isDate: true + }, + sortDate: { + isDate: true + } + }; + exports2.TypeInfo.Comment.fields = { + commentType: { + enumType: exports2.TypeInfo.CommentType + }, + lastContentUpdatedDate: { + isDate: true + }, + lastUpdatedDate: { + isDate: true + }, + publishedDate: { + isDate: true + } + }; + exports2.TypeInfo.CommentThread.fields = { + comments: { + isArray: true, + typeInfo: exports2.TypeInfo.Comment + }, + lastUpdatedDate: { + isDate: true + }, + publishedDate: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.CommentThreadStatus + } + }; + exports2.TypeInfo.FileDiff.fields = { + lineDiffBlocks: { + isArray: true, + typeInfo: exports2.TypeInfo.LineDiffBlock + } + }; + exports2.TypeInfo.GitAnnotatedTag.fields = { + taggedBy: { + typeInfo: exports2.TypeInfo.GitUserDate + }, + taggedObject: { + typeInfo: exports2.TypeInfo.GitObject + } + }; + exports2.TypeInfo.GitAsyncRefOperation.fields = { + detailedStatus: { + typeInfo: exports2.TypeInfo.GitAsyncRefOperationDetail + }, + parameters: { + typeInfo: exports2.TypeInfo.GitAsyncRefOperationParameters + }, + status: { + enumType: exports2.TypeInfo.GitAsyncOperationStatus + } + }; + exports2.TypeInfo.GitAsyncRefOperationDetail.fields = { + status: { + enumType: exports2.TypeInfo.GitAsyncRefOperationFailureStatus + } + }; + exports2.TypeInfo.GitAsyncRefOperationParameters.fields = { + repository: { + typeInfo: exports2.TypeInfo.GitRepository + }, + source: { + typeInfo: exports2.TypeInfo.GitAsyncRefOperationSource + } + }; + exports2.TypeInfo.GitAsyncRefOperationSource.fields = { + commitList: { + isArray: true, + typeInfo: exports2.TypeInfo.GitCommitRef + } + }; + exports2.TypeInfo.GitBaseVersionDescriptor.fields = { + baseVersionOptions: { + enumType: exports2.TypeInfo.GitVersionOptions + }, + baseVersionType: { + enumType: exports2.TypeInfo.GitVersionType + }, + versionOptions: { + enumType: exports2.TypeInfo.GitVersionOptions + }, + versionType: { + enumType: exports2.TypeInfo.GitVersionType + } + }; + exports2.TypeInfo.GitBranchStats.fields = { + commit: { + typeInfo: exports2.TypeInfo.GitCommitRef + } + }; + exports2.TypeInfo.GitChange.fields = { + changeType: { + enumType: exports2.TypeInfo.VersionControlChangeType + }, + newContent: { + typeInfo: exports2.TypeInfo.ItemContent + } + }; + exports2.TypeInfo.GitCherryPick.fields = { + detailedStatus: { + typeInfo: exports2.TypeInfo.GitAsyncRefOperationDetail + }, + parameters: { + typeInfo: exports2.TypeInfo.GitAsyncRefOperationParameters + }, + status: { + enumType: exports2.TypeInfo.GitAsyncOperationStatus + } + }; + exports2.TypeInfo.GitCommit.fields = { + author: { + typeInfo: exports2.TypeInfo.GitUserDate + }, + changes: { + isArray: true, + typeInfo: exports2.TypeInfo.GitChange + }, + committer: { + typeInfo: exports2.TypeInfo.GitUserDate + }, + push: { + typeInfo: exports2.TypeInfo.GitPushRef + }, + statuses: { + isArray: true, + typeInfo: exports2.TypeInfo.GitStatus + } + }; + exports2.TypeInfo.GitCommitChanges.fields = { + changes: { + isArray: true, + typeInfo: exports2.TypeInfo.GitChange + } + }; + exports2.TypeInfo.GitCommitDiffs.fields = { + changeCounts: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.VersionControlChangeType + }, + changes: { + isArray: true, + typeInfo: exports2.TypeInfo.GitChange + } + }; + exports2.TypeInfo.GitCommitRef.fields = { + author: { + typeInfo: exports2.TypeInfo.GitUserDate + }, + changes: { + isArray: true, + typeInfo: exports2.TypeInfo.GitChange + }, + committer: { + typeInfo: exports2.TypeInfo.GitUserDate + }, + push: { + typeInfo: exports2.TypeInfo.GitPushRef + }, + statuses: { + isArray: true, + typeInfo: exports2.TypeInfo.GitStatus + } + }; + exports2.TypeInfo.GitCommitToCreate.fields = { + baseRef: { + typeInfo: exports2.TypeInfo.GitRef + }, + pathActions: { + isArray: true, + typeInfo: exports2.TypeInfo.GitPathAction + } + }; + exports2.TypeInfo.GitConflict.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitConflictAddAdd.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionMergeContent + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitConflictAddRename.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionPathConflict + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitConflictDeleteEdit.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionPickOneAction + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitConflictDeleteRename.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionPickOneAction + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitConflictDirectoryFile.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionPathConflict + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + }, + sourceTree: { + typeInfo: exports2.TypeInfo.GitTreeRef + } + }; + exports2.TypeInfo.GitConflictEditDelete.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionPickOneAction + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitConflictEditEdit.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionMergeContent + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitConflictFileDirectory.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionPathConflict + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + }, + targetTree: { + typeInfo: exports2.TypeInfo.GitTreeRef + } + }; + exports2.TypeInfo.GitConflictRename1to2.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionRename1to2 + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitConflictRename2to1.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionPathConflict + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitConflictRenameAdd.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionPathConflict + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitConflictRenameDelete.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionPickOneAction + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitConflictRenameRename.fields = { + conflictType: { + enumType: exports2.TypeInfo.GitConflictType + }, + mergeBaseCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + resolution: { + typeInfo: exports2.TypeInfo.GitResolutionMergeContent + }, + resolutionError: { + enumType: exports2.TypeInfo.GitResolutionError + }, + resolutionStatus: { + enumType: exports2.TypeInfo.GitResolutionStatus + }, + resolvedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitConflictUpdateResult.fields = { + updatedConflict: { + typeInfo: exports2.TypeInfo.GitConflict + }, + updateStatus: { + enumType: exports2.TypeInfo.GitConflictUpdateStatus + } + }; + exports2.TypeInfo.GitDeletedRepository.fields = { + createdDate: { + isDate: true + }, + deletedDate: { + isDate: true + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.GitForkRef.fields = { + repository: { + typeInfo: exports2.TypeInfo.GitRepository + }, + statuses: { + isArray: true, + typeInfo: exports2.TypeInfo.GitStatus + } + }; + exports2.TypeInfo.GitForkSyncRequest.fields = { + status: { + enumType: exports2.TypeInfo.GitAsyncOperationStatus + } + }; + exports2.TypeInfo.GitForkTeamProjectReference.fields = { + lastUpdateTime: { + isDate: true + }, + visibility: { + enumType: TfsCoreInterfaces.TypeInfo.ProjectVisibility + } + }; + exports2.TypeInfo.GitImportFailedEvent.fields = { + targetRepository: { + typeInfo: exports2.TypeInfo.GitRepository + } + }; + exports2.TypeInfo.GitImportRequest.fields = { + repository: { + typeInfo: exports2.TypeInfo.GitRepository + }, + status: { + enumType: exports2.TypeInfo.GitAsyncOperationStatus + } + }; + exports2.TypeInfo.GitImportSucceededEvent.fields = { + targetRepository: { + typeInfo: exports2.TypeInfo.GitRepository + } + }; + exports2.TypeInfo.GitItem.fields = { + gitObjectType: { + enumType: exports2.TypeInfo.GitObjectType + }, + latestProcessedChange: { + typeInfo: exports2.TypeInfo.GitCommitRef + } + }; + exports2.TypeInfo.GitItemDescriptor.fields = { + recursionLevel: { + enumType: exports2.TypeInfo.VersionControlRecursionType + }, + versionOptions: { + enumType: exports2.TypeInfo.GitVersionOptions + }, + versionType: { + enumType: exports2.TypeInfo.GitVersionType + } + }; + exports2.TypeInfo.GitItemRequestData.fields = { + itemDescriptors: { + isArray: true, + typeInfo: exports2.TypeInfo.GitItemDescriptor + } + }; + exports2.TypeInfo.GitLastChangeTreeItems.fields = { + commits: { + isArray: true, + typeInfo: exports2.TypeInfo.GitCommitRef + }, + lastExploredTime: { + isDate: true + } + }; + exports2.TypeInfo.GitMerge.fields = { + status: { + enumType: exports2.TypeInfo.GitAsyncOperationStatus + } + }; + exports2.TypeInfo.GitObject.fields = { + objectType: { + enumType: exports2.TypeInfo.GitObjectType + } + }; + exports2.TypeInfo.GitPathAction.fields = { + action: { + enumType: exports2.TypeInfo.GitPathActions + } + }; + exports2.TypeInfo.GitPathToItemsCollection.fields = { + items: { + isDictionary: true, + dictionaryValueFieldInfo: { + isArray: true, + typeInfo: exports2.TypeInfo.GitItem + } + } + }; + exports2.TypeInfo.GitPolicyConfigurationResponse.fields = { + policyConfigurations: { + isArray: true, + typeInfo: PolicyInterfaces.TypeInfo.PolicyConfiguration + } + }; + exports2.TypeInfo.GitPullRequest.fields = { + closedDate: { + isDate: true + }, + commits: { + isArray: true, + typeInfo: exports2.TypeInfo.GitCommitRef + }, + completionOptions: { + typeInfo: exports2.TypeInfo.GitPullRequestCompletionOptions + }, + completionQueueTime: { + isDate: true + }, + creationDate: { + isDate: true + }, + forkSource: { + typeInfo: exports2.TypeInfo.GitForkRef + }, + lastMergeCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + lastMergeSourceCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + lastMergeTargetCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + mergeFailureType: { + enumType: exports2.TypeInfo.PullRequestMergeFailureType + }, + mergeStatus: { + enumType: exports2.TypeInfo.PullRequestAsyncStatus + }, + repository: { + typeInfo: exports2.TypeInfo.GitRepository + }, + status: { + enumType: exports2.TypeInfo.PullRequestStatus + } + }; + exports2.TypeInfo.GitPullRequestChange.fields = { + changeType: { + enumType: exports2.TypeInfo.VersionControlChangeType + }, + newContent: { + typeInfo: exports2.TypeInfo.ItemContent + } + }; + exports2.TypeInfo.GitPullRequestCommentThread.fields = { + comments: { + isArray: true, + typeInfo: exports2.TypeInfo.Comment + }, + lastUpdatedDate: { + isDate: true + }, + publishedDate: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.CommentThreadStatus + } + }; + exports2.TypeInfo.GitPullRequestCompletionOptions.fields = { + mergeStrategy: { + enumType: exports2.TypeInfo.GitPullRequestMergeStrategy + } + }; + exports2.TypeInfo.GitPullRequestIteration.fields = { + changeList: { + isArray: true, + typeInfo: exports2.TypeInfo.GitPullRequestChange + }, + commits: { + isArray: true, + typeInfo: exports2.TypeInfo.GitCommitRef + }, + commonRefCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + createdDate: { + isDate: true + }, + push: { + typeInfo: exports2.TypeInfo.GitPushRef + }, + reason: { + enumType: exports2.TypeInfo.IterationReason + }, + sourceRefCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + targetRefCommit: { + typeInfo: exports2.TypeInfo.GitCommitRef + }, + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitPullRequestIterationChanges.fields = { + changeEntries: { + isArray: true, + typeInfo: exports2.TypeInfo.GitPullRequestChange + } + }; + exports2.TypeInfo.GitPullRequestQuery.fields = { + queries: { + isArray: true, + typeInfo: exports2.TypeInfo.GitPullRequestQueryInput + } + }; + exports2.TypeInfo.GitPullRequestQueryInput.fields = { + type: { + enumType: exports2.TypeInfo.GitPullRequestQueryType + } + }; + exports2.TypeInfo.GitPullRequestSearchCriteria.fields = { + maxTime: { + isDate: true + }, + minTime: { + isDate: true + }, + queryTimeRangeType: { + enumType: exports2.TypeInfo.PullRequestTimeRangeType + }, + status: { + enumType: exports2.TypeInfo.PullRequestStatus + } + }; + exports2.TypeInfo.GitPullRequestStatus.fields = { + creationDate: { + isDate: true + }, + state: { + enumType: exports2.TypeInfo.GitStatusState + }, + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitPush.fields = { + commits: { + isArray: true, + typeInfo: exports2.TypeInfo.GitCommitRef + }, + date: { + isDate: true + }, + repository: { + typeInfo: exports2.TypeInfo.GitRepository + } + }; + exports2.TypeInfo.GitPushEventData.fields = { + commits: { + isArray: true, + typeInfo: exports2.TypeInfo.GitCommit + }, + repository: { + typeInfo: exports2.TypeInfo.GitRepository + } + }; + exports2.TypeInfo.GitPushRef.fields = { + date: { + isDate: true + } + }; + exports2.TypeInfo.GitPushSearchCriteria.fields = { + fromDate: { + isDate: true + }, + toDate: { + isDate: true + } + }; + exports2.TypeInfo.GitQueryBranchStatsCriteria.fields = { + baseCommit: { + typeInfo: exports2.TypeInfo.GitVersionDescriptor + }, + targetCommits: { + isArray: true, + typeInfo: exports2.TypeInfo.GitVersionDescriptor + } + }; + exports2.TypeInfo.GitQueryCommitsCriteria.fields = { + compareVersion: { + typeInfo: exports2.TypeInfo.GitVersionDescriptor + }, + historyMode: { + enumType: exports2.TypeInfo.GitHistoryMode + }, + itemVersion: { + typeInfo: exports2.TypeInfo.GitVersionDescriptor + } + }; + exports2.TypeInfo.GitQueryRefsCriteria.fields = { + searchType: { + enumType: exports2.TypeInfo.GitRefSearchType + } + }; + exports2.TypeInfo.GitRef.fields = { + statuses: { + isArray: true, + typeInfo: exports2.TypeInfo.GitStatus + } + }; + exports2.TypeInfo.GitRefFavorite.fields = { + type: { + enumType: exports2.TypeInfo.RefFavoriteType + } + }; + exports2.TypeInfo.GitRefUpdateResult.fields = { + updateStatus: { + enumType: exports2.TypeInfo.GitRefUpdateStatus + } + }; + exports2.TypeInfo.GitRepository.fields = { + parentRepository: { + typeInfo: exports2.TypeInfo.GitRepositoryRef + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.GitRepositoryCreateOptions.fields = { + parentRepository: { + typeInfo: exports2.TypeInfo.GitRepositoryRef + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.GitRepositoryRef.fields = { + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.GitResolutionMergeContent.fields = { + mergeType: { + enumType: exports2.TypeInfo.GitResolutionMergeType + } + }; + exports2.TypeInfo.GitResolutionPathConflict.fields = { + action: { + enumType: exports2.TypeInfo.GitResolutionPathConflictAction + } + }; + exports2.TypeInfo.GitResolutionPickOneAction.fields = { + action: { + enumType: exports2.TypeInfo.GitResolutionWhichAction + } + }; + exports2.TypeInfo.GitResolutionRename1to2.fields = { + action: { + enumType: exports2.TypeInfo.GitResolutionRename1to2Action + }, + mergeType: { + enumType: exports2.TypeInfo.GitResolutionMergeType + } + }; + exports2.TypeInfo.GitRevert.fields = { + detailedStatus: { + typeInfo: exports2.TypeInfo.GitAsyncRefOperationDetail + }, + parameters: { + typeInfo: exports2.TypeInfo.GitAsyncRefOperationParameters + }, + status: { + enumType: exports2.TypeInfo.GitAsyncOperationStatus + } + }; + exports2.TypeInfo.GitStatus.fields = { + creationDate: { + isDate: true + }, + state: { + enumType: exports2.TypeInfo.GitStatusState + }, + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.GitTargetVersionDescriptor.fields = { + targetVersionOptions: { + enumType: exports2.TypeInfo.GitVersionOptions + }, + targetVersionType: { + enumType: exports2.TypeInfo.GitVersionType + }, + versionOptions: { + enumType: exports2.TypeInfo.GitVersionOptions + }, + versionType: { + enumType: exports2.TypeInfo.GitVersionType + } + }; + exports2.TypeInfo.GitTreeDiff.fields = { + diffEntries: { + isArray: true, + typeInfo: exports2.TypeInfo.GitTreeDiffEntry + } + }; + exports2.TypeInfo.GitTreeDiffEntry.fields = { + changeType: { + enumType: exports2.TypeInfo.VersionControlChangeType + }, + objectType: { + enumType: exports2.TypeInfo.GitObjectType + } + }; + exports2.TypeInfo.GitTreeDiffResponse.fields = { + treeDiff: { + typeInfo: exports2.TypeInfo.GitTreeDiff + } + }; + exports2.TypeInfo.GitTreeEntryRef.fields = { + gitObjectType: { + enumType: exports2.TypeInfo.GitObjectType + } + }; + exports2.TypeInfo.GitTreeRef.fields = { + treeEntries: { + isArray: true, + typeInfo: exports2.TypeInfo.GitTreeEntryRef + } + }; + exports2.TypeInfo.GitUserDate.fields = { + date: { + isDate: true + } + }; + exports2.TypeInfo.GitVersionDescriptor.fields = { + versionOptions: { + enumType: exports2.TypeInfo.GitVersionOptions + }, + versionType: { + enumType: exports2.TypeInfo.GitVersionType + } + }; + exports2.TypeInfo.HistoryEntry.fields = { + itemChangeType: { + enumType: exports2.TypeInfo.VersionControlChangeType + } + }; + exports2.TypeInfo.IncludedGitCommit.fields = { + commitTime: { + isDate: true + } + }; + exports2.TypeInfo.ItemContent.fields = { + contentType: { + enumType: exports2.TypeInfo.ItemContentType + } + }; + exports2.TypeInfo.ItemDetailsOptions.fields = { + recursionLevel: { + enumType: exports2.TypeInfo.VersionControlRecursionType + } + }; + exports2.TypeInfo.LineDiffBlock.fields = { + changeType: { + enumType: exports2.TypeInfo.LineDiffBlockChangeType + } + }; + exports2.TypeInfo.SupportedIde.fields = { + ideType: { + enumType: exports2.TypeInfo.SupportedIdeType + } + }; + exports2.TypeInfo.TfvcBranch.fields = { + children: { + isArray: true, + typeInfo: exports2.TypeInfo.TfvcBranch + }, + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcBranchRef.fields = { + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcChange.fields = { + changeType: { + enumType: exports2.TypeInfo.VersionControlChangeType + }, + newContent: { + typeInfo: exports2.TypeInfo.ItemContent + } + }; + exports2.TypeInfo.TfvcChangeset.fields = { + changes: { + isArray: true, + typeInfo: exports2.TypeInfo.TfvcChange + }, + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcChangesetRef.fields = { + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcCheckinEventData.fields = { + changeset: { + typeInfo: exports2.TypeInfo.TfvcChangeset + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.TfvcHistoryEntry.fields = { + itemChangeType: { + enumType: exports2.TypeInfo.VersionControlChangeType + } + }; + exports2.TypeInfo.TfvcItem.fields = { + changeDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcItemDescriptor.fields = { + recursionLevel: { + enumType: exports2.TypeInfo.VersionControlRecursionType + }, + versionOption: { + enumType: exports2.TypeInfo.TfvcVersionOption + }, + versionType: { + enumType: exports2.TypeInfo.TfvcVersionType + } + }; + exports2.TypeInfo.TfvcItemPreviousHash.fields = { + changeDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcItemRequestData.fields = { + itemDescriptors: { + isArray: true, + typeInfo: exports2.TypeInfo.TfvcItemDescriptor + } + }; + exports2.TypeInfo.TfvcLabel.fields = { + items: { + isArray: true, + typeInfo: exports2.TypeInfo.TfvcItem + }, + modifiedDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcLabelRef.fields = { + modifiedDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcShelveset.fields = { + changes: { + isArray: true, + typeInfo: exports2.TypeInfo.TfvcChange + }, + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcShelvesetRef.fields = { + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcVersionDescriptor.fields = { + versionOption: { + enumType: exports2.TypeInfo.TfvcVersionOption + }, + versionType: { + enumType: exports2.TypeInfo.TfvcVersionType + } + }; + exports2.TypeInfo.UpdateRefsRequest.fields = { + updateMode: { + enumType: exports2.TypeInfo.GitRefUpdateMode + } + }; + exports2.TypeInfo.VersionControlProjectInfo.fields = { + defaultSourceControlType: { + enumType: TfsCoreInterfaces.TypeInfo.SourceControlTypes + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + } +}); + +// ../common/output.ts +var output_exports = {}; +__export(output_exports, { + COMMIT_EMAIL: () => COMMIT_EMAIL, + COMMIT_USER: () => COMMIT_USER, + FAILURE_LEVEL: () => FAILURE_LEVEL, + NOTICE_LEVEL: () => NOTICE_LEVEL, + QODANA_CHECK_NAME: () => QODANA_CHECK_NAME, + WARNING_LEVEL: () => WARNING_LEVEL, + getCoverageStats: () => getCoverageStats, + getDepencencyPlural: () => getDepencencyPlural, + getLicenseInfo: () => getLicenseInfo, + getProblemPlural: () => getProblemPlural, + getReportURL: () => getReportURL, + getSummary: () => getSummary, + parseResult: () => parseResult +}); +function parseResult(result2, rules) { + var _a; + if (!result2.locations || result2.locations.length === 0 || !result2.locations[0].physicalLocation) { + return null; + } + return { + title: (_a = rules.get(result2.ruleId)) == null ? void 0 : _a.shortDescription, + level: (() => { + switch (result2.level) { + case "error": + return FAILURE_LEVEL; + case "warning": + return WARNING_LEVEL; + default: + return NOTICE_LEVEL; + } + })() + }; +} +function wrapToDiffBlock(message) { + return `\`\`\`diff +${message} +\`\`\``; +} +function makeConclusion(conclusion, failedByThreshold) { + if (failedByThreshold) { + return `- ${conclusion}`; + } else { + return `+ ${conclusion}`; + } +} +function getCoverageStats(c) { + if (c.totalLines === 0 && c.totalCoveredLines === 0) { + return ""; + } + let stats = ""; + if (c.totalLines !== 0) { + const conclusion = `${c.totalCoverage}% total lines covered`; + stats += `${makeConclusion(conclusion, c.totalCoverage < c.totalCoverageThreshold)} +${c.totalLines} lines analyzed, ${c.totalCoveredLines} lines covered`; + } + if (c.freshLines !== 0) { + const conclusion = `${c.freshCoverage}% fresh lines covered`; + stats += ` +${makeConclusion(conclusion, c.freshCoverage < c.freshCoverageThreshold)} +${c.freshLines} lines analyzed, ${c.freshCoveredLines} lines covered`; + } + return wrapToDiffBlock( + [ + `@@ Code coverage @@`, + `${stats}`, + `# Calculated according to the filters of your coverage tool` + ].join("\n") + ); +} +function getLicenseInfo(resultsDir) { + let licensesInfo = ""; + let packages = 0; + const licensesJson = `${resultsDir}/projectStructure/${QODANA_LICENSES_JSON}`; + if (fs2.existsSync(licensesJson)) { + const licenses = JSON.parse( + fs2.readFileSync(licensesJson, { encoding: "utf8" }) + ); + if (licenses.length > 0) { + packages = licenses.length; + licensesInfo = fs2.readFileSync( + `${resultsDir}/projectStructure/${QODANA_LICENSES_MD}`, + { encoding: "utf8" } + ); + } + } + return { licenses: licensesInfo, packages }; +} +function getReportURL(resultsDir) { + var _a; + let reportUrlFile = `${resultsDir}/${QODANA_OPEN_IN_IDE_NAME}`; + if (fs2.existsSync(reportUrlFile)) { + const rawData = fs2.readFileSync(reportUrlFile, { encoding: "utf8" }); + const data = JSON.parse(rawData); + if ((_a = data == null ? void 0 : data.cloud) == null ? void 0 : _a.url) { + return data.cloud.url; + } + } else { + reportUrlFile = `${resultsDir}/${QODANA_REPORT_URL_NAME}`; + if (fs2.existsSync(reportUrlFile)) { + return fs2.readFileSync(reportUrlFile, { encoding: "utf8" }); + } + } + return ""; +} +function wrapToToggleBlock(header, body) { + return `
+${header} + +${body} +
`; +} +function getViewReportText(reportUrl, viewReportOptions) { + if (reportUrl !== "") { + return `\u2601\uFE0F [View the detailed Qodana report](${reportUrl})`; + } + return wrapToToggleBlock( + "View the detailed Qodana report", + viewReportOptions + ); +} +function getRowsByLevel(annotations, level) { + const problems = annotations.reduce( + (map2, e) => map2.set( + e.title ?? UNKNOWN_RULE_ID, + map2.get(e.title ?? UNKNOWN_RULE_ID) !== void 0 ? map2.get(e.title ?? UNKNOWN_RULE_ID) + 1 : 1 + ), + /* @__PURE__ */ new Map() + ); + return Array.from(problems.entries()).sort((a, b) => b[1] - a[1]).map(([title, count]) => `| \`${title}\` | ${level} | ${count} |`).join("\n"); +} +function getSummary(toolName, projectDir, sourceDir, problemsDescriptors, coverageInfo, packages, licensesInfo, reportUrl, prMode, dependencyCharsLimit, reportViewOptionsHelp) { + const contactBlock = wrapToToggleBlock("Contact Qodana team", SUMMARY_MISC); + let licensesBlock = ""; + if (licensesInfo !== "" && licensesInfo.length < dependencyCharsLimit) { + licensesBlock = wrapToToggleBlock( + `Detected ${packages} ${getDepencencyPlural(packages)}`, + licensesInfo + ); + } + let prModeBlock = ""; + if (prMode) { + prModeBlock = SUMMARY_PR_MODE; + } + if (reportUrl !== "") { + const firstToolName = toolName.split(" ")[0]; + toolName = toolName.replace( + firstToolName, + `[${firstToolName}](${reportUrl})` + ); + } + const analysisScope = (projectDir === "" ? "" : ["Analyzed project: `", projectDir, "/`\n"].join("")).concat( + sourceDir === "" ? "" : ["Analyzed directory: `", sourceDir, "/`\n"].join("") + ); + if (problemsDescriptors.length === 0) { + return [ + `# ${toolName}`, + analysisScope, + "**It seems all right \u{1F44C}**", + "", + "No new problems were found according to the checks applied", + coverageInfo, + prModeBlock, + getViewReportText(reportUrl, reportViewOptionsHelp), + licensesBlock, + contactBlock + ].join("\n"); + } + return [ + `# ${toolName}`, + analysisScope, + `**${problemsDescriptors.length} ${getProblemPlural( + problemsDescriptors.length + )}** were found`, + "", + SUMMARY_TABLE_HEADER, + SUMMARY_TABLE_SEP, + [ + getRowsByLevel( + problemsDescriptors.filter((a) => a.level === FAILURE_LEVEL), + "\u{1F534} Failure" + ), + getRowsByLevel( + problemsDescriptors.filter((a) => a.level === WARNING_LEVEL), + "\u{1F536} Warning" + ), + getRowsByLevel( + problemsDescriptors.filter((a) => a.level === NOTICE_LEVEL), + "\u25FD\uFE0F Notice" + ) + ].filter((e) => e !== "").join("\n"), + "", + coverageInfo, + prModeBlock, + getViewReportText(reportUrl, reportViewOptionsHelp), + licensesBlock, + contactBlock + ].join("\n"); +} +function getProblemPlural(count) { + return `new problem${count !== 1 ? "s" : ""}`; +} +function getDepencencyPlural(count) { + return `dependenc${count !== 1 ? "ies" : "y"}`; +} +var fs2, COMMIT_USER, COMMIT_EMAIL, QODANA_CHECK_NAME, UNKNOWN_RULE_ID, SUMMARY_TABLE_HEADER, SUMMARY_TABLE_SEP, SUMMARY_MISC, SUMMARY_PR_MODE, FAILURE_LEVEL, WARNING_LEVEL, NOTICE_LEVEL; +var init_output = __esm({ + "../common/output.ts"() { + "use strict"; + init_qodana(); + fs2 = __toESM(require("fs")); + COMMIT_USER = "qodana-bot"; + COMMIT_EMAIL = "qodana-support@jetbrains.com"; + QODANA_CHECK_NAME = "Qodana"; + UNKNOWN_RULE_ID = "Unknown"; + SUMMARY_TABLE_HEADER = "| Inspection name | Severity | Problems |"; + SUMMARY_TABLE_SEP = "| --- | --- | --- |"; + SUMMARY_MISC = `Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com) + - Or via our issue tracker: https://jb.gg/qodana-issue + - Or share your feedback: https://jb.gg/qodana-discussions`; + SUMMARY_PR_MODE = `\u{1F4A1} Qodana analysis was run in the pull request mode: only the changed files were checked`; + FAILURE_LEVEL = "failure"; + WARNING_LEVEL = "warning"; + NOTICE_LEVEL = "notice"; + } +}); + +// ../common/utils.ts +var utils_exports = {}; +__export(utils_exports, { + parseRules: () => parseRules +}); +function parseRules(tool) { + var _a, _b; + const rules = /* @__PURE__ */ new Map(); + (_a = tool.driver.rules) == null ? void 0 : _a.forEach((rule) => { + rules.set(rule.id, { + shortDescription: rule.shortDescription.text, + fullDescription: rule.fullDescription.markdown || rule.fullDescription.text + }); + }); + (_b = tool == null ? void 0 : tool.extensions) == null ? void 0 : _b.forEach((ext) => { + var _a2; + (_a2 = ext == null ? void 0 : ext.rules) == null ? void 0 : _a2.forEach((rule) => { + rules.set(rule.id, { + shortDescription: rule.shortDescription.text, + fullDescription: rule.fullDescription.markdown || rule.fullDescription.text + }); + }); + }); + return rules; +} +var init_utils = __esm({ + "../common/utils.ts"() { + "use strict"; + } +}); + +// ../node_modules/azure-devops-node-api/VsoClient.js +var require_VsoClient = __commonJS({ + "../node_modules/azure-devops-node-api/VsoClient.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.VsoClient = exports2.InvalidApiResourceVersionError = void 0; + var url = require("url"); + var path2 = require("path"); + var InvalidApiResourceVersionError = class { + constructor(message) { + this.name = "Invalid resource version"; + this.message = message; + } + }; + exports2.InvalidApiResourceVersionError = InvalidApiResourceVersionError; + var VsoClient = class _VsoClient { + constructor(baseUrl, restClient) { + this.baseUrl = baseUrl; + this.basePath = url.parse(baseUrl).pathname; + this.restClient = restClient; + this._locationsByAreaPromises = {}; + this._initializationPromise = Promise.resolve(true); + } + autoNegotiateApiVersion(location, requestedVersion) { + let negotiatedVersion; + let apiVersion; + let apiVersionString; + if (requestedVersion) { + let apiVersionRegEx = new RegExp("(\\d+(\\.\\d+)?)(-preview(\\.(\\d+))?)?"); + let isPreview = false; + let resourceVersion; + let regExExecArray = apiVersionRegEx.exec(requestedVersion); + if (regExExecArray) { + if (regExExecArray[1]) { + apiVersion = +regExExecArray[1]; + apiVersionString = regExExecArray[1]; + if (regExExecArray[3]) { + isPreview = true; + if (regExExecArray[5]) { + resourceVersion = +regExExecArray[5]; + } + } + if (apiVersion <= +location.releasedVersion || !resourceVersion && apiVersion <= +location.maxVersion && isPreview || resourceVersion && apiVersion <= +location.maxVersion && resourceVersion <= +location.resourceVersion) { + negotiatedVersion = requestedVersion; + } + } + } + } + if (!negotiatedVersion) { + if (apiVersion < +location.maxVersion) { + negotiatedVersion = apiVersionString + "-preview"; + } else if (location.maxVersion === location.releasedVersion) { + negotiatedVersion = location.maxVersion; + } else { + negotiatedVersion = location.maxVersion + "-preview." + location.resourceVersion; + } + } + return negotiatedVersion; + } + /** + * Gets the route template for a resource based on its location ID and negotiates the api version + */ + getVersioningData(apiVersion, area, locationId, routeValues, queryParams) { + let requestUrl; + return this.beginGetLocation(area, locationId).then((location) => { + if (!location) { + throw new Error("Failed to find api location for area: " + area + " id: " + locationId); + } + apiVersion = this.autoNegotiateApiVersion(location, apiVersion); + requestUrl = this.getRequestUrl(location.routeTemplate, location.area, location.resourceName, routeValues, queryParams); + return { + apiVersion, + requestUrl + }; + }); + } + /** + * Sets a promise that is waited on before any requests are issued. Can be used to asynchronously + * set the request url and auth token manager. + */ + _setInitializationPromise(promise) { + if (promise) { + this._initializationPromise = promise; + } + } + /** + * Gets information about an API resource location (route template, supported versions, etc.) + * + * @param area resource area name + * @param locationId Guid of the location to get + */ + beginGetLocation(area, locationId) { + return this._initializationPromise.then(() => { + return this.beginGetAreaLocations(area); + }).then((areaLocations) => { + return areaLocations[(locationId || "").toLowerCase()]; + }); + } + beginGetAreaLocations(area) { + let areaLocationsPromise = this._locationsByAreaPromises[area]; + if (!areaLocationsPromise) { + let requestUrl = this.resolveUrl(_VsoClient.APIS_RELATIVE_PATH + "/" + area); + areaLocationsPromise = this.restClient.options(requestUrl).then((res) => { + if (!res.result) { + return {}; + } + let locationsLookup = {}; + let resourceLocations = res.result.value; + let i; + for (i = 0; i < resourceLocations.length; i++) { + let resourceLocation = resourceLocations[i]; + locationsLookup[resourceLocation.id.toLowerCase()] = resourceLocation; + } + this._locationsByAreaPromises[area] = areaLocationsPromise; + return locationsLookup; + }); + } + return areaLocationsPromise; + } + resolveUrl(relativeUrl) { + return url.resolve(this.baseUrl, path2.join(this.basePath, relativeUrl)); + } + queryParamsToStringHelper(queryParams, prefix) { + if (queryParams == null || queryParams.length === 0) { + return ""; + } + let queryString = ""; + if (typeof queryParams !== "string") { + for (let property2 in queryParams) { + if (queryParams.hasOwnProperty(property2)) { + const prop = queryParams[property2]; + const newPrefix = prefix + encodeURIComponent(property2.toString()) + "."; + queryString += this.queryParamsToStringHelper(prop, newPrefix); + } + } + } + if (queryString === "" && prefix.length > 0) { + const queryValue = typeof queryParams === "object" && "toUTCString" in queryParams ? queryParams.toUTCString() : queryParams.toString(); + queryString = prefix.slice(0, -1) + "=" + encodeURIComponent(queryValue) + "&"; + } + return queryString; + } + queryParamsToString(queryParams) { + const queryString = "?" + this.queryParamsToStringHelper(queryParams, ""); + return queryString.slice(0, -1); + } + getRequestUrl(routeTemplate, area, resource, routeValues, queryParams) { + routeValues = routeValues || {}; + if (!routeValues.area) { + routeValues.area = area; + } + if (!routeValues.resource) { + routeValues.resource = resource; + } + let relativeUrl = this.replaceRouteValues(routeTemplate, routeValues); + if (queryParams) { + relativeUrl += this.queryParamsToString(queryParams); + } + return url.resolve(this.baseUrl, path2.join(this.basePath, relativeUrl)); + } + // helper method copied directly from VSS\WebAPI\restclient.ts + replaceRouteValues(routeTemplate, routeValues) { + let result2 = "", currentPathPart = "", paramName = "", insideParam = false, charIndex, routeTemplateLength = routeTemplate.length, c; + for (charIndex = 0; charIndex < routeTemplateLength; charIndex++) { + c = routeTemplate[charIndex]; + if (insideParam) { + if (c == "}") { + insideParam = false; + if (routeValues[paramName]) { + currentPathPart += encodeURIComponent(routeValues[paramName]); + } else { + let strippedParamName = paramName.replace(/[^a-z0-9]/ig, ""); + if (routeValues[strippedParamName]) { + currentPathPart += encodeURIComponent(routeValues[strippedParamName]); + } + } + paramName = ""; + } else { + paramName += c; + } + } else { + if (c == "/") { + if (currentPathPart) { + if (result2) { + result2 += "/"; + } + result2 += currentPathPart; + currentPathPart = ""; + } + } else if (c == "{") { + if (charIndex + 1 < routeTemplateLength && routeTemplate[charIndex + 1] == "{") { + currentPathPart += c; + charIndex++; + } else { + insideParam = true; + } + } else if (c == "}") { + currentPathPart += c; + if (charIndex + 1 < routeTemplateLength && routeTemplate[charIndex + 1] == "}") { + charIndex++; + } + } else { + currentPathPart += c; + } + } + } + if (currentPathPart) { + if (result2) { + result2 += "/"; + } + result2 += currentPathPart; + } + return result2; + } + }; + exports2.VsoClient = VsoClient; + VsoClient.APIS_RELATIVE_PATH = "_apis"; + VsoClient.PREVIEW_INDICATOR = "-preview."; + } +}); + +// ../node_modules/azure-devops-node-api/Serialization.js +var require_Serialization = __commonJS({ + "../node_modules/azure-devops-node-api/Serialization.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ContractSerializer = void 0; + var ContractSerializer; + (function(ContractSerializer2) { + var _legacyDateRegExp; + function serialize(data, contractMetadata, preserveOriginal) { + if (data && contractMetadata) { + if (Array.isArray(data)) { + return _getTranslatedArray(data, contractMetadata, true, preserveOriginal); + } else { + return _getTranslatedObject(data, contractMetadata, true, preserveOriginal); + } + } else { + return data; + } + } + ContractSerializer2.serialize = serialize; + function deserialize(data, contractMetadata, preserveOriginal, unwrapWrappedCollections) { + if (data) { + if (unwrapWrappedCollections && Array.isArray(data.value)) { + data = data.value; + } + if (contractMetadata) { + if (Array.isArray(data)) { + data = _getTranslatedArray(data, contractMetadata, false, preserveOriginal); + } else { + data = _getTranslatedObject(data, contractMetadata, false, preserveOriginal); + } + } + } + return data; + } + ContractSerializer2.deserialize = deserialize; + function _getTranslatedArray(array, typeMetadata, serialize2, preserveOriginal) { + var resultArray = array; + var arrayCopy = []; + var i; + for (i = 0; i < array.length; i++) { + var item = array[i]; + var processedItem; + if (Array.isArray(item)) { + processedItem = _getTranslatedArray(item, typeMetadata, serialize2, preserveOriginal); + } else { + processedItem = _getTranslatedObject(item, typeMetadata, serialize2, preserveOriginal); + } + if (preserveOriginal) { + arrayCopy.push(processedItem); + if (processedItem !== item) { + resultArray = arrayCopy; + } + } else { + array[i] = processedItem; + } + } + return resultArray; + } + function _getTranslatedObject(typeObject, typeMetadata, serialize2, preserveOriginal) { + var processedItem = typeObject, copiedItem = false; + if (typeObject && typeMetadata.fields) { + for (var fieldName in typeMetadata.fields) { + var fieldMetadata = typeMetadata.fields[fieldName]; + var fieldValue = typeObject[fieldName]; + var translatedValue = _getTranslatedField(fieldValue, fieldMetadata, serialize2, preserveOriginal); + if (fieldValue !== translatedValue) { + if (preserveOriginal && !copiedItem) { + processedItem = this._extend({}, typeObject); + copiedItem = true; + } + processedItem[fieldName] = translatedValue; + } + } + } + return processedItem; + } + function _getTranslatedField(fieldValue, fieldMetadata, serialize2, preserveOriginal) { + if (!fieldValue) { + return fieldValue; + } + if (fieldMetadata.isArray) { + if (Array.isArray(fieldValue)) { + var newArray = [], processedArray = fieldValue; + for (var index = 0; index < fieldValue.length; index++) { + var arrayValue = fieldValue[index]; + var processedValue = arrayValue; + if (fieldMetadata.isDate) { + processedValue = _getTranslatedDateValue(arrayValue, serialize2); + } else if (fieldMetadata.enumType) { + processedValue = _getTranslatedEnumValue(fieldMetadata.enumType, arrayValue, serialize2); + } else if (fieldMetadata.typeInfo) { + if (Array.isArray(arrayValue)) { + processedValue = _getTranslatedArray(arrayValue, fieldMetadata.typeInfo, serialize2, preserveOriginal); + } else { + processedValue = _getTranslatedObject(arrayValue, fieldMetadata.typeInfo, serialize2, preserveOriginal); + } + } + if (preserveOriginal) { + newArray.push(processedValue); + if (processedValue !== arrayValue) { + processedArray = newArray; + } + } else { + fieldValue[index] = processedValue; + } + } + return processedArray; + } else { + return fieldValue; + } + } else if (fieldMetadata.isDictionary) { + var dictionaryModified = false; + var newDictionary = {}; + for (var key in fieldValue) { + var dictionaryValue = fieldValue[key]; + var newKey = key, newValue = dictionaryValue; + if (fieldMetadata.dictionaryKeyIsDate) { + newKey = _getTranslatedDateValue(key, serialize2); + } else if (fieldMetadata.dictionaryKeyEnumType) { + newKey = _getTranslatedEnumValue(fieldMetadata.dictionaryKeyEnumType, key, serialize2); + } + if (fieldMetadata.dictionaryValueIsDate) { + newValue = _getTranslatedDateValue(dictionaryValue, serialize2); + } else if (fieldMetadata.dictionaryValueEnumType) { + newValue = _getTranslatedEnumValue(fieldMetadata.dictionaryValueEnumType, dictionaryValue, serialize2); + } else if (fieldMetadata.dictionaryValueTypeInfo) { + newValue = _getTranslatedObject(newValue, fieldMetadata.dictionaryValueTypeInfo, serialize2, preserveOriginal); + } else if (fieldMetadata.dictionaryValueFieldInfo) { + newValue = _getTranslatedField(dictionaryValue, fieldMetadata.dictionaryValueFieldInfo, serialize2, preserveOriginal); + } + newDictionary[newKey] = newValue; + if (key !== newKey || dictionaryValue !== newValue) { + dictionaryModified = true; + } + } + return dictionaryModified ? newDictionary : fieldValue; + } else { + if (fieldMetadata.isDate) { + return _getTranslatedDateValue(fieldValue, serialize2); + } else if (fieldMetadata.enumType) { + return _getTranslatedEnumValue(fieldMetadata.enumType, fieldValue, serialize2); + } else if (fieldMetadata.typeInfo) { + return _getTranslatedObject(fieldValue, fieldMetadata.typeInfo, serialize2, preserveOriginal); + } else { + return fieldValue; + } + } + } + function _getTranslatedEnumValue(enumType, valueToConvert, serialize2) { + if (serialize2 && typeof valueToConvert === "number") { + } else if (!serialize2 && typeof valueToConvert === "string") { + var result2 = 0; + if (valueToConvert) { + var splitValue = valueToConvert.split(","); + for (var i = 0; i < splitValue.length; i++) { + var valuePart = splitValue[i]; + var enumName = valuePart.replace(/^\s+|\s+$/g, "") || ""; + if (enumName) { + var resultPart = enumType.enumValues[enumName]; + if (!resultPart) { + var lowerCaseEnumName = enumName.toLowerCase(); + if (lowerCaseEnumName !== enumName) { + for (var name in enumType.enumValues) { + var value = enumType.enumValues[name]; + if (name.toLowerCase() === lowerCaseEnumName) { + resultPart = value; + break; + } + } + } + } + if (resultPart) { + result2 |= resultPart; + } + } + } + } + return result2; + } + return valueToConvert; + } + function _getTranslatedDateValue(valueToConvert, serialize2) { + if (!serialize2 && typeof valueToConvert === "string") { + var dateValue = new Date(valueToConvert); + if (isNaN(dateValue) && navigator.userAgent && /msie/i.test(navigator.userAgent)) { + dateValue = _convertLegacyIEDate(valueToConvert); + } + return dateValue; + } + return valueToConvert; + } + function _convertLegacyIEDate(dateStringValue) { + var match; + if (!_legacyDateRegExp) { + _legacyDateRegExp = new RegExp("(\\d+)-(\\d+)-(\\d+)T(\\d+):(\\d+):(\\d+).(\\d+)Z"); + } + match = _legacyDateRegExp.exec(dateStringValue); + if (match) { + return new Date(Date.UTC(parseInt(match[1]), parseInt(match[2]) - 1, parseInt(match[3]), parseInt(match[4]), parseInt(match[5]), parseInt(match[6]), parseInt(match[7]))); + } else { + return null; + } + } + var _extend = function(out) { + out = out || {}; + for (var i = 1; i < arguments.length; i++) { + if (!arguments[i]) + continue; + for (var key in arguments[i]) { + if (arguments[i].hasOwnProperty(key)) + out[key] = arguments[i][key]; + } + } + return out; + }; + })(ContractSerializer = exports2.ContractSerializer || (exports2.ContractSerializer = {})); + } +}); + +// ../node_modules/azure-devops-node-api/node_modules/typed-rest-client/Util.js +var require_Util2 = __commonJS({ + "../node_modules/azure-devops-node-api/node_modules/typed-rest-client/Util.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getUrl = getUrl; + exports2.decompressGzippedContent = decompressGzippedContent; + exports2.buildProxyBypassRegexFromEnv = buildProxyBypassRegexFromEnv; + exports2.obtainContentCharset = obtainContentCharset; + var qs = require_lib4(); + var url = require("url"); + var path2 = require("path"); + var zlib = require("zlib"); + function getUrl(resource, baseUrl, queryParams) { + const pathApi = path2.posix || path2; + let requestUrl = ""; + if (!baseUrl) { + requestUrl = resource; + } else if (!resource) { + requestUrl = baseUrl; + } else { + const base = url.parse(baseUrl); + const resultantUrl = url.parse(resource); + resultantUrl.protocol = resultantUrl.protocol || base.protocol; + resultantUrl.auth = resultantUrl.auth || base.auth; + resultantUrl.host = resultantUrl.host || base.host; + resultantUrl.pathname = pathApi.resolve(base.pathname, resultantUrl.pathname); + if (!resultantUrl.pathname.endsWith("/") && resource.endsWith("/")) { + resultantUrl.pathname += "/"; + } + requestUrl = url.format(resultantUrl); + } + return queryParams ? getUrlWithParsedQueryParams(requestUrl, queryParams) : requestUrl; + } + function getUrlWithParsedQueryParams(requestUrl, queryParams) { + const url2 = requestUrl.replace(/\?$/g, ""); + const parsedQueryParams = qs.stringify(queryParams.params, buildParamsStringifyOptions(queryParams)); + return `${url2}${parsedQueryParams}`; + } + function buildParamsStringifyOptions(queryParams) { + let options = { + addQueryPrefix: true, + delimiter: (queryParams.options || {}).separator || "&", + allowDots: (queryParams.options || {}).shouldAllowDots || false, + arrayFormat: (queryParams.options || {}).arrayFormat || "repeat", + encodeValuesOnly: (queryParams.options || {}).shouldOnlyEncodeValues || true + }; + return options; + } + function decompressGzippedContent(buffer, charset) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + zlib.gunzip(buffer, function(error, buffer2) { + if (error) { + reject2(error); + } else { + resolve(buffer2.toString(charset || "utf-8")); + } + }); + })); + }); + } + function buildProxyBypassRegexFromEnv(bypass) { + try { + return new RegExp(bypass, "i"); + } catch (err) { + if (err instanceof SyntaxError && (bypass || "").startsWith("*")) { + let wildcardEscaped = bypass.replace("*", "(.*)"); + return new RegExp(wildcardEscaped, "i"); + } + throw err; + } + } + function obtainContentCharset(response) { + const nodeSupportedEncodings = ["ascii", "utf8", "utf16le", "ucs2", "base64", "binary", "hex"]; + const contentType = response.message.headers["content-type"] || ""; + const matches = contentType.match(/charset=([^;,\r\n]+)/i); + if (matches && matches[1] && nodeSupportedEncodings.indexOf(matches[1]) != -1) { + return matches[1]; + } + return "utf-8"; + } + } +}); + +// ../node_modules/azure-devops-node-api/node_modules/typed-rest-client/HttpClient.js +var require_HttpClient2 = __commonJS({ + "../node_modules/azure-devops-node-api/node_modules/typed-rest-client/HttpClient.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.HttpClient = exports2.HttpClientResponse = exports2.HttpCodes = void 0; + exports2.isHttps = isHttps; + var url = require("url"); + var http = require("http"); + var https = require("https"); + var util = require_Util2(); + var fs3; + var tunnel; + var HttpCodes; + (function(HttpCodes2) { + HttpCodes2[HttpCodes2["OK"] = 200] = "OK"; + HttpCodes2[HttpCodes2["MultipleChoices"] = 300] = "MultipleChoices"; + HttpCodes2[HttpCodes2["MovedPermanently"] = 301] = "MovedPermanently"; + HttpCodes2[HttpCodes2["ResourceMoved"] = 302] = "ResourceMoved"; + HttpCodes2[HttpCodes2["SeeOther"] = 303] = "SeeOther"; + HttpCodes2[HttpCodes2["NotModified"] = 304] = "NotModified"; + HttpCodes2[HttpCodes2["UseProxy"] = 305] = "UseProxy"; + HttpCodes2[HttpCodes2["SwitchProxy"] = 306] = "SwitchProxy"; + HttpCodes2[HttpCodes2["TemporaryRedirect"] = 307] = "TemporaryRedirect"; + HttpCodes2[HttpCodes2["PermanentRedirect"] = 308] = "PermanentRedirect"; + HttpCodes2[HttpCodes2["BadRequest"] = 400] = "BadRequest"; + HttpCodes2[HttpCodes2["Unauthorized"] = 401] = "Unauthorized"; + HttpCodes2[HttpCodes2["PaymentRequired"] = 402] = "PaymentRequired"; + HttpCodes2[HttpCodes2["Forbidden"] = 403] = "Forbidden"; + HttpCodes2[HttpCodes2["NotFound"] = 404] = "NotFound"; + HttpCodes2[HttpCodes2["MethodNotAllowed"] = 405] = "MethodNotAllowed"; + HttpCodes2[HttpCodes2["NotAcceptable"] = 406] = "NotAcceptable"; + HttpCodes2[HttpCodes2["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; + HttpCodes2[HttpCodes2["RequestTimeout"] = 408] = "RequestTimeout"; + HttpCodes2[HttpCodes2["Conflict"] = 409] = "Conflict"; + HttpCodes2[HttpCodes2["Gone"] = 410] = "Gone"; + HttpCodes2[HttpCodes2["TooManyRequests"] = 429] = "TooManyRequests"; + HttpCodes2[HttpCodes2["InternalServerError"] = 500] = "InternalServerError"; + HttpCodes2[HttpCodes2["NotImplemented"] = 501] = "NotImplemented"; + HttpCodes2[HttpCodes2["BadGateway"] = 502] = "BadGateway"; + HttpCodes2[HttpCodes2["ServiceUnavailable"] = 503] = "ServiceUnavailable"; + HttpCodes2[HttpCodes2["GatewayTimeout"] = 504] = "GatewayTimeout"; + })(HttpCodes || (exports2.HttpCodes = HttpCodes = {})); + var HttpRedirectCodes = [HttpCodes.MovedPermanently, HttpCodes.ResourceMoved, HttpCodes.SeeOther, HttpCodes.TemporaryRedirect, HttpCodes.PermanentRedirect]; + var HttpResponseRetryCodes = [HttpCodes.BadGateway, HttpCodes.ServiceUnavailable, HttpCodes.GatewayTimeout]; + var NetworkRetryErrors = ["ECONNRESET", "ENOTFOUND", "ESOCKETTIMEDOUT", "ETIMEDOUT", "ECONNREFUSED", "EHOSTUNREACH"]; + var RetryableHttpVerbs = ["OPTIONS", "GET", "DELETE", "HEAD"]; + var ExponentialBackoffCeiling = 10; + var ExponentialBackoffTimeSlice = 5; + var HttpClientResponse = class { + constructor(message) { + this.message = message; + } + readBody() { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + const chunks = []; + const encodingCharset = util.obtainContentCharset(this); + const contentEncoding = this.message.headers["content-encoding"] || ""; + const isGzippedEncoded = new RegExp("(gzip$)|(gzip, *deflate)").test(contentEncoding); + this.message.on("data", function(data) { + const chunk2 = typeof data === "string" ? Buffer.from(data, encodingCharset) : data; + chunks.push(chunk2); + }).on("end", function() { + return __awaiter2(this, void 0, void 0, function* () { + const buffer = Buffer.concat(chunks); + if (isGzippedEncoded) { + const gunzippedBody = yield util.decompressGzippedContent(buffer, encodingCharset); + resolve(gunzippedBody); + } else { + resolve(buffer.toString(encodingCharset)); + } + }); + }).on("error", function(err) { + reject2(err); + }); + })); + } + }; + exports2.HttpClientResponse = HttpClientResponse; + function isHttps(requestUrl) { + let parsedUrl = url.parse(requestUrl); + return parsedUrl.protocol === "https:"; + } + var EnvironmentVariables; + (function(EnvironmentVariables2) { + EnvironmentVariables2["HTTP_PROXY"] = "HTTP_PROXY"; + EnvironmentVariables2["HTTPS_PROXY"] = "HTTPS_PROXY"; + EnvironmentVariables2["NO_PROXY"] = "NO_PROXY"; + })(EnvironmentVariables || (EnvironmentVariables = {})); + var HttpClient = class { + constructor(userAgent, handlers, requestOptions) { + this._ignoreSslError = false; + this._allowRedirects = true; + this._allowRedirectDowngrade = false; + this._maxRedirects = 50; + this._allowRetries = false; + this._maxRetries = 1; + this._keepAlive = false; + this._disposed = false; + this._httpGlobalAgentOptions = { + keepAlive: false, + timeout: 3e4 + }; + this.userAgent = userAgent; + this.handlers = handlers || []; + let no_proxy = process.env[EnvironmentVariables.NO_PROXY]; + if (no_proxy) { + this._httpProxyBypassHosts = []; + no_proxy.split(",").forEach((bypass) => { + this._httpProxyBypassHosts.push(util.buildProxyBypassRegexFromEnv(bypass)); + }); + } + this.requestOptions = requestOptions; + if (requestOptions) { + if (requestOptions.ignoreSslError != null) { + this._ignoreSslError = requestOptions.ignoreSslError; + } + this._socketTimeout = requestOptions.socketTimeout; + this._httpProxy = requestOptions.proxy; + if (requestOptions.proxy && requestOptions.proxy.proxyBypassHosts) { + this._httpProxyBypassHosts = []; + requestOptions.proxy.proxyBypassHosts.forEach((bypass) => { + this._httpProxyBypassHosts.push(new RegExp(bypass, "i")); + }); + } + if (requestOptions.globalAgentOptions) { + this._httpGlobalAgentOptions = requestOptions.globalAgentOptions; + } + this._certConfig = requestOptions.cert; + if (this._certConfig) { + fs3 = require("fs"); + if (this._certConfig.caFile && fs3.existsSync(this._certConfig.caFile)) { + this._ca = fs3.readFileSync(this._certConfig.caFile, "utf8"); + } + if (this._certConfig.certFile && fs3.existsSync(this._certConfig.certFile)) { + this._cert = fs3.readFileSync(this._certConfig.certFile, "utf8"); + } + if (this._certConfig.keyFile && fs3.existsSync(this._certConfig.keyFile)) { + this._key = fs3.readFileSync(this._certConfig.keyFile, "utf8"); + } + } + if (requestOptions.allowRedirects != null) { + this._allowRedirects = requestOptions.allowRedirects; + } + if (requestOptions.allowRedirectDowngrade != null) { + this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; + } + if (requestOptions.maxRedirects != null) { + this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); + } + if (requestOptions.keepAlive != null) { + this._keepAlive = requestOptions.keepAlive; + } + if (requestOptions.allowRetries != null) { + this._allowRetries = requestOptions.allowRetries; + } + if (requestOptions.maxRetries != null) { + this._maxRetries = requestOptions.maxRetries; + } + } + } + options(requestUrl, additionalHeaders) { + return this.request("OPTIONS", requestUrl, null, additionalHeaders || {}); + } + get(requestUrl, additionalHeaders) { + return this.request("GET", requestUrl, null, additionalHeaders || {}); + } + del(requestUrl, additionalHeaders) { + return this.request("DELETE", requestUrl, null, additionalHeaders || {}); + } + post(requestUrl, data, additionalHeaders) { + return this.request("POST", requestUrl, data, additionalHeaders || {}); + } + patch(requestUrl, data, additionalHeaders) { + return this.request("PATCH", requestUrl, data, additionalHeaders || {}); + } + put(requestUrl, data, additionalHeaders) { + return this.request("PUT", requestUrl, data, additionalHeaders || {}); + } + head(requestUrl, additionalHeaders) { + return this.request("HEAD", requestUrl, null, additionalHeaders || {}); + } + sendStream(verb, requestUrl, stream, additionalHeaders) { + return this.request(verb, requestUrl, stream, additionalHeaders); + } + /** + * Makes a raw http request. + * All other methods such as get, post, patch, and request ultimately call this. + * Prefer get, del, post and patch + */ + request(verb, requestUrl, data, headers) { + return __awaiter2(this, void 0, void 0, function* () { + if (this._disposed) { + throw new Error("Client has already been disposed."); + } + let parsedUrl = url.parse(requestUrl); + let info = this._prepareRequest(verb, parsedUrl, headers); + let maxTries = this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1 ? this._maxRetries + 1 : 1; + let numTries = 0; + let response; + while (numTries < maxTries) { + try { + response = yield this.requestRaw(info, data); + } catch (err) { + numTries++; + if (err && err.code && NetworkRetryErrors.indexOf(err.code) > -1 && numTries < maxTries) { + yield this._performExponentialBackoff(numTries); + continue; + } + throw err; + } + if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) { + let authenticationHandler; + for (let i = 0; i < this.handlers.length; i++) { + if (this.handlers[i].canHandleAuthentication(response)) { + authenticationHandler = this.handlers[i]; + break; + } + } + if (authenticationHandler) { + return authenticationHandler.handleAuthentication(this, info, data); + } else { + return response; + } + } + let redirectsRemaining = this._maxRedirects; + while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 && this._allowRedirects && redirectsRemaining > 0) { + const redirectUrl = response.message.headers["location"]; + if (!redirectUrl) { + break; + } + let parsedRedirectUrl = url.parse(redirectUrl); + if (parsedUrl.protocol == "https:" && parsedUrl.protocol != parsedRedirectUrl.protocol && !this._allowRedirectDowngrade) { + throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true."); + } + yield response.readBody(); + info = this._prepareRequest(verb, parsedRedirectUrl, headers); + response = yield this.requestRaw(info, data); + redirectsRemaining--; + } + if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { + return response; + } + numTries += 1; + if (numTries < maxTries) { + yield response.readBody(); + yield this._performExponentialBackoff(numTries); + } + } + return response; + }); + } + /** + * Needs to be called if keepAlive is set to true in request options. + */ + dispose() { + if (this._agent) { + this._agent.destroy(); + } + this._disposed = true; + } + /** + * Raw request. + * @param info + * @param data + */ + requestRaw(info, data) { + return new Promise((resolve, reject2) => { + let callbackForResult = function(err, res) { + if (err) { + reject2(err); + } + resolve(res); + }; + this.requestRawWithCallback(info, data, callbackForResult); + }); + } + /** + * Raw request with callback. + * @param info + * @param data + * @param onResult + */ + requestRawWithCallback(info, data, onResult) { + let socket; + if (typeof data === "string") { + info.options.headers["Content-Length"] = Buffer.byteLength(data, "utf8"); + } + let callbackCalled = false; + let handleResult = (err, res) => { + if (!callbackCalled) { + callbackCalled = true; + onResult(err, res); + } + }; + let req = info.httpModule.request(info.options, (msg) => { + let res = new HttpClientResponse(msg); + handleResult(null, res); + }); + req.on("socket", (sock) => { + socket = sock; + }); + req.setTimeout(this._socketTimeout || 3 * 6e4, () => { + if (socket) { + socket.destroy(); + } + handleResult(new Error("Request timeout: " + info.options.path), null); + }); + req.on("error", function(err) { + handleResult(err, null); + }); + if (data && typeof data === "string") { + req.write(data, "utf8"); + } + if (data && typeof data !== "string") { + data.on("close", function() { + req.end(); + }); + data.pipe(req); + } else { + req.end(); + } + } + _prepareRequest(method, requestUrl, headers) { + const info = {}; + info.parsedUrl = requestUrl; + const usingSsl = info.parsedUrl.protocol === "https:"; + info.httpModule = usingSsl ? https : http; + const defaultPort = usingSsl ? 443 : 80; + info.options = {}; + info.options.host = info.parsedUrl.hostname; + info.options.port = info.parsedUrl.port ? parseInt(info.parsedUrl.port) : defaultPort; + info.options.path = (info.parsedUrl.pathname || "") + (info.parsedUrl.search || ""); + info.options.method = method; + info.options.timeout = this.requestOptions && this.requestOptions.socketTimeout || this._socketTimeout; + this._socketTimeout = info.options.timeout; + info.options.headers = this._mergeHeaders(headers); + if (this.userAgent != null) { + info.options.headers["user-agent"] = this.userAgent; + } + info.options.agent = this._getAgent(info.parsedUrl); + if (this.handlers && !this._isPresigned(url.format(requestUrl))) { + this.handlers.forEach((handler) => { + handler.prepareRequest(info.options); + }); + } + return info; + } + _isPresigned(requestUrl) { + if (this.requestOptions && this.requestOptions.presignedUrlPatterns) { + const patterns = this.requestOptions.presignedUrlPatterns; + for (let i = 0; i < patterns.length; i++) { + if (requestUrl.match(patterns[i])) { + return true; + } + } + } + return false; + } + _mergeHeaders(headers) { + const lowercaseKeys = (obj) => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + if (this.requestOptions && this.requestOptions.headers) { + return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); + } + return lowercaseKeys(headers || {}); + } + _getAgent(parsedUrl) { + let agent; + let proxy = this._getProxy(parsedUrl); + let useProxy = proxy.proxyUrl && proxy.proxyUrl.hostname && !this._isMatchInBypassProxyList(parsedUrl); + if (this._keepAlive && useProxy) { + agent = this._proxyAgent; + } + if (this._keepAlive && !useProxy) { + agent = this._agent; + } + if (!!agent) { + return agent; + } + const usingSsl = parsedUrl.protocol === "https:"; + let maxSockets = 100; + if (!!this.requestOptions) { + maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; + } + if (useProxy) { + if (!tunnel) { + tunnel = require_tunnel2(); + } + const agentOptions = { + maxSockets, + keepAlive: this._keepAlive, + proxy: { + proxyAuth: proxy.proxyAuth, + host: proxy.proxyUrl.hostname, + port: proxy.proxyUrl.port + } + }; + let tunnelAgent; + const overHttps = proxy.proxyUrl.protocol === "https:"; + if (usingSsl) { + tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; + } else { + tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; + } + agent = tunnelAgent(agentOptions); + this._proxyAgent = agent; + } + if (this._keepAlive && !agent) { + const options = { keepAlive: this._keepAlive, maxSockets }; + agent = usingSsl ? new https.Agent(options) : new http.Agent(options); + this._agent = agent; + } + if (!agent) { + const globalAgentOptions = { + keepAlive: this._httpGlobalAgentOptions.keepAlive, + timeout: this._httpGlobalAgentOptions.timeout + }; + agent = usingSsl ? new https.Agent(globalAgentOptions) : new http.Agent(globalAgentOptions); + } + if (usingSsl && this._ignoreSslError) { + agent.options = Object.assign(agent.options || {}, { rejectUnauthorized: false }); + } + if (usingSsl && this._certConfig) { + agent.options = Object.assign(agent.options || {}, { ca: this._ca, cert: this._cert, key: this._key, passphrase: this._certConfig.passphrase }); + } + return agent; + } + _getProxy(parsedUrl) { + let usingSsl = parsedUrl.protocol === "https:"; + let proxyConfig = this._httpProxy; + let https_proxy = process.env[EnvironmentVariables.HTTPS_PROXY]; + let http_proxy = process.env[EnvironmentVariables.HTTP_PROXY]; + if (!proxyConfig) { + if (https_proxy && usingSsl) { + proxyConfig = { + proxyUrl: https_proxy + }; + } else if (http_proxy) { + proxyConfig = { + proxyUrl: http_proxy + }; + } + } + let proxyUrl; + let proxyAuth; + if (proxyConfig) { + if (proxyConfig.proxyUrl.length > 0) { + proxyUrl = url.parse(proxyConfig.proxyUrl); + } + if (proxyConfig.proxyUsername || proxyConfig.proxyPassword) { + proxyAuth = proxyConfig.proxyUsername + ":" + proxyConfig.proxyPassword; + } + } + return { proxyUrl, proxyAuth }; + } + _isMatchInBypassProxyList(parsedUrl) { + if (!this._httpProxyBypassHosts) { + return false; + } + let bypass = false; + this._httpProxyBypassHosts.forEach((bypassHost) => { + if (bypassHost.test(parsedUrl.href)) { + bypass = true; + } + }); + return bypass; + } + _performExponentialBackoff(retryNumber) { + retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); + const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); + return new Promise((resolve) => setTimeout(() => resolve(), ms)); + } + }; + exports2.HttpClient = HttpClient; + } +}); + +// ../node_modules/azure-devops-node-api/node_modules/typed-rest-client/RestClient.js +var require_RestClient = __commonJS({ + "../node_modules/azure-devops-node-api/node_modules/typed-rest-client/RestClient.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.RestClient = void 0; + var httpm = require_HttpClient2(); + var util = require_Util2(); + var RestClient = class _RestClient { + /** + * Creates an instance of the RestClient + * @constructor + * @param {string} userAgent - userAgent for requests + * @param {string} baseUrl - (Optional) If not specified, use full urls per request. If supplied and a function passes a relative url, it will be appended to this + * @param {ifm.IRequestHandler[]} handlers - handlers are typically auth handlers (basic, bearer, ntlm supplied) + * @param {ifm.IRequestOptions} requestOptions - options for each http requests (http proxy setting, socket timeout) + */ + constructor(userAgent, baseUrl, handlers, requestOptions) { + this.client = new httpm.HttpClient(userAgent, handlers, requestOptions); + if (baseUrl) { + this._baseUrl = baseUrl; + } + } + /** + * Gets a resource from an endpoint + * Be aware that not found returns a null. Other error conditions reject the promise + * @param {string} requestUrl - fully qualified or relative url + * @param {IRequestOptions} requestOptions - (optional) requestOptions object + */ + options(requestUrl, options) { + return __awaiter2(this, void 0, void 0, function* () { + let url = util.getUrl(requestUrl, this._baseUrl); + let res = yield this.client.options(url, this._headersFromOptions(options)); + return this.processResponse(res, options); + }); + } + /** + * Gets a resource from an endpoint + * Be aware that not found returns a null. Other error conditions reject the promise + * @param {string} resource - fully qualified url or relative path + * @param {IRequestOptions} requestOptions - (optional) requestOptions object + */ + get(resource, options) { + return __awaiter2(this, void 0, void 0, function* () { + let url = util.getUrl(resource, this._baseUrl, (options || {}).queryParameters); + let res = yield this.client.get(url, this._headersFromOptions(options)); + return this.processResponse(res, options); + }); + } + /** + * Deletes a resource from an endpoint + * Be aware that not found returns a null. Other error conditions reject the promise + * @param {string} resource - fully qualified or relative url + * @param {IRequestOptions} requestOptions - (optional) requestOptions object + */ + del(resource, options) { + return __awaiter2(this, void 0, void 0, function* () { + let url = util.getUrl(resource, this._baseUrl, (options || {}).queryParameters); + let res = yield this.client.del(url, this._headersFromOptions(options)); + return this.processResponse(res, options); + }); + } + /** + * Creates resource(s) from an endpoint + * T type of object returned. + * Be aware that not found returns a null. Other error conditions reject the promise + * @param {string} resource - fully qualified or relative url + * @param {IRequestOptions} requestOptions - (optional) requestOptions object + */ + create(resource, resources, options) { + return __awaiter2(this, void 0, void 0, function* () { + let url = util.getUrl(resource, this._baseUrl); + let headers = this._headersFromOptions(options, true); + let data = JSON.stringify(resources, null, 2); + let res = yield this.client.post(url, data, headers); + return this.processResponse(res, options); + }); + } + /** + * Updates resource(s) from an endpoint + * T type of object returned. + * Be aware that not found returns a null. Other error conditions reject the promise + * @param {string} resource - fully qualified or relative url + * @param {IRequestOptions} requestOptions - (optional) requestOptions object + */ + update(resource, resources, options) { + return __awaiter2(this, void 0, void 0, function* () { + let url = util.getUrl(resource, this._baseUrl); + let headers = this._headersFromOptions(options, true); + let data = JSON.stringify(resources, null, 2); + let res = yield this.client.patch(url, data, headers); + return this.processResponse(res, options); + }); + } + /** + * Replaces resource(s) from an endpoint + * T type of object returned. + * Be aware that not found returns a null. Other error conditions reject the promise + * @param {string} resource - fully qualified or relative url + * @param {IRequestOptions} requestOptions - (optional) requestOptions object + */ + replace(resource, resources, options) { + return __awaiter2(this, void 0, void 0, function* () { + let url = util.getUrl(resource, this._baseUrl); + let headers = this._headersFromOptions(options, true); + let data = JSON.stringify(resources, null, 2); + let res = yield this.client.put(url, data, headers); + return this.processResponse(res, options); + }); + } + uploadStream(verb, requestUrl, stream, options) { + return __awaiter2(this, void 0, void 0, function* () { + let url = util.getUrl(requestUrl, this._baseUrl); + let headers = this._headersFromOptions(options, true); + let res = yield this.client.sendStream(verb, url, stream, headers); + return this.processResponse(res, options); + }); + } + _headersFromOptions(options, contentType) { + options = options || {}; + let headers = options.additionalHeaders || {}; + headers["Accept"] = options.acceptHeader || "application/json"; + if (contentType) { + let found = false; + for (let header in headers) { + if (header.toLowerCase() == "content-type") { + found = true; + } + } + if (!found) { + headers["Content-Type"] = "application/json; charset=utf-8"; + } + } + return headers; + } + static dateTimeDeserializer(key, value) { + if (typeof value === "string") { + let a = new Date(value); + if (!isNaN(a.valueOf())) { + return a; + } + } + return value; + } + processResponse(res, options) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + const statusCode = res.message.statusCode; + const response = { + statusCode, + result: null, + headers: {} + }; + if (statusCode == httpm.HttpCodes.NotFound) { + resolve(response); + } + let obj; + let contents; + try { + contents = yield res.readBody(); + if (contents && contents.length > 0) { + if (options && options.deserializeDates) { + obj = JSON.parse(contents, _RestClient.dateTimeDeserializer); + } else { + obj = JSON.parse(contents); + } + if (options && options.responseProcessor) { + response.result = options.responseProcessor(obj); + } else { + response.result = obj; + } + } + response.headers = res.message.headers; + } catch (err) { + } + if (statusCode > 299) { + let msg; + if (obj && obj.message) { + msg = obj.message; + } else if (contents && contents.length > 0) { + msg = contents; + } else { + msg = "Failed request: (" + statusCode + ")"; + } + let err = new Error(msg); + err["statusCode"] = statusCode; + if (response.result) { + err["result"] = response.result; + } + if (response.headers) { + err["responseHeaders"] = response.headers; + } + reject2(err); + } else { + resolve(response); + } + })); + }); + } + }; + exports2.RestClient = RestClient; + } +}); + +// ../node_modules/azure-devops-node-api/ClientApiBases.js +var require_ClientApiBases = __commonJS({ + "../node_modules/azure-devops-node-api/ClientApiBases.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ClientApiBase = void 0; + var vsom = require_VsoClient(); + var serm = require_Serialization(); + var rm = require_RestClient(); + var hm = require_HttpClient2(); + var ClientApiBase = class { + constructor(baseUrl, handlers, userAgent, options) { + this.baseUrl = baseUrl; + this.http = new hm.HttpClient(userAgent, handlers, options); + this.rest = new rm.RestClient(userAgent, null, handlers, options); + this.vsoClient = new vsom.VsoClient(baseUrl, this.rest); + this.userAgent = userAgent; + } + createAcceptHeader(type, apiVersion) { + return type + (apiVersion ? ";api-version=" + apiVersion : ""); + } + createRequestOptions(type, apiVersion) { + let options = {}; + options.acceptHeader = this.createAcceptHeader(type, apiVersion); + return options; + } + formatResponse(data, responseTypeMetadata, isCollection) { + let serializationData = { + responseTypeMetadata, + responseIsCollection: isCollection + }; + let deserializedResult = serm.ContractSerializer.deserialize(data, serializationData.responseTypeMetadata, false, serializationData.responseIsCollection); + return deserializedResult; + } + }; + exports2.ClientApiBase = ClientApiBase; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/AlertInterfaces.js +var require_AlertInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/AlertInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.State = exports2.Severity = exports2.SarifJobStatus = exports2.ResultType = exports2.MetadataOperation = exports2.MetadataChangeType = exports2.ExpandOption = exports2.DismissalType = exports2.Confidence = exports2.ComponentType = exports2.AnalysisConfigurationType = exports2.AlertType = void 0; + var AlertType; + (function(AlertType2) { + AlertType2[AlertType2["Unknown"] = 0] = "Unknown"; + AlertType2[AlertType2["Dependency"] = 1] = "Dependency"; + AlertType2[AlertType2["Secret"] = 2] = "Secret"; + AlertType2[AlertType2["Code"] = 3] = "Code"; + })(AlertType = exports2.AlertType || (exports2.AlertType = {})); + var AnalysisConfigurationType; + (function(AnalysisConfigurationType2) { + AnalysisConfigurationType2[AnalysisConfigurationType2["Default"] = 0] = "Default"; + AnalysisConfigurationType2[AnalysisConfigurationType2["AdoPipeline"] = 1] = "AdoPipeline"; + })(AnalysisConfigurationType = exports2.AnalysisConfigurationType || (exports2.AnalysisConfigurationType = {})); + var ComponentType; + (function(ComponentType2) { + ComponentType2[ComponentType2["Unknown"] = 0] = "Unknown"; + ComponentType2[ComponentType2["NuGet"] = 1] = "NuGet"; + ComponentType2[ComponentType2["Npm"] = 2] = "Npm"; + ComponentType2[ComponentType2["Maven"] = 3] = "Maven"; + ComponentType2[ComponentType2["Git"] = 4] = "Git"; + ComponentType2[ComponentType2["Other"] = 5] = "Other"; + ComponentType2[ComponentType2["RubyGems"] = 6] = "RubyGems"; + ComponentType2[ComponentType2["Cargo"] = 7] = "Cargo"; + ComponentType2[ComponentType2["Pip"] = 8] = "Pip"; + ComponentType2[ComponentType2["File"] = 9] = "File"; + ComponentType2[ComponentType2["Go"] = 10] = "Go"; + ComponentType2[ComponentType2["DockerImage"] = 11] = "DockerImage"; + ComponentType2[ComponentType2["Pod"] = 12] = "Pod"; + ComponentType2[ComponentType2["Linux"] = 13] = "Linux"; + ComponentType2[ComponentType2["Conda"] = 14] = "Conda"; + ComponentType2[ComponentType2["DockerReference"] = 15] = "DockerReference"; + ComponentType2[ComponentType2["Vcpkg"] = 16] = "Vcpkg"; + })(ComponentType = exports2.ComponentType || (exports2.ComponentType = {})); + var Confidence; + (function(Confidence2) { + Confidence2[Confidence2["High"] = 0] = "High"; + Confidence2[Confidence2["Other"] = 1] = "Other"; + })(Confidence = exports2.Confidence || (exports2.Confidence = {})); + var DismissalType; + (function(DismissalType2) { + DismissalType2[DismissalType2["Unknown"] = 0] = "Unknown"; + DismissalType2[DismissalType2["Fixed"] = 1] = "Fixed"; + DismissalType2[DismissalType2["AcceptedRisk"] = 2] = "AcceptedRisk"; + DismissalType2[DismissalType2["FalsePositive"] = 3] = "FalsePositive"; + })(DismissalType = exports2.DismissalType || (exports2.DismissalType = {})); + var ExpandOption; + (function(ExpandOption2) { + ExpandOption2[ExpandOption2["None"] = 0] = "None"; + ExpandOption2[ExpandOption2["ValidationFingerprint"] = 1] = "ValidationFingerprint"; + })(ExpandOption = exports2.ExpandOption || (exports2.ExpandOption = {})); + var MetadataChangeType; + (function(MetadataChangeType2) { + MetadataChangeType2[MetadataChangeType2["None"] = 0] = "None"; + MetadataChangeType2[MetadataChangeType2["Created"] = 1] = "Created"; + MetadataChangeType2[MetadataChangeType2["Updated"] = 2] = "Updated"; + MetadataChangeType2[MetadataChangeType2["Deleted"] = 3] = "Deleted"; + })(MetadataChangeType = exports2.MetadataChangeType || (exports2.MetadataChangeType = {})); + var MetadataOperation; + (function(MetadataOperation2) { + MetadataOperation2[MetadataOperation2["Add"] = 0] = "Add"; + MetadataOperation2[MetadataOperation2["Remove"] = 1] = "Remove"; + })(MetadataOperation = exports2.MetadataOperation || (exports2.MetadataOperation = {})); + var ResultType; + (function(ResultType2) { + ResultType2[ResultType2["Unknown"] = 0] = "Unknown"; + ResultType2[ResultType2["Dependency"] = 1] = "Dependency"; + ResultType2[ResultType2["VersionControl"] = 2] = "VersionControl"; + })(ResultType = exports2.ResultType || (exports2.ResultType = {})); + var SarifJobStatus; + (function(SarifJobStatus2) { + SarifJobStatus2[SarifJobStatus2["New"] = 0] = "New"; + SarifJobStatus2[SarifJobStatus2["Queued"] = 1] = "Queued"; + SarifJobStatus2[SarifJobStatus2["Completed"] = 2] = "Completed"; + SarifJobStatus2[SarifJobStatus2["Failed"] = 3] = "Failed"; + })(SarifJobStatus = exports2.SarifJobStatus || (exports2.SarifJobStatus = {})); + var Severity; + (function(Severity2) { + Severity2[Severity2["Low"] = 0] = "Low"; + Severity2[Severity2["Medium"] = 1] = "Medium"; + Severity2[Severity2["High"] = 2] = "High"; + Severity2[Severity2["Critical"] = 3] = "Critical"; + Severity2[Severity2["Note"] = 4] = "Note"; + Severity2[Severity2["Warning"] = 5] = "Warning"; + Severity2[Severity2["Error"] = 6] = "Error"; + })(Severity = exports2.Severity || (exports2.Severity = {})); + var State; + (function(State2) { + State2[State2["Unknown"] = 0] = "Unknown"; + State2[State2["Active"] = 1] = "Active"; + State2[State2["Dismissed"] = 2] = "Dismissed"; + State2[State2["Fixed"] = 4] = "Fixed"; + State2[State2["AutoDismissed"] = 8] = "AutoDismissed"; + })(State = exports2.State || (exports2.State = {})); + exports2.TypeInfo = { + Alert: {}, + AlertAnalysisInstance: {}, + AlertMetadata: {}, + AlertMetadataChange: {}, + AlertStateUpdate: {}, + AlertType: { + enumValues: { + "unknown": 0, + "dependency": 1, + "secret": 2, + "code": 3 + } + }, + AnalysisConfiguration: {}, + AnalysisConfigurationType: { + enumValues: { + "default": 0, + "adoPipeline": 1 + } + }, + AnalysisInstance: {}, + AnalysisResult: {}, + Branch: {}, + ComponentType: { + enumValues: { + "unknown": 0, + "nuGet": 1, + "npm": 2, + "maven": 3, + "git": 4, + "other": 5, + "rubyGems": 6, + "cargo": 7, + "pip": 8, + "file": 9, + "go": 10, + "dockerImage": 11, + "pod": 12, + "linux": 13, + "conda": 14, + "dockerReference": 15, + "vcpkg": 16 + } + }, + Confidence: { + enumValues: { + "high": 0, + "other": 1 + } + }, + Dependency: {}, + DependencyResult: {}, + Dismissal: {}, + DismissalType: { + enumValues: { + "unknown": 0, + "fixed": 1, + "acceptedRisk": 2, + "falsePositive": 3 + } + }, + ExpandOption: { + enumValues: { + "none": 0, + "validationFingerprint": 1 + } + }, + Metadata: {}, + MetadataChange: {}, + MetadataChangeType: { + enumValues: { + "none": 0, + "created": 1, + "updated": 2, + "deleted": 3 + } + }, + MetadataOperation: { + enumValues: { + "add": 0, + "remove": 1 + } + }, + Result: {}, + ResultType: { + enumValues: { + "unknown": 0, + "dependency": 1, + "versionControl": 2 + } + }, + SarifJobStatus: { + enumValues: { + "new": 0, + "queued": 1, + "completed": 2, + "failed": 3 + } + }, + SarifUploadStatus: {}, + SearchCriteria: {}, + Severity: { + enumValues: { + "low": 0, + "medium": 1, + "high": 2, + "critical": 3, + "note": 4, + "warning": 5, + "error": 6 + } + }, + State: { + enumValues: { + "unknown": 0, + "active": 1, + "dismissed": 2, + "fixed": 4, + "autoDismissed": 8 + } + }, + UxFilters: {} + }; + exports2.TypeInfo.Alert.fields = { + alertType: { + enumType: exports2.TypeInfo.AlertType + }, + confidence: { + enumType: exports2.TypeInfo.Confidence + }, + dismissal: { + typeInfo: exports2.TypeInfo.Dismissal + }, + firstSeenDate: { + isDate: true + }, + fixedDate: { + isDate: true + }, + introducedDate: { + isDate: true + }, + lastSeenDate: { + isDate: true + }, + severity: { + enumType: exports2.TypeInfo.Severity + }, + state: { + enumType: exports2.TypeInfo.State + } + }; + exports2.TypeInfo.AlertAnalysisInstance.fields = { + analysisConfiguration: { + typeInfo: exports2.TypeInfo.AnalysisConfiguration + }, + firstSeen: { + typeInfo: exports2.TypeInfo.AnalysisInstance + }, + fixedIn: { + typeInfo: exports2.TypeInfo.AnalysisInstance + }, + lastSeen: { + typeInfo: exports2.TypeInfo.AnalysisInstance + }, + recentAnalysisInstance: { + typeInfo: exports2.TypeInfo.AnalysisInstance + }, + state: { + enumType: exports2.TypeInfo.State + } + }; + exports2.TypeInfo.AlertMetadata.fields = { + metadata: { + isArray: true, + typeInfo: exports2.TypeInfo.Metadata + } + }; + exports2.TypeInfo.AlertMetadataChange.fields = { + metadataChange: { + typeInfo: exports2.TypeInfo.MetadataChange + } + }; + exports2.TypeInfo.AlertStateUpdate.fields = { + dismissedReason: { + enumType: exports2.TypeInfo.DismissalType + }, + state: { + enumType: exports2.TypeInfo.State + } + }; + exports2.TypeInfo.AnalysisConfiguration.fields = { + analysisConfigurationType: { + enumType: exports2.TypeInfo.AnalysisConfigurationType + } + }; + exports2.TypeInfo.AnalysisInstance.fields = { + configuration: { + typeInfo: exports2.TypeInfo.AnalysisConfiguration + }, + createdDate: { + isDate: true + }, + results: { + isArray: true, + typeInfo: exports2.TypeInfo.AnalysisResult + } + }; + exports2.TypeInfo.AnalysisResult.fields = { + result: { + typeInfo: exports2.TypeInfo.Result + }, + state: { + enumType: exports2.TypeInfo.State + } + }; + exports2.TypeInfo.Branch.fields = { + deletedDate: { + isDate: true + } + }; + exports2.TypeInfo.Dependency.fields = { + componentType: { + enumType: exports2.TypeInfo.ComponentType + } + }; + exports2.TypeInfo.DependencyResult.fields = { + dependency: { + typeInfo: exports2.TypeInfo.Dependency + } + }; + exports2.TypeInfo.Dismissal.fields = { + dismissalType: { + enumType: exports2.TypeInfo.DismissalType + }, + requestedOn: { + isDate: true + } + }; + exports2.TypeInfo.Metadata.fields = { + op: { + enumType: exports2.TypeInfo.MetadataOperation + } + }; + exports2.TypeInfo.MetadataChange.fields = { + changeType: { + enumType: exports2.TypeInfo.MetadataChangeType + } + }; + exports2.TypeInfo.Result.fields = { + dependencyResult: { + typeInfo: exports2.TypeInfo.DependencyResult + }, + resultType: { + enumType: exports2.TypeInfo.ResultType + }, + severity: { + enumType: exports2.TypeInfo.Severity + } + }; + exports2.TypeInfo.SarifUploadStatus.fields = { + processingStatus: { + enumType: exports2.TypeInfo.SarifJobStatus + } + }; + exports2.TypeInfo.SearchCriteria.fields = { + alertType: { + enumType: exports2.TypeInfo.AlertType + }, + confidenceLevels: { + isArray: true, + enumType: exports2.TypeInfo.Confidence + }, + fromDate: { + isDate: true + }, + modifiedSince: { + isDate: true + }, + severities: { + isArray: true, + enumType: exports2.TypeInfo.Severity + }, + states: { + isArray: true, + enumType: exports2.TypeInfo.State + }, + toDate: { + isDate: true + } + }; + exports2.TypeInfo.UxFilters.fields = { + branches: { + isArray: true, + typeInfo: exports2.TypeInfo.Branch + }, + confidenceLevels: { + isArray: true, + enumType: exports2.TypeInfo.Confidence + }, + packages: { + isArray: true, + typeInfo: exports2.TypeInfo.Dependency + }, + severities: { + isArray: true, + enumType: exports2.TypeInfo.Severity + }, + states: { + isArray: true, + enumType: exports2.TypeInfo.State + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/AlertApi.js +var require_AlertApi = __commonJS({ + "../node_modules/azure-devops-node-api/AlertApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AlertApi = void 0; + var basem = require_ClientApiBases(); + var AlertInterfaces = require_AlertInterfaces(); + var AlertApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Alert-api", options); + } + /** + * Get an alert. + * + * @param {string} project - Project ID or project name + * @param {number} alertId - ID of alert to retrieve + * @param {string} repository - Name or id of a repository that alert is part of + * @param {string} ref + * @param {AlertInterfaces.ExpandOption} expand - Expand alert attributes. Possible options are {ValidationFingerprint, None} + */ + getAlert(project, alertId, repository, ref, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + alertId, + repository + }; + let queryValues = { + ref, + expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Alert", "e21b4630-b7d2-4031-99e3-3ad328cc4a7f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, AlertInterfaces.TypeInfo.Alert, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get alerts for a repository + * + * @param {string} project - Project ID or project name + * @param {string} repository - The name or ID of the repository + * @param {number} top - The maximum number of alerts to return + * @param {string} orderBy - Must be "id" "firstSeen" "lastSeen" "fixedOn" or "severity" Defaults to "id" + * @param {AlertInterfaces.SearchCriteria} criteria - Options to limit the alerts returned + * @param {string} continuationToken - If there are more alerts than can be returned, a continuation token is placed in the "x-ms-continuationtoken" header. Use that token here to get the next page of alerts + */ + getAlerts(project, repository, top, orderBy, criteria, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repository + }; + let queryValues = { + top, + orderBy, + criteria, + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Alert", "e21b4630-b7d2-4031-99e3-3ad328cc4a7f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, AlertInterfaces.TypeInfo.Alert, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get an alert. + * + * @param {string} project - Project ID or project name + * @param {number} alertId - ID of alert to retrieve + * @param {string} repository - Name or id of a repository that alert is part of + * @param {string} ref + * @param {AlertInterfaces.ExpandOption} expand - Expand alert attributes. Possible options are {ValidationFingerprint, None} + */ + getAlertSarif(project, alertId, repository, ref, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + alertId, + repository + }; + let queryValues = { + ref, + expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Alert", "e21b4630-b7d2-4031-99e3-3ad328cc4a7f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update the status of an alert + * + * @param {AlertInterfaces.AlertStateUpdate} stateUpdate - The new status of the alert + * @param {string} project - Project ID or project name + * @param {number} alertId - The ID of the alert + * @param {string} repository - The name or ID of the repository + */ + updateAlert(stateUpdate, project, alertId, repository) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + alertId, + repository + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Alert", "e21b4630-b7d2-4031-99e3-3ad328cc4a7f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, stateUpdate, options); + let ret = this.formatResponse(res.result, AlertInterfaces.TypeInfo.Alert, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get instances of an alert. + * + * @param {string} project - Project ID or project name + * @param {number} alertId - ID of alert to retrieve + * @param {string} repository - Name or id of a repository that alert is part of + * @param {string} ref + */ + getAlertInstances(project, alertId, repository, ref) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + alertId, + repository + }; + let queryValues = { + ref + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Alert", "f451ba96-0e95-458a-8dd5-3df894770a49", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, AlertInterfaces.TypeInfo.AlertAnalysisInstance, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update alert metadata associations. + * + * @param {AlertInterfaces.AlertMetadata[]} alertsMetadata - A list of metadata to associate with alerts. + * @param {string} project - Project ID or project name + * @param {string} repository - The name or ID of the repository. + */ + updateAlertsMetadata(alertsMetadata, project, repository) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repository + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Alert", "65de4b84-7519-4ae8-8623-175f79b49b80", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, alertsMetadata, options); + let ret = this.formatResponse(res.result, AlertInterfaces.TypeInfo.AlertMetadataChange, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Upload a Sarif containing security alerts + * + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} project - Project ID or project name + * @param {string} repository - The name or ID of a repository + */ + uploadSarif(customHeaders, contentStream, project, repository) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repository + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Alert", "2a141cae-a50d-4c22-b41b-13f77748d035", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("POST", url, contentStream, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} repository + * @param {AlertInterfaces.AlertType} alertType + */ + getUxFilters(project, repository, alertType) { + return __awaiter2(this, void 0, void 0, function* () { + if (alertType == null) { + throw new TypeError("alertType can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repository + }; + let queryValues = { + alertType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Alert", "8f90675b-f794-434d-8f2c-cfae0a11c02a", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, AlertInterfaces.TypeInfo.UxFilters, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the status of the Sarif processing job + * + * @param {number} sarifId - Sarif ID returned when the Sarif was uploaded + */ + getSarif(sarifId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + sarifId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Alert", "a04689e7-0f81-48a2-8d18-40654c47494c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, AlertInterfaces.TypeInfo.SarifUploadStatus, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.AlertApi = AlertApi; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/common/SystemDataInterfaces.js +var require_SystemDataInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/common/SystemDataInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.SqlDbType = void 0; + var SqlDbType; + (function(SqlDbType2) { + SqlDbType2[SqlDbType2["BigInt"] = 0] = "BigInt"; + SqlDbType2[SqlDbType2["Binary"] = 1] = "Binary"; + SqlDbType2[SqlDbType2["Bit"] = 2] = "Bit"; + SqlDbType2[SqlDbType2["Char"] = 3] = "Char"; + SqlDbType2[SqlDbType2["DateTime"] = 4] = "DateTime"; + SqlDbType2[SqlDbType2["Decimal"] = 5] = "Decimal"; + SqlDbType2[SqlDbType2["Float"] = 6] = "Float"; + SqlDbType2[SqlDbType2["Image"] = 7] = "Image"; + SqlDbType2[SqlDbType2["Int"] = 8] = "Int"; + SqlDbType2[SqlDbType2["Money"] = 9] = "Money"; + SqlDbType2[SqlDbType2["NChar"] = 10] = "NChar"; + SqlDbType2[SqlDbType2["NText"] = 11] = "NText"; + SqlDbType2[SqlDbType2["NVarChar"] = 12] = "NVarChar"; + SqlDbType2[SqlDbType2["Real"] = 13] = "Real"; + SqlDbType2[SqlDbType2["UniqueIdentifier"] = 14] = "UniqueIdentifier"; + SqlDbType2[SqlDbType2["SmallDateTime"] = 15] = "SmallDateTime"; + SqlDbType2[SqlDbType2["SmallInt"] = 16] = "SmallInt"; + SqlDbType2[SqlDbType2["SmallMoney"] = 17] = "SmallMoney"; + SqlDbType2[SqlDbType2["Text"] = 18] = "Text"; + SqlDbType2[SqlDbType2["Timestamp"] = 19] = "Timestamp"; + SqlDbType2[SqlDbType2["TinyInt"] = 20] = "TinyInt"; + SqlDbType2[SqlDbType2["VarBinary"] = 21] = "VarBinary"; + SqlDbType2[SqlDbType2["VarChar"] = 22] = "VarChar"; + SqlDbType2[SqlDbType2["Variant"] = 23] = "Variant"; + SqlDbType2[SqlDbType2["Xml"] = 25] = "Xml"; + SqlDbType2[SqlDbType2["Udt"] = 29] = "Udt"; + SqlDbType2[SqlDbType2["Structured"] = 30] = "Structured"; + SqlDbType2[SqlDbType2["Date"] = 31] = "Date"; + SqlDbType2[SqlDbType2["Time"] = 32] = "Time"; + SqlDbType2[SqlDbType2["DateTime2"] = 33] = "DateTime2"; + SqlDbType2[SqlDbType2["DateTimeOffset"] = 34] = "DateTimeOffset"; + })(SqlDbType = exports2.SqlDbType || (exports2.SqlDbType = {})); + exports2.TypeInfo = { + SqlDbType: { + enumValues: { + "BigInt": 0, + "Binary": 1, + "Bit": 2, + "Char": 3, + "DateTime": 4, + "Decimal": 5, + "Float": 6, + "Image": 7, + "Int": 8, + "Money": 9, + "NChar": 10, + "NText": 11, + "NVarChar": 12, + "Real": 13, + "UniqueIdentifier": 14, + "SmallDateTime": 15, + "SmallInt": 16, + "SmallMoney": 17, + "Text": 18, + "Timestamp": 19, + "TinyInt": 20, + "VarBinary": 21, + "VarChar": 22, + "Variant": 23, + "Xml": 25, + "Udt": 29, + "Structured": 30, + "Date": 31, + "Time": 32, + "DateTime2": 33, + "DateTimeOffset": 34 + } + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/TestInterfaces.js +var require_TestInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/TestInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.TestSessionState = exports2.TestSessionSource = exports2.TestRunSubstate = exports2.TestRunState = exports2.TestRunPublishContext = exports2.TestRunOutcome = exports2.TestResultsSettingsType = exports2.TestResultsSessionState = exports2.TestResultsContextType = exports2.TestResultGroupBy = exports2.TestPointState = exports2.TestOutcome = exports2.TestLogType = exports2.TestLogStoreOperationType = exports2.TestLogStoreEndpointType = exports2.TestLogStatusCode = exports2.TestLogScope = exports2.TestConfigurationState = exports2.TCMServiceDataMigrationStatus = exports2.SuiteExpand = exports2.SessionTimelineType = exports2.SessionResult = exports2.Service = exports2.RunType = exports2.ResultObjectType = exports2.ResultMetaDataDetails = exports2.ResultMetadata = exports2.ResultGroupType = exports2.ResultDetails = exports2.OperationType = exports2.Metrics = exports2.FlakyDetectionType = exports2.CustomTestFieldType = exports2.CustomTestFieldScope = exports2.CoverageSummaryStatus = exports2.CoverageStatus = exports2.CoverageQueryFlags = exports2.CoverageDetailedSummaryStatus = exports2.CloneOperationState = exports2.AttachmentType = void 0; + var SystemData = require_SystemDataInterfaces(); + var TfsCoreInterfaces = require_CoreInterfaces(); + var AttachmentType; + (function(AttachmentType2) { + AttachmentType2[AttachmentType2["GeneralAttachment"] = 0] = "GeneralAttachment"; + AttachmentType2[AttachmentType2["AfnStrip"] = 1] = "AfnStrip"; + AttachmentType2[AttachmentType2["BugFilingData"] = 2] = "BugFilingData"; + AttachmentType2[AttachmentType2["CodeCoverage"] = 3] = "CodeCoverage"; + AttachmentType2[AttachmentType2["IntermediateCollectorData"] = 4] = "IntermediateCollectorData"; + AttachmentType2[AttachmentType2["RunConfig"] = 5] = "RunConfig"; + AttachmentType2[AttachmentType2["TestImpactDetails"] = 6] = "TestImpactDetails"; + AttachmentType2[AttachmentType2["TmiTestRunDeploymentFiles"] = 7] = "TmiTestRunDeploymentFiles"; + AttachmentType2[AttachmentType2["TmiTestRunReverseDeploymentFiles"] = 8] = "TmiTestRunReverseDeploymentFiles"; + AttachmentType2[AttachmentType2["TmiTestResultDetail"] = 9] = "TmiTestResultDetail"; + AttachmentType2[AttachmentType2["TmiTestRunSummary"] = 10] = "TmiTestRunSummary"; + AttachmentType2[AttachmentType2["ConsoleLog"] = 11] = "ConsoleLog"; + })(AttachmentType = exports2.AttachmentType || (exports2.AttachmentType = {})); + var CloneOperationState; + (function(CloneOperationState2) { + CloneOperationState2[CloneOperationState2["Failed"] = 2] = "Failed"; + CloneOperationState2[CloneOperationState2["InProgress"] = 1] = "InProgress"; + CloneOperationState2[CloneOperationState2["Queued"] = 0] = "Queued"; + CloneOperationState2[CloneOperationState2["Succeeded"] = 3] = "Succeeded"; + })(CloneOperationState = exports2.CloneOperationState || (exports2.CloneOperationState = {})); + var CoverageDetailedSummaryStatus; + (function(CoverageDetailedSummaryStatus2) { + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["None"] = 0] = "None"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["InProgress"] = 1] = "InProgress"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["Finalized"] = 2] = "Finalized"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["Pending"] = 3] = "Pending"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["UpdateRequestQueued"] = 4] = "UpdateRequestQueued"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["NoModulesFound"] = 5] = "NoModulesFound"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["NumberOfFilesExceeded"] = 6] = "NumberOfFilesExceeded"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["NoInputFiles"] = 7] = "NoInputFiles"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["BuildCancelled"] = 8] = "BuildCancelled"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["FailedJobs"] = 9] = "FailedJobs"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["ModuleMergeJobTimeout"] = 10] = "ModuleMergeJobTimeout"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["CodeCoverageSuccess"] = 11] = "CodeCoverageSuccess"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["InvalidBuildConfiguration"] = 12] = "InvalidBuildConfiguration"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["CoverageAnalyzerBuildNotFound"] = 13] = "CoverageAnalyzerBuildNotFound"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["FailedToRequeue"] = 14] = "FailedToRequeue"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["BuildBailedOut"] = 15] = "BuildBailedOut"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["NoCodeCoverageTask"] = 16] = "NoCodeCoverageTask"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["MergeJobFailed"] = 17] = "MergeJobFailed"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["MergeInvokerJobFailed"] = 18] = "MergeInvokerJobFailed"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["MonitorJobFailed"] = 19] = "MonitorJobFailed"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["ModuleMergeInvokerJobTimeout"] = 20] = "ModuleMergeInvokerJobTimeout"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["MonitorJobTimeout"] = 21] = "MonitorJobTimeout"; + CoverageDetailedSummaryStatus2[CoverageDetailedSummaryStatus2["InvalidCoverageInput"] = 22] = "InvalidCoverageInput"; + })(CoverageDetailedSummaryStatus = exports2.CoverageDetailedSummaryStatus || (exports2.CoverageDetailedSummaryStatus = {})); + var CoverageQueryFlags; + (function(CoverageQueryFlags2) { + CoverageQueryFlags2[CoverageQueryFlags2["Modules"] = 1] = "Modules"; + CoverageQueryFlags2[CoverageQueryFlags2["Functions"] = 2] = "Functions"; + CoverageQueryFlags2[CoverageQueryFlags2["BlockData"] = 4] = "BlockData"; + })(CoverageQueryFlags = exports2.CoverageQueryFlags || (exports2.CoverageQueryFlags = {})); + var CoverageStatus; + (function(CoverageStatus2) { + CoverageStatus2[CoverageStatus2["Covered"] = 0] = "Covered"; + CoverageStatus2[CoverageStatus2["NotCovered"] = 1] = "NotCovered"; + CoverageStatus2[CoverageStatus2["PartiallyCovered"] = 2] = "PartiallyCovered"; + })(CoverageStatus = exports2.CoverageStatus || (exports2.CoverageStatus = {})); + var CoverageSummaryStatus; + (function(CoverageSummaryStatus2) { + CoverageSummaryStatus2[CoverageSummaryStatus2["None"] = 0] = "None"; + CoverageSummaryStatus2[CoverageSummaryStatus2["InProgress"] = 1] = "InProgress"; + CoverageSummaryStatus2[CoverageSummaryStatus2["Completed"] = 2] = "Completed"; + CoverageSummaryStatus2[CoverageSummaryStatus2["Finalized"] = 3] = "Finalized"; + CoverageSummaryStatus2[CoverageSummaryStatus2["Pending"] = 4] = "Pending"; + CoverageSummaryStatus2[CoverageSummaryStatus2["UpdateRequestQueued"] = 5] = "UpdateRequestQueued"; + })(CoverageSummaryStatus = exports2.CoverageSummaryStatus || (exports2.CoverageSummaryStatus = {})); + var CustomTestFieldScope; + (function(CustomTestFieldScope2) { + CustomTestFieldScope2[CustomTestFieldScope2["None"] = 0] = "None"; + CustomTestFieldScope2[CustomTestFieldScope2["TestRun"] = 1] = "TestRun"; + CustomTestFieldScope2[CustomTestFieldScope2["TestResult"] = 2] = "TestResult"; + CustomTestFieldScope2[CustomTestFieldScope2["System"] = 4] = "System"; + CustomTestFieldScope2[CustomTestFieldScope2["All"] = 7] = "All"; + })(CustomTestFieldScope = exports2.CustomTestFieldScope || (exports2.CustomTestFieldScope = {})); + var CustomTestFieldType; + (function(CustomTestFieldType2) { + CustomTestFieldType2[CustomTestFieldType2["Bit"] = 2] = "Bit"; + CustomTestFieldType2[CustomTestFieldType2["DateTime"] = 4] = "DateTime"; + CustomTestFieldType2[CustomTestFieldType2["Int"] = 8] = "Int"; + CustomTestFieldType2[CustomTestFieldType2["Float"] = 6] = "Float"; + CustomTestFieldType2[CustomTestFieldType2["String"] = 12] = "String"; + CustomTestFieldType2[CustomTestFieldType2["Guid"] = 14] = "Guid"; + })(CustomTestFieldType = exports2.CustomTestFieldType || (exports2.CustomTestFieldType = {})); + var FlakyDetectionType; + (function(FlakyDetectionType2) { + FlakyDetectionType2[FlakyDetectionType2["Custom"] = 1] = "Custom"; + FlakyDetectionType2[FlakyDetectionType2["System"] = 2] = "System"; + })(FlakyDetectionType = exports2.FlakyDetectionType || (exports2.FlakyDetectionType = {})); + var Metrics; + (function(Metrics2) { + Metrics2[Metrics2["All"] = 1] = "All"; + Metrics2[Metrics2["ResultSummary"] = 2] = "ResultSummary"; + Metrics2[Metrics2["ResultsAnalysis"] = 3] = "ResultsAnalysis"; + Metrics2[Metrics2["RunSummary"] = 4] = "RunSummary"; + })(Metrics = exports2.Metrics || (exports2.Metrics = {})); + var OperationType; + (function(OperationType2) { + OperationType2[OperationType2["Add"] = 1] = "Add"; + OperationType2[OperationType2["Delete"] = 2] = "Delete"; + })(OperationType = exports2.OperationType || (exports2.OperationType = {})); + var ResultDetails; + (function(ResultDetails2) { + ResultDetails2[ResultDetails2["None"] = 0] = "None"; + ResultDetails2[ResultDetails2["Iterations"] = 1] = "Iterations"; + ResultDetails2[ResultDetails2["WorkItems"] = 2] = "WorkItems"; + ResultDetails2[ResultDetails2["SubResults"] = 4] = "SubResults"; + ResultDetails2[ResultDetails2["Point"] = 8] = "Point"; + })(ResultDetails = exports2.ResultDetails || (exports2.ResultDetails = {})); + var ResultGroupType; + (function(ResultGroupType2) { + ResultGroupType2[ResultGroupType2["None"] = 0] = "None"; + ResultGroupType2[ResultGroupType2["Rerun"] = 1] = "Rerun"; + ResultGroupType2[ResultGroupType2["DataDriven"] = 2] = "DataDriven"; + ResultGroupType2[ResultGroupType2["OrderedTest"] = 3] = "OrderedTest"; + ResultGroupType2[ResultGroupType2["Generic"] = 4] = "Generic"; + })(ResultGroupType = exports2.ResultGroupType || (exports2.ResultGroupType = {})); + var ResultMetadata; + (function(ResultMetadata2) { + ResultMetadata2[ResultMetadata2["Rerun"] = 1] = "Rerun"; + ResultMetadata2[ResultMetadata2["Flaky"] = 2] = "Flaky"; + })(ResultMetadata = exports2.ResultMetadata || (exports2.ResultMetadata = {})); + var ResultMetaDataDetails; + (function(ResultMetaDataDetails2) { + ResultMetaDataDetails2[ResultMetaDataDetails2["None"] = 0] = "None"; + ResultMetaDataDetails2[ResultMetaDataDetails2["FlakyIdentifiers"] = 1] = "FlakyIdentifiers"; + })(ResultMetaDataDetails = exports2.ResultMetaDataDetails || (exports2.ResultMetaDataDetails = {})); + var ResultObjectType; + (function(ResultObjectType2) { + ResultObjectType2[ResultObjectType2["TestSuite"] = 0] = "TestSuite"; + ResultObjectType2[ResultObjectType2["TestPlan"] = 1] = "TestPlan"; + })(ResultObjectType = exports2.ResultObjectType || (exports2.ResultObjectType = {})); + var RunType; + (function(RunType2) { + RunType2[RunType2["Unspecified"] = 0] = "Unspecified"; + RunType2[RunType2["Normal"] = 1] = "Normal"; + RunType2[RunType2["Blocking"] = 2] = "Blocking"; + RunType2[RunType2["Web"] = 4] = "Web"; + RunType2[RunType2["MtrRunInitiatedFromWeb"] = 8] = "MtrRunInitiatedFromWeb"; + RunType2[RunType2["RunWithDtlEnv"] = 16] = "RunWithDtlEnv"; + RunType2[RunType2["NoConfigRun"] = 32] = "NoConfigRun"; + })(RunType = exports2.RunType || (exports2.RunType = {})); + var Service; + (function(Service2) { + Service2[Service2["Any"] = 0] = "Any"; + Service2[Service2["Tcm"] = 1] = "Tcm"; + Service2[Service2["Tfs"] = 2] = "Tfs"; + })(Service = exports2.Service || (exports2.Service = {})); + var SessionResult; + (function(SessionResult2) { + SessionResult2[SessionResult2["None"] = 0] = "None"; + SessionResult2[SessionResult2["Passed"] = 1] = "Passed"; + SessionResult2[SessionResult2["Failed"] = 2] = "Failed"; + })(SessionResult = exports2.SessionResult || (exports2.SessionResult = {})); + var SessionTimelineType; + (function(SessionTimelineType2) { + SessionTimelineType2[SessionTimelineType2["None"] = 0] = "None"; + SessionTimelineType2[SessionTimelineType2["Queued"] = 1] = "Queued"; + SessionTimelineType2[SessionTimelineType2["Completed"] = 2] = "Completed"; + SessionTimelineType2[SessionTimelineType2["Started"] = 3] = "Started"; + })(SessionTimelineType = exports2.SessionTimelineType || (exports2.SessionTimelineType = {})); + var SuiteExpand; + (function(SuiteExpand2) { + SuiteExpand2[SuiteExpand2["Children"] = 1] = "Children"; + SuiteExpand2[SuiteExpand2["DefaultTesters"] = 2] = "DefaultTesters"; + })(SuiteExpand = exports2.SuiteExpand || (exports2.SuiteExpand = {})); + var TCMServiceDataMigrationStatus; + (function(TCMServiceDataMigrationStatus2) { + TCMServiceDataMigrationStatus2[TCMServiceDataMigrationStatus2["NotStarted"] = 0] = "NotStarted"; + TCMServiceDataMigrationStatus2[TCMServiceDataMigrationStatus2["InProgress"] = 1] = "InProgress"; + TCMServiceDataMigrationStatus2[TCMServiceDataMigrationStatus2["Completed"] = 2] = "Completed"; + TCMServiceDataMigrationStatus2[TCMServiceDataMigrationStatus2["Failed"] = 3] = "Failed"; + })(TCMServiceDataMigrationStatus = exports2.TCMServiceDataMigrationStatus || (exports2.TCMServiceDataMigrationStatus = {})); + var TestConfigurationState; + (function(TestConfigurationState2) { + TestConfigurationState2[TestConfigurationState2["Active"] = 1] = "Active"; + TestConfigurationState2[TestConfigurationState2["Inactive"] = 2] = "Inactive"; + })(TestConfigurationState = exports2.TestConfigurationState || (exports2.TestConfigurationState = {})); + var TestLogScope; + (function(TestLogScope2) { + TestLogScope2[TestLogScope2["Run"] = 0] = "Run"; + TestLogScope2[TestLogScope2["Build"] = 1] = "Build"; + TestLogScope2[TestLogScope2["Release"] = 2] = "Release"; + })(TestLogScope = exports2.TestLogScope || (exports2.TestLogScope = {})); + var TestLogStatusCode; + (function(TestLogStatusCode2) { + TestLogStatusCode2[TestLogStatusCode2["Success"] = 0] = "Success"; + TestLogStatusCode2[TestLogStatusCode2["Failed"] = 1] = "Failed"; + TestLogStatusCode2[TestLogStatusCode2["FileAlreadyExists"] = 2] = "FileAlreadyExists"; + TestLogStatusCode2[TestLogStatusCode2["InvalidInput"] = 3] = "InvalidInput"; + TestLogStatusCode2[TestLogStatusCode2["InvalidFileName"] = 4] = "InvalidFileName"; + TestLogStatusCode2[TestLogStatusCode2["InvalidContainer"] = 5] = "InvalidContainer"; + TestLogStatusCode2[TestLogStatusCode2["TransferFailed"] = 6] = "TransferFailed"; + TestLogStatusCode2[TestLogStatusCode2["FeatureDisabled"] = 7] = "FeatureDisabled"; + TestLogStatusCode2[TestLogStatusCode2["BuildDoesNotExist"] = 8] = "BuildDoesNotExist"; + TestLogStatusCode2[TestLogStatusCode2["RunDoesNotExist"] = 9] = "RunDoesNotExist"; + TestLogStatusCode2[TestLogStatusCode2["ContainerNotCreated"] = 10] = "ContainerNotCreated"; + TestLogStatusCode2[TestLogStatusCode2["APINotSupported"] = 11] = "APINotSupported"; + TestLogStatusCode2[TestLogStatusCode2["FileSizeExceeds"] = 12] = "FileSizeExceeds"; + TestLogStatusCode2[TestLogStatusCode2["ContainerNotFound"] = 13] = "ContainerNotFound"; + TestLogStatusCode2[TestLogStatusCode2["FileNotFound"] = 14] = "FileNotFound"; + TestLogStatusCode2[TestLogStatusCode2["DirectoryNotFound"] = 15] = "DirectoryNotFound"; + TestLogStatusCode2[TestLogStatusCode2["StorageCapacityExceeded"] = 16] = "StorageCapacityExceeded"; + })(TestLogStatusCode = exports2.TestLogStatusCode || (exports2.TestLogStatusCode = {})); + var TestLogStoreEndpointType; + (function(TestLogStoreEndpointType2) { + TestLogStoreEndpointType2[TestLogStoreEndpointType2["Root"] = 1] = "Root"; + TestLogStoreEndpointType2[TestLogStoreEndpointType2["File"] = 2] = "File"; + })(TestLogStoreEndpointType = exports2.TestLogStoreEndpointType || (exports2.TestLogStoreEndpointType = {})); + var TestLogStoreOperationType; + (function(TestLogStoreOperationType2) { + TestLogStoreOperationType2[TestLogStoreOperationType2["Read"] = 1] = "Read"; + TestLogStoreOperationType2[TestLogStoreOperationType2["Create"] = 2] = "Create"; + TestLogStoreOperationType2[TestLogStoreOperationType2["ReadAndCreate"] = 3] = "ReadAndCreate"; + })(TestLogStoreOperationType = exports2.TestLogStoreOperationType || (exports2.TestLogStoreOperationType = {})); + var TestLogType; + (function(TestLogType2) { + TestLogType2[TestLogType2["GeneralAttachment"] = 1] = "GeneralAttachment"; + TestLogType2[TestLogType2["CodeCoverage"] = 2] = "CodeCoverage"; + TestLogType2[TestLogType2["TestImpact"] = 3] = "TestImpact"; + TestLogType2[TestLogType2["Intermediate"] = 4] = "Intermediate"; + TestLogType2[TestLogType2["System"] = 5] = "System"; + TestLogType2[TestLogType2["MergedCoverageFile"] = 6] = "MergedCoverageFile"; + })(TestLogType = exports2.TestLogType || (exports2.TestLogType = {})); + var TestOutcome; + (function(TestOutcome2) { + TestOutcome2[TestOutcome2["Unspecified"] = 0] = "Unspecified"; + TestOutcome2[TestOutcome2["None"] = 1] = "None"; + TestOutcome2[TestOutcome2["Passed"] = 2] = "Passed"; + TestOutcome2[TestOutcome2["Failed"] = 3] = "Failed"; + TestOutcome2[TestOutcome2["Inconclusive"] = 4] = "Inconclusive"; + TestOutcome2[TestOutcome2["Timeout"] = 5] = "Timeout"; + TestOutcome2[TestOutcome2["Aborted"] = 6] = "Aborted"; + TestOutcome2[TestOutcome2["Blocked"] = 7] = "Blocked"; + TestOutcome2[TestOutcome2["NotExecuted"] = 8] = "NotExecuted"; + TestOutcome2[TestOutcome2["Warning"] = 9] = "Warning"; + TestOutcome2[TestOutcome2["Error"] = 10] = "Error"; + TestOutcome2[TestOutcome2["NotApplicable"] = 11] = "NotApplicable"; + TestOutcome2[TestOutcome2["Paused"] = 12] = "Paused"; + TestOutcome2[TestOutcome2["InProgress"] = 13] = "InProgress"; + TestOutcome2[TestOutcome2["NotImpacted"] = 14] = "NotImpacted"; + TestOutcome2[TestOutcome2["MaxValue"] = 14] = "MaxValue"; + })(TestOutcome = exports2.TestOutcome || (exports2.TestOutcome = {})); + var TestPointState; + (function(TestPointState2) { + TestPointState2[TestPointState2["None"] = 0] = "None"; + TestPointState2[TestPointState2["Ready"] = 1] = "Ready"; + TestPointState2[TestPointState2["Completed"] = 2] = "Completed"; + TestPointState2[TestPointState2["NotReady"] = 3] = "NotReady"; + TestPointState2[TestPointState2["InProgress"] = 4] = "InProgress"; + TestPointState2[TestPointState2["MaxValue"] = 4] = "MaxValue"; + })(TestPointState = exports2.TestPointState || (exports2.TestPointState = {})); + var TestResultGroupBy; + (function(TestResultGroupBy2) { + TestResultGroupBy2[TestResultGroupBy2["Branch"] = 1] = "Branch"; + TestResultGroupBy2[TestResultGroupBy2["Environment"] = 2] = "Environment"; + })(TestResultGroupBy = exports2.TestResultGroupBy || (exports2.TestResultGroupBy = {})); + var TestResultsContextType; + (function(TestResultsContextType2) { + TestResultsContextType2[TestResultsContextType2["Build"] = 1] = "Build"; + TestResultsContextType2[TestResultsContextType2["Release"] = 2] = "Release"; + TestResultsContextType2[TestResultsContextType2["Pipeline"] = 3] = "Pipeline"; + })(TestResultsContextType = exports2.TestResultsContextType || (exports2.TestResultsContextType = {})); + var TestResultsSessionState; + (function(TestResultsSessionState2) { + TestResultsSessionState2[TestResultsSessionState2["None"] = 0] = "None"; + TestResultsSessionState2[TestResultsSessionState2["Running"] = 1] = "Running"; + TestResultsSessionState2[TestResultsSessionState2["Completed"] = 2] = "Completed"; + TestResultsSessionState2[TestResultsSessionState2["Waiting"] = 3] = "Waiting"; + TestResultsSessionState2[TestResultsSessionState2["Cancelled"] = 4] = "Cancelled"; + })(TestResultsSessionState = exports2.TestResultsSessionState || (exports2.TestResultsSessionState = {})); + var TestResultsSettingsType; + (function(TestResultsSettingsType2) { + TestResultsSettingsType2[TestResultsSettingsType2["All"] = 1] = "All"; + TestResultsSettingsType2[TestResultsSettingsType2["Flaky"] = 2] = "Flaky"; + TestResultsSettingsType2[TestResultsSettingsType2["NewTestLogging"] = 3] = "NewTestLogging"; + })(TestResultsSettingsType = exports2.TestResultsSettingsType || (exports2.TestResultsSettingsType = {})); + var TestRunOutcome; + (function(TestRunOutcome2) { + TestRunOutcome2[TestRunOutcome2["Passed"] = 0] = "Passed"; + TestRunOutcome2[TestRunOutcome2["Failed"] = 1] = "Failed"; + TestRunOutcome2[TestRunOutcome2["NotImpacted"] = 2] = "NotImpacted"; + TestRunOutcome2[TestRunOutcome2["Others"] = 3] = "Others"; + })(TestRunOutcome = exports2.TestRunOutcome || (exports2.TestRunOutcome = {})); + var TestRunPublishContext; + (function(TestRunPublishContext2) { + TestRunPublishContext2[TestRunPublishContext2["Build"] = 1] = "Build"; + TestRunPublishContext2[TestRunPublishContext2["Release"] = 2] = "Release"; + TestRunPublishContext2[TestRunPublishContext2["All"] = 3] = "All"; + })(TestRunPublishContext = exports2.TestRunPublishContext || (exports2.TestRunPublishContext = {})); + var TestRunState; + (function(TestRunState2) { + TestRunState2[TestRunState2["Unspecified"] = 0] = "Unspecified"; + TestRunState2[TestRunState2["NotStarted"] = 1] = "NotStarted"; + TestRunState2[TestRunState2["InProgress"] = 2] = "InProgress"; + TestRunState2[TestRunState2["Completed"] = 3] = "Completed"; + TestRunState2[TestRunState2["Aborted"] = 4] = "Aborted"; + TestRunState2[TestRunState2["Waiting"] = 5] = "Waiting"; + TestRunState2[TestRunState2["NeedsInvestigation"] = 6] = "NeedsInvestigation"; + })(TestRunState = exports2.TestRunState || (exports2.TestRunState = {})); + var TestRunSubstate; + (function(TestRunSubstate2) { + TestRunSubstate2[TestRunSubstate2["None"] = 0] = "None"; + TestRunSubstate2[TestRunSubstate2["CreatingEnvironment"] = 1] = "CreatingEnvironment"; + TestRunSubstate2[TestRunSubstate2["RunningTests"] = 2] = "RunningTests"; + TestRunSubstate2[TestRunSubstate2["CanceledByUser"] = 3] = "CanceledByUser"; + TestRunSubstate2[TestRunSubstate2["AbortedBySystem"] = 4] = "AbortedBySystem"; + TestRunSubstate2[TestRunSubstate2["TimedOut"] = 5] = "TimedOut"; + TestRunSubstate2[TestRunSubstate2["PendingAnalysis"] = 6] = "PendingAnalysis"; + TestRunSubstate2[TestRunSubstate2["Analyzed"] = 7] = "Analyzed"; + TestRunSubstate2[TestRunSubstate2["CancellationInProgress"] = 8] = "CancellationInProgress"; + })(TestRunSubstate = exports2.TestRunSubstate || (exports2.TestRunSubstate = {})); + var TestSessionSource; + (function(TestSessionSource2) { + TestSessionSource2[TestSessionSource2["Unknown"] = 0] = "Unknown"; + TestSessionSource2[TestSessionSource2["XTDesktop"] = 1] = "XTDesktop"; + TestSessionSource2[TestSessionSource2["FeedbackDesktop"] = 2] = "FeedbackDesktop"; + TestSessionSource2[TestSessionSource2["XTWeb"] = 3] = "XTWeb"; + TestSessionSource2[TestSessionSource2["FeedbackWeb"] = 4] = "FeedbackWeb"; + TestSessionSource2[TestSessionSource2["XTDesktop2"] = 5] = "XTDesktop2"; + TestSessionSource2[TestSessionSource2["SessionInsightsForAll"] = 6] = "SessionInsightsForAll"; + })(TestSessionSource = exports2.TestSessionSource || (exports2.TestSessionSource = {})); + var TestSessionState; + (function(TestSessionState2) { + TestSessionState2[TestSessionState2["Unspecified"] = 0] = "Unspecified"; + TestSessionState2[TestSessionState2["NotStarted"] = 1] = "NotStarted"; + TestSessionState2[TestSessionState2["InProgress"] = 2] = "InProgress"; + TestSessionState2[TestSessionState2["Paused"] = 3] = "Paused"; + TestSessionState2[TestSessionState2["Completed"] = 4] = "Completed"; + TestSessionState2[TestSessionState2["Declined"] = 5] = "Declined"; + })(TestSessionState = exports2.TestSessionState || (exports2.TestSessionState = {})); + exports2.TypeInfo = { + AfnStrip: {}, + AggregatedDataForResultTrend: {}, + AggregatedResultDetailsByOutcome: {}, + AggregatedResultsAnalysis: {}, + AggregatedResultsByOutcome: {}, + AggregatedRunsByOutcome: {}, + AggregatedRunsByState: {}, + AttachmentType: { + enumValues: { + "generalAttachment": 0, + "afnStrip": 1, + "bugFilingData": 2, + "codeCoverage": 3, + "intermediateCollectorData": 4, + "runConfig": 5, + "testImpactDetails": 6, + "tmiTestRunDeploymentFiles": 7, + "tmiTestRunReverseDeploymentFiles": 8, + "tmiTestResultDetail": 9, + "tmiTestRunSummary": 10, + "consoleLog": 11 + } + }, + BatchResponse: {}, + BuildConfiguration: {}, + BuildCoverage: {}, + BuildReference2: {}, + BulkResultUpdateRequest: {}, + CloneOperationInformation: {}, + CloneOperationState: { + enumValues: { + "failed": 2, + "inProgress": 1, + "queued": 0, + "succeeded": 3 + } + }, + CodeCoverageSummary: {}, + Coverage2: {}, + CoverageDetailedSummaryStatus: { + enumValues: { + "none": 0, + "inProgress": 1, + "finalized": 2, + "pending": 3, + "updateRequestQueued": 4, + "noModulesFound": 5, + "numberOfFilesExceeded": 6, + "noInputFiles": 7, + "buildCancelled": 8, + "failedJobs": 9, + "moduleMergeJobTimeout": 10, + "codeCoverageSuccess": 11, + "invalidBuildConfiguration": 12, + "coverageAnalyzerBuildNotFound": 13, + "failedToRequeue": 14, + "buildBailedOut": 15, + "noCodeCoverageTask": 16, + "mergeJobFailed": 17, + "mergeInvokerJobFailed": 18, + "monitorJobFailed": 19, + "moduleMergeInvokerJobTimeout": 20, + "monitorJobTimeout": 21, + "invalidCoverageInput": 22 + } + }, + CoverageQueryFlags: { + enumValues: { + "modules": 1, + "functions": 2, + "blockData": 4 + } + }, + CoverageStatus: { + enumValues: { + "covered": 0, + "notCovered": 1, + "partiallyCovered": 2 + } + }, + CoverageSummaryStatus: { + enumValues: { + "none": 0, + "inProgress": 1, + "completed": 2, + "finalized": 3, + "pending": 4, + "updateRequestQueued": 5 + } + }, + CreateTestMessageLogEntryRequest: {}, + CreateTestResultsRequest: {}, + CreateTestRunRequest: {}, + CustomTestFieldDefinition: {}, + CustomTestFieldScope: { + enumValues: { + "none": 0, + "testRun": 1, + "testResult": 2, + "system": 4, + "all": 7 + } + }, + CustomTestFieldType: { + enumValues: { + "bit": 2, + "dateTime": 4, + "int": 8, + "float": 6, + "string": 12, + "guid": 14 + } + }, + DatedTestFieldData: {}, + FailingSince: {}, + FetchTestResultsResponse: {}, + FlakyDetection: {}, + FlakyDetectionType: { + enumValues: { + "custom": 1, + "system": 2 + } + }, + FlakySettings: {}, + LastResultDetails: {}, + LegacyBuildConfiguration: {}, + LegacyReleaseReference: {}, + LegacyTestCaseResult: {}, + LegacyTestRun: {}, + LegacyTestSettings: {}, + Metrics: { + enumValues: { + "all": 1, + "resultSummary": 2, + "resultsAnalysis": 3, + "runSummary": 4 + } + }, + OperationType: { + enumValues: { + "add": 1, + "delete": 2 + } + }, + PipelineTestMetrics: {}, + PointLastResult: {}, + PointsResults2: {}, + QueryTestActionResultResponse: {}, + ReleaseReference: {}, + ReleaseReference2: {}, + RequirementsToTestsMapping2: {}, + Response: {}, + ResultDetails: { + enumValues: { + "none": 0, + "iterations": 1, + "workItems": 2, + "subResults": 4, + "point": 8 + } + }, + ResultGroupType: { + enumValues: { + "none": 0, + "rerun": 1, + "dataDriven": 2, + "orderedTest": 3, + "generic": 4 + } + }, + ResultMetadata: { + enumValues: { + "rerun": 1, + "flaky": 2 + } + }, + ResultMetaDataDetails: { + enumValues: { + "none": 0, + "flakyIdentifiers": 1 + } + }, + ResultObjectType: { + enumValues: { + "testSuite": 0, + "testPlan": 1 + } + }, + ResultRetentionSettings: {}, + ResultsByQueryResponse: {}, + ResultsFilter: {}, + ResultsSummaryByOutcome: {}, + ResultSummary: {}, + ResultUpdateRequest: {}, + ResultUpdateRequestModel: {}, + ResultUpdateResponse: {}, + RunCreateModel: {}, + RunStatistic: {}, + RunSummary: {}, + RunSummaryModel: {}, + RunType: { + enumValues: { + "unspecified": 0, + "normal": 1, + "blocking": 2, + "web": 4, + "mtrRunInitiatedFromWeb": 8, + "runWithDtlEnv": 16, + "noConfigRun": 32 + } + }, + RunUpdateModel: {}, + Service: { + enumValues: { + "any": 0, + "tcm": 1, + "tfs": 2 + } + }, + SessionResult: { + enumValues: { + "none": 0, + "passed": 1, + "failed": 2 + } + }, + SessionTimelineType: { + enumValues: { + "none": 0, + "queued": 1, + "completed": 2, + "started": 3 + } + }, + SourceViewBuildCoverage: {}, + SuiteExpand: { + enumValues: { + "children": 1, + "defaultTesters": 2 + } + }, + TCMServiceDataMigrationStatus: { + enumValues: { + "notStarted": 0, + "inProgress": 1, + "completed": 2, + "failed": 3 + } + }, + TestActionResult: {}, + TestActionResult2: {}, + TestActionResultModel: {}, + TestAttachment: {}, + TestAuthoringDetails: {}, + TestCaseReference2: {}, + TestCaseResult: {}, + TestConfiguration: {}, + TestConfigurationState: { + enumValues: { + "active": 1, + "inactive": 2 + } + }, + TestExecutionReportData: {}, + TestExtensionField: {}, + TestExtensionFieldDetails: {}, + TestFailuresAnalysis: {}, + TestHistoryQuery: {}, + TestIterationDetailsModel: {}, + TestLog: {}, + TestLogReference: {}, + TestLogScope: { + enumValues: { + "run": 0, + "build": 1, + "release": 2 + } + }, + TestLogStatus: {}, + TestLogStatusCode: { + enumValues: { + "success": 0, + "failed": 1, + "fileAlreadyExists": 2, + "invalidInput": 3, + "invalidFileName": 4, + "invalidContainer": 5, + "transferFailed": 6, + "featureDisabled": 7, + "buildDoesNotExist": 8, + "runDoesNotExist": 9, + "containerNotCreated": 10, + "apiNotSupported": 11, + "fileSizeExceeds": 12, + "containerNotFound": 13, + "fileNotFound": 14, + "directoryNotFound": 15, + "storageCapacityExceeded": 16 + } + }, + TestLogStoreAttachment: {}, + TestLogStoreEndpointDetails: {}, + TestLogStoreEndpointType: { + enumValues: { + "root": 1, + "file": 2 + } + }, + TestLogStoreOperationType: { + enumValues: { + "read": 1, + "create": 2, + "readAndCreate": 3 + } + }, + TestLogType: { + enumValues: { + "generalAttachment": 1, + "codeCoverage": 2, + "testImpact": 3, + "intermediate": 4, + "system": 5, + "mergedCoverageFile": 6 + } + }, + TestMessageLogDetails: {}, + TestMessageLogEntry: {}, + TestMessageLogEntry2: {}, + TestOutcome: { + enumValues: { + "unspecified": 0, + "none": 1, + "passed": 2, + "failed": 3, + "inconclusive": 4, + "timeout": 5, + "aborted": 6, + "blocked": 7, + "notExecuted": 8, + "warning": 9, + "error": 10, + "notApplicable": 11, + "paused": 12, + "inProgress": 13, + "notImpacted": 14, + "maxValue": 14 + } + }, + TestParameter2: {}, + TestPlan: {}, + TestPlanCloneRequest: {}, + TestPlanHubData: {}, + TestPlansWithSelection: {}, + TestPoint: {}, + TestPointReference: {}, + TestPointsEvent: {}, + TestPointsQuery: {}, + TestPointState: { + enumValues: { + "none": 0, + "ready": 1, + "completed": 2, + "notReady": 3, + "inProgress": 4, + "maxValue": 4 + } + }, + TestPointsUpdatedEvent: {}, + TestResult2: {}, + TestResultAcrossProjectResponse: {}, + TestResultAttachment: {}, + TestResultGroupBy: { + enumValues: { + "branch": 1, + "environment": 2 + } + }, + TestResultHistory: {}, + TestResultHistoryDetailsForGroup: {}, + TestResultHistoryForGroup: {}, + TestResultModelBase: {}, + TestResultReset2: {}, + TestResultsContext: {}, + TestResultsContextType: { + enumValues: { + "build": 1, + "release": 2, + "pipeline": 3 + } + }, + TestResultsDetails: {}, + TestResultsDetailsForGroup: {}, + TestResultsEx2: {}, + TestResultsQuery: {}, + TestResultsSession: {}, + TestResultsSessionState: { + enumValues: { + "none": 0, + "running": 1, + "completed": 2, + "waiting": 3, + "cancelled": 4 + } + }, + TestResultsSettings: {}, + TestResultsSettingsType: { + enumValues: { + "all": 1, + "flaky": 2, + "newTestLogging": 3 + } + }, + TestResultSummary: {}, + TestResultsUpdateSettings: {}, + TestResultsWithWatermark: {}, + TestResultTrendFilter: {}, + TestRun: {}, + TestRun2: {}, + TestRunCanceledEvent: {}, + TestRunCreatedEvent: {}, + TestRunEvent: {}, + TestRunEx2: {}, + TestRunOutcome: { + enumValues: { + "passed": 0, + "failed": 1, + "notImpacted": 2, + "others": 3 + } + }, + TestRunPublishContext: { + enumValues: { + "build": 1, + "release": 2, + "all": 3 + } + }, + TestRunStartedEvent: {}, + TestRunState: { + enumValues: { + "unspecified": 0, + "notStarted": 1, + "inProgress": 2, + "completed": 3, + "aborted": 4, + "waiting": 5, + "needsInvestigation": 6 + } + }, + TestRunStatistic: {}, + TestRunSubstate: { + enumValues: { + "none": 0, + "creatingEnvironment": 1, + "runningTests": 2, + "canceledByUser": 3, + "abortedBySystem": 4, + "timedOut": 5, + "pendingAnalysis": 6, + "analyzed": 7, + "cancellationInProgress": 8 + } + }, + TestRunSummary2: {}, + TestRunWithDtlEnvEvent: {}, + TestSession: {}, + TestSessionExploredWorkItemReference: {}, + TestSessionSource: { + enumValues: { + "unknown": 0, + "xtDesktop": 1, + "feedbackDesktop": 2, + "xtWeb": 3, + "feedbackWeb": 4, + "xtDesktop2": 5, + "sessionInsightsForAll": 6 + } + }, + TestSessionState: { + enumValues: { + "unspecified": 0, + "notStarted": 1, + "inProgress": 2, + "paused": 3, + "completed": 4, + "declined": 5 + } + }, + TestSettings2: {}, + TestSubResult: {}, + TestSuite: {}, + TestSummaryForWorkItem: {}, + Timeline: {}, + UpdatedProperties: {}, + UpdateTestRunRequest: {}, + UpdateTestRunResponse: {}, + WorkItemToTestLinks: {} + }; + exports2.TypeInfo.AfnStrip.fields = { + creationDate: { + isDate: true + } + }; + exports2.TypeInfo.AggregatedDataForResultTrend.fields = { + resultsByOutcome: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.TestOutcome, + dictionaryValueTypeInfo: exports2.TypeInfo.AggregatedResultsByOutcome + }, + runSummaryByState: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.TestRunState, + dictionaryValueTypeInfo: exports2.TypeInfo.AggregatedRunsByState + }, + testResultsContext: { + typeInfo: exports2.TypeInfo.TestResultsContext + } + }; + exports2.TypeInfo.AggregatedResultDetailsByOutcome.fields = { + outcome: { + enumType: exports2.TypeInfo.TestOutcome + } + }; + exports2.TypeInfo.AggregatedResultsAnalysis.fields = { + notReportedResultsByOutcome: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.TestOutcome, + dictionaryValueTypeInfo: exports2.TypeInfo.AggregatedResultsByOutcome + }, + previousContext: { + typeInfo: exports2.TypeInfo.TestResultsContext + }, + resultsByOutcome: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.TestOutcome, + dictionaryValueTypeInfo: exports2.TypeInfo.AggregatedResultsByOutcome + }, + runSummaryByOutcome: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.TestRunOutcome, + dictionaryValueTypeInfo: exports2.TypeInfo.AggregatedRunsByOutcome + }, + runSummaryByState: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.TestRunState, + dictionaryValueTypeInfo: exports2.TypeInfo.AggregatedRunsByState + } + }; + exports2.TypeInfo.AggregatedResultsByOutcome.fields = { + outcome: { + enumType: exports2.TypeInfo.TestOutcome + } + }; + exports2.TypeInfo.AggregatedRunsByOutcome.fields = { + outcome: { + enumType: exports2.TypeInfo.TestRunOutcome + } + }; + exports2.TypeInfo.AggregatedRunsByState.fields = { + resultsByOutcome: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.TestOutcome, + dictionaryValueTypeInfo: exports2.TypeInfo.AggregatedResultsByOutcome + }, + state: { + enumType: exports2.TypeInfo.TestRunState + } + }; + exports2.TypeInfo.BatchResponse.fields = { + responses: { + isArray: true, + typeInfo: exports2.TypeInfo.Response + } + }; + exports2.TypeInfo.BuildConfiguration.fields = { + creationDate: { + isDate: true + } + }; + exports2.TypeInfo.BuildCoverage.fields = { + configuration: { + typeInfo: exports2.TypeInfo.BuildConfiguration + } + }; + exports2.TypeInfo.BuildReference2.fields = { + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.BulkResultUpdateRequest.fields = { + requests: { + isArray: true, + typeInfo: exports2.TypeInfo.ResultUpdateRequest + } + }; + exports2.TypeInfo.CloneOperationInformation.fields = { + completionDate: { + isDate: true + }, + creationDate: { + isDate: true + }, + resultObjectType: { + enumType: exports2.TypeInfo.ResultObjectType + }, + state: { + enumType: exports2.TypeInfo.CloneOperationState + } + }; + exports2.TypeInfo.CodeCoverageSummary.fields = { + coverageDetailedSummaryStatus: { + enumType: exports2.TypeInfo.CoverageDetailedSummaryStatus + }, + status: { + enumType: exports2.TypeInfo.CoverageSummaryStatus + } + }; + exports2.TypeInfo.Coverage2.fields = { + dateCreated: { + isDate: true + }, + dateModified: { + isDate: true + } + }; + exports2.TypeInfo.CreateTestMessageLogEntryRequest.fields = { + testMessageLogEntry: { + isArray: true, + typeInfo: exports2.TypeInfo.TestMessageLogEntry + } + }; + exports2.TypeInfo.CreateTestResultsRequest.fields = { + results: { + isArray: true, + typeInfo: exports2.TypeInfo.LegacyTestCaseResult + } + }; + exports2.TypeInfo.CreateTestRunRequest.fields = { + results: { + isArray: true, + typeInfo: exports2.TypeInfo.LegacyTestCaseResult + }, + testRun: { + typeInfo: exports2.TypeInfo.LegacyTestRun + }, + testSettings: { + typeInfo: exports2.TypeInfo.LegacyTestSettings + } + }; + exports2.TypeInfo.CustomTestFieldDefinition.fields = { + fieldType: { + enumType: exports2.TypeInfo.CustomTestFieldType + }, + scope: { + enumType: exports2.TypeInfo.CustomTestFieldScope + } + }; + exports2.TypeInfo.DatedTestFieldData.fields = { + date: { + isDate: true + } + }; + exports2.TypeInfo.FailingSince.fields = { + date: { + isDate: true + }, + release: { + typeInfo: exports2.TypeInfo.ReleaseReference + } + }; + exports2.TypeInfo.FetchTestResultsResponse.fields = { + actionResults: { + isArray: true, + typeInfo: exports2.TypeInfo.TestActionResult + }, + attachments: { + isArray: true, + typeInfo: exports2.TypeInfo.TestResultAttachment + }, + results: { + isArray: true, + typeInfo: exports2.TypeInfo.LegacyTestCaseResult + } + }; + exports2.TypeInfo.FlakyDetection.fields = { + flakyDetectionType: { + enumType: exports2.TypeInfo.FlakyDetectionType + } + }; + exports2.TypeInfo.FlakySettings.fields = { + flakyDetection: { + typeInfo: exports2.TypeInfo.FlakyDetection + } + }; + exports2.TypeInfo.LastResultDetails.fields = { + dateCompleted: { + isDate: true + } + }; + exports2.TypeInfo.LegacyBuildConfiguration.fields = { + completedDate: { + isDate: true + }, + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.LegacyReleaseReference.fields = { + environmentCreationDate: { + isDate: true + }, + releaseCreationDate: { + isDate: true + } + }; + exports2.TypeInfo.LegacyTestCaseResult.fields = { + buildReference: { + typeInfo: exports2.TypeInfo.LegacyBuildConfiguration + }, + creationDate: { + isDate: true + }, + customFields: { + isArray: true, + typeInfo: exports2.TypeInfo.TestExtensionField + }, + dateCompleted: { + isDate: true + }, + dateStarted: { + isDate: true + }, + failingSince: { + typeInfo: exports2.TypeInfo.FailingSince + }, + lastUpdated: { + isDate: true + }, + releaseReference: { + typeInfo: exports2.TypeInfo.LegacyReleaseReference + }, + resultGroupType: { + enumType: exports2.TypeInfo.ResultGroupType + }, + stackTrace: { + typeInfo: exports2.TypeInfo.TestExtensionField + } + }; + exports2.TypeInfo.LegacyTestRun.fields = { + buildReference: { + typeInfo: exports2.TypeInfo.LegacyBuildConfiguration + }, + completeDate: { + isDate: true + }, + creationDate: { + isDate: true + }, + customFields: { + isArray: true, + typeInfo: exports2.TypeInfo.TestExtensionField + }, + dueDate: { + isDate: true + }, + lastUpdated: { + isDate: true + }, + releaseReference: { + typeInfo: exports2.TypeInfo.LegacyReleaseReference + }, + startDate: { + isDate: true + }, + testMessageLogEntries: { + isArray: true, + typeInfo: exports2.TypeInfo.TestMessageLogDetails + } + }; + exports2.TypeInfo.LegacyTestSettings.fields = { + createdDate: { + isDate: true + }, + lastUpdated: { + isDate: true + } + }; + exports2.TypeInfo.PipelineTestMetrics.fields = { + resultSummary: { + typeInfo: exports2.TypeInfo.ResultSummary + }, + runSummary: { + typeInfo: exports2.TypeInfo.RunSummary + }, + summaryAtChild: { + isArray: true, + typeInfo: exports2.TypeInfo.PipelineTestMetrics + } + }; + exports2.TypeInfo.PointLastResult.fields = { + lastUpdatedDate: { + isDate: true + } + }; + exports2.TypeInfo.PointsResults2.fields = { + lastUpdated: { + isDate: true + } + }; + exports2.TypeInfo.QueryTestActionResultResponse.fields = { + testActionResults: { + isArray: true, + typeInfo: exports2.TypeInfo.TestActionResult + }, + testAttachments: { + isArray: true, + typeInfo: exports2.TypeInfo.TestResultAttachment + } + }; + exports2.TypeInfo.ReleaseReference.fields = { + creationDate: { + isDate: true + }, + environmentCreationDate: { + isDate: true + } + }; + exports2.TypeInfo.ReleaseReference2.fields = { + environmentCreationDate: { + isDate: true + }, + releaseCreationDate: { + isDate: true + } + }; + exports2.TypeInfo.RequirementsToTestsMapping2.fields = { + creationDate: { + isDate: true + }, + deletionDate: { + isDate: true + } + }; + exports2.TypeInfo.Response.fields = {}; + exports2.TypeInfo.ResultRetentionSettings.fields = { + lastUpdatedDate: { + isDate: true + } + }; + exports2.TypeInfo.ResultsByQueryResponse.fields = { + testResults: { + isArray: true, + typeInfo: exports2.TypeInfo.LegacyTestCaseResult + } + }; + exports2.TypeInfo.ResultsFilter.fields = { + executedIn: { + enumType: exports2.TypeInfo.Service + }, + maxCompleteDate: { + isDate: true + }, + testResultsContext: { + typeInfo: exports2.TypeInfo.TestResultsContext + } + }; + exports2.TypeInfo.ResultsSummaryByOutcome.fields = { + aggregatedResultDetailsByOutcome: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.TestOutcome, + dictionaryValueTypeInfo: exports2.TypeInfo.AggregatedResultDetailsByOutcome + } + }; + exports2.TypeInfo.ResultSummary.fields = { + resultSummaryByRunState: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.TestRunState, + dictionaryValueTypeInfo: exports2.TypeInfo.ResultsSummaryByOutcome + } + }; + exports2.TypeInfo.ResultUpdateRequest.fields = { + actionResultDeletes: { + isArray: true, + typeInfo: exports2.TypeInfo.TestActionResult + }, + actionResults: { + isArray: true, + typeInfo: exports2.TypeInfo.TestActionResult + }, + attachments: { + isArray: true, + typeInfo: exports2.TypeInfo.TestResultAttachment + }, + testCaseResult: { + typeInfo: exports2.TypeInfo.LegacyTestCaseResult + } + }; + exports2.TypeInfo.ResultUpdateRequestModel.fields = { + actionResultDeletes: { + isArray: true, + typeInfo: exports2.TypeInfo.TestActionResultModel + }, + actionResults: { + isArray: true, + typeInfo: exports2.TypeInfo.TestActionResultModel + } + }; + exports2.TypeInfo.ResultUpdateResponse.fields = { + lastUpdated: { + isDate: true + } + }; + exports2.TypeInfo.RunCreateModel.fields = { + buildReference: { + typeInfo: exports2.TypeInfo.BuildConfiguration + }, + releaseReference: { + typeInfo: exports2.TypeInfo.ReleaseReference + }, + runSummary: { + isArray: true, + typeInfo: exports2.TypeInfo.RunSummaryModel + } + }; + exports2.TypeInfo.RunStatistic.fields = { + resultMetadata: { + enumType: exports2.TypeInfo.ResultMetadata + } + }; + exports2.TypeInfo.RunSummary.fields = { + runSummaryByOutcome: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.TestRunOutcome + }, + runSummaryByState: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.TestRunState + } + }; + exports2.TypeInfo.RunSummaryModel.fields = { + testOutcome: { + enumType: exports2.TypeInfo.TestOutcome + } + }; + exports2.TypeInfo.RunUpdateModel.fields = { + logEntries: { + isArray: true, + typeInfo: exports2.TypeInfo.TestMessageLogDetails + }, + runSummary: { + isArray: true, + typeInfo: exports2.TypeInfo.RunSummaryModel + }, + substate: { + enumType: exports2.TypeInfo.TestRunSubstate + } + }; + exports2.TypeInfo.SourceViewBuildCoverage.fields = { + configuration: { + typeInfo: exports2.TypeInfo.BuildConfiguration + } + }; + exports2.TypeInfo.TestActionResult.fields = { + creationDate: { + isDate: true + }, + dateCompleted: { + isDate: true + }, + dateStarted: { + isDate: true + }, + lastUpdated: { + isDate: true + } + }; + exports2.TypeInfo.TestActionResult2.fields = { + creationDate: { + isDate: true + }, + dateCompleted: { + isDate: true + }, + dateStarted: { + isDate: true + }, + lastUpdated: { + isDate: true + } + }; + exports2.TypeInfo.TestActionResultModel.fields = { + completedDate: { + isDate: true + }, + startedDate: { + isDate: true + } + }; + exports2.TypeInfo.TestAttachment.fields = { + attachmentType: { + enumType: exports2.TypeInfo.AttachmentType + }, + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TestAuthoringDetails.fields = { + lastUpdated: { + isDate: true + }, + state: { + enumType: exports2.TypeInfo.TestPointState + } + }; + exports2.TypeInfo.TestCaseReference2.fields = { + creationDate: { + isDate: true + }, + lastRefTestRunDate: { + isDate: true + } + }; + exports2.TypeInfo.TestCaseResult.fields = { + completedDate: { + isDate: true + }, + createdDate: { + isDate: true + }, + failingSince: { + typeInfo: exports2.TypeInfo.FailingSince + }, + iterationDetails: { + isArray: true, + typeInfo: exports2.TypeInfo.TestIterationDetailsModel + }, + lastUpdatedDate: { + isDate: true + }, + releaseReference: { + typeInfo: exports2.TypeInfo.ReleaseReference + }, + resultGroupType: { + enumType: exports2.TypeInfo.ResultGroupType + }, + startedDate: { + isDate: true + }, + subResults: { + isArray: true, + typeInfo: exports2.TypeInfo.TestSubResult + } + }; + exports2.TypeInfo.TestConfiguration.fields = { + lastUpdatedDate: { + isDate: true + }, + state: { + enumType: exports2.TypeInfo.TestConfigurationState + } + }; + exports2.TypeInfo.TestExecutionReportData.fields = { + reportData: { + isArray: true, + typeInfo: exports2.TypeInfo.DatedTestFieldData + } + }; + exports2.TypeInfo.TestExtensionField.fields = { + field: { + typeInfo: exports2.TypeInfo.TestExtensionFieldDetails + } + }; + exports2.TypeInfo.TestExtensionFieldDetails.fields = { + type: { + enumType: SystemData.TypeInfo.SqlDbType + } + }; + exports2.TypeInfo.TestFailuresAnalysis.fields = { + previousContext: { + typeInfo: exports2.TypeInfo.TestResultsContext + } + }; + exports2.TypeInfo.TestHistoryQuery.fields = { + groupBy: { + enumType: exports2.TypeInfo.TestResultGroupBy + }, + maxCompleteDate: { + isDate: true + }, + resultsForGroup: { + isArray: true, + typeInfo: exports2.TypeInfo.TestResultHistoryForGroup + } + }; + exports2.TypeInfo.TestIterationDetailsModel.fields = { + actionResults: { + isArray: true, + typeInfo: exports2.TypeInfo.TestActionResultModel + }, + completedDate: { + isDate: true + }, + startedDate: { + isDate: true + } + }; + exports2.TypeInfo.TestLog.fields = { + logReference: { + typeInfo: exports2.TypeInfo.TestLogReference + }, + modifiedOn: { + isDate: true + } + }; + exports2.TypeInfo.TestLogReference.fields = { + scope: { + enumType: exports2.TypeInfo.TestLogScope + }, + type: { + enumType: exports2.TypeInfo.TestLogType + } + }; + exports2.TypeInfo.TestLogStatus.fields = { + status: { + enumType: exports2.TypeInfo.TestLogStatusCode + } + }; + exports2.TypeInfo.TestLogStoreAttachment.fields = { + attachmentType: { + enumType: exports2.TypeInfo.AttachmentType + }, + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TestLogStoreEndpointDetails.fields = { + endpointType: { + enumType: exports2.TypeInfo.TestLogStoreEndpointType + }, + status: { + enumType: exports2.TypeInfo.TestLogStatusCode + } + }; + exports2.TypeInfo.TestMessageLogDetails.fields = { + dateCreated: { + isDate: true + } + }; + exports2.TypeInfo.TestMessageLogEntry.fields = { + dateCreated: { + isDate: true + } + }; + exports2.TypeInfo.TestMessageLogEntry2.fields = { + dateCreated: { + isDate: true + } + }; + exports2.TypeInfo.TestParameter2.fields = { + creationDate: { + isDate: true + }, + dateModified: { + isDate: true + } + }; + exports2.TypeInfo.TestPlan.fields = { + endDate: { + isDate: true + }, + startDate: { + isDate: true + }, + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.TestPlanCloneRequest.fields = { + destinationTestPlan: { + typeInfo: exports2.TypeInfo.TestPlan + } + }; + exports2.TypeInfo.TestPlanHubData.fields = { + testPlan: { + typeInfo: exports2.TypeInfo.TestPlan + }, + testPoints: { + isArray: true, + typeInfo: exports2.TypeInfo.TestPoint + }, + testSuites: { + isArray: true, + typeInfo: exports2.TypeInfo.TestSuite + } + }; + exports2.TypeInfo.TestPlansWithSelection.fields = { + plans: { + isArray: true, + typeInfo: exports2.TypeInfo.TestPlan + } + }; + exports2.TypeInfo.TestPoint.fields = { + lastResetToActive: { + isDate: true + }, + lastResultDetails: { + typeInfo: exports2.TypeInfo.LastResultDetails + }, + lastUpdatedDate: { + isDate: true + } + }; + exports2.TypeInfo.TestPointReference.fields = { + state: { + enumType: exports2.TypeInfo.TestPointState + } + }; + exports2.TypeInfo.TestPointsEvent.fields = { + testPoints: { + isArray: true, + typeInfo: exports2.TypeInfo.TestPointReference + } + }; + exports2.TypeInfo.TestPointsQuery.fields = { + points: { + isArray: true, + typeInfo: exports2.TypeInfo.TestPoint + } + }; + exports2.TypeInfo.TestPointsUpdatedEvent.fields = { + testPoints: { + isArray: true, + typeInfo: exports2.TypeInfo.TestPointReference + } + }; + exports2.TypeInfo.TestResult2.fields = { + creationDate: { + isDate: true + }, + dateCompleted: { + isDate: true + }, + dateStarted: { + isDate: true + }, + lastUpdated: { + isDate: true + } + }; + exports2.TypeInfo.TestResultAcrossProjectResponse.fields = { + testResult: { + typeInfo: exports2.TypeInfo.LegacyTestCaseResult + } + }; + exports2.TypeInfo.TestResultAttachment.fields = { + attachmentType: { + enumType: exports2.TypeInfo.AttachmentType + }, + creationDate: { + isDate: true + } + }; + exports2.TypeInfo.TestResultHistory.fields = { + resultsForGroup: { + isArray: true, + typeInfo: exports2.TypeInfo.TestResultHistoryDetailsForGroup + } + }; + exports2.TypeInfo.TestResultHistoryDetailsForGroup.fields = { + latestResult: { + typeInfo: exports2.TypeInfo.TestCaseResult + } + }; + exports2.TypeInfo.TestResultHistoryForGroup.fields = { + results: { + isArray: true, + typeInfo: exports2.TypeInfo.TestCaseResult + } + }; + exports2.TypeInfo.TestResultModelBase.fields = { + completedDate: { + isDate: true + }, + startedDate: { + isDate: true + } + }; + exports2.TypeInfo.TestResultReset2.fields = { + dateModified: { + isDate: true + } + }; + exports2.TypeInfo.TestResultsContext.fields = { + contextType: { + enumType: exports2.TypeInfo.TestResultsContextType + }, + release: { + typeInfo: exports2.TypeInfo.ReleaseReference + } + }; + exports2.TypeInfo.TestResultsDetails.fields = { + resultsForGroup: { + isArray: true, + typeInfo: exports2.TypeInfo.TestResultsDetailsForGroup + } + }; + exports2.TypeInfo.TestResultsDetailsForGroup.fields = { + results: { + isArray: true, + typeInfo: exports2.TypeInfo.TestCaseResult + }, + resultsCountByOutcome: { + isDictionary: true, + dictionaryKeyEnumType: exports2.TypeInfo.TestOutcome, + dictionaryValueTypeInfo: exports2.TypeInfo.AggregatedResultsByOutcome + } + }; + exports2.TypeInfo.TestResultsEx2.fields = { + creationDate: { + isDate: true + }, + dateTimeValue: { + isDate: true + } + }; + exports2.TypeInfo.TestResultsQuery.fields = { + results: { + isArray: true, + typeInfo: exports2.TypeInfo.TestCaseResult + }, + resultsFilter: { + typeInfo: exports2.TypeInfo.ResultsFilter + } + }; + exports2.TypeInfo.TestResultsSession.fields = { + endTimeUTC: { + isDate: true + }, + result: { + enumType: exports2.TypeInfo.SessionResult + }, + startTimeUTC: { + isDate: true + }, + state: { + enumType: exports2.TypeInfo.TestResultsSessionState + } + }; + exports2.TypeInfo.TestResultsSettings.fields = { + flakySettings: { + typeInfo: exports2.TypeInfo.FlakySettings + } + }; + exports2.TypeInfo.TestResultSummary.fields = { + aggregatedResultsAnalysis: { + typeInfo: exports2.TypeInfo.AggregatedResultsAnalysis + }, + teamProject: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + }, + testFailures: { + typeInfo: exports2.TypeInfo.TestFailuresAnalysis + }, + testResultsContext: { + typeInfo: exports2.TypeInfo.TestResultsContext + } + }; + exports2.TypeInfo.TestResultsUpdateSettings.fields = { + flakySettings: { + typeInfo: exports2.TypeInfo.FlakySettings + } + }; + exports2.TypeInfo.TestResultsWithWatermark.fields = { + changedDate: { + isDate: true + }, + pointsResults: { + isArray: true, + typeInfo: exports2.TypeInfo.PointsResults2 + } + }; + exports2.TypeInfo.TestResultTrendFilter.fields = { + maxCompleteDate: { + isDate: true + } + }; + exports2.TypeInfo.TestRun.fields = { + buildConfiguration: { + typeInfo: exports2.TypeInfo.BuildConfiguration + }, + completedDate: { + isDate: true + }, + createdDate: { + isDate: true + }, + dueDate: { + isDate: true + }, + lastUpdatedDate: { + isDate: true + }, + release: { + typeInfo: exports2.TypeInfo.ReleaseReference + }, + runStatistics: { + isArray: true, + typeInfo: exports2.TypeInfo.RunStatistic + }, + startedDate: { + isDate: true + }, + substate: { + enumType: exports2.TypeInfo.TestRunSubstate + } + }; + exports2.TypeInfo.TestRun2.fields = { + completeDate: { + isDate: true + }, + creationDate: { + isDate: true + }, + deletedOn: { + isDate: true + }, + dueDate: { + isDate: true + }, + lastUpdated: { + isDate: true + }, + startDate: { + isDate: true + } + }; + exports2.TypeInfo.TestRunCanceledEvent.fields = { + testRun: { + typeInfo: exports2.TypeInfo.TestRun + } + }; + exports2.TypeInfo.TestRunCreatedEvent.fields = { + testRun: { + typeInfo: exports2.TypeInfo.TestRun + } + }; + exports2.TypeInfo.TestRunEvent.fields = { + testRun: { + typeInfo: exports2.TypeInfo.TestRun + } + }; + exports2.TypeInfo.TestRunEx2.fields = { + createdDate: { + isDate: true + }, + dateTimeValue: { + isDate: true + } + }; + exports2.TypeInfo.TestRunStartedEvent.fields = { + testRun: { + typeInfo: exports2.TypeInfo.TestRun + } + }; + exports2.TypeInfo.TestRunStatistic.fields = { + runStatistics: { + isArray: true, + typeInfo: exports2.TypeInfo.RunStatistic + } + }; + exports2.TypeInfo.TestRunSummary2.fields = { + testRunCompletedDate: { + isDate: true + } + }; + exports2.TypeInfo.TestRunWithDtlEnvEvent.fields = { + testRun: { + typeInfo: exports2.TypeInfo.TestRun + } + }; + exports2.TypeInfo.TestSession.fields = { + endDate: { + isDate: true + }, + lastUpdatedDate: { + isDate: true + }, + source: { + enumType: exports2.TypeInfo.TestSessionSource + }, + startDate: { + isDate: true + }, + state: { + enumType: exports2.TypeInfo.TestSessionState + } + }; + exports2.TypeInfo.TestSessionExploredWorkItemReference.fields = { + endTime: { + isDate: true + }, + startTime: { + isDate: true + } + }; + exports2.TypeInfo.TestSettings2.fields = { + createdDate: { + isDate: true + }, + lastUpdatedDate: { + isDate: true + } + }; + exports2.TypeInfo.TestSubResult.fields = { + completedDate: { + isDate: true + }, + lastUpdatedDate: { + isDate: true + }, + resultGroupType: { + enumType: exports2.TypeInfo.ResultGroupType + }, + startedDate: { + isDate: true + }, + subResults: { + isArray: true, + typeInfo: exports2.TypeInfo.TestSubResult + } + }; + exports2.TypeInfo.TestSuite.fields = { + children: { + isArray: true, + typeInfo: exports2.TypeInfo.TestSuite + }, + lastPopulatedDate: { + isDate: true + }, + lastUpdatedDate: { + isDate: true + } + }; + exports2.TypeInfo.TestSummaryForWorkItem.fields = { + summary: { + typeInfo: exports2.TypeInfo.AggregatedDataForResultTrend + } + }; + exports2.TypeInfo.Timeline.fields = { + timestampUTC: { + isDate: true + } + }; + exports2.TypeInfo.UpdatedProperties.fields = { + lastUpdated: { + isDate: true + } + }; + exports2.TypeInfo.UpdateTestRunRequest.fields = { + attachmentsToAdd: { + isArray: true, + typeInfo: exports2.TypeInfo.TestResultAttachment + }, + testRun: { + typeInfo: exports2.TypeInfo.LegacyTestRun + } + }; + exports2.TypeInfo.UpdateTestRunResponse.fields = { + updatedProperties: { + typeInfo: exports2.TypeInfo.UpdatedProperties + } + }; + exports2.TypeInfo.WorkItemToTestLinks.fields = { + executedIn: { + enumType: exports2.TypeInfo.Service + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/BuildInterfaces.js +var require_BuildInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/BuildInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.WorkspaceMappingType = exports2.ValidationResult = exports2.TimelineRecordState = exports2.TaskResult = exports2.SupportLevel = exports2.StageUpdateType = exports2.SourceProviderAvailability = exports2.ServiceHostStatus = exports2.ScheduleDays = exports2.ResultSet = exports2.RepositoryCleanOptions = exports2.QueuePriority = exports2.QueueOptions = exports2.QueryDeletedOption = exports2.ProcessTemplateType = exports2.IssueType = exports2.GetOption = exports2.FolderQueryOrder = exports2.DeleteOptions = exports2.DefinitionType = exports2.DefinitionTriggerType = exports2.DefinitionQueueStatus = exports2.DefinitionQueryOrder = exports2.DefinitionQuality = exports2.ControllerStatus = exports2.BuildStatus = exports2.BuildResult = exports2.BuildReason = exports2.BuildQueryOrder = exports2.BuildPhaseStatus = exports2.BuildOptionInputType = exports2.BuildAuthorizationScope = exports2.AuditAction = exports2.AgentStatus = void 0; + var TFS_TestManagement_Contracts = require_TestInterfaces(); + var TfsCoreInterfaces = require_CoreInterfaces(); + var AgentStatus; + (function(AgentStatus2) { + AgentStatus2[AgentStatus2["Unavailable"] = 0] = "Unavailable"; + AgentStatus2[AgentStatus2["Available"] = 1] = "Available"; + AgentStatus2[AgentStatus2["Offline"] = 2] = "Offline"; + })(AgentStatus = exports2.AgentStatus || (exports2.AgentStatus = {})); + var AuditAction; + (function(AuditAction2) { + AuditAction2[AuditAction2["Add"] = 1] = "Add"; + AuditAction2[AuditAction2["Update"] = 2] = "Update"; + AuditAction2[AuditAction2["Delete"] = 3] = "Delete"; + })(AuditAction = exports2.AuditAction || (exports2.AuditAction = {})); + var BuildAuthorizationScope; + (function(BuildAuthorizationScope2) { + BuildAuthorizationScope2[BuildAuthorizationScope2["ProjectCollection"] = 1] = "ProjectCollection"; + BuildAuthorizationScope2[BuildAuthorizationScope2["Project"] = 2] = "Project"; + })(BuildAuthorizationScope = exports2.BuildAuthorizationScope || (exports2.BuildAuthorizationScope = {})); + var BuildOptionInputType; + (function(BuildOptionInputType2) { + BuildOptionInputType2[BuildOptionInputType2["String"] = 0] = "String"; + BuildOptionInputType2[BuildOptionInputType2["Boolean"] = 1] = "Boolean"; + BuildOptionInputType2[BuildOptionInputType2["StringList"] = 2] = "StringList"; + BuildOptionInputType2[BuildOptionInputType2["Radio"] = 3] = "Radio"; + BuildOptionInputType2[BuildOptionInputType2["PickList"] = 4] = "PickList"; + BuildOptionInputType2[BuildOptionInputType2["MultiLine"] = 5] = "MultiLine"; + BuildOptionInputType2[BuildOptionInputType2["BranchFilter"] = 6] = "BranchFilter"; + })(BuildOptionInputType = exports2.BuildOptionInputType || (exports2.BuildOptionInputType = {})); + var BuildPhaseStatus; + (function(BuildPhaseStatus2) { + BuildPhaseStatus2[BuildPhaseStatus2["Unknown"] = 0] = "Unknown"; + BuildPhaseStatus2[BuildPhaseStatus2["Failed"] = 1] = "Failed"; + BuildPhaseStatus2[BuildPhaseStatus2["Succeeded"] = 2] = "Succeeded"; + })(BuildPhaseStatus = exports2.BuildPhaseStatus || (exports2.BuildPhaseStatus = {})); + var BuildQueryOrder; + (function(BuildQueryOrder2) { + BuildQueryOrder2[BuildQueryOrder2["FinishTimeAscending"] = 2] = "FinishTimeAscending"; + BuildQueryOrder2[BuildQueryOrder2["FinishTimeDescending"] = 3] = "FinishTimeDescending"; + BuildQueryOrder2[BuildQueryOrder2["QueueTimeDescending"] = 4] = "QueueTimeDescending"; + BuildQueryOrder2[BuildQueryOrder2["QueueTimeAscending"] = 5] = "QueueTimeAscending"; + BuildQueryOrder2[BuildQueryOrder2["StartTimeDescending"] = 6] = "StartTimeDescending"; + BuildQueryOrder2[BuildQueryOrder2["StartTimeAscending"] = 7] = "StartTimeAscending"; + })(BuildQueryOrder = exports2.BuildQueryOrder || (exports2.BuildQueryOrder = {})); + var BuildReason; + (function(BuildReason2) { + BuildReason2[BuildReason2["None"] = 0] = "None"; + BuildReason2[BuildReason2["Manual"] = 1] = "Manual"; + BuildReason2[BuildReason2["IndividualCI"] = 2] = "IndividualCI"; + BuildReason2[BuildReason2["BatchedCI"] = 4] = "BatchedCI"; + BuildReason2[BuildReason2["Schedule"] = 8] = "Schedule"; + BuildReason2[BuildReason2["ScheduleForced"] = 16] = "ScheduleForced"; + BuildReason2[BuildReason2["UserCreated"] = 32] = "UserCreated"; + BuildReason2[BuildReason2["ValidateShelveset"] = 64] = "ValidateShelveset"; + BuildReason2[BuildReason2["CheckInShelveset"] = 128] = "CheckInShelveset"; + BuildReason2[BuildReason2["PullRequest"] = 256] = "PullRequest"; + BuildReason2[BuildReason2["BuildCompletion"] = 512] = "BuildCompletion"; + BuildReason2[BuildReason2["ResourceTrigger"] = 1024] = "ResourceTrigger"; + BuildReason2[BuildReason2["Triggered"] = 1967] = "Triggered"; + BuildReason2[BuildReason2["All"] = 2031] = "All"; + })(BuildReason = exports2.BuildReason || (exports2.BuildReason = {})); + var BuildResult; + (function(BuildResult2) { + BuildResult2[BuildResult2["None"] = 0] = "None"; + BuildResult2[BuildResult2["Succeeded"] = 2] = "Succeeded"; + BuildResult2[BuildResult2["PartiallySucceeded"] = 4] = "PartiallySucceeded"; + BuildResult2[BuildResult2["Failed"] = 8] = "Failed"; + BuildResult2[BuildResult2["Canceled"] = 32] = "Canceled"; + })(BuildResult = exports2.BuildResult || (exports2.BuildResult = {})); + var BuildStatus; + (function(BuildStatus2) { + BuildStatus2[BuildStatus2["None"] = 0] = "None"; + BuildStatus2[BuildStatus2["InProgress"] = 1] = "InProgress"; + BuildStatus2[BuildStatus2["Completed"] = 2] = "Completed"; + BuildStatus2[BuildStatus2["Cancelling"] = 4] = "Cancelling"; + BuildStatus2[BuildStatus2["Postponed"] = 8] = "Postponed"; + BuildStatus2[BuildStatus2["NotStarted"] = 32] = "NotStarted"; + BuildStatus2[BuildStatus2["All"] = 47] = "All"; + })(BuildStatus = exports2.BuildStatus || (exports2.BuildStatus = {})); + var ControllerStatus; + (function(ControllerStatus2) { + ControllerStatus2[ControllerStatus2["Unavailable"] = 0] = "Unavailable"; + ControllerStatus2[ControllerStatus2["Available"] = 1] = "Available"; + ControllerStatus2[ControllerStatus2["Offline"] = 2] = "Offline"; + })(ControllerStatus = exports2.ControllerStatus || (exports2.ControllerStatus = {})); + var DefinitionQuality; + (function(DefinitionQuality2) { + DefinitionQuality2[DefinitionQuality2["Definition"] = 1] = "Definition"; + DefinitionQuality2[DefinitionQuality2["Draft"] = 2] = "Draft"; + })(DefinitionQuality = exports2.DefinitionQuality || (exports2.DefinitionQuality = {})); + var DefinitionQueryOrder; + (function(DefinitionQueryOrder2) { + DefinitionQueryOrder2[DefinitionQueryOrder2["None"] = 0] = "None"; + DefinitionQueryOrder2[DefinitionQueryOrder2["LastModifiedAscending"] = 1] = "LastModifiedAscending"; + DefinitionQueryOrder2[DefinitionQueryOrder2["LastModifiedDescending"] = 2] = "LastModifiedDescending"; + DefinitionQueryOrder2[DefinitionQueryOrder2["DefinitionNameAscending"] = 3] = "DefinitionNameAscending"; + DefinitionQueryOrder2[DefinitionQueryOrder2["DefinitionNameDescending"] = 4] = "DefinitionNameDescending"; + })(DefinitionQueryOrder = exports2.DefinitionQueryOrder || (exports2.DefinitionQueryOrder = {})); + var DefinitionQueueStatus; + (function(DefinitionQueueStatus2) { + DefinitionQueueStatus2[DefinitionQueueStatus2["Enabled"] = 0] = "Enabled"; + DefinitionQueueStatus2[DefinitionQueueStatus2["Paused"] = 1] = "Paused"; + DefinitionQueueStatus2[DefinitionQueueStatus2["Disabled"] = 2] = "Disabled"; + })(DefinitionQueueStatus = exports2.DefinitionQueueStatus || (exports2.DefinitionQueueStatus = {})); + var DefinitionTriggerType; + (function(DefinitionTriggerType2) { + DefinitionTriggerType2[DefinitionTriggerType2["None"] = 1] = "None"; + DefinitionTriggerType2[DefinitionTriggerType2["ContinuousIntegration"] = 2] = "ContinuousIntegration"; + DefinitionTriggerType2[DefinitionTriggerType2["BatchedContinuousIntegration"] = 4] = "BatchedContinuousIntegration"; + DefinitionTriggerType2[DefinitionTriggerType2["Schedule"] = 8] = "Schedule"; + DefinitionTriggerType2[DefinitionTriggerType2["GatedCheckIn"] = 16] = "GatedCheckIn"; + DefinitionTriggerType2[DefinitionTriggerType2["BatchedGatedCheckIn"] = 32] = "BatchedGatedCheckIn"; + DefinitionTriggerType2[DefinitionTriggerType2["PullRequest"] = 64] = "PullRequest"; + DefinitionTriggerType2[DefinitionTriggerType2["BuildCompletion"] = 128] = "BuildCompletion"; + DefinitionTriggerType2[DefinitionTriggerType2["All"] = 255] = "All"; + })(DefinitionTriggerType = exports2.DefinitionTriggerType || (exports2.DefinitionTriggerType = {})); + var DefinitionType; + (function(DefinitionType2) { + DefinitionType2[DefinitionType2["Xaml"] = 1] = "Xaml"; + DefinitionType2[DefinitionType2["Build"] = 2] = "Build"; + })(DefinitionType = exports2.DefinitionType || (exports2.DefinitionType = {})); + var DeleteOptions; + (function(DeleteOptions2) { + DeleteOptions2[DeleteOptions2["None"] = 0] = "None"; + DeleteOptions2[DeleteOptions2["DropLocation"] = 1] = "DropLocation"; + DeleteOptions2[DeleteOptions2["TestResults"] = 2] = "TestResults"; + DeleteOptions2[DeleteOptions2["Label"] = 4] = "Label"; + DeleteOptions2[DeleteOptions2["Details"] = 8] = "Details"; + DeleteOptions2[DeleteOptions2["Symbols"] = 16] = "Symbols"; + DeleteOptions2[DeleteOptions2["All"] = 31] = "All"; + })(DeleteOptions = exports2.DeleteOptions || (exports2.DeleteOptions = {})); + var FolderQueryOrder; + (function(FolderQueryOrder2) { + FolderQueryOrder2[FolderQueryOrder2["None"] = 0] = "None"; + FolderQueryOrder2[FolderQueryOrder2["FolderAscending"] = 1] = "FolderAscending"; + FolderQueryOrder2[FolderQueryOrder2["FolderDescending"] = 2] = "FolderDescending"; + })(FolderQueryOrder = exports2.FolderQueryOrder || (exports2.FolderQueryOrder = {})); + var GetOption; + (function(GetOption2) { + GetOption2[GetOption2["LatestOnQueue"] = 0] = "LatestOnQueue"; + GetOption2[GetOption2["LatestOnBuild"] = 1] = "LatestOnBuild"; + GetOption2[GetOption2["Custom"] = 2] = "Custom"; + })(GetOption = exports2.GetOption || (exports2.GetOption = {})); + var IssueType; + (function(IssueType2) { + IssueType2[IssueType2["Error"] = 1] = "Error"; + IssueType2[IssueType2["Warning"] = 2] = "Warning"; + })(IssueType = exports2.IssueType || (exports2.IssueType = {})); + var ProcessTemplateType; + (function(ProcessTemplateType2) { + ProcessTemplateType2[ProcessTemplateType2["Custom"] = 0] = "Custom"; + ProcessTemplateType2[ProcessTemplateType2["Default"] = 1] = "Default"; + ProcessTemplateType2[ProcessTemplateType2["Upgrade"] = 2] = "Upgrade"; + })(ProcessTemplateType = exports2.ProcessTemplateType || (exports2.ProcessTemplateType = {})); + var QueryDeletedOption; + (function(QueryDeletedOption2) { + QueryDeletedOption2[QueryDeletedOption2["ExcludeDeleted"] = 0] = "ExcludeDeleted"; + QueryDeletedOption2[QueryDeletedOption2["IncludeDeleted"] = 1] = "IncludeDeleted"; + QueryDeletedOption2[QueryDeletedOption2["OnlyDeleted"] = 2] = "OnlyDeleted"; + })(QueryDeletedOption = exports2.QueryDeletedOption || (exports2.QueryDeletedOption = {})); + var QueueOptions; + (function(QueueOptions2) { + QueueOptions2[QueueOptions2["None"] = 0] = "None"; + QueueOptions2[QueueOptions2["DoNotRun"] = 1] = "DoNotRun"; + })(QueueOptions = exports2.QueueOptions || (exports2.QueueOptions = {})); + var QueuePriority; + (function(QueuePriority2) { + QueuePriority2[QueuePriority2["Low"] = 5] = "Low"; + QueuePriority2[QueuePriority2["BelowNormal"] = 4] = "BelowNormal"; + QueuePriority2[QueuePriority2["Normal"] = 3] = "Normal"; + QueuePriority2[QueuePriority2["AboveNormal"] = 2] = "AboveNormal"; + QueuePriority2[QueuePriority2["High"] = 1] = "High"; + })(QueuePriority = exports2.QueuePriority || (exports2.QueuePriority = {})); + var RepositoryCleanOptions; + (function(RepositoryCleanOptions2) { + RepositoryCleanOptions2[RepositoryCleanOptions2["Source"] = 0] = "Source"; + RepositoryCleanOptions2[RepositoryCleanOptions2["SourceAndOutputDir"] = 1] = "SourceAndOutputDir"; + RepositoryCleanOptions2[RepositoryCleanOptions2["SourceDir"] = 2] = "SourceDir"; + RepositoryCleanOptions2[RepositoryCleanOptions2["AllBuildDir"] = 3] = "AllBuildDir"; + })(RepositoryCleanOptions = exports2.RepositoryCleanOptions || (exports2.RepositoryCleanOptions = {})); + var ResultSet; + (function(ResultSet2) { + ResultSet2[ResultSet2["All"] = 0] = "All"; + ResultSet2[ResultSet2["Top"] = 1] = "Top"; + })(ResultSet = exports2.ResultSet || (exports2.ResultSet = {})); + var ScheduleDays; + (function(ScheduleDays2) { + ScheduleDays2[ScheduleDays2["None"] = 0] = "None"; + ScheduleDays2[ScheduleDays2["Monday"] = 1] = "Monday"; + ScheduleDays2[ScheduleDays2["Tuesday"] = 2] = "Tuesday"; + ScheduleDays2[ScheduleDays2["Wednesday"] = 4] = "Wednesday"; + ScheduleDays2[ScheduleDays2["Thursday"] = 8] = "Thursday"; + ScheduleDays2[ScheduleDays2["Friday"] = 16] = "Friday"; + ScheduleDays2[ScheduleDays2["Saturday"] = 32] = "Saturday"; + ScheduleDays2[ScheduleDays2["Sunday"] = 64] = "Sunday"; + ScheduleDays2[ScheduleDays2["All"] = 127] = "All"; + })(ScheduleDays = exports2.ScheduleDays || (exports2.ScheduleDays = {})); + var ServiceHostStatus; + (function(ServiceHostStatus2) { + ServiceHostStatus2[ServiceHostStatus2["Online"] = 1] = "Online"; + ServiceHostStatus2[ServiceHostStatus2["Offline"] = 2] = "Offline"; + })(ServiceHostStatus = exports2.ServiceHostStatus || (exports2.ServiceHostStatus = {})); + var SourceProviderAvailability; + (function(SourceProviderAvailability2) { + SourceProviderAvailability2[SourceProviderAvailability2["Hosted"] = 1] = "Hosted"; + SourceProviderAvailability2[SourceProviderAvailability2["OnPremises"] = 2] = "OnPremises"; + SourceProviderAvailability2[SourceProviderAvailability2["All"] = 3] = "All"; + })(SourceProviderAvailability = exports2.SourceProviderAvailability || (exports2.SourceProviderAvailability = {})); + var StageUpdateType; + (function(StageUpdateType2) { + StageUpdateType2[StageUpdateType2["Cancel"] = 0] = "Cancel"; + StageUpdateType2[StageUpdateType2["Retry"] = 1] = "Retry"; + })(StageUpdateType = exports2.StageUpdateType || (exports2.StageUpdateType = {})); + var SupportLevel; + (function(SupportLevel2) { + SupportLevel2[SupportLevel2["Unsupported"] = 0] = "Unsupported"; + SupportLevel2[SupportLevel2["Supported"] = 1] = "Supported"; + SupportLevel2[SupportLevel2["Required"] = 2] = "Required"; + })(SupportLevel = exports2.SupportLevel || (exports2.SupportLevel = {})); + var TaskResult; + (function(TaskResult2) { + TaskResult2[TaskResult2["Succeeded"] = 0] = "Succeeded"; + TaskResult2[TaskResult2["SucceededWithIssues"] = 1] = "SucceededWithIssues"; + TaskResult2[TaskResult2["Failed"] = 2] = "Failed"; + TaskResult2[TaskResult2["Canceled"] = 3] = "Canceled"; + TaskResult2[TaskResult2["Skipped"] = 4] = "Skipped"; + TaskResult2[TaskResult2["Abandoned"] = 5] = "Abandoned"; + })(TaskResult = exports2.TaskResult || (exports2.TaskResult = {})); + var TimelineRecordState; + (function(TimelineRecordState2) { + TimelineRecordState2[TimelineRecordState2["Pending"] = 0] = "Pending"; + TimelineRecordState2[TimelineRecordState2["InProgress"] = 1] = "InProgress"; + TimelineRecordState2[TimelineRecordState2["Completed"] = 2] = "Completed"; + })(TimelineRecordState = exports2.TimelineRecordState || (exports2.TimelineRecordState = {})); + var ValidationResult; + (function(ValidationResult2) { + ValidationResult2[ValidationResult2["OK"] = 0] = "OK"; + ValidationResult2[ValidationResult2["Warning"] = 1] = "Warning"; + ValidationResult2[ValidationResult2["Error"] = 2] = "Error"; + })(ValidationResult = exports2.ValidationResult || (exports2.ValidationResult = {})); + var WorkspaceMappingType; + (function(WorkspaceMappingType2) { + WorkspaceMappingType2[WorkspaceMappingType2["Map"] = 0] = "Map"; + WorkspaceMappingType2[WorkspaceMappingType2["Cloak"] = 1] = "Cloak"; + })(WorkspaceMappingType = exports2.WorkspaceMappingType || (exports2.WorkspaceMappingType = {})); + exports2.TypeInfo = { + AgentStatus: { + enumValues: { + "unavailable": 0, + "available": 1, + "offline": 2 + } + }, + AuditAction: { + enumValues: { + "add": 1, + "update": 2, + "delete": 3 + } + }, + Build: {}, + BuildAgent: {}, + BuildAuthorizationScope: { + enumValues: { + "projectCollection": 1, + "project": 2 + } + }, + BuildCompletedEvent: {}, + BuildCompletionTrigger: {}, + BuildController: {}, + BuildDefinition: {}, + BuildDefinition3_2: {}, + BuildDefinitionReference: {}, + BuildDefinitionReference3_2: {}, + BuildDefinitionRevision: {}, + BuildDefinitionSourceProvider: {}, + BuildDefinitionTemplate: {}, + BuildDefinitionTemplate3_2: {}, + BuildDeletedEvent: {}, + BuildDeployment: {}, + BuildLog: {}, + BuildMetric: {}, + BuildOptionDefinition: {}, + BuildOptionInputDefinition: {}, + BuildOptionInputType: { + enumValues: { + "string": 0, + "boolean": 1, + "stringList": 2, + "radio": 3, + "pickList": 4, + "multiLine": 5, + "branchFilter": 6 + } + }, + BuildPhaseStatus: { + enumValues: { + "unknown": 0, + "failed": 1, + "succeeded": 2 + } + }, + BuildProcessTemplate: {}, + BuildQueryOrder: { + enumValues: { + "finishTimeAscending": 2, + "finishTimeDescending": 3, + "queueTimeDescending": 4, + "queueTimeAscending": 5, + "startTimeDescending": 6, + "startTimeAscending": 7 + } + }, + BuildQueuedEvent: {}, + BuildReason: { + enumValues: { + "none": 0, + "manual": 1, + "individualCI": 2, + "batchedCI": 4, + "schedule": 8, + "scheduleForced": 16, + "userCreated": 32, + "validateShelveset": 64, + "checkInShelveset": 128, + "pullRequest": 256, + "buildCompletion": 512, + "resourceTrigger": 1024, + "triggered": 1967, + "all": 2031 + } + }, + BuildReference: {}, + BuildRequestValidationResult: {}, + BuildResult: { + enumValues: { + "none": 0, + "succeeded": 2, + "partiallySucceeded": 4, + "failed": 8, + "canceled": 32 + } + }, + BuildRetentionHistory: {}, + BuildRetentionSample: {}, + BuildServer: {}, + BuildStatus: { + enumValues: { + "none": 0, + "inProgress": 1, + "completed": 2, + "cancelling": 4, + "postponed": 8, + "notStarted": 32, + "all": 47 + } + }, + BuildSummary: {}, + BuildTagsAddedEvent: {}, + BuildTrigger: {}, + BuildUpdatedEvent: {}, + Change: {}, + ContinuousDeploymentDefinition: {}, + ContinuousIntegrationTrigger: {}, + ControllerStatus: { + enumValues: { + "unavailable": 0, + "available": 1, + "offline": 2 + } + }, + DefinitionQuality: { + enumValues: { + "definition": 1, + "draft": 2 + } + }, + DefinitionQueryOrder: { + enumValues: { + "none": 0, + "lastModifiedAscending": 1, + "lastModifiedDescending": 2, + "definitionNameAscending": 3, + "definitionNameDescending": 4 + } + }, + DefinitionQueueStatus: { + enumValues: { + "enabled": 0, + "paused": 1, + "disabled": 2 + } + }, + DefinitionReference: {}, + DefinitionTriggerType: { + enumValues: { + "none": 1, + "continuousIntegration": 2, + "batchedContinuousIntegration": 4, + "schedule": 8, + "gatedCheckIn": 16, + "batchedGatedCheckIn": 32, + "pullRequest": 64, + "buildCompletion": 128, + "all": 255 + } + }, + DefinitionType: { + enumValues: { + "xaml": 1, + "build": 2 + } + }, + DeleteOptions: { + enumValues: { + "none": 0, + "dropLocation": 1, + "testResults": 2, + "label": 4, + "details": 8, + "symbols": 16, + "all": 31 + } + }, + DesignerProcess: {}, + Folder: {}, + FolderQueryOrder: { + enumValues: { + "none": 0, + "folderAscending": 1, + "folderDescending": 2 + } + }, + GatedCheckInTrigger: {}, + GetOption: { + enumValues: { + "latestOnQueue": 0, + "latestOnBuild": 1, + "custom": 2 + } + }, + InformationNode: {}, + Issue: {}, + IssueType: { + enumValues: { + "error": 1, + "warning": 2 + } + }, + Phase: {}, + ProcessTemplateType: { + enumValues: { + "custom": 0, + "default": 1, + "upgrade": 2 + } + }, + PullRequestTrigger: {}, + QueryDeletedOption: { + enumValues: { + "excludeDeleted": 0, + "includeDeleted": 1, + "onlyDeleted": 2 + } + }, + QueueOptions: { + enumValues: { + "none": 0, + "doNotRun": 1 + } + }, + QueuePriority: { + enumValues: { + "low": 5, + "belowNormal": 4, + "normal": 3, + "aboveNormal": 2, + "high": 1 + } + }, + RepositoryCleanOptions: { + enumValues: { + "source": 0, + "sourceAndOutputDir": 1, + "sourceDir": 2, + "allBuildDir": 3 + } + }, + RepositoryWebhook: {}, + ResultSet: { + enumValues: { + "all": 0, + "top": 1 + } + }, + RetentionLease: {}, + Schedule: {}, + ScheduleDays: { + enumValues: { + "none": 0, + "monday": 1, + "tuesday": 2, + "wednesday": 4, + "thursday": 8, + "friday": 16, + "saturday": 32, + "sunday": 64, + "all": 127 + } + }, + ScheduleTrigger: {}, + ServiceHostStatus: { + enumValues: { + "online": 1, + "offline": 2 + } + }, + SourceProviderAttributes: {}, + SourceProviderAvailability: { + enumValues: { + "hosted": 1, + "onPremises": 2, + "all": 3 + } + }, + StageUpdateType: { + enumValues: { + "cancel": 0, + "retry": 1 + } + }, + SupportedTrigger: {}, + SupportLevel: { + enumValues: { + "unsupported": 0, + "supported": 1, + "required": 2 + } + }, + TaskResult: { + enumValues: { + "succeeded": 0, + "succeededWithIssues": 1, + "failed": 2, + "canceled": 3, + "skipped": 4, + "abandoned": 5 + } + }, + Timeline: {}, + TimelineRecord: {}, + TimelineRecordState: { + enumValues: { + "pending": 0, + "inProgress": 1, + "completed": 2 + } + }, + TimelineRecordsUpdatedEvent: {}, + UpdateStageParameters: {}, + ValidationResult: { + enumValues: { + "ok": 0, + "warning": 1, + "error": 2 + } + }, + WorkspaceMapping: {}, + WorkspaceMappingType: { + enumValues: { + "map": 0, + "cloak": 1 + } + }, + WorkspaceTemplate: {}, + XamlBuildDefinition: {} + }; + exports2.TypeInfo.Build.fields = { + controller: { + typeInfo: exports2.TypeInfo.BuildController + }, + definition: { + typeInfo: exports2.TypeInfo.DefinitionReference + }, + deletedDate: { + isDate: true + }, + finishTime: { + isDate: true + }, + lastChangedDate: { + isDate: true + }, + priority: { + enumType: exports2.TypeInfo.QueuePriority + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + }, + queueOptions: { + enumType: exports2.TypeInfo.QueueOptions + }, + queueTime: { + isDate: true + }, + reason: { + enumType: exports2.TypeInfo.BuildReason + }, + result: { + enumType: exports2.TypeInfo.BuildResult + }, + startTime: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.BuildStatus + }, + triggeredByBuild: { + typeInfo: exports2.TypeInfo.Build + }, + validationResults: { + isArray: true, + typeInfo: exports2.TypeInfo.BuildRequestValidationResult + } + }; + exports2.TypeInfo.BuildAgent.fields = { + createdDate: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.AgentStatus + }, + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.BuildCompletedEvent.fields = { + build: { + typeInfo: exports2.TypeInfo.Build + }, + changes: { + isArray: true, + typeInfo: exports2.TypeInfo.Change + }, + testResults: { + typeInfo: TFS_TestManagement_Contracts.TypeInfo.AggregatedResultsAnalysis + }, + timelineRecords: { + isArray: true, + typeInfo: exports2.TypeInfo.TimelineRecord + } + }; + exports2.TypeInfo.BuildCompletionTrigger.fields = { + definition: { + typeInfo: exports2.TypeInfo.DefinitionReference + }, + triggerType: { + enumType: exports2.TypeInfo.DefinitionTriggerType + } + }; + exports2.TypeInfo.BuildController.fields = { + createdDate: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.ControllerStatus + }, + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.BuildDefinition.fields = { + createdDate: { + isDate: true + }, + draftOf: { + typeInfo: exports2.TypeInfo.DefinitionReference + }, + drafts: { + isArray: true, + typeInfo: exports2.TypeInfo.DefinitionReference + }, + jobAuthorizationScope: { + enumType: exports2.TypeInfo.BuildAuthorizationScope + }, + latestBuild: { + typeInfo: exports2.TypeInfo.Build + }, + latestCompletedBuild: { + typeInfo: exports2.TypeInfo.Build + }, + metrics: { + isArray: true, + typeInfo: exports2.TypeInfo.BuildMetric + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + }, + quality: { + enumType: exports2.TypeInfo.DefinitionQuality + }, + queueStatus: { + enumType: exports2.TypeInfo.DefinitionQueueStatus + }, + triggers: { + isArray: true, + typeInfo: exports2.TypeInfo.BuildTrigger + }, + type: { + enumType: exports2.TypeInfo.DefinitionType + } + }; + exports2.TypeInfo.BuildDefinition3_2.fields = { + createdDate: { + isDate: true + }, + draftOf: { + typeInfo: exports2.TypeInfo.DefinitionReference + }, + drafts: { + isArray: true, + typeInfo: exports2.TypeInfo.DefinitionReference + }, + jobAuthorizationScope: { + enumType: exports2.TypeInfo.BuildAuthorizationScope + }, + latestBuild: { + typeInfo: exports2.TypeInfo.Build + }, + latestCompletedBuild: { + typeInfo: exports2.TypeInfo.Build + }, + metrics: { + isArray: true, + typeInfo: exports2.TypeInfo.BuildMetric + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + }, + quality: { + enumType: exports2.TypeInfo.DefinitionQuality + }, + queueStatus: { + enumType: exports2.TypeInfo.DefinitionQueueStatus + }, + triggers: { + isArray: true, + typeInfo: exports2.TypeInfo.BuildTrigger + }, + type: { + enumType: exports2.TypeInfo.DefinitionType + } + }; + exports2.TypeInfo.BuildDefinitionReference.fields = { + createdDate: { + isDate: true + }, + draftOf: { + typeInfo: exports2.TypeInfo.DefinitionReference + }, + drafts: { + isArray: true, + typeInfo: exports2.TypeInfo.DefinitionReference + }, + latestBuild: { + typeInfo: exports2.TypeInfo.Build + }, + latestCompletedBuild: { + typeInfo: exports2.TypeInfo.Build + }, + metrics: { + isArray: true, + typeInfo: exports2.TypeInfo.BuildMetric + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + }, + quality: { + enumType: exports2.TypeInfo.DefinitionQuality + }, + queueStatus: { + enumType: exports2.TypeInfo.DefinitionQueueStatus + }, + type: { + enumType: exports2.TypeInfo.DefinitionType + } + }; + exports2.TypeInfo.BuildDefinitionReference3_2.fields = { + createdDate: { + isDate: true + }, + draftOf: { + typeInfo: exports2.TypeInfo.DefinitionReference + }, + drafts: { + isArray: true, + typeInfo: exports2.TypeInfo.DefinitionReference + }, + metrics: { + isArray: true, + typeInfo: exports2.TypeInfo.BuildMetric + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + }, + quality: { + enumType: exports2.TypeInfo.DefinitionQuality + }, + queueStatus: { + enumType: exports2.TypeInfo.DefinitionQueueStatus + }, + type: { + enumType: exports2.TypeInfo.DefinitionType + } + }; + exports2.TypeInfo.BuildDefinitionRevision.fields = { + changedDate: { + isDate: true + }, + changeType: { + enumType: exports2.TypeInfo.AuditAction + } + }; + exports2.TypeInfo.BuildDefinitionSourceProvider.fields = { + lastModified: { + isDate: true + }, + supportedTriggerTypes: { + enumType: exports2.TypeInfo.DefinitionTriggerType + } + }; + exports2.TypeInfo.BuildDefinitionTemplate.fields = { + template: { + typeInfo: exports2.TypeInfo.BuildDefinition + } + }; + exports2.TypeInfo.BuildDefinitionTemplate3_2.fields = { + template: { + typeInfo: exports2.TypeInfo.BuildDefinition3_2 + } + }; + exports2.TypeInfo.BuildDeletedEvent.fields = { + build: { + typeInfo: exports2.TypeInfo.Build + } + }; + exports2.TypeInfo.BuildDeployment.fields = { + deployment: { + typeInfo: exports2.TypeInfo.BuildSummary + } + }; + exports2.TypeInfo.BuildLog.fields = { + createdOn: { + isDate: true + }, + lastChangedOn: { + isDate: true + } + }; + exports2.TypeInfo.BuildMetric.fields = { + date: { + isDate: true + } + }; + exports2.TypeInfo.BuildOptionDefinition.fields = { + inputs: { + isArray: true, + typeInfo: exports2.TypeInfo.BuildOptionInputDefinition + } + }; + exports2.TypeInfo.BuildOptionInputDefinition.fields = { + type: { + enumType: exports2.TypeInfo.BuildOptionInputType + } + }; + exports2.TypeInfo.BuildProcessTemplate.fields = { + supportedReasons: { + enumType: exports2.TypeInfo.BuildReason + }, + templateType: { + enumType: exports2.TypeInfo.ProcessTemplateType + } + }; + exports2.TypeInfo.BuildQueuedEvent.fields = { + build: { + typeInfo: exports2.TypeInfo.Build + } + }; + exports2.TypeInfo.BuildReference.fields = { + finishTime: { + isDate: true + }, + queueTime: { + isDate: true + }, + result: { + enumType: exports2.TypeInfo.BuildResult + }, + startTime: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.BuildStatus + } + }; + exports2.TypeInfo.BuildRequestValidationResult.fields = { + result: { + enumType: exports2.TypeInfo.ValidationResult + } + }; + exports2.TypeInfo.BuildRetentionHistory.fields = { + buildRetentionSamples: { + isArray: true, + typeInfo: exports2.TypeInfo.BuildRetentionSample + } + }; + exports2.TypeInfo.BuildRetentionSample.fields = { + sampleTime: { + isDate: true + } + }; + exports2.TypeInfo.BuildServer.fields = { + status: { + enumType: exports2.TypeInfo.ServiceHostStatus + }, + statusChangedDate: { + isDate: true + } + }; + exports2.TypeInfo.BuildSummary.fields = { + finishTime: { + isDate: true + }, + reason: { + enumType: exports2.TypeInfo.BuildReason + }, + startTime: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.BuildStatus + } + }; + exports2.TypeInfo.BuildTagsAddedEvent.fields = { + build: { + typeInfo: exports2.TypeInfo.Build + } + }; + exports2.TypeInfo.BuildTrigger.fields = { + triggerType: { + enumType: exports2.TypeInfo.DefinitionTriggerType + } + }; + exports2.TypeInfo.BuildUpdatedEvent.fields = { + build: { + typeInfo: exports2.TypeInfo.Build + } + }; + exports2.TypeInfo.Change.fields = { + timestamp: { + isDate: true + } + }; + exports2.TypeInfo.ContinuousDeploymentDefinition.fields = { + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.ContinuousIntegrationTrigger.fields = { + triggerType: { + enumType: exports2.TypeInfo.DefinitionTriggerType + } + }; + exports2.TypeInfo.DefinitionReference.fields = { + createdDate: { + isDate: true + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + }, + queueStatus: { + enumType: exports2.TypeInfo.DefinitionQueueStatus + }, + type: { + enumType: exports2.TypeInfo.DefinitionType + } + }; + exports2.TypeInfo.DesignerProcess.fields = { + phases: { + isArray: true, + typeInfo: exports2.TypeInfo.Phase + } + }; + exports2.TypeInfo.Folder.fields = { + createdOn: { + isDate: true + }, + lastChangedDate: { + isDate: true + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.GatedCheckInTrigger.fields = { + triggerType: { + enumType: exports2.TypeInfo.DefinitionTriggerType + } + }; + exports2.TypeInfo.InformationNode.fields = { + lastModifiedDate: { + isDate: true + } + }; + exports2.TypeInfo.Issue.fields = { + type: { + enumType: exports2.TypeInfo.IssueType + } + }; + exports2.TypeInfo.Phase.fields = { + jobAuthorizationScope: { + enumType: exports2.TypeInfo.BuildAuthorizationScope + } + }; + exports2.TypeInfo.PullRequestTrigger.fields = { + triggerType: { + enumType: exports2.TypeInfo.DefinitionTriggerType + } + }; + exports2.TypeInfo.RepositoryWebhook.fields = { + types: { + isArray: true, + enumType: exports2.TypeInfo.DefinitionTriggerType + } + }; + exports2.TypeInfo.RetentionLease.fields = { + createdOn: { + isDate: true + }, + validUntil: { + isDate: true + } + }; + exports2.TypeInfo.Schedule.fields = { + daysToBuild: { + enumType: exports2.TypeInfo.ScheduleDays + } + }; + exports2.TypeInfo.ScheduleTrigger.fields = { + schedules: { + isArray: true, + typeInfo: exports2.TypeInfo.Schedule + }, + triggerType: { + enumType: exports2.TypeInfo.DefinitionTriggerType + } + }; + exports2.TypeInfo.SourceProviderAttributes.fields = { + supportedTriggers: { + isArray: true, + typeInfo: exports2.TypeInfo.SupportedTrigger + } + }; + exports2.TypeInfo.SupportedTrigger.fields = { + supportedCapabilities: { + isDictionary: true, + dictionaryValueEnumType: exports2.TypeInfo.SupportLevel + }, + type: { + enumType: exports2.TypeInfo.DefinitionTriggerType + } + }; + exports2.TypeInfo.Timeline.fields = { + lastChangedOn: { + isDate: true + }, + records: { + isArray: true, + typeInfo: exports2.TypeInfo.TimelineRecord + } + }; + exports2.TypeInfo.TimelineRecord.fields = { + finishTime: { + isDate: true + }, + issues: { + isArray: true, + typeInfo: exports2.TypeInfo.Issue + }, + lastModified: { + isDate: true + }, + result: { + enumType: exports2.TypeInfo.TaskResult + }, + startTime: { + isDate: true + }, + state: { + enumType: exports2.TypeInfo.TimelineRecordState + } + }; + exports2.TypeInfo.TimelineRecordsUpdatedEvent.fields = { + timelineRecords: { + isArray: true, + typeInfo: exports2.TypeInfo.TimelineRecord + } + }; + exports2.TypeInfo.UpdateStageParameters.fields = { + state: { + enumType: exports2.TypeInfo.StageUpdateType + } + }; + exports2.TypeInfo.WorkspaceMapping.fields = { + mappingType: { + enumType: exports2.TypeInfo.WorkspaceMappingType + } + }; + exports2.TypeInfo.WorkspaceTemplate.fields = { + lastModifiedDate: { + isDate: true + }, + mappings: { + isArray: true, + typeInfo: exports2.TypeInfo.WorkspaceMapping + } + }; + exports2.TypeInfo.XamlBuildDefinition.fields = { + controller: { + typeInfo: exports2.TypeInfo.BuildController + }, + createdDate: { + isDate: true + }, + createdOn: { + isDate: true + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + }, + queueStatus: { + enumType: exports2.TypeInfo.DefinitionQueueStatus + }, + supportedReasons: { + enumType: exports2.TypeInfo.BuildReason + }, + triggerType: { + enumType: exports2.TypeInfo.DefinitionTriggerType + }, + type: { + enumType: exports2.TypeInfo.DefinitionType + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/BuildApi.js +var require_BuildApi = __commonJS({ + "../node_modules/azure-devops-node-api/BuildApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BuildApi = void 0; + var basem = require_ClientApiBases(); + var BuildInterfaces = require_BuildInterfaces(); + var BuildApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Build-api", options); + } + /** + * Associates an artifact with a build. + * + * @param {BuildInterfaces.BuildArtifact} artifact - The artifact. + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + */ + createArtifact(artifact, project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, artifact, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a specific artifact for a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {string} artifactName - The name of the artifact. + */ + getArtifact(project, buildId, artifactName) { + return __awaiter2(this, void 0, void 0, function* () { + if (artifactName == null) { + throw new TypeError("artifactName can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + let queryValues = { + artifactName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a specific artifact for a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {string} artifactName - The name of the artifact. + */ + getArtifactContentZip(project, buildId, artifactName) { + return __awaiter2(this, void 0, void 0, function* () { + if (artifactName == null) { + throw new TypeError("artifactName can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + let queryValues = { + artifactName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets all artifacts for a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + */ + getArtifacts(project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a file from the build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {string} artifactName - The name of the artifact. + * @param {string} fileId - The primary key for the file. + * @param {string} fileName - The name that the file will be set to. + */ + getFile(project, buildId, artifactName, fileId, fileName) { + return __awaiter2(this, void 0, void 0, function* () { + if (artifactName == null) { + throw new TypeError("artifactName can not be null or undefined"); + } + if (fileId == null) { + throw new TypeError("fileId can not be null or undefined"); + } + if (fileName == null) { + throw new TypeError("fileName can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + let queryValues = { + artifactName, + fileId, + fileName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.5", "build", "1db06c96-014e-44e1-ac91-90b2d4b3e984", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the list of attachments of a specific type that are associated with a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {string} type - The type of attachment. + */ + getAttachments(project, buildId, type) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId, + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "f2192269-89fa-4f94-baf6-8fb128c55159", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a specific attachment. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {string} timelineId - The ID of the timeline. + * @param {string} recordId - The ID of the timeline record. + * @param {string} type - The type of the attachment. + * @param {string} name - The name of the attachment. + */ + getAttachment(project, buildId, timelineId, recordId, type, name) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId, + timelineId, + recordId, + type, + name + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "af5122d3-3438-485e-a25a-2dbbfde84ee6", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {BuildInterfaces.DefinitionResourceReference[]} resources + * @param {string} project - Project ID or project name + */ + authorizeProjectResources(resources, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "398c85bc-81aa-4822-947c-a194a05f0fef", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, resources, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} type + * @param {string} id + */ + getProjectResources(project, type, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + type, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "398c85bc-81aa-4822-947c-a194a05f0fef", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a badge that indicates the status of the most recent build for a definition. Note that this API is deprecated. Prefer StatusBadgeController.GetStatusBadge. + * + * @param {string} project - The project ID or name. + * @param {number} definitionId - The ID of the definition. + * @param {string} branchName - The name of the branch. + */ + getBadge(project, definitionId, branchName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + let queryValues = { + branchName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "de6a4df8-22cd-44ee-af2d-39f6aa7a4261", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a list of branches for the given source code repository. + * + * @param {string} project - Project ID or project name + * @param {string} providerName - The name of the source provider. + * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + * @param {string} repository - The vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. + * @param {string} branchName - If supplied, the name of the branch to check for specifically. + */ + listBranches(project, providerName, serviceEndpointId, repository, branchName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + providerName + }; + let queryValues = { + serviceEndpointId, + repository, + branchName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "e05d4403-9b81-4244-8763-20fde28d1976", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a badge that indicates the status of the most recent build for the specified branch. + * + * @param {string} project - Project ID or project name + * @param {string} repoType - The repository type. + * @param {string} repoId - The repository ID. + * @param {string} branchName - The branch name. + */ + getBuildBadge(project, repoType, repoId, branchName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repoType + }; + let queryValues = { + repoId, + branchName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "21b3b9ce-fad5-4567-9ad0-80679794e003", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a badge that indicates the status of the most recent build for the specified branch. + * + * @param {string} project - Project ID or project name + * @param {string} repoType - The repository type. + * @param {string} repoId - The repository ID. + * @param {string} branchName - The branch name. + */ + getBuildBadgeData(project, repoType, repoId, branchName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repoType + }; + let queryValues = { + repoId, + branchName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "21b3b9ce-fad5-4567-9ad0-80679794e003", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets all retention leases that apply to a specific build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + */ + getRetentionLeasesForBuild(project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "3da19a6a-f088-45c4-83ce-2ad3a87be6c4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + */ + deleteBuild(project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a build + * + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {string} propertyFilters + */ + getBuild(project, buildId, propertyFilters) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + let queryValues = { + propertyFilters + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a list of builds. + * + * @param {string} project - Project ID or project name + * @param {number[]} definitions - A comma-delimited list of definition IDs. If specified, filters to builds for these definitions. + * @param {number[]} queues - A comma-delimited list of queue IDs. If specified, filters to builds that ran against these queues. + * @param {string} buildNumber - If specified, filters to builds that match this build number. Append * to do a prefix search. + * @param {Date} minTime - If specified, filters to builds that finished/started/queued after this date based on the queryOrder specified. + * @param {Date} maxTime - If specified, filters to builds that finished/started/queued before this date based on the queryOrder specified. + * @param {string} requestedFor - If specified, filters to builds requested for the specified user. + * @param {BuildInterfaces.BuildReason} reasonFilter - If specified, filters to builds that match this reason. + * @param {BuildInterfaces.BuildStatus} statusFilter - If specified, filters to builds that match this status. + * @param {BuildInterfaces.BuildResult} resultFilter - If specified, filters to builds that match this result. + * @param {string[]} tagFilters - A comma-delimited list of tags. If specified, filters to builds that have the specified tags. + * @param {string[]} properties - A comma-delimited list of properties to retrieve. + * @param {number} top - The maximum number of builds to return. + * @param {string} continuationToken - A continuation token, returned by a previous call to this method, that can be used to return the next set of builds. + * @param {number} maxBuildsPerDefinition - The maximum number of builds to return per definition. + * @param {BuildInterfaces.QueryDeletedOption} deletedFilter - Indicates whether to exclude, include, or only return deleted builds. + * @param {BuildInterfaces.BuildQueryOrder} queryOrder - The order in which builds should be returned. + * @param {string} branchName - If specified, filters to builds that built branches that built this branch. + * @param {number[]} buildIds - A comma-delimited list that specifies the IDs of builds to retrieve. + * @param {string} repositoryId - If specified, filters to builds that built from this repository. + * @param {string} repositoryType - If specified, filters to builds that built from repositories of this type. + */ + getBuilds(project, definitions, queues, buildNumber, minTime, maxTime, requestedFor, reasonFilter, statusFilter, resultFilter, tagFilters, properties, top, continuationToken, maxBuildsPerDefinition, deletedFilter, queryOrder, branchName, buildIds, repositoryId, repositoryType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + definitions: definitions && definitions.join(","), + queues: queues && queues.join(","), + buildNumber, + minTime, + maxTime, + requestedFor, + reasonFilter, + statusFilter, + resultFilter, + tagFilters: tagFilters && tagFilters.join(","), + properties: properties && properties.join(","), + "$top": top, + continuationToken, + maxBuildsPerDefinition, + deletedFilter, + queryOrder, + branchName, + buildIds: buildIds && buildIds.join(","), + repositoryId, + repositoryType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Queues a build + * + * @param {BuildInterfaces.Build} build + * @param {string} project - Project ID or project name + * @param {boolean} ignoreWarnings + * @param {string} checkInTicket + * @param {number} sourceBuildId + * @param {number} definitionId - Optional definition id to queue a build without a body. Ignored if there's a valid body + */ + queueBuild(build, project, ignoreWarnings, checkInTicket, sourceBuildId, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + ignoreWarnings, + checkInTicket, + sourceBuildId, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, build, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a build. + * + * @param {BuildInterfaces.Build} build - The build. + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {boolean} retry + */ + updateBuild(build, project, buildId, retry) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + let queryValues = { + retry + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, build, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates multiple builds. + * + * @param {BuildInterfaces.Build[]} builds - The builds to update. + * @param {string} project - Project ID or project name + */ + updateBuilds(builds, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "0cd358e1-9217-4d94-8269-1c1ee6f93dcf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, builds, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the changes associated with a build + * + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {string} continuationToken + * @param {number} top - The maximum number of changes to return + * @param {boolean} includeSourceChange + */ + getBuildChanges(project, buildId, continuationToken, top, includeSourceChange) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + let queryValues = { + continuationToken, + "$top": top, + includeSourceChange + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "54572c7b-bbd3-45d4-80dc-28be08941620", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Change, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the changes made to the repository between two given builds. + * + * @param {string} project - Project ID or project name + * @param {number} fromBuildId - The ID of the first build. + * @param {number} toBuildId - The ID of the last build. + * @param {number} top - The maximum number of changes to return. + */ + getChangesBetweenBuilds(project, fromBuildId, toBuildId, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + fromBuildId, + toBuildId, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "f10f0ea5-18a1-43ec-a8fb-2042c7be9b43", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Change, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a controller + * + * @param {number} controllerId + */ + getBuildController(controllerId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + controllerId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "fcac1932-2ee1-437f-9b6f-7f696be858f6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildController, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets controller, optionally filtered by name + * + * @param {string} name + */ + getBuildControllers(name) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + name + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "fcac1932-2ee1-437f-9b6f-7f696be858f6", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildController, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a new definition. + * + * @param {BuildInterfaces.BuildDefinition} definition - The definition. + * @param {string} project - Project ID or project name + * @param {number} definitionToCloneId + * @param {number} definitionToCloneRevision + */ + createDefinition(definition, project, definitionToCloneId, definitionToCloneRevision) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + definitionToCloneId, + definitionToCloneRevision + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, definition, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes a definition and all associated builds. + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + */ + deleteDefinition(project, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a definition, optionally at a specific revision. + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + * @param {number} revision - The revision number to retrieve. If this is not specified, the latest version will be returned. + * @param {Date} minMetricsTime - If specified, indicates the date from which metrics should be included. + * @param {string[]} propertyFilters - A comma-delimited list of properties to include in the results. + * @param {boolean} includeLatestBuilds + */ + getDefinition(project, definitionId, revision, minMetricsTime, propertyFilters, includeLatestBuilds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + let queryValues = { + revision, + minMetricsTime, + propertyFilters: propertyFilters && propertyFilters.join(","), + includeLatestBuilds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a list of definitions. + * + * @param {string} project - Project ID or project name + * @param {string} name - If specified, filters to definitions whose names match this pattern. + * @param {string} repositoryId - A repository ID. If specified, filters to definitions that use this repository. + * @param {string} repositoryType - If specified, filters to definitions that have a repository of this type. + * @param {BuildInterfaces.DefinitionQueryOrder} queryOrder - Indicates the order in which definitions should be returned. + * @param {number} top - The maximum number of definitions to return. + * @param {string} continuationToken - A continuation token, returned by a previous call to this method, that can be used to return the next set of definitions. + * @param {Date} minMetricsTime - If specified, indicates the date from which metrics should be included. + * @param {number[]} definitionIds - A comma-delimited list that specifies the IDs of definitions to retrieve. + * @param {string} path - If specified, filters to definitions under this folder. + * @param {Date} builtAfter - If specified, filters to definitions that have builds after this date. + * @param {Date} notBuiltAfter - If specified, filters to definitions that do not have builds after this date. + * @param {boolean} includeAllProperties - Indicates whether the full definitions should be returned. By default, shallow representations of the definitions are returned. + * @param {boolean} includeLatestBuilds - Indicates whether to return the latest and latest completed builds for this definition. + * @param {string} taskIdFilter - If specified, filters to definitions that use the specified task. + * @param {number} processType - If specified, filters to definitions with the given process type. + * @param {string} yamlFilename - If specified, filters to YAML definitions that match the given filename. To use this filter includeAllProperties should be set to true + */ + getDefinitions(project, name, repositoryId, repositoryType, queryOrder, top, continuationToken, minMetricsTime, definitionIds, path2, builtAfter, notBuiltAfter, includeAllProperties, includeLatestBuilds, taskIdFilter, processType, yamlFilename) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + name, + repositoryId, + repositoryType, + queryOrder, + "$top": top, + continuationToken, + minMetricsTime, + definitionIds: definitionIds && definitionIds.join(","), + path: path2, + builtAfter, + notBuiltAfter, + includeAllProperties, + includeLatestBuilds, + taskIdFilter, + processType, + yamlFilename + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinitionReference, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Restores a deleted definition + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - The identifier of the definition to restore. + * @param {boolean} deleted - When false, restores a deleted definition. + */ + restoreDefinition(project, definitionId, deleted) { + return __awaiter2(this, void 0, void 0, function* () { + if (deleted == null) { + throw new TypeError("deleted can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + let queryValues = { + deleted + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, null, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates an existing build definition. In order for this operation to succeed, the value of the "Revision" property of the request body must match the existing build definition's. It is recommended that you obtain the existing build definition by using GET, modify the build definition as necessary, and then submit the modified definition with PUT. + * + * @param {BuildInterfaces.BuildDefinition} definition - The new version of the definition. Its "Revision" property must match the existing definition for the update to be accepted. + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + * @param {number} secretsSourceDefinitionId + * @param {number} secretsSourceDefinitionRevision + */ + updateDefinition(definition, project, definitionId, secretsSourceDefinitionId, secretsSourceDefinitionRevision) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + let queryValues = { + secretsSourceDefinitionId, + secretsSourceDefinitionRevision + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "build", "dbeaf647-6167-421a-bda9-c9327b25e2e6", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, definition, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the contents of a file in the given source code repository. + * + * @param {string} project - Project ID or project name + * @param {string} providerName - The name of the source provider. + * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + * @param {string} repository - If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. + * @param {string} commitOrBranch - The identifier of the commit or branch from which a file's contents are retrieved. + * @param {string} path - The path to the file to retrieve, relative to the root of the repository. + */ + getFileContents(project, providerName, serviceEndpointId, repository, commitOrBranch, path2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + providerName + }; + let queryValues = { + serviceEndpointId, + repository, + commitOrBranch, + path: path2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "29d12225-b1d9-425f-b668-6c594a981313", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a new folder. + * + * @param {BuildInterfaces.Folder} folder - The folder. + * @param {string} project - Project ID or project name + * @param {string} path - The full path of the folder. + */ + createFolder(folder, project, path2) { + return __awaiter2(this, void 0, void 0, function* () { + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + path: path2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "a906531b-d2da-4f55-bda7-f3e676cc50d9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, folder, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Folder, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes a definition folder. Definitions and their corresponding builds will also be deleted. + * + * @param {string} project - Project ID or project name + * @param {string} path - The full path to the folder. + */ + deleteFolder(project, path2) { + return __awaiter2(this, void 0, void 0, function* () { + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + path: path2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "a906531b-d2da-4f55-bda7-f3e676cc50d9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a list of build definition folders. + * + * @param {string} project - Project ID or project name + * @param {string} path - The path to start with. + * @param {BuildInterfaces.FolderQueryOrder} queryOrder - The order in which folders should be returned. + */ + getFolders(project, path2, queryOrder) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + path: path2 + }; + let queryValues = { + queryOrder + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "a906531b-d2da-4f55-bda7-f3e676cc50d9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Folder, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates an existing folder at given existing path + * + * @param {BuildInterfaces.Folder} folder - The new version of the folder. + * @param {string} project - Project ID or project name + * @param {string} path - The full path to the folder. + */ + updateFolder(folder, project, path2) { + return __awaiter2(this, void 0, void 0, function* () { + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + path: path2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "a906531b-d2da-4f55-bda7-f3e676cc50d9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, folder, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Folder, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets pipeline general settings. + * + * @param {string} project - Project ID or project name + */ + getBuildGeneralSettings(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "c4aefd19-30ff-405b-80ad-aca021e7242a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates pipeline general settings. + * + * @param {BuildInterfaces.PipelineGeneralSettings} newSettings + * @param {string} project - Project ID or project name + */ + updateBuildGeneralSettings(newSettings, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "c4aefd19-30ff-405b-80ad-aca021e7242a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, newSettings, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns the retention history for the project collection. This includes pipelines that have custom retention rules that may prevent the retention job from cleaning them up, runs per pipeline with retention type, files associated with pipelines owned by the collection with retention type, and the number of files per pipeline. + * + * @param {number} daysToLookback + */ + getRetentionHistory(daysToLookback) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + daysToLookback + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "1a9c48be-0ef5-4ec2-b94f-f053bdd2d3bf", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildRetentionHistory, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the latest build for a definition, optionally scoped to a specific branch. + * + * @param {string} project - Project ID or project name + * @param {string} definition - definition name with optional leading folder path, or the definition id + * @param {string} branchName - optional parameter that indicates the specific branch to use. If not specified, the default branch is used. + */ + getLatestBuild(project, definition, branchName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definition + }; + let queryValues = { + branchName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "54481611-01f4-47f3-998f-160da0f0c229", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Build, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds new leases for pipeline runs. + * + * @param {BuildInterfaces.NewRetentionLease[]} newLeases + * @param {string} project - Project ID or project name + */ + addRetentionLeases(newLeases, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, newLeases, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes specific retention leases. + * + * @param {string} project - Project ID or project name + * @param {number[]} ids + */ + deleteRetentionLeasesById(project, ids) { + return __awaiter2(this, void 0, void 0, function* () { + if (ids == null) { + throw new TypeError("ids can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + ids: ids && ids.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns the details of the retention lease given a lease id. + * + * @param {string} project - Project ID or project name + * @param {number} leaseId + */ + getRetentionLease(project, leaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + leaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns any leases matching the specified MinimalRetentionLeases + * + * @param {string} project - Project ID or project name + * @param {BuildInterfaces.MinimalRetentionLease[]} leasesToFetch - List of JSON-serialized MinimalRetentionLeases separated by '|' + */ + getRetentionLeasesByMinimalRetentionLeases(project, leasesToFetch) { + return __awaiter2(this, void 0, void 0, function* () { + if (leasesToFetch == null) { + throw new TypeError("leasesToFetch can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + leasesToFetch: leasesToFetch && leasesToFetch.join("|") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns any leases owned by the specified entity, optionally scoped to a single pipeline definition and run. + * + * @param {string} project - Project ID or project name + * @param {string} ownerId + * @param {number} definitionId - An optional parameter to limit the search to a specific pipeline definition. + * @param {number} runId - An optional parameter to limit the search to a single pipeline run. Requires definitionId. + */ + getRetentionLeasesByOwnerId(project, ownerId, definitionId, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + ownerId, + definitionId, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns any leases owned by the specified user, optionally scoped to a single pipeline definition and run. + * + * @param {string} project - Project ID or project name + * @param {string} userOwnerId - The user id to search for. + * @param {number} definitionId - An optional parameter to limit the search to a specific pipeline definition. + * @param {number} runId - An optional parameter to limit the search to a single pipeline run. Requires definitionId. + */ + getRetentionLeasesByUserId(project, userOwnerId, definitionId, runId) { + return __awaiter2(this, void 0, void 0, function* () { + if (userOwnerId == null) { + throw new TypeError("userOwnerId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + userOwnerId, + definitionId, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates the duration or pipeline protection status of a retention lease. + * + * @param {BuildInterfaces.RetentionLeaseUpdate} leaseUpdate - The new data for the retention lease. + * @param {string} project - Project ID or project name + * @param {number} leaseId - The ID of the lease to update. + */ + updateRetentionLease(leaseUpdate, project, leaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + leaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "272051e4-9af1-45b5-ae22-8d960a5539d4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, leaseUpdate, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RetentionLease, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets an individual log file for a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {number} logId - The ID of the log file. + * @param {number} startLine - The start line. + * @param {number} endLine - The end line. + */ + getBuildLog(project, buildId, logId, startLine, endLine) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId, + logId + }; + let queryValues = { + startLine, + endLine + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "35a80daf-7f30-45fc-86e8-6b813d9c90df", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets an individual log file for a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {number} logId - The ID of the log file. + * @param {number} startLine - The start line. + * @param {number} endLine - The end line. + */ + getBuildLogLines(project, buildId, logId, startLine, endLine) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId, + logId + }; + let queryValues = { + startLine, + endLine + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "35a80daf-7f30-45fc-86e8-6b813d9c90df", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the logs for a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + */ + getBuildLogs(project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "35a80daf-7f30-45fc-86e8-6b813d9c90df", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildLog, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the logs for a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + */ + getBuildLogsZip(project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "35a80daf-7f30-45fc-86e8-6b813d9c90df", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets an individual log file for a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {number} logId - The ID of the log file. + * @param {number} startLine - The start line. + * @param {number} endLine - The end line. + */ + getBuildLogZip(project, buildId, logId, startLine, endLine) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId, + logId + }; + let queryValues = { + startLine, + endLine + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "35a80daf-7f30-45fc-86e8-6b813d9c90df", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets build metrics for a project. + * + * @param {string} project - Project ID or project name + * @param {string} metricAggregationType - The aggregation type to use (hourly, daily). + * @param {Date} minMetricsTime - The date from which to calculate metrics. + */ + getProjectMetrics(project, metricAggregationType, minMetricsTime) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + metricAggregationType + }; + let queryValues = { + minMetricsTime + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "7433fae7-a6bc-41dc-a6e2-eef9005ce41a", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildMetric, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets build metrics for a definition. + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + * @param {Date} minMetricsTime - The date from which to calculate metrics. + */ + getDefinitionMetrics(project, definitionId, minMetricsTime) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + let queryValues = { + minMetricsTime + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "d973b939-0ce0-4fec-91d8-da3940fa1827", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildMetric, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets all build definition options supported by the system. + * + * @param {string} project - Project ID or project name + */ + getBuildOptionDefinitions(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "591cb5a4-2d46-4f3a-a697-5cd42b6bd332", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildOptionDefinition, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the contents of a directory in the given source code repository. + * + * @param {string} project - Project ID or project name + * @param {string} providerName - The name of the source provider. + * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + * @param {string} repository - If specified, the vendor-specific identifier or the name of the repository to get branches. Can only be omitted for providers that do not support multiple repositories. + * @param {string} commitOrBranch - The identifier of the commit or branch from which a file's contents are retrieved. + * @param {string} path - The path contents to list, relative to the root of the repository. + */ + getPathContents(project, providerName, serviceEndpointId, repository, commitOrBranch, path2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + providerName + }; + let queryValues = { + serviceEndpointId, + repository, + commitOrBranch, + path: path2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "7944d6fb-df01-4709-920a-7a189aa34037", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets properties for a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {string[]} filter - A comma-delimited list of properties. If specified, filters to these specific properties. + */ + getBuildProperties(project, buildId, filter2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + let queryValues = { + filter: filter2 && filter2.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "0a6312e9-0627-49b7-8083-7d74a64849c9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates properties for a build. + * + * @param {VSSInterfaces.JsonPatchDocument} document - A json-patch document describing the properties to update. + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + */ + updateBuildProperties(customHeaders, document, project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/json-patch+json"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "0a6312e9-0627-49b7-8083-7d74a64849c9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.update(url, document, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets properties for a definition. + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + * @param {string[]} filter - A comma-delimited list of properties. If specified, filters to these specific properties. + */ + getDefinitionProperties(project, definitionId, filter2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + let queryValues = { + filter: filter2 && filter2.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "d9826ad7-2a68-46a9-a6e9-677698777895", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates properties for a definition. + * + * @param {VSSInterfaces.JsonPatchDocument} document - A json-patch document describing the properties to update. + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + */ + updateDefinitionProperties(customHeaders, document, project, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/json-patch+json"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "d9826ad7-2a68-46a9-a6e9-677698777895", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.update(url, document, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a pull request object from source provider. + * + * @param {string} project - Project ID or project name + * @param {string} providerName - The name of the source provider. + * @param {string} pullRequestId - Vendor-specific id of the pull request. + * @param {string} repositoryId - Vendor-specific identifier or the name of the repository that contains the pull request. + * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + */ + getPullRequest(project, providerName, pullRequestId, repositoryId, serviceEndpointId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + providerName, + pullRequestId + }; + let queryValues = { + repositoryId, + serviceEndpointId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "d8763ec7-9ff0-4fb4-b2b2-9d757906ff14", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a build report. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {string} type + */ + getBuildReport(project, buildId, type) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + let queryValues = { + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "45bcaa88-67e1-4042-a035-56d3b4a7d44c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a build report. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {string} type + */ + getBuildReportHtmlContent(project, buildId, type) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + let queryValues = { + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "45bcaa88-67e1-4042-a035-56d3b4a7d44c", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/html", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a list of source code repositories. + * + * @param {string} project - Project ID or project name + * @param {string} providerName - The name of the source provider. + * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + * @param {string} repository - If specified, the vendor-specific identifier or the name of a single repository to get. + * @param {BuildInterfaces.ResultSet} resultSet - 'top' for the repositories most relevant for the endpoint. If not set, all repositories are returned. Ignored if 'repository' is set. + * @param {boolean} pageResults - If set to true, this will limit the set of results and will return a continuation token to continue the query. + * @param {string} continuationToken - When paging results, this is a continuation token, returned by a previous call to this method, that can be used to return the next set of repositories. + */ + listRepositories(project, providerName, serviceEndpointId, repository, resultSet, pageResults, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + providerName + }; + let queryValues = { + serviceEndpointId, + repository, + resultSet, + pageResults, + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "d44d1680-f978-4834-9b93-8c6e132329c9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {BuildInterfaces.DefinitionResourceReference[]} resources + * @param {string} project - Project ID or project name + * @param {number} definitionId + */ + authorizeDefinitionResources(resources, project, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "ea623316-1967-45eb-89ab-e9e6110cf2d6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, resources, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} definitionId + */ + getDefinitionResources(project, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "ea623316-1967-45eb-89ab-e9e6110cf2d6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets information about build resources in the system. + * + */ + getResourceUsage() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "3813d06c-9e36-4ea1-aac3-61a485d60e3d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the project's retention settings. + * + * @param {string} project - Project ID or project name + */ + getRetentionSettings(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "dadb46e7-5851-4c72-820e-ae8abb82f59f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates the project's retention settings. + * + * @param {BuildInterfaces.UpdateProjectRetentionSettingModel} updateModel + * @param {string} project - Project ID or project name + */ + updateRetentionSettings(updateModel, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "dadb46e7-5851-4c72-820e-ae8abb82f59f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, updateModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets all revisions of a definition. + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + */ + getDefinitionRevisions(project, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "7c116775-52e5-453e-8c5d-914d9762d8c4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinitionRevision, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the build settings. + * + * @param {string} project - Project ID or project name + */ + getBuildSettings(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates the build settings. + * + * @param {BuildInterfaces.BuildSettings} settings - The new settings. + * @param {string} project - Project ID or project name + */ + updateBuildSettings(settings, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "aa8c1c9c-ef8b-474a-b8c4-785c7b191d0d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, settings, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of source providers and their capabilities. + * + * @param {string} project - Project ID or project name + */ + listSourceProviders(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "3ce81729-954f-423d-a581-9fea01d25186", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.SourceProviderAttributes, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a build stage + * + * @param {BuildInterfaces.UpdateStageParameters} updateParameters + * @param {number} buildId + * @param {string} stageRefName + * @param {string} project - Project ID or project name + */ + updateStage(updateParameters, buildId, stageRefName, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId, + stageRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "b8aac6c9-744b-46e1-88fc-3550969f9313", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, updateParameters, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + *

Gets the build status for a definition, optionally scoped to a specific branch, stage, job, and configuration.

If there are more than one, then it is required to pass in a stageName value when specifying a jobName, and the same rule then applies for both if passing a configuration parameter.

+ * + * @param {string} project - Project ID or project name + * @param {string} definition - Either the definition name with optional leading folder path, or the definition id. + * @param {string} branchName - Only consider the most recent build for this branch. If not specified, the default branch is used. + * @param {string} stageName - Use this stage within the pipeline to render the status. + * @param {string} jobName - Use this job within a stage of the pipeline to render the status. + * @param {string} configuration - Use this job configuration to render the status + * @param {string} label - Replaces the default text on the left side of the badge. + */ + getStatusBadge(project, definition, branchName, stageName, jobName, configuration, label) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definition + }; + let queryValues = { + branchName, + stageName, + jobName, + configuration, + label + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "07acfdce-4757-4439-b422-ddd13a2fcc10", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a tag to a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {string} tag - The tag to add. + */ + addBuildTag(project, buildId, tag) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId, + tag + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "6e6114b2-8161-44c8-8f6c-c5505782427f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds tags to a build. + * + * @param {string[]} tags - The tags to add. Request body is composed directly from listed tags. + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + */ + addBuildTags(tags, project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "6e6114b2-8161-44c8-8f6c-c5505782427f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, tags, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a tag from a build. NOTE: This API will not work for tags with special characters. To remove tags with special characters, use the PATCH method instead (in 6.0+) + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {string} tag - The tag to remove. + */ + deleteBuildTag(project, buildId, tag) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId, + tag + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "6e6114b2-8161-44c8-8f6c-c5505782427f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the tags for a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + */ + getBuildTags(project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "6e6114b2-8161-44c8-8f6c-c5505782427f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds/Removes tags from a build. + * + * @param {BuildInterfaces.UpdateTagParameters} updateParameters - The tags to add/remove. + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + */ + updateBuildTags(updateParameters, project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "6e6114b2-8161-44c8-8f6c-c5505782427f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, updateParameters, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a tag to a definition + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + * @param {string} tag - The tag to add. + */ + addDefinitionTag(project, definitionId, tag) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId, + tag + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "cb894432-134a-4d31-a839-83beceaace4b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds multiple tags to a definition. + * + * @param {string[]} tags - The tags to add. + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + */ + addDefinitionTags(tags, project, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "cb894432-134a-4d31-a839-83beceaace4b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, tags, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a tag from a definition. NOTE: This API will not work for tags with special characters. To remove tags with special characters, use the PATCH method instead (in 6.0+) + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + * @param {string} tag - The tag to remove. + */ + deleteDefinitionTag(project, definitionId, tag) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId, + tag + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "cb894432-134a-4d31-a839-83beceaace4b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the tags for a definition. + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + * @param {number} revision - The definition revision number. If not specified, uses the latest revision of the definition. + */ + getDefinitionTags(project, definitionId, revision) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + let queryValues = { + revision + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "cb894432-134a-4d31-a839-83beceaace4b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds/Removes tags from a definition. + * + * @param {BuildInterfaces.UpdateTagParameters} updateParameters - The tags to add/remove. + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + */ + updateDefinitionTags(updateParameters, project, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "cb894432-134a-4d31-a839-83beceaace4b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, updateParameters, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a tag from builds, definitions, and from the tag store + * + * @param {string} project - Project ID or project name + * @param {string} tag - The tag to remove. + */ + deleteTag(project, tag) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + tag + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "d84ac5c6-edc7-43d5-adc9-1b34be5dea09", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a list of all build tags in the project. + * + * @param {string} project - Project ID or project name + */ + getTags(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "d84ac5c6-edc7-43d5-adc9-1b34be5dea09", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes a build definition template. + * + * @param {string} project - Project ID or project name + * @param {string} templateId - The ID of the template. + */ + deleteTemplate(project, templateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + templateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "e884571e-7f92-4d6a-9274-3f5649900835", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a specific build definition template. + * + * @param {string} project - Project ID or project name + * @param {string} templateId - The ID of the requested template. + */ + getTemplate(project, templateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + templateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "e884571e-7f92-4d6a-9274-3f5649900835", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinitionTemplate, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets all definition templates. + * + * @param {string} project - Project ID or project name + */ + getTemplates(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "e884571e-7f92-4d6a-9274-3f5649900835", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinitionTemplate, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates an existing build definition template. + * + * @param {BuildInterfaces.BuildDefinitionTemplate} template - The new version of the template. + * @param {string} project - Project ID or project name + * @param {string} templateId - The ID of the template. + */ + saveTemplate(template2, project, templateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + templateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "build", "e884571e-7f92-4d6a-9274-3f5649900835", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, template2, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.BuildDefinitionTemplate, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets details for a build + * + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {string} timelineId + * @param {number} changeId + * @param {string} planId + */ + getBuildTimeline(project, buildId, timelineId, changeId, planId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId, + timelineId + }; + let queryValues = { + changeId, + planId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "8baac422-4c6e-4de5-8532-db96d92acffa", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.Timeline, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Recreates the webhooks for the specified triggers in the given source code repository. + * + * @param {BuildInterfaces.DefinitionTriggerType[]} triggerTypes - The types of triggers to restore webhooks for. + * @param {string} project - Project ID or project name + * @param {string} providerName - The name of the source provider. + * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + * @param {string} repository - If specified, the vendor-specific identifier or the name of the repository to get webhooks. Can only be omitted for providers that do not support multiple repositories. + */ + restoreWebhooks(triggerTypes, project, providerName, serviceEndpointId, repository) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + providerName + }; + let queryValues = { + serviceEndpointId, + repository + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "793bceb8-9736-4030-bd2f-fb3ce6d6b478", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, triggerTypes, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a list of webhooks installed in the given source code repository. + * + * @param {string} project - Project ID or project name + * @param {string} providerName - The name of the source provider. + * @param {string} serviceEndpointId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TFVC or TFGit. + * @param {string} repository - If specified, the vendor-specific identifier or the name of the repository to get webhooks. Can only be omitted for providers that do not support multiple repositories. + */ + listWebhooks(project, providerName, serviceEndpointId, repository) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + providerName + }; + let queryValues = { + serviceEndpointId, + repository + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "8f20ff82-9498-4812-9f6e-9c01bdc50e99", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, BuildInterfaces.TypeInfo.RepositoryWebhook, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the work items associated with a build. Only work items in the same project are returned. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {number} top - The maximum number of work items to return. + */ + getBuildWorkItemsRefs(project, buildId, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + let queryValues = { + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "5a21f5d2-5642-47e4-a0bd-1356e6731bee", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the work items associated with a build, filtered to specific commits. + * + * @param {string[]} commitIds - A comma-delimited list of commit IDs. + * @param {string} project - Project ID or project name + * @param {number} buildId - The ID of the build. + * @param {number} top - The maximum number of work items to return, or the number of commits to consider if no commit IDs are specified. + */ + getBuildWorkItemsRefsFromCommits(commitIds, project, buildId, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + let queryValues = { + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "5a21f5d2-5642-47e4-a0bd-1356e6731bee", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, commitIds, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets all the work items between two builds. + * + * @param {string} project - Project ID or project name + * @param {number} fromBuildId - The ID of the first build. + * @param {number} toBuildId - The ID of the last build. + * @param {number} top - The maximum number of work items to return. + */ + getWorkItemsBetweenBuilds(project, fromBuildId, toBuildId, top) { + return __awaiter2(this, void 0, void 0, function* () { + if (fromBuildId == null) { + throw new TypeError("fromBuildId can not be null or undefined"); + } + if (toBuildId == null) { + throw new TypeError("toBuildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + fromBuildId, + toBuildId, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "build", "52ba8915-5518-42e3-a4bb-b0182d159e2d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Converts a definition to YAML, optionally at a specific revision. + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - The ID of the definition. + * @param {number} revision - The revision number to retrieve. If this is not specified, the latest version will be returned. + * @param {Date} minMetricsTime - If specified, indicates the date from which metrics should be included. + * @param {string[]} propertyFilters - A comma-delimited list of properties to include in the results. + * @param {boolean} includeLatestBuilds + */ + getDefinitionYaml(project, definitionId, revision, minMetricsTime, propertyFilters, includeLatestBuilds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + let queryValues = { + revision, + minMetricsTime, + propertyFilters: propertyFilters && propertyFilters.join(","), + includeLatestBuilds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "build", "7c3df3a1-7e51-4150-8cf7-540347f8697f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.BuildApi = BuildApi; + BuildApi.RESOURCE_AREA_ID = "965220d5-5bb9-42cf-8d67-9b146df2a5a4"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/common/OperationsInterfaces.js +var require_OperationsInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/common/OperationsInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.OperationStatus = void 0; + var OperationStatus; + (function(OperationStatus2) { + OperationStatus2[OperationStatus2["NotSet"] = 0] = "NotSet"; + OperationStatus2[OperationStatus2["Queued"] = 1] = "Queued"; + OperationStatus2[OperationStatus2["InProgress"] = 2] = "InProgress"; + OperationStatus2[OperationStatus2["Cancelled"] = 3] = "Cancelled"; + OperationStatus2[OperationStatus2["Succeeded"] = 4] = "Succeeded"; + OperationStatus2[OperationStatus2["Failed"] = 5] = "Failed"; + })(OperationStatus = exports2.OperationStatus || (exports2.OperationStatus = {})); + exports2.TypeInfo = { + Operation: {}, + OperationReference: {}, + OperationStatus: { + enumValues: { + "notSet": 0, + "queued": 1, + "inProgress": 2, + "cancelled": 3, + "succeeded": 4, + "failed": 5 + } + } + }; + exports2.TypeInfo.Operation.fields = { + status: { + enumType: exports2.TypeInfo.OperationStatus + } + }; + exports2.TypeInfo.OperationReference.fields = { + status: { + enumType: exports2.TypeInfo.OperationStatus + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/CoreApi.js +var require_CoreApi = __commonJS({ + "../node_modules/azure-devops-node-api/CoreApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.CoreApi = void 0; + var basem = require_ClientApiBases(); + var CoreInterfaces = require_CoreInterfaces(); + var OperationsInterfaces = require_OperationsInterfaces(); + var CoreApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Core-api", options); + } + /** + * Removes the avatar for the project. + * + * @param {string} projectId - The ID or name of the project. + */ + removeProjectAvatar(projectId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "54b2a2a0-859b-4d05-827c-ec4c862f641a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Sets the avatar for the project. + * + * @param {CoreInterfaces.ProjectAvatar} avatarBlob - The avatar blob data object to upload. + * @param {string} projectId - The ID or name of the project. + */ + setProjectAvatar(avatarBlob, projectId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "54b2a2a0-859b-4d05-827c-ec4c862f641a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, avatarBlob, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets list of user readable teams in a project and teams user is member of (excluded from readable list). + * + * @param {string} projectId - The name or ID (GUID) of the team project containing the teams to retrieve. + * @param {boolean} expandIdentity - A value indicating whether or not to expand Identity information in the result WebApiTeam object. + * @param {number} top - Maximum number of teams to return. + * @param {number} skip - Number of teams to skip. + */ + getProjectTeamsByCategory(projectId, expandIdentity, top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId + }; + let queryValues = { + "$expandIdentity": expandIdentity, + "$top": top, + "$skip": skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "6f9619ff-8b86-d011-b42d-00c04fc964ff", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {CoreInterfaces.WebApiConnectedServiceDetails} connectedServiceCreationData + * @param {string} projectId + */ + createConnectedService(connectedServiceCreationData, projectId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "b4f70219-e18b-42c5-abe3-98b07d35525e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, connectedServiceCreationData, options); + let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.WebApiConnectedService, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} projectId + * @param {string} name + */ + getConnectedServiceDetails(projectId, name) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId, + name + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "b4f70219-e18b-42c5-abe3-98b07d35525e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.WebApiConnectedServiceDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} projectId + * @param {CoreInterfaces.ConnectedServiceKind} kind + */ + getConnectedServices(projectId, kind) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId + }; + let queryValues = { + kind + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "b4f70219-e18b-42c5-abe3-98b07d35525e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.WebApiConnectedService, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {CoreInterfaces.IdentityData} mruData + * @param {string} mruName + */ + createIdentityMru(mruData, mruName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + mruName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "5ead0b70-2572-4697-97e9-f341069a783a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, mruData, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {CoreInterfaces.IdentityData} mruData + * @param {string} mruName + */ + deleteIdentityMru(mruData, mruName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + mruName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "5ead0b70-2572-4697-97e9-f341069a783a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} mruName + */ + getIdentityMru(mruName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + mruName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "5ead0b70-2572-4697-97e9-f341069a783a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {CoreInterfaces.IdentityData} mruData + * @param {string} mruName + */ + updateIdentityMru(mruData, mruName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + mruName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "5ead0b70-2572-4697-97e9-f341069a783a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, mruData, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of members for a specific team. + * + * @param {string} projectId - The name or ID (GUID) of the team project the team belongs to. + * @param {string} teamId - The name or ID (GUID) of the team . + * @param {number} top + * @param {number} skip + */ + getTeamMembersWithExtendedProperties(projectId, teamId, top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId, + teamId + }; + let queryValues = { + "$top": top, + "$skip": skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "294c494c-2600-4d7e-b76c-3dd50c3c95be", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a process by ID. + * + * @param {string} processId - ID for a process. + */ + getProcessById(processId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "93878975-88c5-4e6a-8abb-7ddd77a8a7d8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.Process, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of processes. + * + */ + getProcesses() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "93878975-88c5-4e6a-8abb-7ddd77a8a7d8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.Process, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get project collection with the specified id or name. + * + * @param {string} collectionId + */ + getProjectCollection(collectionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + collectionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "8031090f-ef1d-4af6-85fc-698cd75d42bf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.TeamProjectCollection, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get project collection references for this application. + * + * @param {number} top + * @param {number} skip + */ + getProjectCollections(top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + "$top": top, + "$skip": skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "8031090f-ef1d-4af6-85fc-698cd75d42bf", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the history of changes to the project. + * + * @param {number} minRevision - The minimum revision number to return in the history. + */ + getProjectHistoryEntries(minRevision) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + minRevision + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "6488a877-4749-4954-82ea-7340d36be9f2", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.ProjectInfo, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get project with the specified id or name, optionally including capabilities. + * + * @param {string} projectId + * @param {boolean} includeCapabilities - Include capabilities (such as source control) in the team project result (default: false). + * @param {boolean} includeHistory - Search within renamed projects (that had such name in the past). + */ + getProject(projectId, includeCapabilities, includeHistory) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId + }; + let queryValues = { + includeCapabilities, + includeHistory + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "core", "603fe2ac-9723-48b9-88ad-09305aa6c6e1", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.TeamProject, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all projects in the organization that the authenticated user has access to. + * + * @param {any} stateFilter - Filter on team projects in a specific team project state (default: WellFormed). + * @param {number} top + * @param {number} skip + * @param {number} continuationToken - Pointer that shows how many projects already been fetched. + * @param {boolean} getDefaultTeamImageUrl + */ + getProjects(stateFilter, top, skip, continuationToken, getDefaultTeamImageUrl) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + stateFilter, + "$top": top, + "$skip": skip, + continuationToken, + getDefaultTeamImageUrl + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "core", "603fe2ac-9723-48b9-88ad-09305aa6c6e1", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, CoreInterfaces.TypeInfo.TeamProjectReference, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Queues a project to be created. Use the [GetOperation](../../operations/operations/get) to periodically check for create project status. + * + * @param {CoreInterfaces.TeamProject} projectToCreate - The project to create. + */ + queueCreateProject(projectToCreate) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "core", "603fe2ac-9723-48b9-88ad-09305aa6c6e1", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, projectToCreate, options); + let ret = this.formatResponse(res.result, OperationsInterfaces.TypeInfo.OperationReference, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Queues a project to be deleted. Use the [GetOperation](../../operations/operations/get) to periodically check for delete project status. + * + * @param {string} projectId - The project id of the project to delete. + */ + queueDeleteProject(projectId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "core", "603fe2ac-9723-48b9-88ad-09305aa6c6e1", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, OperationsInterfaces.TypeInfo.OperationReference, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update an existing project's name, abbreviation, description, or restore a project. + * + * @param {CoreInterfaces.TeamProject} projectUpdate - The updates for the project. The state must be set to wellFormed to restore the project. + * @param {string} projectId - The project id of the project to update. + */ + updateProject(projectUpdate, projectId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "core", "603fe2ac-9723-48b9-88ad-09305aa6c6e1", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, projectUpdate, options); + let ret = this.formatResponse(res.result, OperationsInterfaces.TypeInfo.OperationReference, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a collection of team project properties for multiple projects. + * + * @param {string[]} projectIds - A comma-delimited string of team project IDs + * @param {string[]} properties + */ + getProjectsProperties(projectIds, properties) { + return __awaiter2(this, void 0, void 0, function* () { + if (projectIds == null) { + throw new TypeError("projectIds can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + projectIds: projectIds && projectIds.join(","), + properties: properties && properties.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "0a3ffdfc-fe94-47a6-bb27-79bf3f762eac", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a collection of team project properties. + * + * @param {string} projectId - The team project ID. + * @param {string[]} keys - A comma-delimited string of team project property names. Wildcard characters ("?" and "*") are supported. If no key is specified, all properties will be returned. + */ + getProjectProperties(projectId, keys2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId + }; + let queryValues = { + keys: keys2 && keys2.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "4976a71a-4487-49aa-8aab-a1eda469037a", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create, update, and delete team project properties. + * + * @param {string} projectId - The team project ID. + * @param {VSSInterfaces.JsonPatchDocument} patchDocument - A JSON Patch document that represents an array of property operations. See RFC 6902 for more details on JSON Patch. The accepted operation verbs are Add and Remove, where Add is used for both creating and updating properties. The path consists of a forward slash and a property name. + */ + setProjectProperties(customHeaders, projectId, patchDocument) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/json-patch+json"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "core", "4976a71a-4487-49aa-8aab-a1eda469037a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.update(url, patchDocument, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {CoreInterfaces.Proxy} proxy + */ + createOrUpdateProxy(proxy) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "ec1f4311-f2b4-4c15-b2b8-8990b80d2908", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, proxy, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} proxyUrl + * @param {string} site + */ + deleteProxy(proxyUrl, site) { + return __awaiter2(this, void 0, void 0, function* () { + if (proxyUrl == null) { + throw new TypeError("proxyUrl can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + proxyUrl, + site + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "ec1f4311-f2b4-4c15-b2b8-8990b80d2908", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} proxyUrl + */ + getProxies(proxyUrl) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + proxyUrl + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "core", "ec1f4311-f2b4-4c15-b2b8-8990b80d2908", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of all teams. + * + * @param {boolean} mine - If true, then return all teams requesting user is member. Otherwise return all teams user has read access. + * @param {number} top - Maximum number of teams to return. + * @param {number} skip - Number of teams to skip. + * @param {boolean} expandIdentity - A value indicating whether or not to expand Identity information in the result WebApiTeam object. + */ + getAllTeams(mine, top, skip, expandIdentity) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + "$mine": mine, + "$top": top, + "$skip": skip, + "$expandIdentity": expandIdentity + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "core", "7a4d9ee9-3433-4347-b47a-7a80f1cf307e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a team in a team project. + * + * @param {CoreInterfaces.WebApiTeam} team - The team data used to create the team. + * @param {string} projectId - The name or ID (GUID) of the team project in which to create the team. + */ + createTeam(team, projectId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "core", "d30a3dd1-f8ba-442a-b86a-bd0c0c383e59", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, team, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a team. + * + * @param {string} projectId - The name or ID (GUID) of the team project containing the team to delete. + * @param {string} teamId - The name or ID of the team to delete. + */ + deleteTeam(projectId, teamId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId, + teamId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "core", "d30a3dd1-f8ba-442a-b86a-bd0c0c383e59", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a specific team. + * + * @param {string} projectId - The name or ID (GUID) of the team project containing the team. + * @param {string} teamId - The name or ID (GUID) of the team. + * @param {boolean} expandIdentity - A value indicating whether or not to expand Identity information in the result WebApiTeam object. + */ + getTeam(projectId, teamId, expandIdentity) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId, + teamId + }; + let queryValues = { + "$expandIdentity": expandIdentity + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "core", "d30a3dd1-f8ba-442a-b86a-bd0c0c383e59", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of teams. + * + * @param {string} projectId + * @param {boolean} mine - If true return all the teams requesting user is member, otherwise return all the teams user has read access. + * @param {number} top - Maximum number of teams to return. + * @param {number} skip - Number of teams to skip. + * @param {boolean} expandIdentity - A value indicating whether or not to expand Identity information in the result WebApiTeam object. + */ + getTeams(projectId, mine, top, skip, expandIdentity) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId + }; + let queryValues = { + "$mine": mine, + "$top": top, + "$skip": skip, + "$expandIdentity": expandIdentity + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "core", "d30a3dd1-f8ba-442a-b86a-bd0c0c383e59", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a team's name and/or description. + * + * @param {CoreInterfaces.WebApiTeam} teamData + * @param {string} projectId - The name or ID (GUID) of the team project containing the team to update. + * @param {string} teamId - The name of ID of the team to update. + */ + updateTeam(teamData, projectId, teamId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId, + teamId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "core", "d30a3dd1-f8ba-442a-b86a-bd0c0c383e59", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, teamData, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.CoreApi = CoreApi; + CoreApi.RESOURCE_AREA_ID = "79134c72-4a58-4b42-976c-04e7115f32bf"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/DashboardInterfaces.js +var require_DashboardInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/DashboardInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.WidgetScope = exports2.TeamDashboardPermission = exports2.GroupMemberPermission = exports2.DashboardScope = void 0; + var DashboardScope; + (function(DashboardScope2) { + DashboardScope2[DashboardScope2["Collection_User"] = 0] = "Collection_User"; + DashboardScope2[DashboardScope2["Project_Team"] = 1] = "Project_Team"; + DashboardScope2[DashboardScope2["Project"] = 2] = "Project"; + })(DashboardScope = exports2.DashboardScope || (exports2.DashboardScope = {})); + var GroupMemberPermission; + (function(GroupMemberPermission2) { + GroupMemberPermission2[GroupMemberPermission2["None"] = 0] = "None"; + GroupMemberPermission2[GroupMemberPermission2["Edit"] = 1] = "Edit"; + GroupMemberPermission2[GroupMemberPermission2["Manage"] = 2] = "Manage"; + GroupMemberPermission2[GroupMemberPermission2["ManagePermissions"] = 3] = "ManagePermissions"; + })(GroupMemberPermission = exports2.GroupMemberPermission || (exports2.GroupMemberPermission = {})); + var TeamDashboardPermission; + (function(TeamDashboardPermission2) { + TeamDashboardPermission2[TeamDashboardPermission2["None"] = 0] = "None"; + TeamDashboardPermission2[TeamDashboardPermission2["Read"] = 1] = "Read"; + TeamDashboardPermission2[TeamDashboardPermission2["Create"] = 2] = "Create"; + TeamDashboardPermission2[TeamDashboardPermission2["Edit"] = 4] = "Edit"; + TeamDashboardPermission2[TeamDashboardPermission2["Delete"] = 8] = "Delete"; + TeamDashboardPermission2[TeamDashboardPermission2["ManagePermissions"] = 16] = "ManagePermissions"; + })(TeamDashboardPermission = exports2.TeamDashboardPermission || (exports2.TeamDashboardPermission = {})); + var WidgetScope; + (function(WidgetScope2) { + WidgetScope2[WidgetScope2["Collection_User"] = 0] = "Collection_User"; + WidgetScope2[WidgetScope2["Project_Team"] = 1] = "Project_Team"; + })(WidgetScope = exports2.WidgetScope || (exports2.WidgetScope = {})); + exports2.TypeInfo = { + CopyDashboardOptions: {}, + CopyDashboardResponse: {}, + Dashboard: {}, + DashboardGroup: {}, + DashboardGroupEntry: {}, + DashboardGroupEntryResponse: {}, + DashboardResponse: {}, + DashboardScope: { + enumValues: { + "collection_User": 0, + "project_Team": 1, + "project": 2 + } + }, + GroupMemberPermission: { + enumValues: { + "none": 0, + "edit": 1, + "manage": 2, + "managePermissions": 3 + } + }, + TeamDashboardPermission: { + enumValues: { + "none": 0, + "read": 1, + "create": 2, + "edit": 4, + "delete": 8, + "managePermissions": 16 + } + }, + Widget: {}, + WidgetMetadata: {}, + WidgetMetadataResponse: {}, + WidgetResponse: {}, + WidgetScope: { + enumValues: { + "collection_User": 0, + "project_Team": 1 + } + }, + WidgetsVersionedList: {}, + WidgetTypesResponse: {} + }; + exports2.TypeInfo.CopyDashboardOptions.fields = { + copyDashboardScope: { + enumType: exports2.TypeInfo.DashboardScope + } + }; + exports2.TypeInfo.CopyDashboardResponse.fields = { + copiedDashboard: { + typeInfo: exports2.TypeInfo.Dashboard + }, + copyDashboardOptions: { + typeInfo: exports2.TypeInfo.CopyDashboardOptions + } + }; + exports2.TypeInfo.Dashboard.fields = { + dashboardScope: { + enumType: exports2.TypeInfo.DashboardScope + }, + lastAccessedDate: { + isDate: true + }, + modifiedDate: { + isDate: true + }, + widgets: { + isArray: true, + typeInfo: exports2.TypeInfo.Widget + } + }; + exports2.TypeInfo.DashboardGroup.fields = { + dashboardEntries: { + isArray: true, + typeInfo: exports2.TypeInfo.DashboardGroupEntry + }, + permission: { + enumType: exports2.TypeInfo.GroupMemberPermission + }, + teamDashboardPermission: { + enumType: exports2.TypeInfo.TeamDashboardPermission + } + }; + exports2.TypeInfo.DashboardGroupEntry.fields = { + dashboardScope: { + enumType: exports2.TypeInfo.DashboardScope + }, + lastAccessedDate: { + isDate: true + }, + modifiedDate: { + isDate: true + }, + widgets: { + isArray: true, + typeInfo: exports2.TypeInfo.Widget + } + }; + exports2.TypeInfo.DashboardGroupEntryResponse.fields = { + dashboardScope: { + enumType: exports2.TypeInfo.DashboardScope + }, + lastAccessedDate: { + isDate: true + }, + modifiedDate: { + isDate: true + }, + widgets: { + isArray: true, + typeInfo: exports2.TypeInfo.Widget + } + }; + exports2.TypeInfo.DashboardResponse.fields = { + dashboardScope: { + enumType: exports2.TypeInfo.DashboardScope + }, + lastAccessedDate: { + isDate: true + }, + modifiedDate: { + isDate: true + }, + widgets: { + isArray: true, + typeInfo: exports2.TypeInfo.Widget + } + }; + exports2.TypeInfo.Widget.fields = { + dashboard: { + typeInfo: exports2.TypeInfo.Dashboard + } + }; + exports2.TypeInfo.WidgetMetadata.fields = { + supportedScopes: { + isArray: true, + enumType: exports2.TypeInfo.WidgetScope + } + }; + exports2.TypeInfo.WidgetMetadataResponse.fields = { + widgetMetadata: { + typeInfo: exports2.TypeInfo.WidgetMetadata + } + }; + exports2.TypeInfo.WidgetResponse.fields = { + dashboard: { + typeInfo: exports2.TypeInfo.Dashboard + } + }; + exports2.TypeInfo.WidgetsVersionedList.fields = { + widgets: { + isArray: true, + typeInfo: exports2.TypeInfo.Widget + } + }; + exports2.TypeInfo.WidgetTypesResponse.fields = { + widgetTypes: { + isArray: true, + typeInfo: exports2.TypeInfo.WidgetMetadata + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/DashboardApi.js +var require_DashboardApi = __commonJS({ + "../node_modules/azure-devops-node-api/DashboardApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.DashboardApi = void 0; + var basem = require_ClientApiBases(); + var DashboardInterfaces = require_DashboardInterfaces(); + var DashboardApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Dashboard-api", options); + } + /** + * Create the supplied dashboard. + * + * @param {DashboardInterfaces.Dashboard} dashboard - The initial state of the dashboard + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + createDashboard(dashboard, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Dashboard", "454b3e51-2e6e-48d4-ad81-978154089351", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, dashboard, options); + let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Dashboard, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a dashboard given its ID. This also deletes the widgets associated with this dashboard. + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} dashboardId - ID of the dashboard to delete. + */ + deleteDashboard(teamContext, dashboardId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + dashboardId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Dashboard", "454b3e51-2e6e-48d4-ad81-978154089351", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a dashboard by its ID. + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} dashboardId + */ + getDashboard(teamContext, dashboardId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + dashboardId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Dashboard", "454b3e51-2e6e-48d4-ad81-978154089351", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Dashboard, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of dashboards under a project. + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + getDashboardsByProject(teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Dashboard", "454b3e51-2e6e-48d4-ad81-978154089351", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Dashboard, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Replace configuration for the specified dashboard. Replaces Widget list on Dashboard, only if property is supplied. + * + * @param {DashboardInterfaces.Dashboard} dashboard - The Configuration of the dashboard to replace. + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} dashboardId - ID of the dashboard to replace. + */ + replaceDashboard(dashboard, teamContext, dashboardId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + dashboardId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Dashboard", "454b3e51-2e6e-48d4-ad81-978154089351", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, dashboard, options); + let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Dashboard, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update the name and position of dashboards in the supplied group, and remove omitted dashboards. Does not modify dashboard content. + * + * @param {DashboardInterfaces.DashboardGroup} group + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + replaceDashboards(group2, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Dashboard", "454b3e51-2e6e-48d4-ad81-978154089351", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, group2, options); + let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.DashboardGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a widget on the specified dashboard. + * + * @param {DashboardInterfaces.Widget} widget - State of the widget to add + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} dashboardId - ID of dashboard the widget will be added to. + */ + createWidget(widget, teamContext, dashboardId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + dashboardId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Dashboard", "bdcff53a-8355-4172-a00a-40497ea23afc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, widget, options); + let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Widget, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete the specified widget. + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} dashboardId - ID of the dashboard containing the widget. + * @param {string} widgetId - ID of the widget to update. + */ + deleteWidget(teamContext, dashboardId, widgetId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + dashboardId, + widgetId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Dashboard", "bdcff53a-8355-4172-a00a-40497ea23afc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Dashboard, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the current state of the specified widget. + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} dashboardId - ID of the dashboard containing the widget. + * @param {string} widgetId - ID of the widget to read. + */ + getWidget(teamContext, dashboardId, widgetId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + dashboardId, + widgetId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Dashboard", "bdcff53a-8355-4172-a00a-40497ea23afc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Widget, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Override the state of the specified widget. + * + * @param {DashboardInterfaces.Widget} widget - State to be written for the widget. + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} dashboardId - ID of the dashboard containing the widget. + * @param {string} widgetId - ID of the widget to update. + */ + replaceWidget(widget, teamContext, dashboardId, widgetId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + dashboardId, + widgetId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Dashboard", "bdcff53a-8355-4172-a00a-40497ea23afc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, widget, options); + let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Widget, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Perform a partial update of the specified widget. + * + * @param {DashboardInterfaces.Widget} widget - Description of the widget changes to apply. All non-null fields will be replaced. + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} dashboardId - ID of the dashboard containing the widget. + * @param {string} widgetId - ID of the widget to update. + */ + updateWidget(widget, teamContext, dashboardId, widgetId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + dashboardId, + widgetId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Dashboard", "bdcff53a-8355-4172-a00a-40497ea23afc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, widget, options); + let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.Widget, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the widget metadata satisfying the specified contribution ID. + * + * @param {string} contributionId - The ID of Contribution for the Widget + * @param {string} project - Project ID or project name + */ + getWidgetMetadata(contributionId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + contributionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Dashboard", "6b3628d3-e96f-4fc7-b176-50240b03b515", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.WidgetMetadataResponse, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all available widget metadata in alphabetical order, including widgets marked with isVisibleFromCatalog == false. + * + * @param {DashboardInterfaces.WidgetScope} scope + * @param {string} project - Project ID or project name + */ + getWidgetTypes(scope, project) { + return __awaiter2(this, void 0, void 0, function* () { + if (scope == null) { + throw new TypeError("scope can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + "$scope": scope + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Dashboard", "6b3628d3-e96f-4fc7-b176-50240b03b515", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, DashboardInterfaces.TypeInfo.WidgetTypesResponse, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.DashboardApi = DashboardApi; + DashboardApi.RESOURCE_AREA_ID = "31c84e0a-3ece-48fd-a29d-100849af99ba"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/GalleryInterfaces.js +var require_GalleryInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/GalleryInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.VSCodeWebExtensionStatisicsType = exports2.SortOrderType = exports2.SortByType = exports2.ReviewResourceType = exports2.ReviewPatchOperation = exports2.ReviewFilterOptions = exports2.ReviewEventOperation = exports2.RestApiResponseStatus = exports2.QnAItemStatus = exports2.PublisherState = exports2.PublisherRoleAccess = exports2.PublisherQueryFlags = exports2.PublisherPermissions = exports2.PublisherFlags = exports2.PublishedExtensionFlags = exports2.PagingDirection = exports2.NotificationTemplateType = exports2.ExtensionVersionFlags = exports2.ExtensionStatsAggregateType = exports2.ExtensionStatisticOperation = exports2.ExtensionQueryFlags = exports2.ExtensionQueryFilterType = exports2.ExtensionPolicyFlags = exports2.ExtensionLifecycleEventType = exports2.ExtensionDeploymentTechnology = exports2.DraftStateType = exports2.DraftPatchOperation = exports2.ConcernCategory = exports2.AcquisitionOperationType = exports2.AcquisitionOperationState = exports2.AcquisitionAssignmentType = void 0; + var AcquisitionAssignmentType; + (function(AcquisitionAssignmentType2) { + AcquisitionAssignmentType2[AcquisitionAssignmentType2["None"] = 0] = "None"; + AcquisitionAssignmentType2[AcquisitionAssignmentType2["Me"] = 1] = "Me"; + AcquisitionAssignmentType2[AcquisitionAssignmentType2["All"] = 2] = "All"; + })(AcquisitionAssignmentType = exports2.AcquisitionAssignmentType || (exports2.AcquisitionAssignmentType = {})); + var AcquisitionOperationState; + (function(AcquisitionOperationState2) { + AcquisitionOperationState2[AcquisitionOperationState2["Disallow"] = 0] = "Disallow"; + AcquisitionOperationState2[AcquisitionOperationState2["Allow"] = 1] = "Allow"; + AcquisitionOperationState2[AcquisitionOperationState2["Completed"] = 3] = "Completed"; + })(AcquisitionOperationState = exports2.AcquisitionOperationState || (exports2.AcquisitionOperationState = {})); + var AcquisitionOperationType; + (function(AcquisitionOperationType2) { + AcquisitionOperationType2[AcquisitionOperationType2["Get"] = 0] = "Get"; + AcquisitionOperationType2[AcquisitionOperationType2["Install"] = 1] = "Install"; + AcquisitionOperationType2[AcquisitionOperationType2["Buy"] = 2] = "Buy"; + AcquisitionOperationType2[AcquisitionOperationType2["Try"] = 3] = "Try"; + AcquisitionOperationType2[AcquisitionOperationType2["Request"] = 4] = "Request"; + AcquisitionOperationType2[AcquisitionOperationType2["None"] = 5] = "None"; + AcquisitionOperationType2[AcquisitionOperationType2["PurchaseRequest"] = 6] = "PurchaseRequest"; + })(AcquisitionOperationType = exports2.AcquisitionOperationType || (exports2.AcquisitionOperationType = {})); + var ConcernCategory; + (function(ConcernCategory2) { + ConcernCategory2[ConcernCategory2["General"] = 1] = "General"; + ConcernCategory2[ConcernCategory2["Abusive"] = 2] = "Abusive"; + ConcernCategory2[ConcernCategory2["Spam"] = 4] = "Spam"; + })(ConcernCategory = exports2.ConcernCategory || (exports2.ConcernCategory = {})); + var DraftPatchOperation; + (function(DraftPatchOperation2) { + DraftPatchOperation2[DraftPatchOperation2["Publish"] = 1] = "Publish"; + DraftPatchOperation2[DraftPatchOperation2["Cancel"] = 2] = "Cancel"; + })(DraftPatchOperation = exports2.DraftPatchOperation || (exports2.DraftPatchOperation = {})); + var DraftStateType; + (function(DraftStateType2) { + DraftStateType2[DraftStateType2["Unpublished"] = 1] = "Unpublished"; + DraftStateType2[DraftStateType2["Published"] = 2] = "Published"; + DraftStateType2[DraftStateType2["Cancelled"] = 3] = "Cancelled"; + DraftStateType2[DraftStateType2["Error"] = 4] = "Error"; + })(DraftStateType = exports2.DraftStateType || (exports2.DraftStateType = {})); + var ExtensionDeploymentTechnology; + (function(ExtensionDeploymentTechnology2) { + ExtensionDeploymentTechnology2[ExtensionDeploymentTechnology2["Exe"] = 1] = "Exe"; + ExtensionDeploymentTechnology2[ExtensionDeploymentTechnology2["Msi"] = 2] = "Msi"; + ExtensionDeploymentTechnology2[ExtensionDeploymentTechnology2["Vsix"] = 3] = "Vsix"; + ExtensionDeploymentTechnology2[ExtensionDeploymentTechnology2["ReferralLink"] = 4] = "ReferralLink"; + })(ExtensionDeploymentTechnology = exports2.ExtensionDeploymentTechnology || (exports2.ExtensionDeploymentTechnology = {})); + var ExtensionLifecycleEventType; + (function(ExtensionLifecycleEventType2) { + ExtensionLifecycleEventType2[ExtensionLifecycleEventType2["Uninstall"] = 1] = "Uninstall"; + ExtensionLifecycleEventType2[ExtensionLifecycleEventType2["Install"] = 2] = "Install"; + ExtensionLifecycleEventType2[ExtensionLifecycleEventType2["Review"] = 3] = "Review"; + ExtensionLifecycleEventType2[ExtensionLifecycleEventType2["Acquisition"] = 4] = "Acquisition"; + ExtensionLifecycleEventType2[ExtensionLifecycleEventType2["Sales"] = 5] = "Sales"; + ExtensionLifecycleEventType2[ExtensionLifecycleEventType2["Other"] = 999] = "Other"; + })(ExtensionLifecycleEventType = exports2.ExtensionLifecycleEventType || (exports2.ExtensionLifecycleEventType = {})); + var ExtensionPolicyFlags; + (function(ExtensionPolicyFlags2) { + ExtensionPolicyFlags2[ExtensionPolicyFlags2["None"] = 0] = "None"; + ExtensionPolicyFlags2[ExtensionPolicyFlags2["Private"] = 1] = "Private"; + ExtensionPolicyFlags2[ExtensionPolicyFlags2["Public"] = 2] = "Public"; + ExtensionPolicyFlags2[ExtensionPolicyFlags2["Preview"] = 4] = "Preview"; + ExtensionPolicyFlags2[ExtensionPolicyFlags2["Released"] = 8] = "Released"; + ExtensionPolicyFlags2[ExtensionPolicyFlags2["FirstParty"] = 16] = "FirstParty"; + ExtensionPolicyFlags2[ExtensionPolicyFlags2["All"] = 31] = "All"; + })(ExtensionPolicyFlags = exports2.ExtensionPolicyFlags || (exports2.ExtensionPolicyFlags = {})); + var ExtensionQueryFilterType; + (function(ExtensionQueryFilterType2) { + ExtensionQueryFilterType2[ExtensionQueryFilterType2["Tag"] = 1] = "Tag"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["DisplayName"] = 2] = "DisplayName"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["Private"] = 3] = "Private"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["Id"] = 4] = "Id"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["Category"] = 5] = "Category"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["ContributionType"] = 6] = "ContributionType"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["Name"] = 7] = "Name"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["InstallationTarget"] = 8] = "InstallationTarget"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["Featured"] = 9] = "Featured"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["SearchText"] = 10] = "SearchText"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["FeaturedInCategory"] = 11] = "FeaturedInCategory"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["ExcludeWithFlags"] = 12] = "ExcludeWithFlags"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["IncludeWithFlags"] = 13] = "IncludeWithFlags"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["Lcid"] = 14] = "Lcid"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["InstallationTargetVersion"] = 15] = "InstallationTargetVersion"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["InstallationTargetVersionRange"] = 16] = "InstallationTargetVersionRange"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["VsixMetadata"] = 17] = "VsixMetadata"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["PublisherName"] = 18] = "PublisherName"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["PublisherDisplayName"] = 19] = "PublisherDisplayName"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["IncludeWithPublisherFlags"] = 20] = "IncludeWithPublisherFlags"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["OrganizationSharedWith"] = 21] = "OrganizationSharedWith"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["ProductArchitecture"] = 22] = "ProductArchitecture"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["TargetPlatform"] = 23] = "TargetPlatform"; + ExtensionQueryFilterType2[ExtensionQueryFilterType2["ExtensionName"] = 24] = "ExtensionName"; + })(ExtensionQueryFilterType = exports2.ExtensionQueryFilterType || (exports2.ExtensionQueryFilterType = {})); + var ExtensionQueryFlags; + (function(ExtensionQueryFlags2) { + ExtensionQueryFlags2[ExtensionQueryFlags2["None"] = 0] = "None"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeVersions"] = 1] = "IncludeVersions"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeFiles"] = 2] = "IncludeFiles"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeCategoryAndTags"] = 4] = "IncludeCategoryAndTags"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeSharedAccounts"] = 8] = "IncludeSharedAccounts"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeVersionProperties"] = 16] = "IncludeVersionProperties"; + ExtensionQueryFlags2[ExtensionQueryFlags2["ExcludeNonValidated"] = 32] = "ExcludeNonValidated"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeInstallationTargets"] = 64] = "IncludeInstallationTargets"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeAssetUri"] = 128] = "IncludeAssetUri"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeStatistics"] = 256] = "IncludeStatistics"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeLatestVersionOnly"] = 512] = "IncludeLatestVersionOnly"; + ExtensionQueryFlags2[ExtensionQueryFlags2["UseFallbackAssetUri"] = 1024] = "UseFallbackAssetUri"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeMetadata"] = 2048] = "IncludeMetadata"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeMinimalPayloadForVsIde"] = 4096] = "IncludeMinimalPayloadForVsIde"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeLcids"] = 8192] = "IncludeLcids"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeSharedOrganizations"] = 16384] = "IncludeSharedOrganizations"; + ExtensionQueryFlags2[ExtensionQueryFlags2["IncludeNameConflictInfo"] = 32768] = "IncludeNameConflictInfo"; + ExtensionQueryFlags2[ExtensionQueryFlags2["AllAttributes"] = 16863] = "AllAttributes"; + })(ExtensionQueryFlags = exports2.ExtensionQueryFlags || (exports2.ExtensionQueryFlags = {})); + var ExtensionStatisticOperation; + (function(ExtensionStatisticOperation2) { + ExtensionStatisticOperation2[ExtensionStatisticOperation2["None"] = 0] = "None"; + ExtensionStatisticOperation2[ExtensionStatisticOperation2["Set"] = 1] = "Set"; + ExtensionStatisticOperation2[ExtensionStatisticOperation2["Increment"] = 2] = "Increment"; + ExtensionStatisticOperation2[ExtensionStatisticOperation2["Decrement"] = 3] = "Decrement"; + ExtensionStatisticOperation2[ExtensionStatisticOperation2["Delete"] = 4] = "Delete"; + })(ExtensionStatisticOperation = exports2.ExtensionStatisticOperation || (exports2.ExtensionStatisticOperation = {})); + var ExtensionStatsAggregateType; + (function(ExtensionStatsAggregateType2) { + ExtensionStatsAggregateType2[ExtensionStatsAggregateType2["Daily"] = 1] = "Daily"; + })(ExtensionStatsAggregateType = exports2.ExtensionStatsAggregateType || (exports2.ExtensionStatsAggregateType = {})); + var ExtensionVersionFlags; + (function(ExtensionVersionFlags2) { + ExtensionVersionFlags2[ExtensionVersionFlags2["None"] = 0] = "None"; + ExtensionVersionFlags2[ExtensionVersionFlags2["Validated"] = 1] = "Validated"; + })(ExtensionVersionFlags = exports2.ExtensionVersionFlags || (exports2.ExtensionVersionFlags = {})); + var NotificationTemplateType; + (function(NotificationTemplateType2) { + NotificationTemplateType2[NotificationTemplateType2["ReviewNotification"] = 1] = "ReviewNotification"; + NotificationTemplateType2[NotificationTemplateType2["QnaNotification"] = 2] = "QnaNotification"; + NotificationTemplateType2[NotificationTemplateType2["CustomerContactNotification"] = 3] = "CustomerContactNotification"; + NotificationTemplateType2[NotificationTemplateType2["PublisherMemberUpdateNotification"] = 4] = "PublisherMemberUpdateNotification"; + })(NotificationTemplateType = exports2.NotificationTemplateType || (exports2.NotificationTemplateType = {})); + var PagingDirection; + (function(PagingDirection2) { + PagingDirection2[PagingDirection2["Backward"] = 1] = "Backward"; + PagingDirection2[PagingDirection2["Forward"] = 2] = "Forward"; + })(PagingDirection = exports2.PagingDirection || (exports2.PagingDirection = {})); + var PublishedExtensionFlags; + (function(PublishedExtensionFlags2) { + PublishedExtensionFlags2[PublishedExtensionFlags2["None"] = 0] = "None"; + PublishedExtensionFlags2[PublishedExtensionFlags2["Disabled"] = 1] = "Disabled"; + PublishedExtensionFlags2[PublishedExtensionFlags2["BuiltIn"] = 2] = "BuiltIn"; + PublishedExtensionFlags2[PublishedExtensionFlags2["Validated"] = 4] = "Validated"; + PublishedExtensionFlags2[PublishedExtensionFlags2["Trusted"] = 8] = "Trusted"; + PublishedExtensionFlags2[PublishedExtensionFlags2["Paid"] = 16] = "Paid"; + PublishedExtensionFlags2[PublishedExtensionFlags2["Public"] = 256] = "Public"; + PublishedExtensionFlags2[PublishedExtensionFlags2["MultiVersion"] = 512] = "MultiVersion"; + PublishedExtensionFlags2[PublishedExtensionFlags2["System"] = 1024] = "System"; + PublishedExtensionFlags2[PublishedExtensionFlags2["Preview"] = 2048] = "Preview"; + PublishedExtensionFlags2[PublishedExtensionFlags2["Unpublished"] = 4096] = "Unpublished"; + PublishedExtensionFlags2[PublishedExtensionFlags2["Trial"] = 8192] = "Trial"; + PublishedExtensionFlags2[PublishedExtensionFlags2["Locked"] = 16384] = "Locked"; + PublishedExtensionFlags2[PublishedExtensionFlags2["Hidden"] = 32768] = "Hidden"; + })(PublishedExtensionFlags = exports2.PublishedExtensionFlags || (exports2.PublishedExtensionFlags = {})); + var PublisherFlags; + (function(PublisherFlags2) { + PublisherFlags2[PublisherFlags2["UnChanged"] = 1073741824] = "UnChanged"; + PublisherFlags2[PublisherFlags2["None"] = 0] = "None"; + PublisherFlags2[PublisherFlags2["Disabled"] = 1] = "Disabled"; + PublisherFlags2[PublisherFlags2["Verified"] = 2] = "Verified"; + PublisherFlags2[PublisherFlags2["Certified"] = 4] = "Certified"; + PublisherFlags2[PublisherFlags2["ServiceFlags"] = 7] = "ServiceFlags"; + })(PublisherFlags = exports2.PublisherFlags || (exports2.PublisherFlags = {})); + var PublisherPermissions; + (function(PublisherPermissions2) { + PublisherPermissions2[PublisherPermissions2["Read"] = 1] = "Read"; + PublisherPermissions2[PublisherPermissions2["UpdateExtension"] = 2] = "UpdateExtension"; + PublisherPermissions2[PublisherPermissions2["CreatePublisher"] = 4] = "CreatePublisher"; + PublisherPermissions2[PublisherPermissions2["PublishExtension"] = 8] = "PublishExtension"; + PublisherPermissions2[PublisherPermissions2["Admin"] = 16] = "Admin"; + PublisherPermissions2[PublisherPermissions2["TrustedPartner"] = 32] = "TrustedPartner"; + PublisherPermissions2[PublisherPermissions2["PrivateRead"] = 64] = "PrivateRead"; + PublisherPermissions2[PublisherPermissions2["DeleteExtension"] = 128] = "DeleteExtension"; + PublisherPermissions2[PublisherPermissions2["EditSettings"] = 256] = "EditSettings"; + PublisherPermissions2[PublisherPermissions2["ViewPermissions"] = 512] = "ViewPermissions"; + PublisherPermissions2[PublisherPermissions2["ManagePermissions"] = 1024] = "ManagePermissions"; + PublisherPermissions2[PublisherPermissions2["DeletePublisher"] = 2048] = "DeletePublisher"; + })(PublisherPermissions = exports2.PublisherPermissions || (exports2.PublisherPermissions = {})); + var PublisherQueryFlags; + (function(PublisherQueryFlags2) { + PublisherQueryFlags2[PublisherQueryFlags2["None"] = 0] = "None"; + PublisherQueryFlags2[PublisherQueryFlags2["IncludeExtensions"] = 1] = "IncludeExtensions"; + PublisherQueryFlags2[PublisherQueryFlags2["IncludeEmailAddress"] = 2] = "IncludeEmailAddress"; + })(PublisherQueryFlags = exports2.PublisherQueryFlags || (exports2.PublisherQueryFlags = {})); + var PublisherRoleAccess; + (function(PublisherRoleAccess2) { + PublisherRoleAccess2[PublisherRoleAccess2["Assigned"] = 1] = "Assigned"; + PublisherRoleAccess2[PublisherRoleAccess2["Inherited"] = 2] = "Inherited"; + })(PublisherRoleAccess = exports2.PublisherRoleAccess || (exports2.PublisherRoleAccess = {})); + var PublisherState; + (function(PublisherState2) { + PublisherState2[PublisherState2["None"] = 0] = "None"; + PublisherState2[PublisherState2["VerificationPending"] = 1] = "VerificationPending"; + PublisherState2[PublisherState2["CertificationPending"] = 2] = "CertificationPending"; + PublisherState2[PublisherState2["CertificationRejected"] = 4] = "CertificationRejected"; + PublisherState2[PublisherState2["CertificationRevoked"] = 8] = "CertificationRevoked"; + })(PublisherState = exports2.PublisherState || (exports2.PublisherState = {})); + var QnAItemStatus; + (function(QnAItemStatus2) { + QnAItemStatus2[QnAItemStatus2["None"] = 0] = "None"; + QnAItemStatus2[QnAItemStatus2["UserEditable"] = 1] = "UserEditable"; + QnAItemStatus2[QnAItemStatus2["PublisherCreated"] = 2] = "PublisherCreated"; + })(QnAItemStatus = exports2.QnAItemStatus || (exports2.QnAItemStatus = {})); + var RestApiResponseStatus; + (function(RestApiResponseStatus2) { + RestApiResponseStatus2[RestApiResponseStatus2["Completed"] = 0] = "Completed"; + RestApiResponseStatus2[RestApiResponseStatus2["Failed"] = 1] = "Failed"; + RestApiResponseStatus2[RestApiResponseStatus2["Inprogress"] = 2] = "Inprogress"; + RestApiResponseStatus2[RestApiResponseStatus2["Skipped"] = 3] = "Skipped"; + })(RestApiResponseStatus = exports2.RestApiResponseStatus || (exports2.RestApiResponseStatus = {})); + var ReviewEventOperation; + (function(ReviewEventOperation2) { + ReviewEventOperation2[ReviewEventOperation2["Create"] = 1] = "Create"; + ReviewEventOperation2[ReviewEventOperation2["Update"] = 2] = "Update"; + ReviewEventOperation2[ReviewEventOperation2["Delete"] = 3] = "Delete"; + })(ReviewEventOperation = exports2.ReviewEventOperation || (exports2.ReviewEventOperation = {})); + var ReviewFilterOptions; + (function(ReviewFilterOptions2) { + ReviewFilterOptions2[ReviewFilterOptions2["None"] = 0] = "None"; + ReviewFilterOptions2[ReviewFilterOptions2["FilterEmptyReviews"] = 1] = "FilterEmptyReviews"; + ReviewFilterOptions2[ReviewFilterOptions2["FilterEmptyUserNames"] = 2] = "FilterEmptyUserNames"; + })(ReviewFilterOptions = exports2.ReviewFilterOptions || (exports2.ReviewFilterOptions = {})); + var ReviewPatchOperation; + (function(ReviewPatchOperation2) { + ReviewPatchOperation2[ReviewPatchOperation2["FlagReview"] = 1] = "FlagReview"; + ReviewPatchOperation2[ReviewPatchOperation2["UpdateReview"] = 2] = "UpdateReview"; + ReviewPatchOperation2[ReviewPatchOperation2["ReplyToReview"] = 3] = "ReplyToReview"; + ReviewPatchOperation2[ReviewPatchOperation2["AdminResponseForReview"] = 4] = "AdminResponseForReview"; + ReviewPatchOperation2[ReviewPatchOperation2["DeleteAdminReply"] = 5] = "DeleteAdminReply"; + ReviewPatchOperation2[ReviewPatchOperation2["DeletePublisherReply"] = 6] = "DeletePublisherReply"; + })(ReviewPatchOperation = exports2.ReviewPatchOperation || (exports2.ReviewPatchOperation = {})); + var ReviewResourceType; + (function(ReviewResourceType2) { + ReviewResourceType2[ReviewResourceType2["Review"] = 1] = "Review"; + ReviewResourceType2[ReviewResourceType2["PublisherReply"] = 2] = "PublisherReply"; + ReviewResourceType2[ReviewResourceType2["AdminReply"] = 3] = "AdminReply"; + })(ReviewResourceType = exports2.ReviewResourceType || (exports2.ReviewResourceType = {})); + var SortByType; + (function(SortByType2) { + SortByType2[SortByType2["Relevance"] = 0] = "Relevance"; + SortByType2[SortByType2["LastUpdatedDate"] = 1] = "LastUpdatedDate"; + SortByType2[SortByType2["Title"] = 2] = "Title"; + SortByType2[SortByType2["Publisher"] = 3] = "Publisher"; + SortByType2[SortByType2["InstallCount"] = 4] = "InstallCount"; + SortByType2[SortByType2["PublishedDate"] = 5] = "PublishedDate"; + SortByType2[SortByType2["AverageRating"] = 6] = "AverageRating"; + SortByType2[SortByType2["TrendingDaily"] = 7] = "TrendingDaily"; + SortByType2[SortByType2["TrendingWeekly"] = 8] = "TrendingWeekly"; + SortByType2[SortByType2["TrendingMonthly"] = 9] = "TrendingMonthly"; + SortByType2[SortByType2["ReleaseDate"] = 10] = "ReleaseDate"; + SortByType2[SortByType2["Author"] = 11] = "Author"; + SortByType2[SortByType2["WeightedRating"] = 12] = "WeightedRating"; + })(SortByType = exports2.SortByType || (exports2.SortByType = {})); + var SortOrderType; + (function(SortOrderType2) { + SortOrderType2[SortOrderType2["Default"] = 0] = "Default"; + SortOrderType2[SortOrderType2["Ascending"] = 1] = "Ascending"; + SortOrderType2[SortOrderType2["Descending"] = 2] = "Descending"; + })(SortOrderType = exports2.SortOrderType || (exports2.SortOrderType = {})); + var VSCodeWebExtensionStatisicsType; + (function(VSCodeWebExtensionStatisicsType2) { + VSCodeWebExtensionStatisicsType2[VSCodeWebExtensionStatisicsType2["Install"] = 1] = "Install"; + VSCodeWebExtensionStatisicsType2[VSCodeWebExtensionStatisicsType2["Update"] = 2] = "Update"; + VSCodeWebExtensionStatisicsType2[VSCodeWebExtensionStatisicsType2["Uninstall"] = 3] = "Uninstall"; + })(VSCodeWebExtensionStatisicsType = exports2.VSCodeWebExtensionStatisicsType || (exports2.VSCodeWebExtensionStatisicsType = {})); + exports2.TypeInfo = { + AcquisitionAssignmentType: { + enumValues: { + "none": 0, + "me": 1, + "all": 2 + } + }, + AcquisitionOperation: {}, + AcquisitionOperationState: { + enumValues: { + "disallow": 0, + "allow": 1, + "completed": 3 + } + }, + AcquisitionOperationType: { + enumValues: { + "get": 0, + "install": 1, + "buy": 2, + "try": 3, + "request": 4, + "none": 5, + "purchaseRequest": 6 + } + }, + AcquisitionOptions: {}, + AzureRestApiResponseModel: {}, + Concern: {}, + ConcernCategory: { + enumValues: { + "general": 1, + "abusive": 2, + "spam": 4 + } + }, + CustomerLastContact: {}, + CustomerSupportRequest: {}, + DraftPatchOperation: { + enumValues: { + "publish": 1, + "cancel": 2 + } + }, + DraftStateType: { + enumValues: { + "unpublished": 1, + "published": 2, + "cancelled": 3, + "error": 4 + } + }, + ExtensionAcquisitionRequest: {}, + ExtensionDailyStat: {}, + ExtensionDailyStats: {}, + ExtensionDeploymentTechnology: { + enumValues: { + "exe": 1, + "msi": 2, + "vsix": 3, + "referralLink": 4 + } + }, + ExtensionDraft: {}, + ExtensionDraftPatch: {}, + ExtensionEvent: {}, + ExtensionEvents: {}, + ExtensionFilterResult: {}, + ExtensionLifecycleEventType: { + enumValues: { + "uninstall": 1, + "install": 2, + "review": 3, + "acquisition": 4, + "sales": 5, + "other": 999 + } + }, + ExtensionPayload: {}, + ExtensionPolicy: {}, + ExtensionPolicyFlags: { + enumValues: { + "none": 0, + "private": 1, + "public": 2, + "preview": 4, + "released": 8, + "firstParty": 16, + "all": 31 + } + }, + ExtensionQuery: {}, + ExtensionQueryFilterType: { + enumValues: { + "tag": 1, + "displayName": 2, + "private": 3, + "id": 4, + "category": 5, + "contributionType": 6, + "name": 7, + "installationTarget": 8, + "featured": 9, + "searchText": 10, + "featuredInCategory": 11, + "excludeWithFlags": 12, + "includeWithFlags": 13, + "lcid": 14, + "installationTargetVersion": 15, + "installationTargetVersionRange": 16, + "vsixMetadata": 17, + "publisherName": 18, + "publisherDisplayName": 19, + "includeWithPublisherFlags": 20, + "organizationSharedWith": 21, + "productArchitecture": 22, + "targetPlatform": 23, + "extensionName": 24 + } + }, + ExtensionQueryFlags: { + enumValues: { + "none": 0, + "includeVersions": 1, + "includeFiles": 2, + "includeCategoryAndTags": 4, + "includeSharedAccounts": 8, + "includeVersionProperties": 16, + "excludeNonValidated": 32, + "includeInstallationTargets": 64, + "includeAssetUri": 128, + "includeStatistics": 256, + "includeLatestVersionOnly": 512, + "useFallbackAssetUri": 1024, + "includeMetadata": 2048, + "includeMinimalPayloadForVsIde": 4096, + "includeLcids": 8192, + "includeSharedOrganizations": 16384, + "includeNameConflictInfo": 32768, + "allAttributes": 16863 + } + }, + ExtensionQueryResult: {}, + ExtensionStatisticOperation: { + enumValues: { + "none": 0, + "set": 1, + "increment": 2, + "decrement": 3, + "delete": 4 + } + }, + ExtensionStatisticUpdate: {}, + ExtensionStatsAggregateType: { + enumValues: { + "daily": 1 + } + }, + ExtensionVersion: {}, + ExtensionVersionFlags: { + enumValues: { + "none": 0, + "validated": 1 + } + }, + NotificationsData: {}, + NotificationTemplateType: { + enumValues: { + "reviewNotification": 1, + "qnaNotification": 2, + "customerContactNotification": 3, + "publisherMemberUpdateNotification": 4 + } + }, + PagingDirection: { + enumValues: { + "backward": 1, + "forward": 2 + } + }, + PublishedExtension: {}, + PublishedExtensionFlags: { + enumValues: { + "none": 0, + "disabled": 1, + "builtIn": 2, + "validated": 4, + "trusted": 8, + "paid": 16, + "public": 256, + "multiVersion": 512, + "system": 1024, + "preview": 2048, + "unpublished": 4096, + "trial": 8192, + "locked": 16384, + "hidden": 32768 + } + }, + Publisher: {}, + PublisherBase: {}, + PublisherFacts: {}, + PublisherFilterResult: {}, + PublisherFlags: { + enumValues: { + "unChanged": 1073741824, + "none": 0, + "disabled": 1, + "verified": 2, + "certified": 4, + "serviceFlags": 7 + } + }, + PublisherPermissions: { + enumValues: { + "read": 1, + "updateExtension": 2, + "createPublisher": 4, + "publishExtension": 8, + "admin": 16, + "trustedPartner": 32, + "privateRead": 64, + "deleteExtension": 128, + "editSettings": 256, + "viewPermissions": 512, + "managePermissions": 1024, + "deletePublisher": 2048 + } + }, + PublisherQuery: {}, + PublisherQueryFlags: { + enumValues: { + "none": 0, + "includeExtensions": 1, + "includeEmailAddress": 2 + } + }, + PublisherQueryResult: {}, + PublisherRoleAccess: { + enumValues: { + "assigned": 1, + "inherited": 2 + } + }, + PublisherRoleAssignment: {}, + PublisherState: { + enumValues: { + "none": 0, + "verificationPending": 1, + "certificationPending": 2, + "certificationRejected": 4, + "certificationRevoked": 8 + } + }, + QnAItem: {}, + QnAItemStatus: { + enumValues: { + "none": 0, + "userEditable": 1, + "publisherCreated": 2 + } + }, + QueryFilter: {}, + Question: {}, + QuestionsResult: {}, + Response: {}, + RestApiResponseStatus: { + enumValues: { + "completed": 0, + "failed": 1, + "inprogress": 2, + "skipped": 3 + } + }, + RestApiResponseStatusModel: {}, + Review: {}, + ReviewEventOperation: { + enumValues: { + "create": 1, + "update": 2, + "delete": 3 + } + }, + ReviewEventProperties: {}, + ReviewFilterOptions: { + enumValues: { + "none": 0, + "filterEmptyReviews": 1, + "filterEmptyUserNames": 2 + } + }, + ReviewPatch: {}, + ReviewPatchOperation: { + enumValues: { + "flagReview": 1, + "updateReview": 2, + "replyToReview": 3, + "adminResponseForReview": 4, + "deleteAdminReply": 5, + "deletePublisherReply": 6 + } + }, + ReviewReply: {}, + ReviewResourceType: { + enumValues: { + "review": 1, + "publisherReply": 2, + "adminReply": 3 + } + }, + ReviewsResult: {}, + SortByType: { + enumValues: { + "relevance": 0, + "lastUpdatedDate": 1, + "title": 2, + "publisher": 3, + "installCount": 4, + "publishedDate": 5, + "averageRating": 6, + "trendingDaily": 7, + "trendingWeekly": 8, + "trendingMonthly": 9, + "releaseDate": 10, + "author": 11, + "weightedRating": 12 + } + }, + SortOrderType: { + enumValues: { + "default": 0, + "ascending": 1, + "descending": 2 + } + }, + UserExtensionPolicy: {}, + UserReportedConcern: {}, + VSCodeWebExtensionStatisicsType: { + enumValues: { + "install": 1, + "update": 2, + "uninstall": 3 + } + } + }; + exports2.TypeInfo.AcquisitionOperation.fields = { + operationState: { + enumType: exports2.TypeInfo.AcquisitionOperationState + }, + operationType: { + enumType: exports2.TypeInfo.AcquisitionOperationType + } + }; + exports2.TypeInfo.AcquisitionOptions.fields = { + defaultOperation: { + typeInfo: exports2.TypeInfo.AcquisitionOperation + }, + operations: { + isArray: true, + typeInfo: exports2.TypeInfo.AcquisitionOperation + } + }; + exports2.TypeInfo.AzureRestApiResponseModel.fields = { + operationStatus: { + typeInfo: exports2.TypeInfo.RestApiResponseStatusModel + } + }; + exports2.TypeInfo.Concern.fields = { + category: { + enumType: exports2.TypeInfo.ConcernCategory + }, + createdDate: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.QnAItemStatus + }, + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.CustomerLastContact.fields = { + lastContactDate: { + isDate: true + } + }; + exports2.TypeInfo.CustomerSupportRequest.fields = { + review: { + typeInfo: exports2.TypeInfo.Review + } + }; + exports2.TypeInfo.ExtensionAcquisitionRequest.fields = { + assignmentType: { + enumType: exports2.TypeInfo.AcquisitionAssignmentType + }, + operationType: { + enumType: exports2.TypeInfo.AcquisitionOperationType + } + }; + exports2.TypeInfo.ExtensionDailyStat.fields = { + statisticDate: { + isDate: true + } + }; + exports2.TypeInfo.ExtensionDailyStats.fields = { + dailyStats: { + isArray: true, + typeInfo: exports2.TypeInfo.ExtensionDailyStat + } + }; + exports2.TypeInfo.ExtensionDraft.fields = { + createdDate: { + isDate: true + }, + draftState: { + enumType: exports2.TypeInfo.DraftStateType + }, + lastUpdated: { + isDate: true + }, + payload: { + typeInfo: exports2.TypeInfo.ExtensionPayload + } + }; + exports2.TypeInfo.ExtensionDraftPatch.fields = { + operation: { + enumType: exports2.TypeInfo.DraftPatchOperation + } + }; + exports2.TypeInfo.ExtensionEvent.fields = { + statisticDate: { + isDate: true + } + }; + exports2.TypeInfo.ExtensionEvents.fields = { + events: { + isDictionary: true, + dictionaryValueFieldInfo: { + isArray: true, + typeInfo: exports2.TypeInfo.ExtensionEvent + } + } + }; + exports2.TypeInfo.ExtensionFilterResult.fields = { + extensions: { + isArray: true, + typeInfo: exports2.TypeInfo.PublishedExtension + } + }; + exports2.TypeInfo.ExtensionPayload.fields = { + type: { + enumType: exports2.TypeInfo.ExtensionDeploymentTechnology + } + }; + exports2.TypeInfo.ExtensionPolicy.fields = { + install: { + enumType: exports2.TypeInfo.ExtensionPolicyFlags + }, + request: { + enumType: exports2.TypeInfo.ExtensionPolicyFlags + } + }; + exports2.TypeInfo.ExtensionQuery.fields = { + filters: { + isArray: true, + typeInfo: exports2.TypeInfo.QueryFilter + }, + flags: { + enumType: exports2.TypeInfo.ExtensionQueryFlags + } + }; + exports2.TypeInfo.ExtensionQueryResult.fields = { + results: { + isArray: true, + typeInfo: exports2.TypeInfo.ExtensionFilterResult + } + }; + exports2.TypeInfo.ExtensionStatisticUpdate.fields = { + operation: { + enumType: exports2.TypeInfo.ExtensionStatisticOperation + } + }; + exports2.TypeInfo.ExtensionVersion.fields = { + flags: { + enumType: exports2.TypeInfo.ExtensionVersionFlags + }, + lastUpdated: { + isDate: true + } + }; + exports2.TypeInfo.NotificationsData.fields = { + type: { + enumType: exports2.TypeInfo.NotificationTemplateType + } + }; + exports2.TypeInfo.PublishedExtension.fields = { + deploymentType: { + enumType: exports2.TypeInfo.ExtensionDeploymentTechnology + }, + flags: { + enumType: exports2.TypeInfo.PublishedExtensionFlags + }, + lastUpdated: { + isDate: true + }, + publishedDate: { + isDate: true + }, + publisher: { + typeInfo: exports2.TypeInfo.PublisherFacts + }, + releaseDate: { + isDate: true + }, + versions: { + isArray: true, + typeInfo: exports2.TypeInfo.ExtensionVersion + } + }; + exports2.TypeInfo.Publisher.fields = { + extensions: { + isArray: true, + typeInfo: exports2.TypeInfo.PublishedExtension + }, + flags: { + enumType: exports2.TypeInfo.PublisherFlags + }, + lastUpdated: { + isDate: true + }, + state: { + enumType: exports2.TypeInfo.PublisherState + } + }; + exports2.TypeInfo.PublisherBase.fields = { + extensions: { + isArray: true, + typeInfo: exports2.TypeInfo.PublishedExtension + }, + flags: { + enumType: exports2.TypeInfo.PublisherFlags + }, + lastUpdated: { + isDate: true + }, + state: { + enumType: exports2.TypeInfo.PublisherState + } + }; + exports2.TypeInfo.PublisherFacts.fields = { + flags: { + enumType: exports2.TypeInfo.PublisherFlags + } + }; + exports2.TypeInfo.PublisherFilterResult.fields = { + publishers: { + isArray: true, + typeInfo: exports2.TypeInfo.Publisher + } + }; + exports2.TypeInfo.PublisherQuery.fields = { + filters: { + isArray: true, + typeInfo: exports2.TypeInfo.QueryFilter + }, + flags: { + enumType: exports2.TypeInfo.PublisherQueryFlags + } + }; + exports2.TypeInfo.PublisherQueryResult.fields = { + results: { + isArray: true, + typeInfo: exports2.TypeInfo.PublisherFilterResult + } + }; + exports2.TypeInfo.PublisherRoleAssignment.fields = { + access: { + enumType: exports2.TypeInfo.PublisherRoleAccess + } + }; + exports2.TypeInfo.QnAItem.fields = { + createdDate: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.QnAItemStatus + }, + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.QueryFilter.fields = { + direction: { + enumType: exports2.TypeInfo.PagingDirection + } + }; + exports2.TypeInfo.Question.fields = { + createdDate: { + isDate: true + }, + responses: { + isArray: true, + typeInfo: exports2.TypeInfo.Response + }, + status: { + enumType: exports2.TypeInfo.QnAItemStatus + }, + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.QuestionsResult.fields = { + questions: { + isArray: true, + typeInfo: exports2.TypeInfo.Question + } + }; + exports2.TypeInfo.Response.fields = { + createdDate: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.QnAItemStatus + }, + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.RestApiResponseStatusModel.fields = { + status: { + enumType: exports2.TypeInfo.RestApiResponseStatus + } + }; + exports2.TypeInfo.Review.fields = { + adminReply: { + typeInfo: exports2.TypeInfo.ReviewReply + }, + reply: { + typeInfo: exports2.TypeInfo.ReviewReply + }, + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.ReviewEventProperties.fields = { + eventOperation: { + enumType: exports2.TypeInfo.ReviewEventOperation + }, + replyDate: { + isDate: true + }, + resourceType: { + enumType: exports2.TypeInfo.ReviewResourceType + }, + reviewDate: { + isDate: true + } + }; + exports2.TypeInfo.ReviewPatch.fields = { + operation: { + enumType: exports2.TypeInfo.ReviewPatchOperation + }, + reportedConcern: { + typeInfo: exports2.TypeInfo.UserReportedConcern + }, + reviewItem: { + typeInfo: exports2.TypeInfo.Review + } + }; + exports2.TypeInfo.ReviewReply.fields = { + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.ReviewsResult.fields = { + reviews: { + isArray: true, + typeInfo: exports2.TypeInfo.Review + } + }; + exports2.TypeInfo.UserExtensionPolicy.fields = { + permissions: { + typeInfo: exports2.TypeInfo.ExtensionPolicy + } + }; + exports2.TypeInfo.UserReportedConcern.fields = { + category: { + enumType: exports2.TypeInfo.ConcernCategory + }, + submittedDate: { + isDate: true + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/ExtensionManagementInterfaces.js +var require_ExtensionManagementInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/ExtensionManagementInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.InstalledExtensionStateIssueType = exports2.ExtensionUpdateType = exports2.ExtensionStateFlags = exports2.ExtensionRequestUpdateType = exports2.ExtensionRequestState = exports2.ExtensionFlags = exports2.ContributionQueryOptions = exports2.ContributionPropertyType = exports2.ContributionLicensingBehaviorType = exports2.AcquisitionOperationType = exports2.AcquisitionOperationState = exports2.AcquisitionAssignmentType = void 0; + var GalleryInterfaces = require_GalleryInterfaces(); + var AcquisitionAssignmentType; + (function(AcquisitionAssignmentType2) { + AcquisitionAssignmentType2[AcquisitionAssignmentType2["None"] = 0] = "None"; + AcquisitionAssignmentType2[AcquisitionAssignmentType2["Me"] = 1] = "Me"; + AcquisitionAssignmentType2[AcquisitionAssignmentType2["All"] = 2] = "All"; + })(AcquisitionAssignmentType = exports2.AcquisitionAssignmentType || (exports2.AcquisitionAssignmentType = {})); + var AcquisitionOperationState; + (function(AcquisitionOperationState2) { + AcquisitionOperationState2[AcquisitionOperationState2["Disallow"] = 0] = "Disallow"; + AcquisitionOperationState2[AcquisitionOperationState2["Allow"] = 1] = "Allow"; + AcquisitionOperationState2[AcquisitionOperationState2["Completed"] = 3] = "Completed"; + })(AcquisitionOperationState = exports2.AcquisitionOperationState || (exports2.AcquisitionOperationState = {})); + var AcquisitionOperationType; + (function(AcquisitionOperationType2) { + AcquisitionOperationType2[AcquisitionOperationType2["Get"] = 0] = "Get"; + AcquisitionOperationType2[AcquisitionOperationType2["Install"] = 1] = "Install"; + AcquisitionOperationType2[AcquisitionOperationType2["Buy"] = 2] = "Buy"; + AcquisitionOperationType2[AcquisitionOperationType2["Try"] = 3] = "Try"; + AcquisitionOperationType2[AcquisitionOperationType2["Request"] = 4] = "Request"; + AcquisitionOperationType2[AcquisitionOperationType2["None"] = 5] = "None"; + AcquisitionOperationType2[AcquisitionOperationType2["PurchaseRequest"] = 6] = "PurchaseRequest"; + })(AcquisitionOperationType = exports2.AcquisitionOperationType || (exports2.AcquisitionOperationType = {})); + var ContributionLicensingBehaviorType; + (function(ContributionLicensingBehaviorType2) { + ContributionLicensingBehaviorType2[ContributionLicensingBehaviorType2["OnlyIfLicensed"] = 0] = "OnlyIfLicensed"; + ContributionLicensingBehaviorType2[ContributionLicensingBehaviorType2["OnlyIfUnlicensed"] = 1] = "OnlyIfUnlicensed"; + ContributionLicensingBehaviorType2[ContributionLicensingBehaviorType2["AlwaysInclude"] = 2] = "AlwaysInclude"; + })(ContributionLicensingBehaviorType = exports2.ContributionLicensingBehaviorType || (exports2.ContributionLicensingBehaviorType = {})); + var ContributionPropertyType; + (function(ContributionPropertyType2) { + ContributionPropertyType2[ContributionPropertyType2["Unknown"] = 0] = "Unknown"; + ContributionPropertyType2[ContributionPropertyType2["String"] = 1] = "String"; + ContributionPropertyType2[ContributionPropertyType2["Uri"] = 2] = "Uri"; + ContributionPropertyType2[ContributionPropertyType2["Guid"] = 4] = "Guid"; + ContributionPropertyType2[ContributionPropertyType2["Boolean"] = 8] = "Boolean"; + ContributionPropertyType2[ContributionPropertyType2["Integer"] = 16] = "Integer"; + ContributionPropertyType2[ContributionPropertyType2["Double"] = 32] = "Double"; + ContributionPropertyType2[ContributionPropertyType2["DateTime"] = 64] = "DateTime"; + ContributionPropertyType2[ContributionPropertyType2["Dictionary"] = 128] = "Dictionary"; + ContributionPropertyType2[ContributionPropertyType2["Array"] = 256] = "Array"; + ContributionPropertyType2[ContributionPropertyType2["Object"] = 512] = "Object"; + })(ContributionPropertyType = exports2.ContributionPropertyType || (exports2.ContributionPropertyType = {})); + var ContributionQueryOptions; + (function(ContributionQueryOptions2) { + ContributionQueryOptions2[ContributionQueryOptions2["None"] = 0] = "None"; + ContributionQueryOptions2[ContributionQueryOptions2["IncludeSelf"] = 16] = "IncludeSelf"; + ContributionQueryOptions2[ContributionQueryOptions2["IncludeChildren"] = 32] = "IncludeChildren"; + ContributionQueryOptions2[ContributionQueryOptions2["IncludeSubTree"] = 96] = "IncludeSubTree"; + ContributionQueryOptions2[ContributionQueryOptions2["IncludeAll"] = 112] = "IncludeAll"; + ContributionQueryOptions2[ContributionQueryOptions2["IgnoreConstraints"] = 256] = "IgnoreConstraints"; + })(ContributionQueryOptions = exports2.ContributionQueryOptions || (exports2.ContributionQueryOptions = {})); + var ExtensionFlags; + (function(ExtensionFlags2) { + ExtensionFlags2[ExtensionFlags2["BuiltIn"] = 1] = "BuiltIn"; + ExtensionFlags2[ExtensionFlags2["Trusted"] = 2] = "Trusted"; + })(ExtensionFlags = exports2.ExtensionFlags || (exports2.ExtensionFlags = {})); + var ExtensionRequestState; + (function(ExtensionRequestState2) { + ExtensionRequestState2[ExtensionRequestState2["Open"] = 0] = "Open"; + ExtensionRequestState2[ExtensionRequestState2["Accepted"] = 1] = "Accepted"; + ExtensionRequestState2[ExtensionRequestState2["Rejected"] = 2] = "Rejected"; + })(ExtensionRequestState = exports2.ExtensionRequestState || (exports2.ExtensionRequestState = {})); + var ExtensionRequestUpdateType; + (function(ExtensionRequestUpdateType2) { + ExtensionRequestUpdateType2[ExtensionRequestUpdateType2["Created"] = 1] = "Created"; + ExtensionRequestUpdateType2[ExtensionRequestUpdateType2["Approved"] = 2] = "Approved"; + ExtensionRequestUpdateType2[ExtensionRequestUpdateType2["Rejected"] = 3] = "Rejected"; + ExtensionRequestUpdateType2[ExtensionRequestUpdateType2["Deleted"] = 4] = "Deleted"; + })(ExtensionRequestUpdateType = exports2.ExtensionRequestUpdateType || (exports2.ExtensionRequestUpdateType = {})); + var ExtensionStateFlags; + (function(ExtensionStateFlags2) { + ExtensionStateFlags2[ExtensionStateFlags2["None"] = 0] = "None"; + ExtensionStateFlags2[ExtensionStateFlags2["Disabled"] = 1] = "Disabled"; + ExtensionStateFlags2[ExtensionStateFlags2["BuiltIn"] = 2] = "BuiltIn"; + ExtensionStateFlags2[ExtensionStateFlags2["MultiVersion"] = 4] = "MultiVersion"; + ExtensionStateFlags2[ExtensionStateFlags2["UnInstalled"] = 8] = "UnInstalled"; + ExtensionStateFlags2[ExtensionStateFlags2["VersionCheckError"] = 16] = "VersionCheckError"; + ExtensionStateFlags2[ExtensionStateFlags2["Trusted"] = 32] = "Trusted"; + ExtensionStateFlags2[ExtensionStateFlags2["Error"] = 64] = "Error"; + ExtensionStateFlags2[ExtensionStateFlags2["NeedsReauthorization"] = 128] = "NeedsReauthorization"; + ExtensionStateFlags2[ExtensionStateFlags2["AutoUpgradeError"] = 256] = "AutoUpgradeError"; + ExtensionStateFlags2[ExtensionStateFlags2["Warning"] = 512] = "Warning"; + })(ExtensionStateFlags = exports2.ExtensionStateFlags || (exports2.ExtensionStateFlags = {})); + var ExtensionUpdateType; + (function(ExtensionUpdateType2) { + ExtensionUpdateType2[ExtensionUpdateType2["Installed"] = 1] = "Installed"; + ExtensionUpdateType2[ExtensionUpdateType2["Uninstalled"] = 2] = "Uninstalled"; + ExtensionUpdateType2[ExtensionUpdateType2["Enabled"] = 3] = "Enabled"; + ExtensionUpdateType2[ExtensionUpdateType2["Disabled"] = 4] = "Disabled"; + ExtensionUpdateType2[ExtensionUpdateType2["VersionUpdated"] = 5] = "VersionUpdated"; + ExtensionUpdateType2[ExtensionUpdateType2["ActionRequired"] = 6] = "ActionRequired"; + ExtensionUpdateType2[ExtensionUpdateType2["ActionResolved"] = 7] = "ActionResolved"; + })(ExtensionUpdateType = exports2.ExtensionUpdateType || (exports2.ExtensionUpdateType = {})); + var InstalledExtensionStateIssueType; + (function(InstalledExtensionStateIssueType2) { + InstalledExtensionStateIssueType2[InstalledExtensionStateIssueType2["Warning"] = 0] = "Warning"; + InstalledExtensionStateIssueType2[InstalledExtensionStateIssueType2["Error"] = 1] = "Error"; + })(InstalledExtensionStateIssueType = exports2.InstalledExtensionStateIssueType || (exports2.InstalledExtensionStateIssueType = {})); + exports2.TypeInfo = { + AcquisitionAssignmentType: { + enumValues: { + "none": 0, + "me": 1, + "all": 2 + } + }, + AcquisitionOperation: {}, + AcquisitionOperationState: { + enumValues: { + "disallow": 0, + "allow": 1, + "completed": 3 + } + }, + AcquisitionOperationType: { + enumValues: { + "get": 0, + "install": 1, + "buy": 2, + "try": 3, + "request": 4, + "none": 5, + "purchaseRequest": 6 + } + }, + AcquisitionOptions: {}, + ContributionLicensingBehaviorType: { + enumValues: { + "onlyIfLicensed": 0, + "onlyIfUnlicensed": 1, + "alwaysInclude": 2 + } + }, + ContributionNodeQuery: {}, + ContributionPropertyDescription: {}, + ContributionPropertyType: { + enumValues: { + "unknown": 0, + "string": 1, + "uri": 2, + "guid": 4, + "boolean": 8, + "integer": 16, + "double": 32, + "dateTime": 64, + "dictionary": 128, + "array": 256, + "object": 512 + } + }, + ContributionQueryOptions: { + enumValues: { + "none": 0, + "includeSelf": 16, + "includeChildren": 32, + "includeSubTree": 96, + "includeAll": 112, + "ignoreConstraints": 256 + } + }, + ContributionType: {}, + ExtensionAcquisitionRequest: {}, + ExtensionAuditLog: {}, + ExtensionAuditLogEntry: {}, + ExtensionEvent: {}, + ExtensionFlags: { + enumValues: { + "builtIn": 1, + "trusted": 2 + } + }, + ExtensionLicensing: {}, + ExtensionManifest: {}, + ExtensionRequest: {}, + ExtensionRequestEvent: {}, + ExtensionRequestsEvent: {}, + ExtensionRequestState: { + enumValues: { + "open": 0, + "accepted": 1, + "rejected": 2 + } + }, + ExtensionRequestUpdateType: { + enumValues: { + "created": 1, + "approved": 2, + "rejected": 3, + "deleted": 4 + } + }, + ExtensionState: {}, + ExtensionStateFlags: { + enumValues: { + "none": 0, + "disabled": 1, + "builtIn": 2, + "multiVersion": 4, + "unInstalled": 8, + "versionCheckError": 16, + "trusted": 32, + "error": 64, + "needsReauthorization": 128, + "autoUpgradeError": 256, + "warning": 512 + } + }, + ExtensionUpdateType: { + enumValues: { + "installed": 1, + "uninstalled": 2, + "enabled": 3, + "disabled": 4, + "versionUpdated": 5, + "actionRequired": 6, + "actionResolved": 7 + } + }, + InstalledExtension: {}, + InstalledExtensionState: {}, + InstalledExtensionStateIssue: {}, + InstalledExtensionStateIssueType: { + enumValues: { + "warning": 0, + "error": 1 + } + }, + LicensingOverride: {}, + RequestedExtension: {} + }; + exports2.TypeInfo.AcquisitionOperation.fields = { + operationState: { + enumType: exports2.TypeInfo.AcquisitionOperationState + }, + operationType: { + enumType: exports2.TypeInfo.AcquisitionOperationType + } + }; + exports2.TypeInfo.AcquisitionOptions.fields = { + defaultOperation: { + typeInfo: exports2.TypeInfo.AcquisitionOperation + }, + operations: { + isArray: true, + typeInfo: exports2.TypeInfo.AcquisitionOperation + } + }; + exports2.TypeInfo.ContributionNodeQuery.fields = { + queryOptions: { + enumType: exports2.TypeInfo.ContributionQueryOptions + } + }; + exports2.TypeInfo.ContributionPropertyDescription.fields = { + type: { + enumType: exports2.TypeInfo.ContributionPropertyType + } + }; + exports2.TypeInfo.ContributionType.fields = { + properties: { + isDictionary: true, + dictionaryValueTypeInfo: exports2.TypeInfo.ContributionPropertyDescription + } + }; + exports2.TypeInfo.ExtensionAcquisitionRequest.fields = { + assignmentType: { + enumType: exports2.TypeInfo.AcquisitionAssignmentType + }, + operationType: { + enumType: exports2.TypeInfo.AcquisitionOperationType + } + }; + exports2.TypeInfo.ExtensionAuditLog.fields = { + entries: { + isArray: true, + typeInfo: exports2.TypeInfo.ExtensionAuditLogEntry + } + }; + exports2.TypeInfo.ExtensionAuditLogEntry.fields = { + auditDate: { + isDate: true + } + }; + exports2.TypeInfo.ExtensionEvent.fields = { + extension: { + typeInfo: GalleryInterfaces.TypeInfo.PublishedExtension + }, + updateType: { + enumType: exports2.TypeInfo.ExtensionUpdateType + } + }; + exports2.TypeInfo.ExtensionLicensing.fields = { + overrides: { + isArray: true, + typeInfo: exports2.TypeInfo.LicensingOverride + } + }; + exports2.TypeInfo.ExtensionManifest.fields = { + contributionTypes: { + isArray: true, + typeInfo: exports2.TypeInfo.ContributionType + }, + licensing: { + typeInfo: exports2.TypeInfo.ExtensionLicensing + } + }; + exports2.TypeInfo.ExtensionRequest.fields = { + requestDate: { + isDate: true + }, + requestState: { + enumType: exports2.TypeInfo.ExtensionRequestState + }, + resolveDate: { + isDate: true + } + }; + exports2.TypeInfo.ExtensionRequestEvent.fields = { + extension: { + typeInfo: GalleryInterfaces.TypeInfo.PublishedExtension + }, + request: { + typeInfo: exports2.TypeInfo.ExtensionRequest + }, + updateType: { + enumType: exports2.TypeInfo.ExtensionRequestUpdateType + } + }; + exports2.TypeInfo.ExtensionRequestsEvent.fields = { + extension: { + typeInfo: GalleryInterfaces.TypeInfo.PublishedExtension + }, + requests: { + isArray: true, + typeInfo: exports2.TypeInfo.ExtensionRequest + }, + updateType: { + enumType: exports2.TypeInfo.ExtensionRequestUpdateType + } + }; + exports2.TypeInfo.ExtensionState.fields = { + flags: { + enumType: exports2.TypeInfo.ExtensionStateFlags + }, + installationIssues: { + isArray: true, + typeInfo: exports2.TypeInfo.InstalledExtensionStateIssue + }, + lastUpdated: { + isDate: true + }, + lastVersionCheck: { + isDate: true + } + }; + exports2.TypeInfo.InstalledExtension.fields = { + contributionTypes: { + isArray: true, + typeInfo: exports2.TypeInfo.ContributionType + }, + flags: { + enumType: exports2.TypeInfo.ExtensionFlags + }, + installState: { + typeInfo: exports2.TypeInfo.InstalledExtensionState + }, + lastPublished: { + isDate: true + }, + licensing: { + typeInfo: exports2.TypeInfo.ExtensionLicensing + } + }; + exports2.TypeInfo.InstalledExtensionState.fields = { + flags: { + enumType: exports2.TypeInfo.ExtensionStateFlags + }, + installationIssues: { + isArray: true, + typeInfo: exports2.TypeInfo.InstalledExtensionStateIssue + }, + lastUpdated: { + isDate: true + } + }; + exports2.TypeInfo.InstalledExtensionStateIssue.fields = { + type: { + enumType: exports2.TypeInfo.InstalledExtensionStateIssueType + } + }; + exports2.TypeInfo.LicensingOverride.fields = { + behavior: { + enumType: exports2.TypeInfo.ContributionLicensingBehaviorType + } + }; + exports2.TypeInfo.RequestedExtension.fields = { + extensionRequests: { + isArray: true, + typeInfo: exports2.TypeInfo.ExtensionRequest + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/ExtensionManagementApi.js +var require_ExtensionManagementApi = __commonJS({ + "../node_modules/azure-devops-node-api/ExtensionManagementApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ExtensionManagementApi = void 0; + var basem = require_ClientApiBases(); + var ExtensionManagementInterfaces = require_ExtensionManagementInterfaces(); + var GalleryInterfaces = require_GalleryInterfaces(); + var ExtensionManagementApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-ExtensionManagement-api", options); + } + /** + * This API is called by acquisition/install page to get possible user actions like Buy/Request + * + * @param {string} itemId - Fully qualified name of extension (.) + * @param {boolean} testCommerce - Parameter to test paid preview extension without making azure plans public + * @param {boolean} isFreeOrTrialInstall - Parameter represents install or trial workflow (required for legacy install flows) + * @param {boolean} isAccountOwner - Parameter represents whether user is owner or PCA of an account + * @param {boolean} isLinked - Parameter represents whether account is linked with a subscription + * @param {boolean} isConnectedServer - Parameter represents whether Buy operation should be evaluated + * @param {boolean} isBuyOperationValid + */ + getAcquisitionOptions(itemId, testCommerce, isFreeOrTrialInstall, isAccountOwner, isLinked, isConnectedServer, isBuyOperationValid) { + return __awaiter2(this, void 0, void 0, function* () { + if (itemId == null) { + throw new TypeError("itemId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + itemId, + testCommerce, + isFreeOrTrialInstall, + isAccountOwner, + isLinked, + isConnectedServer, + isBuyOperationValid + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "288dff58-d13b-468e-9671-0fb754e9398c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.AcquisitionOptions, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {ExtensionManagementInterfaces.ExtensionAcquisitionRequest} acquisitionRequest + */ + requestAcquisition(acquisitionRequest) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "da616457-eed3-4672-92d7-18d21f5c1658", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, acquisitionRequest, options); + let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.ExtensionAcquisitionRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + */ + getAuditLog(publisherName, extensionName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "23a312e0-562d-42fb-a505-5a046b5635db", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.ExtensionAuditLog, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} registrationId + */ + registerAuthorization(publisherName, extensionName, registrationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + registrationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "f21cfc80-d2d2-4248-98bb-7820c74c4606", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {any} doc + * @param {string} publisherName + * @param {string} extensionName + * @param {string} scopeType + * @param {string} scopeValue + * @param {string} collectionName + */ + createDocumentByName(doc, publisherName, extensionName, scopeType, scopeValue, collectionName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + scopeType, + scopeValue, + collectionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "bbe06c18-1c8b-4fcd-b9c6-1535aaab8749", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, doc, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} scopeType + * @param {string} scopeValue + * @param {string} collectionName + * @param {string} documentId + */ + deleteDocumentByName(publisherName, extensionName, scopeType, scopeValue, collectionName, documentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + scopeType, + scopeValue, + collectionName, + documentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "bbe06c18-1c8b-4fcd-b9c6-1535aaab8749", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} scopeType + * @param {string} scopeValue + * @param {string} collectionName + * @param {string} documentId + */ + getDocumentByName(publisherName, extensionName, scopeType, scopeValue, collectionName, documentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + scopeType, + scopeValue, + collectionName, + documentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "bbe06c18-1c8b-4fcd-b9c6-1535aaab8749", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} scopeType + * @param {string} scopeValue + * @param {string} collectionName + */ + getDocumentsByName(publisherName, extensionName, scopeType, scopeValue, collectionName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + scopeType, + scopeValue, + collectionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "bbe06c18-1c8b-4fcd-b9c6-1535aaab8749", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {any} doc + * @param {string} publisherName + * @param {string} extensionName + * @param {string} scopeType + * @param {string} scopeValue + * @param {string} collectionName + */ + setDocumentByName(doc, publisherName, extensionName, scopeType, scopeValue, collectionName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + scopeType, + scopeValue, + collectionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "bbe06c18-1c8b-4fcd-b9c6-1535aaab8749", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, doc, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {any} doc + * @param {string} publisherName + * @param {string} extensionName + * @param {string} scopeType + * @param {string} scopeValue + * @param {string} collectionName + */ + updateDocumentByName(doc, publisherName, extensionName, scopeType, scopeValue, collectionName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + scopeType, + scopeValue, + collectionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "bbe06c18-1c8b-4fcd-b9c6-1535aaab8749", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, doc, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Query for one or more data collections for the specified extension. Note: the token used for authorization must have been issued on behalf of the specified extension. + * + * @param {ExtensionManagementInterfaces.ExtensionDataCollectionQuery} collectionQuery + * @param {string} publisherName - Name of the publisher. Example: "fabrikam". + * @param {string} extensionName - Name of the extension. Example: "ops-tools". + */ + queryCollectionsByName(collectionQuery, publisherName, extensionName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "56c331f1-ce53-4318-adfd-4db5c52a7a2e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, collectionQuery, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * List state and version information for all installed extensions. + * + * @param {boolean} includeDisabled - If true (the default), include disabled extensions in the results. + * @param {boolean} includeErrors - If true, include installed extensions in an error state in the results. + * @param {boolean} includeInstallationIssues + * @param {boolean} forceRefresh + */ + getStates(includeDisabled, includeErrors, includeInstallationIssues, forceRefresh) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + includeDisabled, + includeErrors, + includeInstallationIssues, + forceRefresh + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "92755d3d-9a8a-42b3-8a4d-87359fe5aa93", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.ExtensionState, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {ExtensionManagementInterfaces.InstalledExtensionQuery} query + */ + queryExtensions(query) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "046c980f-1345-4ce2-bf85-b46d10ff4cfd", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, query, options); + let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.InstalledExtension, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * List the installed extensions in the account / project collection. + * + * @param {boolean} includeDisabledExtensions - If true (the default), include disabled extensions in the results. + * @param {boolean} includeErrors - If true, include installed extensions with errors. + * @param {string[]} assetTypes - Determines which files are returned in the files array. Provide the wildcard '*' to return all files, or a colon separated list to retrieve files with specific asset types. + * @param {boolean} includeInstallationIssues + */ + getInstalledExtensions(includeDisabledExtensions, includeErrors, assetTypes, includeInstallationIssues) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + includeDisabledExtensions, + includeErrors, + assetTypes: assetTypes && assetTypes.join(":"), + includeInstallationIssues + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "275424d0-c844-4fe2-bda6-04933a1357d8", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.InstalledExtension, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update an installed extension. Typically this API is used to enable or disable an extension. + * + * @param {ExtensionManagementInterfaces.InstalledExtension} extension + */ + updateInstalledExtension(extension) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "275424d0-c844-4fe2-bda6-04933a1357d8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, extension, options); + let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.InstalledExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get an installed extension by its publisher and extension name. + * + * @param {string} publisherName - Name of the publisher. Example: "fabrikam". + * @param {string} extensionName - Name of the extension. Example: "ops-tools". + * @param {string[]} assetTypes - Determines which files are returned in the files array. Provide the wildcard '*' to return all files, or a colon separated list to retrieve files with specific asset types. + */ + getInstalledExtensionByName(publisherName, extensionName, assetTypes) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + assetTypes: assetTypes && assetTypes.join(":") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "fb0da285-f23e-4b56-8b53-3ef5f9f6de66", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.InstalledExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Install the specified extension into the account / project collection. + * + * @param {string} publisherName - Name of the publisher. Example: "fabrikam". + * @param {string} extensionName - Name of the extension. Example: "ops-tools". + * @param {string} version + */ + installExtensionByName(publisherName, extensionName, version2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + version: version2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "fb0da285-f23e-4b56-8b53-3ef5f9f6de66", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.InstalledExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Uninstall the specified extension from the account / project collection. + * + * @param {string} publisherName - Name of the publisher. Example: "fabrikam". + * @param {string} extensionName - Name of the extension. Example: "ops-tools". + * @param {string} reason + * @param {string} reasonCode + */ + uninstallExtensionByName(publisherName, extensionName, reason, reasonCode) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + reason, + reasonCode + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "fb0da285-f23e-4b56-8b53-3ef5f9f6de66", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} userId + */ + getPolicies(userId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + userId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "e5cc8c09-407b-4867-8319-2ae3338cbf6f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.UserExtensionPolicy, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} rejectMessage + * @param {string} publisherName + * @param {string} extensionName + * @param {string} requesterId + * @param {ExtensionManagementInterfaces.ExtensionRequestState} state + */ + resolveRequest(rejectMessage, publisherName, extensionName, requesterId, state) { + return __awaiter2(this, void 0, void 0, function* () { + if (state == null) { + throw new TypeError("state can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + requesterId + }; + let queryValues = { + state + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "aa93e1f3-511c-4364-8b9c-eb98818f2e0b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, rejectMessage, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + */ + getRequests() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "216b978f-b164-424e-ada2-b77561e842b7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.RequestedExtension, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} rejectMessage + * @param {string} publisherName + * @param {string} extensionName + * @param {ExtensionManagementInterfaces.ExtensionRequestState} state + */ + resolveAllRequests(rejectMessage, publisherName, extensionName, state) { + return __awaiter2(this, void 0, void 0, function* () { + if (state == null) { + throw new TypeError("state can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + state + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "ba93e1f3-511c-4364-8b9c-eb98818f2e0b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, rejectMessage, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + */ + deleteRequest(publisherName, extensionName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "f5afca1e-a728-4294-aa2d-4af0173431b5", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} requestMessage + */ + requestExtension(publisherName, extensionName, requestMessage) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "f5afca1e-a728-4294-aa2d-4af0173431b5", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, requestMessage, options); + let ret = this.formatResponse(res.result, ExtensionManagementInterfaces.TypeInfo.RequestedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + */ + getToken() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "ExtensionManagement", "3a2e24ed-1d6f-4cb2-9f3b-45a96bbfaf50", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.ExtensionManagementApi = ExtensionManagementApi; + ExtensionManagementApi.RESOURCE_AREA_ID = "6c2b0933-3600-42ae-bf8b-93d4f7e83594"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/FeatureManagementInterfaces.js +var require_FeatureManagementInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/FeatureManagementInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.ContributedFeatureEnabledValue = void 0; + var ContributedFeatureEnabledValue; + (function(ContributedFeatureEnabledValue2) { + ContributedFeatureEnabledValue2[ContributedFeatureEnabledValue2["Undefined"] = -1] = "Undefined"; + ContributedFeatureEnabledValue2[ContributedFeatureEnabledValue2["Disabled"] = 0] = "Disabled"; + ContributedFeatureEnabledValue2[ContributedFeatureEnabledValue2["Enabled"] = 1] = "Enabled"; + })(ContributedFeatureEnabledValue = exports2.ContributedFeatureEnabledValue || (exports2.ContributedFeatureEnabledValue = {})); + exports2.TypeInfo = { + ContributedFeatureEnabledValue: { + enumValues: { + "undefined": -1, + "disabled": 0, + "enabled": 1 + } + }, + ContributedFeatureState: {}, + ContributedFeatureStateQuery: {} + }; + exports2.TypeInfo.ContributedFeatureState.fields = { + state: { + enumType: exports2.TypeInfo.ContributedFeatureEnabledValue + } + }; + exports2.TypeInfo.ContributedFeatureStateQuery.fields = { + featureStates: { + isDictionary: true, + dictionaryValueTypeInfo: exports2.TypeInfo.ContributedFeatureState + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/FeatureManagementApi.js +var require_FeatureManagementApi = __commonJS({ + "../node_modules/azure-devops-node-api/FeatureManagementApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FeatureManagementApi = void 0; + var basem = require_ClientApiBases(); + var FeatureManagementInterfaces = require_FeatureManagementInterfaces(); + var FeatureManagementApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-FeatureManagement-api", options); + } + /** + * Get a specific feature by its id + * + * @param {string} featureId - The contribution id of the feature + */ + getFeature(featureId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + featureId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "c4209f25-7a27-41dd-9f04-06080c7b6afd", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of all defined features + * + * @param {string} targetContributionId - Optional target contribution. If null/empty, return all features. If specified include the features that target the specified contribution. + */ + getFeatures(targetContributionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + targetContributionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "c4209f25-7a27-41dd-9f04-06080c7b6afd", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the state of the specified feature for the given user/all-users scope + * + * @param {string} featureId - Contribution id of the feature + * @param {string} userScope - User-Scope at which to get the value. Should be "me" for the current user or "host" for all users. + */ + getFeatureState(featureId, userScope) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + featureId, + userScope + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "98911314-3f9b-4eaf-80e8-83900d8e85d9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Set the state of a feature + * + * @param {FeatureManagementInterfaces.ContributedFeatureState} feature - Posted feature state object. Should specify the effective value. + * @param {string} featureId - Contribution id of the feature + * @param {string} userScope - User-Scope at which to set the value. Should be "me" for the current user or "host" for all users. + * @param {string} reason - Reason for changing the state + * @param {string} reasonCode - Short reason code + */ + setFeatureState(feature, featureId, userScope, reason, reasonCode) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + featureId, + userScope + }; + let queryValues = { + reason, + reasonCode + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "98911314-3f9b-4eaf-80e8-83900d8e85d9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, feature, options); + let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the state of the specified feature for the given named scope + * + * @param {string} featureId - Contribution id of the feature + * @param {string} userScope - User-Scope at which to get the value. Should be "me" for the current user or "host" for all users. + * @param {string} scopeName - Scope at which to get the feature setting for (e.g. "project" or "team") + * @param {string} scopeValue - Value of the scope (e.g. the project or team id) + */ + getFeatureStateForScope(featureId, userScope, scopeName, scopeValue) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + featureId, + userScope, + scopeName, + scopeValue + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "dd291e43-aa9f-4cee-8465-a93c78e414a4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Set the state of a feature at a specific scope + * + * @param {FeatureManagementInterfaces.ContributedFeatureState} feature - Posted feature state object. Should specify the effective value. + * @param {string} featureId - Contribution id of the feature + * @param {string} userScope - User-Scope at which to set the value. Should be "me" for the current user or "host" for all users. + * @param {string} scopeName - Scope at which to get the feature setting for (e.g. "project" or "team") + * @param {string} scopeValue - Value of the scope (e.g. the project or team id) + * @param {string} reason - Reason for changing the state + * @param {string} reasonCode - Short reason code + */ + setFeatureStateForScope(feature, featureId, userScope, scopeName, scopeValue, reason, reasonCode) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + featureId, + userScope, + scopeName, + scopeValue + }; + let queryValues = { + reason, + reasonCode + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "dd291e43-aa9f-4cee-8465-a93c78e414a4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, feature, options); + let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureState, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the effective state for a list of feature ids + * + * @param {FeatureManagementInterfaces.ContributedFeatureStateQuery} query - Features to query along with current scope values + */ + queryFeatureStates(query) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "2b4486ad-122b-400c-ae65-17b6672c1f9d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, query, options); + let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureStateQuery, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the states of the specified features for the default scope + * + * @param {FeatureManagementInterfaces.ContributedFeatureStateQuery} query - Query describing the features to query. + * @param {string} userScope + */ + queryFeatureStatesForDefaultScope(query, userScope) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + userScope + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "3f810f28-03e2-4239-b0bc-788add3005e5", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, query, options); + let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureStateQuery, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the states of the specified features for the specific named scope + * + * @param {FeatureManagementInterfaces.ContributedFeatureStateQuery} query - Query describing the features to query. + * @param {string} userScope + * @param {string} scopeName + * @param {string} scopeValue + */ + queryFeatureStatesForNamedScope(query, userScope, scopeName, scopeValue) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + userScope, + scopeName, + scopeValue + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "FeatureManagement", "f29e997b-c2da-4d15-8380-765788a1a74c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, query, options); + let ret = this.formatResponse(res.result, FeatureManagementInterfaces.TypeInfo.ContributedFeatureStateQuery, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.FeatureManagementApi = FeatureManagementApi; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/FileContainerInterfaces.js +var require_FileContainerInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/FileContainerInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.ContainerOptions = exports2.ContainerItemType = exports2.ContainerItemStatus = exports2.BlobCompressionType = void 0; + var BlobCompressionType; + (function(BlobCompressionType2) { + BlobCompressionType2[BlobCompressionType2["None"] = 0] = "None"; + BlobCompressionType2[BlobCompressionType2["GZip"] = 1] = "GZip"; + })(BlobCompressionType = exports2.BlobCompressionType || (exports2.BlobCompressionType = {})); + var ContainerItemStatus; + (function(ContainerItemStatus2) { + ContainerItemStatus2[ContainerItemStatus2["Created"] = 1] = "Created"; + ContainerItemStatus2[ContainerItemStatus2["PendingUpload"] = 2] = "PendingUpload"; + })(ContainerItemStatus = exports2.ContainerItemStatus || (exports2.ContainerItemStatus = {})); + var ContainerItemType; + (function(ContainerItemType2) { + ContainerItemType2[ContainerItemType2["Any"] = 0] = "Any"; + ContainerItemType2[ContainerItemType2["Folder"] = 1] = "Folder"; + ContainerItemType2[ContainerItemType2["File"] = 2] = "File"; + })(ContainerItemType = exports2.ContainerItemType || (exports2.ContainerItemType = {})); + var ContainerOptions; + (function(ContainerOptions2) { + ContainerOptions2[ContainerOptions2["None"] = 0] = "None"; + })(ContainerOptions = exports2.ContainerOptions || (exports2.ContainerOptions = {})); + exports2.TypeInfo = { + BlobCompressionType: { + enumValues: { + "none": 0, + "gZip": 1 + } + }, + ContainerItemBlobReference: {}, + ContainerItemStatus: { + enumValues: { + "created": 1, + "pendingUpload": 2 + } + }, + ContainerItemType: { + enumValues: { + "any": 0, + "folder": 1, + "file": 2 + } + }, + ContainerOptions: { + enumValues: { + "none": 0 + } + }, + FileContainer: {}, + FileContainerItem: {} + }; + exports2.TypeInfo.ContainerItemBlobReference.fields = { + compressionType: { + enumType: exports2.TypeInfo.BlobCompressionType + } + }; + exports2.TypeInfo.FileContainer.fields = { + dateCreated: { + isDate: true + }, + options: { + enumType: exports2.TypeInfo.ContainerOptions + } + }; + exports2.TypeInfo.FileContainerItem.fields = { + blobMetadata: { + typeInfo: exports2.TypeInfo.ContainerItemBlobReference + }, + dateCreated: { + isDate: true + }, + dateLastModified: { + isDate: true + }, + itemType: { + enumType: exports2.TypeInfo.ContainerItemType + }, + status: { + enumType: exports2.TypeInfo.ContainerItemStatus + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/FileContainerApiBase.js +var require_FileContainerApiBase = __commonJS({ + "../node_modules/azure-devops-node-api/FileContainerApiBase.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FileContainerApiBase = void 0; + var basem = require_ClientApiBases(); + var FileContainerInterfaces = require_FileContainerInterfaces(); + var FileContainerApiBase = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-FileContainer-api", options); + } + /** + * Creates the specified items in the referenced container. + * + * @param {VSSInterfaces.VssJsonCollectionWrapperV} items + * @param {number} containerId + * @param {string} scope - A guid representing the scope of the container. This is often the project id. + */ + createItems(items, containerId, scope) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + containerId + }; + let queryValues = { + scope + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, items, options); + let ret = this.formatResponse(res.result, FileContainerInterfaces.TypeInfo.FileContainerItem, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes the specified items in a container. + * + * @param {number} containerId - Container Id. + * @param {string} itemPath - Path to delete. + * @param {string} scope - A guid representing the scope of the container. This is often the project id. + */ + deleteItem(containerId, itemPath, scope) { + return __awaiter2(this, void 0, void 0, function* () { + if (itemPath == null) { + throw new TypeError("itemPath can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + containerId + }; + let queryValues = { + itemPath, + scope + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets containers filtered by a comma separated list of artifact uris within the same scope, if not specified returns all containers + * + * @param {string} scope - A guid representing the scope of the container. This is often the project id. + * @param {string} artifactUris + */ + getContainers(scope, artifactUris) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + scope, + artifactUris + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, FileContainerInterfaces.TypeInfo.FileContainer, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the specified file container object in a format dependent upon the given parameters or HTTP Accept request header + * + * @param {number} containerId - The requested container Id + * @param {string} scope - A guid representing the scope of the container. This is often the project id. + * @param {string} itemPath - The path to the item of interest + * @param {boolean} metadata - If true, this overrides any specified format parameter or HTTP Accept request header to provide non-recursive information for the given itemPath + * @param {string} format - If specified, this overrides the HTTP Accept request header to return either 'json' or 'zip'. If $format is specified, then api-version should also be specified as a query parameter. + * @param {string} downloadFileName - If specified and returning other than JSON format, then this download name will be used (else defaults to itemPath) + * @param {boolean} includeDownloadTickets + * @param {boolean} isShallow - If true, returns only immediate children(files & folders) for the given itemPath. False will return all items recursively within itemPath. + * @param {boolean} ignoreRequestedMediaType - Set to true to ignore the HTTP Accept request header. Default is false. + * @param {boolean} includeBlobMetadata + * @param {boolean} saveAbsolutePath - Set to false to not save the absolute path to the specified directory of the artifact in the returned archive. Works only for artifact directories. Default is true. + * @param {boolean} preferRedirect - Set to true to get the redirect response which leads to the stream with content. Default is false. + */ + getItems(containerId, scope, itemPath, metadata, format, downloadFileName, includeDownloadTickets, isShallow, ignoreRequestedMediaType, includeBlobMetadata, saveAbsolutePath, preferRedirect) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + containerId + }; + let queryValues = { + scope, + itemPath, + metadata, + "$format": format, + downloadFileName, + includeDownloadTickets, + isShallow, + ignoreRequestedMediaType, + includeBlobMetadata, + saveAbsolutePath, + preferRedirect + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, FileContainerInterfaces.TypeInfo.FileContainerItem, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.FileContainerApiBase = FileContainerApiBase; + } +}); + +// ../node_modules/azure-devops-node-api/FileContainerApi.js +var require_FileContainerApi = __commonJS({ + "../node_modules/azure-devops-node-api/FileContainerApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FileContainerApi = void 0; + var stream = require("stream"); + var zlib = require("zlib"); + var httpm = require_HttpClient2(); + var FileContainerApiBase = require_FileContainerApiBase(); + var FileContainerInterfaces = require_FileContainerInterfaces(); + var FileContainerApi = class extends FileContainerApiBase.FileContainerApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, options); + } + /** + * @param {number} containerId + * @param {string} scope + * @param {string} itemPath + * @param {string} downloadFileName + */ + getItem(containerId, scope, itemPath, downloadFileName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + containerId + }; + let queryValues = { + scope, + itemPath, + "$format": "OctetStream", + downloadFileName + }; + try { + let verData = yield this.vsoClient.getVersioningData("4.0-preview.4", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/octet-stream", verData.apiVersion); + let res = yield this.http.get(url); + let rres = {}; + let statusCode = res.message.statusCode; + rres.statusCode = statusCode; + if (statusCode == httpm.HttpCodes.NotFound) { + resolve(rres); + } + if (statusCode > 299) { + let msg; + let contents = yield res.readBody(); + let obj; + if (contents && contents.length > 0) { + obj = JSON.parse(contents); + if (options && options.responseProcessor) { + rres.result = options.responseProcessor(obj); + } else { + rres.result = obj; + } + } + if (obj && obj.message) { + msg = obj.message; + } else { + msg = "Failed request: (" + statusCode + ") " + res.message.url; + } + reject2(new Error(msg)); + } else { + if (res.message.headers["content-encoding"] === "gzip") { + let unzipStream = zlib.createGunzip(); + res.message.pipe(unzipStream); + rres.result = unzipStream; + } else { + rres.result = res.message; + } + resolve(rres); + } + } catch (err) { + reject2(err); + } + })); + }); + } + createItem(contentStream, uncompressedLength, containerId, itemPath, scope, options) { + return new Promise((resolve, reject2) => { + let chunkStream = new ChunkStream(this, uncompressedLength, containerId, itemPath, scope, options); + chunkStream.on("finish", () => { + resolve(chunkStream.getItem()); + }); + contentStream.pipe(chunkStream); + }); + } + // used by ChunkStream + _createItem(customHeaders, contentStream, containerId, itemPath, scope, onResult) { + var routeValues = { + containerId + }; + var queryValues = { + itemPath, + scope + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = ""; + this.vsoClient.getVersioningData("4.0-preview.4", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues).then((versioningData) => { + var url = versioningData.requestUrl; + var serializationData = { responseTypeMetadata: FileContainerInterfaces.TypeInfo.FileContainerItem, responseIsCollection: false }; + let options = this.createRequestOptions("application/octet-stream", versioningData.apiVersion); + options.additionalHeaders = customHeaders; + this.rest.uploadStream("PUT", url, contentStream, options).then((res) => { + let ret = this.formatResponse(res.result, FileContainerInterfaces.TypeInfo.FileContainerItem, false); + onResult(null, res.statusCode, ret); + }).catch((err) => { + onResult(err, err.statusCode, null); + }); + }, (error) => { + onResult(error, error.statusCode, null); + }); + } + }; + exports2.FileContainerApi = FileContainerApi; + var ChunkStream = class _ChunkStream extends stream.Writable { + constructor(api, uncompressedLength, containerId, itemPath, scope, options) { + super(); + this._buffer = new Buffer(_ChunkStream.ChunkSize); + this._length = 0; + this._startRange = 0; + this._bytesToSend = 0; + this._totalReceived = 0; + this._api = api; + this._options = options || {}; + this._uncompressedLength = uncompressedLength; + this._containerId = containerId; + this._itemPath = itemPath; + this._scope = scope; + this._bytesToSend = this._options.isGzipped ? this._options.compressedLength : uncompressedLength; + } + _write(data, encoding, callback) { + let chunk2 = data; + if (!chunk2) { + if (this._length == 0) { + callback(); + } else { + this._sendChunk(callback); + } + return; + } + let newBuffer = null; + if (this._length + chunk2.length > _ChunkStream.ChunkSize) { + let overflowPosition = chunk2.length - (_ChunkStream.ChunkSize - this._length); + chunk2.copy(this._buffer, this._length, 0, overflowPosition); + this._length += overflowPosition; + newBuffer = chunk2.slice(overflowPosition); + } else { + chunk2.copy(this._buffer, this._length, 0, chunk2.length); + this._length += chunk2.length; + } + this._totalReceived += chunk2.length; + if (this._length >= _ChunkStream.ChunkSize || this._totalReceived >= this._bytesToSend) { + this._sendChunk(callback, newBuffer); + } else { + callback(); + } + } + _sendChunk(callback, newBuffer) { + let endRange = this._startRange + this._length; + let headers = { + "Content-Range": "bytes " + this._startRange + "-" + (endRange - 1) + "/" + this._bytesToSend, + "Content-Length": this._length + }; + if (this._options.isGzipped) { + headers["Accept-Encoding"] = "gzip"; + headers["Content-Encoding"] = "gzip"; + headers["x-tfs-filelength"] = this._uncompressedLength; + } + this._startRange = endRange; + this._api._createItem(headers, new BufferStream(this._buffer, this._length), this._containerId, this._itemPath, this._scope, (err, statusCode, item) => { + if (newBuffer) { + this._length = newBuffer.length; + newBuffer.copy(this._buffer); + } else { + this._length = 0; + } + this._item = item; + callback(err); + }); + } + getItem() { + return this._item; + } + }; + ChunkStream.ChunkSize = 16 * 1024 * 1024; + var BufferStream = class extends stream.Readable { + constructor(buffer, length) { + super(); + this._position = 0; + this._length = 0; + this._buffer = buffer; + this._length = length; + } + _read(size2) { + if (this._position >= this._length) { + this.push(null); + return; + } + let end = Math.min(this._position + size2, this._length); + this.push(this._buffer.slice(this._position, end)); + this._position = end; + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/GalleryCompatHttpClientBase.js +var require_GalleryCompatHttpClientBase = __commonJS({ + "../node_modules/azure-devops-node-api/GalleryCompatHttpClientBase.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.GalleryCompatHttpClientBase = void 0; + var basem = require_ClientApiBases(); + var GalleryInterfaces = require_GalleryInterfaces(); + var GalleryCompatHttpClientBase = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, userAgent, options) { + super(baseUrl, handlers, userAgent, options); + } + /** + * @param {GalleryInterfaces.ExtensionPackage} extensionPackage + */ + createExtensionJson(extensionPackage) { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("3.1-preview.1", "gallery", "a41192c8-9525-4b58-bc86-179fa549d80d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, extensionPackage, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + } + /** + * @param {GalleryInterfaces.ExtensionPackage} extensionPackage + * @param {string} extensionId + */ + updateExtensionByIdJson(extensionPackage, extensionId) { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + extensionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.1-preview.1", "gallery", "a41192c8-9525-4b58-bc86-179fa549d80d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, extensionPackage, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + } + /** + * @param {GalleryInterfaces.ExtensionPackage} extensionPackage + * @param {string} publisherName + */ + createExtensionWithPublisherJson(extensionPackage, publisherName) { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.1-preview.1", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, extensionPackage, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + } + /** + * @param {GalleryInterfaces.ExtensionPackage} extensionPackage + * @param {string} publisherName + * @param {string} extensionName + */ + updateExtensionJson(extensionPackage, publisherName, extensionName) { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.1-preview.1", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, extensionPackage, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + } + }; + exports2.GalleryCompatHttpClientBase = GalleryCompatHttpClientBase; + } +}); + +// ../node_modules/azure-devops-node-api/GalleryApi.js +var require_GalleryApi = __commonJS({ + "../node_modules/azure-devops-node-api/GalleryApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.GalleryApi = void 0; + var compatBase = require_GalleryCompatHttpClientBase(); + var GalleryInterfaces = require_GalleryInterfaces(); + var GalleryApi = class extends compatBase.GalleryCompatHttpClientBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Gallery-api", options); + } + /** + * @param {string} extensionId + * @param {string} accountName + */ + shareExtensionById(extensionId, accountName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + extensionId, + accountName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "1f19631b-a0b4-4a03-89c2-d79785d24360", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} extensionId + * @param {string} accountName + */ + unshareExtensionById(extensionId, accountName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + extensionId, + accountName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "1f19631b-a0b4-4a03-89c2-d79785d24360", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} accountName + */ + shareExtension(publisherName, extensionName, accountName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + accountName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "a1e66d8f-f5de-4d16-8309-91a4e015ee46", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} accountName + */ + unshareExtension(publisherName, extensionName, accountName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + accountName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "a1e66d8f-f5de-4d16-8309-91a4e015ee46", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} itemId + * @param {string} installationTarget + * @param {boolean} testCommerce + * @param {boolean} isFreeOrTrialInstall + */ + getAcquisitionOptions(itemId, installationTarget, testCommerce, isFreeOrTrialInstall) { + return __awaiter2(this, void 0, void 0, function* () { + if (installationTarget == null) { + throw new TypeError("installationTarget can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + itemId + }; + let queryValues = { + installationTarget, + testCommerce, + isFreeOrTrialInstall + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "9d0a0105-075e-4760-aa15-8bcf54d1bd7d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.AcquisitionOptions, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {GalleryInterfaces.ExtensionAcquisitionRequest} acquisitionRequest + */ + requestAcquisition(acquisitionRequest) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "3adb1f2d-e328-446e-be73-9f6d98071c45", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, acquisitionRequest, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionAcquisitionRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} version + * @param {string} assetType + * @param {string} accountToken + * @param {boolean} acceptDefault + * @param {String} accountTokenHeader - Header to pass the account token + */ + getAssetByName(customHeaders, publisherName, extensionName, version2, assetType, accountToken, acceptDefault, accountTokenHeader) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + version: version2, + assetType + }; + let queryValues = { + accountToken, + acceptDefault + }; + customHeaders = customHeaders || {}; + customHeaders["X-Market-AccountToken"] = "accountTokenHeader"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "7529171f-a002-4180-93ba-685f358a0482", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} extensionId + * @param {string} version + * @param {string} assetType + * @param {string} accountToken + * @param {boolean} acceptDefault + * @param {String} accountTokenHeader - Header to pass the account token + */ + getAsset(customHeaders, extensionId, version2, assetType, accountToken, acceptDefault, accountTokenHeader) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + extensionId, + version: version2, + assetType + }; + let queryValues = { + accountToken, + acceptDefault + }; + customHeaders = customHeaders || {}; + customHeaders["X-Market-AccountToken"] = "accountTokenHeader"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "5d545f3d-ef47-488b-8be3-f5ee1517856c", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} version + * @param {string} assetType + * @param {string} accountToken + * @param {String} accountTokenHeader - Header to pass the account token + */ + getAssetAuthenticated(customHeaders, publisherName, extensionName, version2, assetType, accountToken, accountTokenHeader) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + version: version2, + assetType + }; + let queryValues = { + accountToken + }; + customHeaders = customHeaders || {}; + customHeaders["X-Market-AccountToken"] = "accountTokenHeader"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "506aff36-2622-4f70-8063-77cce6366d20", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} azurePublisherId + */ + associateAzurePublisher(publisherName, azurePublisherId) { + return __awaiter2(this, void 0, void 0, function* () { + if (azurePublisherId == null) { + throw new TypeError("azurePublisherId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + let queryValues = { + azurePublisherId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "efd202a6-9d87-4ebc-9229-d2b8ae2fdb6d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + */ + queryAssociatedAzurePublisher(publisherName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "efd202a6-9d87-4ebc-9229-d2b8ae2fdb6d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} languages + */ + getCategories(languages) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + languages + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "e0a5a71e-3ac3-43a0-ae7d-0bb5c3046a2a", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} categoryName + * @param {string} languages + * @param {string} product + */ + getCategoryDetails(categoryName, languages, product) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + categoryName + }; + let queryValues = { + languages, + product + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "75d3c04d-84d2-4973-acd2-22627587dabc", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} product + * @param {string} categoryId + * @param {number} lcid + * @param {string} source + * @param {string} productVersion + * @param {string} skus + * @param {string} subSkus + * @param {string} productArchitecture + */ + getCategoryTree(product, categoryId, lcid, source, productVersion, skus, subSkus, productArchitecture) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + product, + categoryId + }; + let queryValues = { + lcid, + source, + productVersion, + skus, + subSkus, + productArchitecture + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "1102bb42-82b0-4955-8d8a-435d6b4cedd3", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} product + * @param {number} lcid + * @param {string} source + * @param {string} productVersion + * @param {string} skus + * @param {string} subSkus + */ + getRootCategories(product, lcid, source, productVersion, skus, subSkus) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + product + }; + let queryValues = { + lcid, + source, + productVersion, + skus, + subSkus + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "31fba831-35b2-46f6-a641-d05de5a877d8", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} version + */ + getCertificate(publisherName, extensionName, version2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + version: version2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "e905ad6a-3f1f-4d08-9f6d-7d357ff8b7d0", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + */ + getContentVerificationLog(publisherName, extensionName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "c0f1c7c4-3557-4ffb-b774-1e48c4865e99", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {GalleryInterfaces.CustomerSupportRequest} customerSupportRequest + */ + createSupportRequest(customerSupportRequest) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "8eded385-026a-4c15-b810-b8eb402771f1", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, customerSupportRequest, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + */ + createDraftForEditExtension(publisherName, extensionName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "02b33873-4e61-496e-83a2-59d1df46b7d8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDraft, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {GalleryInterfaces.ExtensionDraftPatch} draftPatch + * @param {string} publisherName + * @param {string} extensionName + * @param {string} draftId + */ + performEditExtensionDraftOperation(draftPatch, publisherName, extensionName, draftId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + draftId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "02b33873-4e61-496e-83a2-59d1df46b7d8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, draftPatch, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDraft, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} publisherName + * @param {string} extensionName + * @param {string} draftId + * @param {String} fileName - Header to pass the filename of the uploaded data + */ + updatePayloadInDraftForEditExtension(customHeaders, contentStream, publisherName, extensionName, draftId, fileName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + draftId + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + customHeaders["X-Market-UploadFileName"] = "fileName"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "02b33873-4e61-496e-83a2-59d1df46b7d8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("PUT", url, contentStream, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDraft, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} publisherName + * @param {string} extensionName + * @param {string} draftId + * @param {string} assetType + */ + addAssetForEditExtensionDraft(customHeaders, contentStream, publisherName, extensionName, draftId, assetType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + draftId, + assetType + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "f1db9c47-6619-4998-a7e5-d7f9f41a4617", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("PUT", url, contentStream, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} publisherName + * @param {String} product - Header to pass the product type of the payload file + * @param {String} fileName - Header to pass the filename of the uploaded data + */ + createDraftForNewExtension(customHeaders, contentStream, publisherName, product, fileName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + customHeaders["X-Market-UploadFileProduct"] = "product"; + customHeaders["X-Market-UploadFileName"] = "fileName"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "b3ab127d-ebb9-4d22-b611-4e09593c8d79", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("POST", url, contentStream, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDraft, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {GalleryInterfaces.ExtensionDraftPatch} draftPatch + * @param {string} publisherName + * @param {string} draftId + */ + performNewExtensionDraftOperation(draftPatch, publisherName, draftId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + draftId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "b3ab127d-ebb9-4d22-b611-4e09593c8d79", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, draftPatch, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDraft, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} publisherName + * @param {string} draftId + * @param {String} fileName - Header to pass the filename of the uploaded data + */ + updatePayloadInDraftForNewExtension(customHeaders, contentStream, publisherName, draftId, fileName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + draftId + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + customHeaders["X-Market-UploadFileName"] = "fileName"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "b3ab127d-ebb9-4d22-b611-4e09593c8d79", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("PUT", url, contentStream, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDraft, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} publisherName + * @param {string} draftId + * @param {string} assetType + */ + addAssetForNewExtensionDraft(customHeaders, contentStream, publisherName, draftId, assetType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + draftId, + assetType + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "88c0b1c8-b4f1-498a-9b2a-8446ef9f32e7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("PUT", url, contentStream, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} draftId + * @param {string} assetType + * @param {string} extensionName + */ + getAssetFromEditExtensionDraft(publisherName, draftId, assetType, extensionName) { + return __awaiter2(this, void 0, void 0, function* () { + if (extensionName == null) { + throw new TypeError("extensionName can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + draftId, + assetType + }; + let queryValues = { + extensionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "88c0b1c8-b4f1-498a-9b2a-8446ef9f32e7", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} draftId + * @param {string} assetType + */ + getAssetFromNewExtensionDraft(publisherName, draftId, assetType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + draftId, + assetType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "88c0b1c8-b4f1-498a-9b2a-8446ef9f32e7", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get install/uninstall events of an extension. If both count and afterDate parameters are specified, count takes precedence. + * + * @param {string} publisherName - Name of the publisher + * @param {string} extensionName - Name of the extension + * @param {number} count - Count of events to fetch, applies to each event type. + * @param {Date} afterDate - Fetch events that occurred on or after this date + * @param {string} include - Filter options. Supported values: install, uninstall, review, acquisition, sales. Default is to fetch all types of events + * @param {string} includeProperty - Event properties to include. Currently only 'lastContactDetails' is supported for uninstall events + */ + getExtensionEvents(publisherName, extensionName, count, afterDate, include, includeProperty) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + count, + afterDate, + include, + includeProperty + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "3d13c499-2168-4d06-bef4-14aba185dcd5", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionEvents, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * API endpoint to publish extension install/uninstall events. This is meant to be invoked by EMS only for sending us data related to install/uninstall of an extension. + * + * @param {GalleryInterfaces.ExtensionEvents[]} extensionEvents + */ + publishExtensionEvents(extensionEvents) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "0bf2bd3a-70e0-4d5d-8bf7-bd4a9c2ab6e7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, extensionEvents, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {GalleryInterfaces.ExtensionQuery} extensionQuery + * @param {string} accountToken + * @param {String} accountTokenHeader - Header to pass the account token + */ + queryExtensions(customHeaders, extensionQuery, accountToken, accountTokenHeader) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + accountToken + }; + customHeaders = customHeaders || {}; + customHeaders["X-Market-AccountToken"] = "accountTokenHeader"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "eb9d5ee1-6d43-456b-b80e-8a96fbc014b6", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.create(url, extensionQuery, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionQueryResult, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} extensionType + * @param {string} reCaptchaToken + */ + createExtension(customHeaders, contentStream, extensionType, reCaptchaToken) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + extensionType, + reCaptchaToken + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "a41192c8-9525-4b58-bc86-179fa549d80d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("POST", url, contentStream, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} extensionId + * @param {string} version + */ + deleteExtensionById(extensionId, version2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + extensionId + }; + let queryValues = { + version: version2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "a41192c8-9525-4b58-bc86-179fa549d80d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} extensionId + * @param {string} version + * @param {GalleryInterfaces.ExtensionQueryFlags} flags + */ + getExtensionById(extensionId, version2, flags) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + extensionId + }; + let queryValues = { + version: version2, + flags + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "a41192c8-9525-4b58-bc86-179fa549d80d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} extensionId + * @param {string} reCaptchaToken + */ + updateExtensionById(extensionId, reCaptchaToken) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + extensionId + }; + let queryValues = { + reCaptchaToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "a41192c8-9525-4b58-bc86-179fa549d80d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} publisherName + * @param {string} extensionType + * @param {string} reCaptchaToken + */ + createExtensionWithPublisher(customHeaders, contentStream, publisherName, extensionType, reCaptchaToken) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + let queryValues = { + extensionType, + reCaptchaToken + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("POST", url, contentStream, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} version + */ + deleteExtension(publisherName, extensionName, version2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + version: version2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} version + * @param {GalleryInterfaces.ExtensionQueryFlags} flags + * @param {string} accountToken + * @param {String} accountTokenHeader - Header to pass the account token + */ + getExtension(customHeaders, publisherName, extensionName, version2, flags, accountToken, accountTokenHeader) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + version: version2, + flags, + accountToken + }; + customHeaders = customHeaders || {}; + customHeaders["X-Market-AccountToken"] = "accountTokenHeader"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * REST endpoint to update an extension. + * + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} publisherName - Name of the publisher + * @param {string} extensionName - Name of the extension + * @param {string} extensionType + * @param {string} reCaptchaToken + * @param {boolean} bypassScopeCheck - This parameter decides if the scope change check needs to be invoked or not + */ + updateExtension(customHeaders, contentStream, publisherName, extensionName, extensionType, reCaptchaToken, bypassScopeCheck) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + extensionType, + reCaptchaToken, + bypassScopeCheck + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("PUT", url, contentStream, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {GalleryInterfaces.PublishedExtensionFlags} flags + */ + updateExtensionProperties(publisherName, extensionName, flags) { + return __awaiter2(this, void 0, void 0, function* () { + if (flags == null) { + throw new TypeError("flags can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + flags + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0966", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, null, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} hostType + * @param {string} hostName + */ + shareExtensionWithHost(publisherName, extensionName, hostType, hostName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + hostType, + hostName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "328a3af8-d124-46e9-9483-01690cd415b9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} hostType + * @param {string} hostName + */ + unshareExtensionWithHost(publisherName, extensionName, hostType, hostName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + hostType, + hostName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "328a3af8-d124-46e9-9483-01690cd415b9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Rest end point to validate if an Azure publisher owns an extension for 3rd party commerce scenario. Azure only supports POST operations and the above signature is not typical of the REST operations. http://sharepoint/sites/AzureUX/_layouts/15/WopiFrame2.aspx?sourcedoc={A793D31E-6DC6-4174-8FA3-DE3F82B51642}&file=Data%20Market%20Partner%20integration%20with%20Marketplace%20service.docx&action=default + * + * @param {GalleryInterfaces.AzureRestApiRequestModel} azureRestApiRequestModel - All the parameters are sent in the request body + */ + extensionValidator(azureRestApiRequestModel) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "05e8a5e1-8c59-4c2c-8856-0ff087d1a844", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, azureRestApiRequestModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Send Notification + * + * @param {GalleryInterfaces.NotificationsData} notificationData - Denoting the data needed to send notification + */ + sendNotifications(notificationData) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "eab39817-413c-4602-a49f-07ad00844980", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, notificationData, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * This endpoint gets hit when you download a VSTS extension from the Web UI + * + * @param {string} publisherName + * @param {string} extensionName + * @param {string} version + * @param {string} accountToken + * @param {boolean} acceptDefault + * @param {String} accountTokenHeader - Header to pass the account token + */ + getPackage(customHeaders, publisherName, extensionName, version2, accountToken, acceptDefault, accountTokenHeader) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + version: version2 + }; + let queryValues = { + accountToken, + acceptDefault + }; + customHeaders = customHeaders || {}; + customHeaders["X-Market-AccountToken"] = "accountTokenHeader"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "7cb576f8-1cae-4c4b-b7b1-e4af5759e965", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} version + * @param {string} assetType + * @param {string} assetToken + * @param {string} accountToken + * @param {boolean} acceptDefault + * @param {String} accountTokenHeader - Header to pass the account token + */ + getAssetWithToken(customHeaders, publisherName, extensionName, version2, assetType, assetToken, accountToken, acceptDefault, accountTokenHeader) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + version: version2, + assetType, + assetToken + }; + let queryValues = { + accountToken, + acceptDefault + }; + customHeaders = customHeaders || {}; + customHeaders["X-Market-AccountToken"] = "accountTokenHeader"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "364415a1-0077-4a41-a7a0-06edd4497492", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete publisher asset like logo + * + * @param {string} publisherName - Internal name of the publisher + * @param {string} assetType - Type of asset. Default value is 'logo'. + */ + deletePublisherAsset(publisherName, assetType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + let queryValues = { + assetType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "21143299-34f9-4c62-8ca8-53da691192f9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get publisher asset like logo as a stream + * + * @param {string} publisherName - Internal name of the publisher + * @param {string} assetType - Type of asset. Default value is 'logo'. + */ + getPublisherAsset(publisherName, assetType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + let queryValues = { + assetType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "21143299-34f9-4c62-8ca8-53da691192f9", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update publisher asset like logo. It accepts asset file as an octet stream and file name is passed in header values. + * + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} publisherName - Internal name of the publisher + * @param {string} assetType - Type of asset. Default value is 'logo'. + * @param {String} fileName - Header to pass the filename of the uploaded data + */ + updatePublisherAsset(customHeaders, contentStream, publisherName, assetType, fileName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + let queryValues = { + assetType + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + customHeaders["X-Market-UploadFileName"] = "fileName"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "21143299-34f9-4c62-8ca8-53da691192f9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("PUT", url, contentStream, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + */ + fetchDomainToken(publisherName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "67a609ef-fa74-4b52-8664-78d76f7b3634", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + */ + verifyDomainToken(publisherName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "67a609ef-fa74-4b52-8664-78d76f7b3634", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {GalleryInterfaces.PublisherQuery} publisherQuery + */ + queryPublishers(publisherQuery) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "2ad6ee0a-b53f-4034-9d1d-d009fda1212e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, publisherQuery, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublisherQueryResult, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {GalleryInterfaces.Publisher} publisher + */ + createPublisher(publisher) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4ddec66a-e4f6-4f5d-999e-9e77710d7ff4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, publisher, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Publisher, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + */ + deletePublisher(publisherName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4ddec66a-e4f6-4f5d-999e-9e77710d7ff4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {number} flags + */ + getPublisher(publisherName, flags) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + let queryValues = { + flags + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4ddec66a-e4f6-4f5d-999e-9e77710d7ff4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Publisher, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {GalleryInterfaces.Publisher} publisher + * @param {string} publisherName + */ + updatePublisher(publisher, publisherName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4ddec66a-e4f6-4f5d-999e-9e77710d7ff4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, publisher, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Publisher, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Endpoint to add/modify publisher membership. Currently Supports only addition/modification of 1 user at a time Works only for adding members of same tenant. + * + * @param {GalleryInterfaces.PublisherUserRoleAssignmentRef[]} roleAssignments - List of user identifiers(email address) and role to be added. Currently only one entry is supported. + * @param {string} publisherName - The name/id of publisher to which users have to be added + * @param {boolean} limitToCallerIdentityDomain - Should cross tenant addtions be allowed or not. + */ + updatePublisherMembers(roleAssignments, publisherName, limitToCallerIdentityDomain) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + let queryValues = { + limitToCallerIdentityDomain + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4ddec66a-e4f6-4f5d-999e-9e77710d7ff4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, roleAssignments, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublisherRoleAssignment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} publisherName + * @param {string} extensionName + * @param {string} extensionType + * @param {string} reCaptchaToken + * @param {boolean} bypassScopeCheck + */ + publishExtensionWithPublisherSignature(customHeaders, contentStream, publisherName, extensionName, extensionType, reCaptchaToken, bypassScopeCheck) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + extensionType, + reCaptchaToken, + bypassScopeCheck + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "multipart/related"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "e11ea35a-16fe-4b80-ab11-c4cab88a0969", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("PUT", url, contentStream, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.PublishedExtension, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + */ + getPublisherWithoutToken(publisherName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "215a2ed8-458a-4850-ad5a-45f1dabc3461", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Publisher, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of questions with their responses associated with an extension. + * + * @param {string} publisherName - Name of the publisher who published the extension. + * @param {string} extensionName - Name of the extension. + * @param {number} count - Number of questions to retrieve (defaults to 10). + * @param {number} page - Page number from which set of questions are to be retrieved. + * @param {Date} afterDate - If provided, results questions are returned which were posted after this date + */ + getQuestions(publisherName, extensionName, count, page, afterDate) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + count, + page, + afterDate + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "c010d03d-812c-4ade-ae07-c1862475eda5", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.QuestionsResult, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Flags a concern with an existing question for an extension. + * + * @param {GalleryInterfaces.Concern} concern - User reported concern with a question for the extension. + * @param {string} pubName - Name of the publisher who published the extension. + * @param {string} extName - Name of the extension. + * @param {number} questionId - Identifier of the question to be updated for the extension. + */ + reportQuestion(concern, pubName, extName, questionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + pubName, + extName, + questionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "784910cd-254a-494d-898b-0728549b2f10", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, concern, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Concern, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a new question for an extension. + * + * @param {GalleryInterfaces.Question} question - Question to be created for the extension. + * @param {string} publisherName - Name of the publisher who published the extension. + * @param {string} extensionName - Name of the extension. + */ + createQuestion(question, publisherName, extensionName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "6d1d9741-eca8-4701-a3a5-235afc82dfa4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, question, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Question, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes an existing question and all its associated responses for an extension. (soft delete) + * + * @param {string} publisherName - Name of the publisher who published the extension. + * @param {string} extensionName - Name of the extension. + * @param {number} questionId - Identifier of the question to be deleted for the extension. + */ + deleteQuestion(publisherName, extensionName, questionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + questionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "6d1d9741-eca8-4701-a3a5-235afc82dfa4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates an existing question for an extension. + * + * @param {GalleryInterfaces.Question} question - Updated question to be set for the extension. + * @param {string} publisherName - Name of the publisher who published the extension. + * @param {string} extensionName - Name of the extension. + * @param {number} questionId - Identifier of the question to be updated for the extension. + */ + updateQuestion(question, publisherName, extensionName, questionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + questionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "6d1d9741-eca8-4701-a3a5-235afc82dfa4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, question, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Question, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a new response for a given question for an extension. + * + * @param {GalleryInterfaces.Response} response - Response to be created for the extension. + * @param {string} publisherName - Name of the publisher who published the extension. + * @param {string} extensionName - Name of the extension. + * @param {number} questionId - Identifier of the question for which response is to be created for the extension. + */ + createResponse(response, publisherName, extensionName, questionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + questionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "7f8ae5e0-46b0-438f-b2e8-13e8513517bd", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, response, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Response, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes a response for an extension. (soft delete) + * + * @param {string} publisherName - Name of the publisher who published the extension. + * @param {string} extensionName - Name of the extension. + * @param {number} questionId - Identifies the question whose response is to be deleted. + * @param {number} responseId - Identifies the response to be deleted. + */ + deleteResponse(publisherName, extensionName, questionId, responseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + questionId, + responseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "7f8ae5e0-46b0-438f-b2e8-13e8513517bd", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates an existing response for a given question for an extension. + * + * @param {GalleryInterfaces.Response} response - Updated response to be set for the extension. + * @param {string} publisherName - Name of the publisher who published the extension. + * @param {string} extensionName - Name of the extension. + * @param {number} questionId - Identifier of the question for which response is to be updated for the extension. + * @param {number} responseId - Identifier of the response which has to be updated. + */ + updateResponse(response, publisherName, extensionName, questionId, responseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + questionId, + responseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "7f8ae5e0-46b0-438f-b2e8-13e8513517bd", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, response, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Response, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns extension reports + * + * @param {string} publisherName - Name of the publisher who published the extension + * @param {string} extensionName - Name of the extension + * @param {number} days - Last n days report. If afterDate and days are specified, days will take priority + * @param {number} count - Number of events to be returned + * @param {Date} afterDate - Use if you want to fetch events newer than the specified date + */ + getExtensionReports(publisherName, extensionName, days, count, afterDate) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + days, + count, + afterDate + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "79e0c74f-157f-437e-845f-74fbb4121d4c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of reviews associated with an extension + * + * @param {string} publisherName - Name of the publisher who published the extension + * @param {string} extensionName - Name of the extension + * @param {number} count - Number of reviews to retrieve (defaults to 5) + * @param {GalleryInterfaces.ReviewFilterOptions} filterOptions - FilterOptions to filter out empty reviews etcetera, defaults to none + * @param {Date} beforeDate - Use if you want to fetch reviews older than the specified date, defaults to null + * @param {Date} afterDate - Use if you want to fetch reviews newer than the specified date, defaults to null + */ + getReviews(publisherName, extensionName, count, filterOptions, beforeDate, afterDate) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + count, + filterOptions, + beforeDate, + afterDate + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "5b3f819f-f247-42ad-8c00-dd9ab9ab246d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ReviewsResult, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a summary of the reviews + * + * @param {string} pubName - Name of the publisher who published the extension + * @param {string} extName - Name of the extension + * @param {Date} beforeDate - Use if you want to fetch summary of reviews older than the specified date, defaults to null + * @param {Date} afterDate - Use if you want to fetch summary of reviews newer than the specified date, defaults to null + */ + getReviewsSummary(pubName, extName, beforeDate, afterDate) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + pubName, + extName + }; + let queryValues = { + beforeDate, + afterDate + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "b7b44e21-209e-48f0-ae78-04727fc37d77", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a new review for an extension + * + * @param {GalleryInterfaces.Review} review - Review to be created for the extension + * @param {string} pubName - Name of the publisher who published the extension + * @param {string} extName - Name of the extension + */ + createReview(review, pubName, extName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + pubName, + extName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "e6e85b9d-aa70-40e6-aa28-d0fbf40b91a3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, review, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.Review, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes a review + * + * @param {string} pubName - Name of the publisher who published the extension + * @param {string} extName - Name of the extension + * @param {number} reviewId - Id of the review which needs to be updated + */ + deleteReview(pubName, extName, reviewId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + pubName, + extName, + reviewId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "e6e85b9d-aa70-40e6-aa28-d0fbf40b91a3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates or Flags a review + * + * @param {GalleryInterfaces.ReviewPatch} reviewPatch - ReviewPatch object which contains the changes to be applied to the review + * @param {string} pubName - Name of the publisher who published the extension + * @param {string} extName - Name of the extension + * @param {number} reviewId - Id of the review which needs to be updated + */ + updateReview(reviewPatch, pubName, extName, reviewId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + pubName, + extName, + reviewId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "e6e85b9d-aa70-40e6-aa28-d0fbf40b91a3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, reviewPatch, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ReviewPatch, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {GalleryInterfaces.ExtensionCategory} category + */ + createCategory(category) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "476531a3-7024-4516-a76a-ed64d3008ad6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, category, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all setting entries for the given user/all-users scope + * + * @param {string} userScope - User-Scope at which to get the value. Should be "me" for the current user or "host" for all users. + * @param {string} key - Optional key under which to filter all the entries + */ + getGalleryUserSettings(userScope, key) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + userScope, + key + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "9b75ece3-7960-401c-848b-148ac01ca350", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Set all setting entries for the given user/all-users scope + * + * @param {{ [key: string] : any; }} entries - A key-value pair of all settings that need to be set + * @param {string} userScope - User-Scope at which to get the value. Should be "me" for the current user or "host" for all users. + */ + setGalleryUserSettings(entries, userScope) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + userScope + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "9b75ece3-7960-401c-848b-148ac01ca350", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, entries, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} keyType + * @param {number} expireCurrentSeconds + */ + generateKey(keyType, expireCurrentSeconds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + keyType + }; + let queryValues = { + expireCurrentSeconds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "92ed5cf4-c38b-465a-9059-2f2fb7c624b5", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} keyType + */ + getSigningKey(keyType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + keyType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "92ed5cf4-c38b-465a-9059-2f2fb7c624b5", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {GalleryInterfaces.ExtensionStatisticUpdate} extensionStatisticsUpdate + * @param {string} publisherName + * @param {string} extensionName + */ + updateExtensionStatistics(extensionStatisticsUpdate, publisherName, extensionName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "a0ea3204-11e9-422d-a9ca-45851cc41400", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, extensionStatisticsUpdate, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {number} days + * @param {GalleryInterfaces.ExtensionStatsAggregateType} aggregate + * @param {Date} afterDate + */ + getExtensionDailyStats(publisherName, extensionName, days, aggregate, afterDate) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName + }; + let queryValues = { + days, + aggregate, + afterDate + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "ae06047e-51c5-4fb4-ab65-7be488544416", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDailyStats, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * This route/location id only supports HTTP POST anonymously, so that the page view daily stat can be incremented from Marketplace client. Trying to call GET on this route should result in an exception. Without this explicit implementation, calling GET on this public route invokes the above GET implementation GetExtensionDailyStats. + * + * @param {string} publisherName - Name of the publisher + * @param {string} extensionName - Name of the extension + * @param {string} version - Version of the extension + */ + getExtensionDailyStatsAnonymous(publisherName, extensionName, version2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + version: version2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4fa7adb6-ca65-4075-a232-5f28323288ea", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GalleryInterfaces.TypeInfo.ExtensionDailyStats, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Increments a daily statistic associated with the extension + * + * @param {string} publisherName - Name of the publisher + * @param {string} extensionName - Name of the extension + * @param {string} version - Version of the extension + * @param {string} statType - Type of stat to increment + * @param {string} targetPlatform + */ + incrementExtensionDailyStat(publisherName, extensionName, version2, statType, targetPlatform) { + return __awaiter2(this, void 0, void 0, function* () { + if (statType == null) { + throw new TypeError("statType can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + version: version2 + }; + let queryValues = { + statType, + targetPlatform + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "4fa7adb6-ca65-4075-a232-5f28323288ea", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} publisherName + * @param {string} extensionName + * @param {string} version + * @param {string} targetPlatform + */ + getVerificationLog(publisherName, extensionName, version2, targetPlatform) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + publisherName, + extensionName, + version: version2 + }; + let queryValues = { + targetPlatform + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "c5523abe-b843-437f-875b-5833064efe4d", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} itemName + * @param {string} version + * @param {GalleryInterfaces.VSCodeWebExtensionStatisicsType} statType + */ + updateVSCodeWebExtensionStatistics(itemName, version2, statType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + itemName, + version: version2, + statType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "gallery", "205c91a8-7841-4fd3-ae4f-5a745d5a8df5", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.GalleryApi = GalleryApi; + GalleryApi.RESOURCE_AREA_ID = "69d21c00-f135-441b-b5ce-3626378e0819"; + } +}); + +// ../node_modules/azure-devops-node-api/GitApi.js +var require_GitApi = __commonJS({ + "../node_modules/azure-devops-node-api/GitApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.GitApi = void 0; + var basem = require_ClientApiBases(); + var GitInterfaces = require_GitInterfaces(); + var GitApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Git-api", options); + } + /** + * DELETE Deletes Enablement status and BillableCommitters data from DB. Deleting the enablement data will effectively disable it for the repositories affected. + * + * @param {boolean} allProjects + * @param {boolean} includeBillableCommitters + * @param {string[]} projectIds + */ + deleteEnablementStatus(allProjects, includeBillableCommitters, projectIds) { + return __awaiter2(this, void 0, void 0, function* () { + if (allProjects == null) { + throw new TypeError("allProjects can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + "$allProjects": allProjects, + "$includeBillableCommitters": includeBillableCommitters, + projectIds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * GET Enablement status for project's repositories. + * + * @param {string[]} projectIds - Null defaults to all projects in the host, list of project's repos status to return + * @param {Date} billingDate - UTC expected, Null defaults to UtcNow(), can be provided for a point in time status + * @param {number} skip - Skip X rows of resultset to simulate paging. + * @param {number} take - Return Y rows of resultset to simulate paging. + */ + getEnablementStatus(projectIds, billingDate, skip, take) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + projectIds, + "$billingDate": billingDate, + "$skip": skip, + "$take": take + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.AdvSecEnablementStatus, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {boolean} enableOnCreateHost + */ + getEnableOnCreateHost(enableOnCreateHost) { + return __awaiter2(this, void 0, void 0, function* () { + if (enableOnCreateHost == null) { + throw new TypeError("enableOnCreateHost can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + "$enableOnCreateHost": enableOnCreateHost + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} enableOnCreateProjectId + */ + getEnableOnCreateProject(enableOnCreateProjectId) { + return __awaiter2(this, void 0, void 0, function* () { + if (enableOnCreateProjectId == null) { + throw new TypeError("enableOnCreateProjectId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + "$enableOnCreateProjectId": enableOnCreateProjectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {boolean} enableOnCreateHost + */ + setEnableOnCreateHost(enableOnCreateHost) { + return __awaiter2(this, void 0, void 0, function* () { + if (enableOnCreateHost == null) { + throw new TypeError("enableOnCreateHost can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + "$enableOnCreateHost": enableOnCreateHost + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} enableOnCreateProjectId + * @param {boolean} enableOnStatus + */ + setEnableOnCreateProject(enableOnCreateProjectId, enableOnStatus) { + return __awaiter2(this, void 0, void 0, function* () { + if (enableOnCreateProjectId == null) { + throw new TypeError("enableOnCreateProjectId can not be null or undefined"); + } + if (enableOnStatus == null) { + throw new TypeError("enableOnStatus can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + "$enableOnCreateProjectId": enableOnCreateProjectId, + "$enableOnStatus": enableOnStatus + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * POST Enablement status for repositories. + * + * @param {GitInterfaces.AdvSecEnablementUpdate[]} enablementUpdates + */ + updateEnablementStatus(enablementUpdates) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b43dd56f-a1b4-47a5-a857-73fc1b6c700c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, enablementUpdates, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get estimated billable pushers for an Organization for last 90 days. + * + */ + getEstimatedBillablePushersOrg() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "2277ffbe-28d4-40d6-9c26-40baf26d1408", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get estimated billable pushers for a project for last 90 days. + * + * @param {string} project - Project ID or project name + */ + getEstimatedBillablePushersProject(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1df7833e-1eed-447b-81a3-390c74923900", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get estimated billable committers for a repository for the last 90 days. + * + * @param {string} project - Project ID or project name + * @param {string} repositoryId + */ + getEstimatedBillableCommittersRepo(project, repositoryId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5dcec07b-a844-4efb-9fc1-968fd1f149db", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * GET Advanced Security Permission status. + * + * @param {string} projectName + * @param {string} repositoryId - Repository user is trying to access + * @param {string} permission - Permission being requestd, must be "viewAlert" "dismissAlert" "manage" "viewEnablement" or "repoRead" + */ + getPermission(projectName, repositoryId, permission) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + "$projectName": projectName, + "$repositoryId": repositoryId, + "$permission": permission + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "61b21a05-a60f-4910-a733-ba5347c2142d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create an annotated tag. + * + * @param {GitInterfaces.GitAnnotatedTag} tagObject - Object containing details of tag to be created. + * @param {string} project - Project ID or project name + * @param {string} repositoryId - ID or name of the repository. + */ + createAnnotatedTag(tagObject, project, repositoryId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5e8a8081-3851-4626-b677-9891cc04102e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, tagObject, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitAnnotatedTag, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get an annotated tag. + * + * @param {string} project - Project ID or project name + * @param {string} repositoryId - ID or name of the repository. + * @param {string} objectId - ObjectId (Sha1Id) of tag to get. + */ + getAnnotatedTag(project, repositoryId, objectId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + objectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5e8a8081-3851-4626-b677-9891cc04102e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitAnnotatedTag, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve actual billable committers for Advanced Security service for a given date. + * + * @param {string} project - Project ID or project name + * @param {Date} billingDate - UTC expected. If not specified defaults to the previous billing day. + * @param {number} skip - Skip X rows of resultset to simulate paging. + * @param {number} take - Return Y rows of resultset to simulate paging. + */ + getBillableCommitters(project, billingDate, skip, take) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + "$billingDate": billingDate, + "$skip": skip, + "$take": take + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5c5e3ebc-37b0-4547-a957-945912d44922", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve detailed actual billable committers for Advanced Security service for a given date. Detailed results intentionally does not filter out soft deleted projects and repositories to help diagnose billing issues. + * + * @param {string} project - Project ID or project name + * @param {string} includeDetails - Return all the details on the billable committers. + * @param {Date} billingDate - UTC expected. If not specified defaults to the previous billing day. + */ + getBillableCommittersDetail(project, includeDetails, billingDate) { + return __awaiter2(this, void 0, void 0, function* () { + if (includeDetails == null) { + throw new TypeError("includeDetails can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + "$includeDetails": includeDetails, + "$billingDate": billingDate + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5c5e3ebc-37b0-4547-a957-945912d44922", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.BillableCommitterDetail, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a single blob. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} sha1 - SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint. + * @param {string} project - Project ID or project name + * @param {boolean} download - If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip + * @param {string} fileName - Provide a fileName to use for a download. + * @param {boolean} resolveLfs - If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types + */ + getBlob(repositoryId, sha1, project, download, fileName, resolveLfs) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + sha1 + }; + let queryValues = { + download, + fileName, + resolveLfs + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7b28e929-2c99-405d-9c5c-6167a06e6816", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a single blob. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} sha1 - SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint. + * @param {string} project - Project ID or project name + * @param {boolean} download - If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip + * @param {string} fileName - Provide a fileName to use for a download. + * @param {boolean} resolveLfs - If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types + */ + getBlobContent(repositoryId, sha1, project, download, fileName, resolveLfs) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + sha1 + }; + let queryValues = { + download, + fileName, + resolveLfs + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7b28e929-2c99-405d-9c5c-6167a06e6816", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets one or more blobs in a zip file download. + * + * @param {string[]} blobIds - Blob IDs (SHA1 hashes) to be returned in the zip file. + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} project - Project ID or project name + * @param {string} filename + */ + getBlobsZip(blobIds, repositoryId, project, filename) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + filename + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7b28e929-2c99-405d-9c5c-6167a06e6816", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a single blob. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} sha1 - SHA1 hash of the file. You can get the SHA1 of a file using the "Git/Items/Get Item" endpoint. + * @param {string} project - Project ID or project name + * @param {boolean} download - If true, prompt for a download rather than rendering in a browser. Note: this value defaults to true if $format is zip + * @param {string} fileName - Provide a fileName to use for a download. + * @param {boolean} resolveLfs - If true, try to resolve a blob to its LFS contents, if it's an LFS pointer file. Only compatible with octet-stream Accept headers or $format types + */ + getBlobZip(repositoryId, sha1, project, download, fileName, resolveLfs) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + sha1 + }; + let queryValues = { + download, + fileName, + resolveLfs + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7b28e929-2c99-405d-9c5c-6167a06e6816", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve statistics about a single branch. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} name - Name of the branch. + * @param {string} project - Project ID or project name + * @param {GitInterfaces.GitVersionDescriptor} baseVersionDescriptor - Identifies the commit or branch to use as the base. + */ + getBranch(repositoryId, name, project, baseVersionDescriptor) { + return __awaiter2(this, void 0, void 0, function* () { + if (name == null) { + throw new TypeError("name can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + name, + baseVersionDescriptor + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d5b216de-d8d5-4d32-ae76-51df755b16d3", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitBranchStats, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve statistics about all branches within a repository. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} project - Project ID or project name + * @param {GitInterfaces.GitVersionDescriptor} baseVersionDescriptor - Identifies the commit or branch to use as the base. + */ + getBranches(repositoryId, project, baseVersionDescriptor) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + baseVersionDescriptor + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d5b216de-d8d5-4d32-ae76-51df755b16d3", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitBranchStats, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve statistics for multiple commits + * + * @param {GitInterfaces.GitQueryBranchStatsCriteria} searchCriteria - Base Commit and List of Target Commits to compare. + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} project - Project ID or project name + */ + getBranchStatsBatch(searchCriteria, repositoryId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d5b216de-d8d5-4d32-ae76-51df755b16d3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, searchCriteria, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitBranchStats, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve changes for a particular commit. + * + * @param {string} commitId - The id of the commit. + * @param {string} repositoryId - The id or friendly name of the repository. To use the friendly name, projectId must also be specified. + * @param {string} project - Project ID or project name + * @param {number} top - The maximum number of changes to return. + * @param {number} skip - The number of changes to skip. + */ + getChanges(commitId, repositoryId, project, top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + commitId, + repositoryId + }; + let queryValues = { + top, + skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5bf884f5-3e07-42e9-afb8-1b872267bf16", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitChanges, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve one conflict for a cherry pick by ID + * + * @param {string} repositoryId + * @param {number} cherryPickId + * @param {number} conflictId + * @param {string} project - Project ID or project name + */ + getCherryPickConflict(repositoryId, cherryPickId, conflictId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + cherryPickId, + conflictId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1fe5aab2-d4c0-4b2f-a030-f3831e7aca26", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve all conflicts for a cherry pick + * + * @param {string} repositoryId + * @param {number} cherryPickId + * @param {string} project - Project ID or project name + * @param {string} continuationToken + * @param {number} top + * @param {boolean} excludeResolved + * @param {boolean} onlyResolved + * @param {boolean} includeObsolete + */ + getCherryPickConflicts(repositoryId, cherryPickId, project, continuationToken, top, excludeResolved, onlyResolved, includeObsolete) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + cherryPickId + }; + let queryValues = { + continuationToken, + "$top": top, + excludeResolved, + onlyResolved, + includeObsolete + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1fe5aab2-d4c0-4b2f-a030-f3831e7aca26", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update merge conflict resolution + * + * @param {GitInterfaces.GitConflict} conflict + * @param {string} repositoryId + * @param {number} cherryPickId + * @param {number} conflictId + * @param {string} project - Project ID or project name + */ + updateCherryPickConflict(conflict, repositoryId, cherryPickId, conflictId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + cherryPickId, + conflictId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1fe5aab2-d4c0-4b2f-a030-f3831e7aca26", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, conflict, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update multiple merge conflict resolutions + * + * @param {GitInterfaces.GitConflict[]} conflictUpdates + * @param {string} repositoryId + * @param {number} cherryPickId + * @param {string} project - Project ID or project name + */ + updateCherryPickConflicts(conflictUpdates, repositoryId, cherryPickId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + cherryPickId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1fe5aab2-d4c0-4b2f-a030-f3831e7aca26", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, conflictUpdates, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflictUpdateResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Given a commitId, returns a list of commits that are in the same cherry-pick family. + * + * @param {string} repositoryNameOrId + * @param {string} commitId + * @param {string} project - Project ID or project name + * @param {boolean} includeLinks + */ + getCherryPickRelationships(repositoryNameOrId, commitId, project, includeLinks) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryNameOrId, + commitId + }; + let queryValues = { + includeLinks + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "8af142a4-27c2-4168-9e82-46b8629aaa0d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Cherry pick a specific commit or commits that are associated to a pull request into a new branch. + * + * @param {GitInterfaces.GitAsyncRefOperationParameters} cherryPickToCreate + * @param {string} project - Project ID or project name + * @param {string} repositoryId - ID of the repository. + */ + createCherryPick(cherryPickToCreate, project, repositoryId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "033bad68-9a14-43d1-90e0-59cb8856fef6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, cherryPickToCreate, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCherryPick, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve information about a cherry pick operation by cherry pick Id. + * + * @param {string} project - Project ID or project name + * @param {number} cherryPickId - ID of the cherry pick. + * @param {string} repositoryId - ID of the repository. + */ + getCherryPick(project, cherryPickId, repositoryId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + cherryPickId, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "033bad68-9a14-43d1-90e0-59cb8856fef6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCherryPick, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve information about a cherry pick operation for a specific branch. This operation is expensive due to the underlying object structure, so this API only looks at the 1000 most recent cherry pick operations. + * + * @param {string} project - Project ID or project name + * @param {string} repositoryId - ID of the repository. + * @param {string} refName - The GitAsyncRefOperationParameters generatedRefName used for the cherry pick operation. + */ + getCherryPickForRefName(project, repositoryId, refName) { + return __awaiter2(this, void 0, void 0, function* () { + if (refName == null) { + throw new TypeError("refName can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + refName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "033bad68-9a14-43d1-90e0-59cb8856fef6", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCherryPick, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Find the closest common commit (the merge base) between base and target commits, and get the diff between either the base and target commits or common and target commits. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} project - Project ID or project name + * @param {boolean} diffCommonCommit - If true, diff between common and target commits. If false, diff between base and target commits. + * @param {number} top - Maximum number of changes to return. Defaults to 100. + * @param {number} skip - Number of changes to skip + * @param {GitInterfaces.GitBaseVersionDescriptor} baseVersionDescriptor - Descriptor for base commit. + * @param {GitInterfaces.GitTargetVersionDescriptor} targetVersionDescriptor - Descriptor for target commit. + */ + getCommitDiffs(repositoryId, project, diffCommonCommit, top, skip, baseVersionDescriptor, targetVersionDescriptor) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + diffCommonCommit, + "$top": top, + "$skip": skip + }; + if (baseVersionDescriptor) { + queryValues.baseVersionType = baseVersionDescriptor.versionType; + queryValues.baseVersion = baseVersionDescriptor.version; + queryValues.baseVersionOptions = baseVersionDescriptor.versionOptions; + } + if (targetVersionDescriptor) { + queryValues.targetVersionType = targetVersionDescriptor.versionType; + queryValues.targetVersion = targetVersionDescriptor.version; + queryValues.targetVersionOptions = targetVersionDescriptor.versionOptions; + } + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "615588d5-c0c7-4b88-88f8-e625306446e8", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitDiffs, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a particular commit. + * + * @param {string} commitId - The id of the commit. + * @param {string} repositoryId - The id or friendly name of the repository. To use the friendly name, projectId must also be specified. + * @param {string} project - Project ID or project name + * @param {number} changeCount - The number of changes to include in the result. + */ + getCommit(commitId, repositoryId, project, changeCount) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + commitId, + repositoryId + }; + let queryValues = { + changeCount + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "c2570c3b-5b3f-41b8-98bf-5407bfde8d58", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommit, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve git commits for a project + * + * @param {string} repositoryId - The id or friendly name of the repository. To use the friendly name, projectId must also be specified. + * @param {GitInterfaces.GitQueryCommitsCriteria} searchCriteria + * @param {string} project - Project ID or project name + * @param {number} skip + * @param {number} top + */ + getCommits(repositoryId, searchCriteria, project, skip, top) { + return __awaiter2(this, void 0, void 0, function* () { + if (searchCriteria == null) { + throw new TypeError("searchCriteria can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + searchCriteria, + "$skip": skip, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "c2570c3b-5b3f-41b8-98bf-5407bfde8d58", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a list of commits associated with a particular push. + * + * @param {string} repositoryId - The id or friendly name of the repository. To use the friendly name, projectId must also be specified. + * @param {number} pushId - The id of the push. + * @param {string} project - Project ID or project name + * @param {number} top - The maximum number of commits to return ("get the top x commits"). + * @param {number} skip - The number of commits to skip. + * @param {boolean} includeLinks - Set to false to avoid including REST Url links for resources. Defaults to true. + */ + getPushCommits(repositoryId, pushId, project, top, skip, includeLinks) { + return __awaiter2(this, void 0, void 0, function* () { + if (pushId == null) { + throw new TypeError("pushId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + pushId, + top, + skip, + includeLinks + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "c2570c3b-5b3f-41b8-98bf-5407bfde8d58", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve git commits for a project matching the search criteria + * + * @param {GitInterfaces.GitQueryCommitsCriteria} searchCriteria - Search options + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} project - Project ID or project name + * @param {number} skip - Number of commits to skip. The value cannot exceed 3,000,000. + * @param {number} top - Maximum number of commits to return. The value cannot exceed 50,000. + * @param {boolean} includeStatuses - True to include additional commit status information. + */ + getCommitsBatch(searchCriteria, repositoryId, project, skip, top, includeStatuses) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + "$skip": skip, + "$top": top, + includeStatuses + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "6400dfb2-0bcb-462b-b992-5a57f8f1416c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, searchCriteria, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve deleted git repositories. + * + * @param {string} project - Project ID or project name + */ + getDeletedRepositories(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "2b6869c4-cb25-42b5-b7a3-0d3e6be0a11a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitDeletedRepository, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the file diffs for each of the specified files + * + * @param {GitInterfaces.FileDiffsCriteria} fileDiffsCriteria - List of file parameters objects + * @param {string} project - Project ID or project name + * @param {string} repositoryId - The name or ID of the repository + */ + getFileDiffs(fileDiffsCriteria, project, repositoryId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "c4c5a7e6-e9f3-4730-a92b-84baacff694b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, fileDiffsCriteria, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.FileDiff, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve all forks of a repository in the collection. + * + * @param {string} repositoryNameOrId - The name or ID of the repository. + * @param {string} collectionId - Team project collection ID. + * @param {string} project - Project ID or project name + * @param {boolean} includeLinks - True to include links. + */ + getForks(repositoryNameOrId, collectionId, project, includeLinks) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryNameOrId, + collectionId + }; + let queryValues = { + includeLinks + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "158c0340-bf6f-489c-9625-d572a1480d57", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepositoryRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Request that another repository's refs be fetched into this one. It syncs two existing forks. To create a fork, please see the repositories endpoint + * + * @param {GitInterfaces.GitForkSyncRequestParameters} syncParams - Source repository and ref mapping. + * @param {string} repositoryNameOrId - The name or ID of the repository. + * @param {string} project - Project ID or project name + * @param {boolean} includeLinks - True to include links + */ + createForkSyncRequest(syncParams, repositoryNameOrId, project, includeLinks) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryNameOrId + }; + let queryValues = { + includeLinks + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1703f858-b9d1-46af-ab62-483e9e1055b5", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, syncParams, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitForkSyncRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a specific fork sync operation's details. + * + * @param {string} repositoryNameOrId - The name or ID of the repository. + * @param {number} forkSyncOperationId - OperationId of the sync request. + * @param {string} project - Project ID or project name + * @param {boolean} includeLinks - True to include links. + */ + getForkSyncRequest(repositoryNameOrId, forkSyncOperationId, project, includeLinks) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryNameOrId, + forkSyncOperationId + }; + let queryValues = { + includeLinks + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1703f858-b9d1-46af-ab62-483e9e1055b5", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitForkSyncRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve all requested fork sync operations on this repository. + * + * @param {string} repositoryNameOrId - The name or ID of the repository. + * @param {string} project - Project ID or project name + * @param {boolean} includeAbandoned - True to include abandoned requests. + * @param {boolean} includeLinks - True to include links. + */ + getForkSyncRequests(repositoryNameOrId, project, includeAbandoned, includeLinks) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryNameOrId + }; + let queryValues = { + includeAbandoned, + includeLinks + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "1703f858-b9d1-46af-ab62-483e9e1055b5", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitForkSyncRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create an import request. + * + * @param {GitInterfaces.GitImportRequest} importRequest - The import request to create. + * @param {string} project - Project ID or project name + * @param {string} repositoryId - The name or ID of the repository. + */ + createImportRequest(importRequest, project, repositoryId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "01828ddc-3600-4a41-8633-99b3a73a0eb3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, importRequest, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitImportRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a particular import request. + * + * @param {string} project - Project ID or project name + * @param {string} repositoryId - The name or ID of the repository. + * @param {number} importRequestId - The unique identifier for the import request. + */ + getImportRequest(project, repositoryId, importRequestId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + importRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "01828ddc-3600-4a41-8633-99b3a73a0eb3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitImportRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve import requests for a repository. + * + * @param {string} project - Project ID or project name + * @param {string} repositoryId - The name or ID of the repository. + * @param {boolean} includeAbandoned - True to include abandoned import requests in the results. + */ + queryImportRequests(project, repositoryId, includeAbandoned) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + includeAbandoned + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "01828ddc-3600-4a41-8633-99b3a73a0eb3", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitImportRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retry or abandon a failed import request. + * + * @param {GitInterfaces.GitImportRequest} importRequestToUpdate - The updated version of the import request. Currently, the only change allowed is setting the Status to Queued or Abandoned. + * @param {string} project - Project ID or project name + * @param {string} repositoryId - The name or ID of the repository. + * @param {number} importRequestId - The unique identifier for the import request to update. + */ + updateImportRequest(importRequestToUpdate, project, repositoryId, importRequestId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + importRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "01828ddc-3600-4a41-8633-99b3a73a0eb3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, importRequestToUpdate, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitImportRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} path - The item path. + * @param {string} project - Project ID or project name + * @param {string} scopePath - The path scope. The default is null. + * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion. + * @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false. + * @param {boolean} latestProcessedChange - Set to true to include the latest changes. Default is false. + * @param {boolean} download - Set to true to download the response as a file. Default is false. + * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is the default branch for the repository. + * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false. + * @param {boolean} resolveLfs - Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false. + * @param {boolean} sanitize - Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false. + */ + getItem(repositoryId, path2, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, versionDescriptor, includeContent, resolveLfs, sanitize) { + return __awaiter2(this, void 0, void 0, function* () { + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + path: path2, + scopePath, + recursionLevel, + includeContentMetadata, + latestProcessedChange, + download, + versionDescriptor, + includeContent, + resolveLfs, + sanitize + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "fb93c0db-47ed-4a31-8c20-47552878fb44", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitItem, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} path - The item path. + * @param {string} project - Project ID or project name + * @param {string} scopePath - The path scope. The default is null. + * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion. + * @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false. + * @param {boolean} latestProcessedChange - Set to true to include the latest changes. Default is false. + * @param {boolean} download - Set to true to download the response as a file. Default is false. + * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is the default branch for the repository. + * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false. + * @param {boolean} resolveLfs - Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false. + * @param {boolean} sanitize - Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false. + */ + getItemContent(repositoryId, path2, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, versionDescriptor, includeContent, resolveLfs, sanitize) { + return __awaiter2(this, void 0, void 0, function* () { + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + path: path2, + scopePath, + recursionLevel, + includeContentMetadata, + latestProcessedChange, + download, + versionDescriptor, + includeContent, + resolveLfs, + sanitize + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "fb93c0db-47ed-4a31-8c20-47552878fb44", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get Item Metadata and/or Content for a collection of items. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} project - Project ID or project name + * @param {string} scopePath - The path scope. The default is null. + * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion. + * @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false. + * @param {boolean} latestProcessedChange - Set to true to include the latest changes. Default is false. + * @param {boolean} download - Set to true to download the response as a file. Default is false. + * @param {boolean} includeLinks - Set to true to include links to items. Default is false. + * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is the default branch for the repository. + * @param {boolean} zipForUnix - Set to true to keep the file permissions for unix (and POSIX) systems like executables and symlinks + */ + getItems(repositoryId, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, includeLinks, versionDescriptor, zipForUnix) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + scopePath, + recursionLevel, + includeContentMetadata, + latestProcessedChange, + download, + includeLinks, + versionDescriptor, + zipForUnix + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "fb93c0db-47ed-4a31-8c20-47552878fb44", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitItem, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} path - The item path. + * @param {string} project - Project ID or project name + * @param {string} scopePath - The path scope. The default is null. + * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion. + * @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false. + * @param {boolean} latestProcessedChange - Set to true to include the latest changes. Default is false. + * @param {boolean} download - Set to true to download the response as a file. Default is false. + * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is the default branch for the repository. + * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false. + * @param {boolean} resolveLfs - Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false. + * @param {boolean} sanitize - Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false. + */ + getItemText(repositoryId, path2, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, versionDescriptor, includeContent, resolveLfs, sanitize) { + return __awaiter2(this, void 0, void 0, function* () { + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + path: path2, + scopePath, + recursionLevel, + includeContentMetadata, + latestProcessedChange, + download, + versionDescriptor, + includeContent, + resolveLfs, + sanitize + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "fb93c0db-47ed-4a31-8c20-47552878fb44", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content, which is always returned as a download. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} path - The item path. + * @param {string} project - Project ID or project name + * @param {string} scopePath - The path scope. The default is null. + * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - The recursion level of this request. The default is 'none', no recursion. + * @param {boolean} includeContentMetadata - Set to true to include content metadata. Default is false. + * @param {boolean} latestProcessedChange - Set to true to include the latest changes. Default is false. + * @param {boolean} download - Set to true to download the response as a file. Default is false. + * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - Version descriptor. Default is the default branch for the repository. + * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false. + * @param {boolean} resolveLfs - Set to true to resolve Git LFS pointer files to return actual content from Git LFS. Default is false. + * @param {boolean} sanitize - Set to true to sanitize an svg file and return it as image. Useful only if requested for svg file. Default is false. + */ + getItemZip(repositoryId, path2, project, scopePath, recursionLevel, includeContentMetadata, latestProcessedChange, download, versionDescriptor, includeContent, resolveLfs, sanitize) { + return __awaiter2(this, void 0, void 0, function* () { + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + path: path2, + scopePath, + recursionLevel, + includeContentMetadata, + latestProcessedChange, + download, + versionDescriptor, + includeContent, + resolveLfs, + sanitize + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "fb93c0db-47ed-4a31-8c20-47552878fb44", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Post for retrieving a creating a batch out of a set of items in a repo / project given a list of paths or a long path + * + * @param {GitInterfaces.GitItemRequestData} requestData - Request data attributes: ItemDescriptors, IncludeContentMetadata, LatestProcessedChange, IncludeLinks. ItemDescriptors: Collection of items to fetch, including path, version, and recursion level. IncludeContentMetadata: Whether to include metadata for all items LatestProcessedChange: Whether to include shallow ref to commit that last changed each item. IncludeLinks: Whether to include the _links field on the shallow references. + * @param {string} repositoryId - The name or ID of the repository + * @param {string} project - Project ID or project name + */ + getItemsBatch(requestData, repositoryId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "630fd2e4-fb88-4f85-ad21-13f3fd1fbca9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, requestData, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitItem, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Find the merge bases of two commits, optionally across forks. If otherRepositoryId is not specified, the merge bases will only be calculated within the context of the local repositoryNameOrId. + * + * @param {string} repositoryNameOrId - ID or name of the local repository. + * @param {string} commitId - First commit, usually the tip of the target branch of the potential merge. + * @param {string} otherCommitId - Other commit, usually the tip of the source branch of the potential merge. + * @param {string} project - Project ID or project name + * @param {string} otherCollectionId - The collection ID where otherCommitId lives. + * @param {string} otherRepositoryId - The repository ID where otherCommitId lives. + */ + getMergeBases(repositoryNameOrId, commitId, otherCommitId, project, otherCollectionId, otherRepositoryId) { + return __awaiter2(this, void 0, void 0, function* () { + if (otherCommitId == null) { + throw new TypeError("otherCommitId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryNameOrId, + commitId + }; + let queryValues = { + otherCommitId, + otherCollectionId, + otherRepositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "7cf2abb6-c964-4f7e-9872-f78c66e72e9c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Request a git merge operation. Currently we support merging only 2 commits. + * + * @param {GitInterfaces.GitMergeParameters} mergeParameters - Parents commitIds and merge commit messsage. + * @param {string} project - Project ID or project name + * @param {string} repositoryNameOrId - The name or ID of the repository. + * @param {boolean} includeLinks - True to include links + */ + createMergeRequest(mergeParameters, project, repositoryNameOrId, includeLinks) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryNameOrId + }; + let queryValues = { + includeLinks + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "985f7ae9-844f-4906-9897-7ef41516c0e2", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, mergeParameters, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitMerge, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a specific merge operation's details. + * + * @param {string} project - Project ID or project name + * @param {string} repositoryNameOrId - The name or ID of the repository. + * @param {number} mergeOperationId - OperationId of the merge request. + * @param {boolean} includeLinks - True to include links + */ + getMergeRequest(project, repositoryNameOrId, mergeOperationId, includeLinks) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryNameOrId, + mergeOperationId + }; + let queryValues = { + includeLinks + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "985f7ae9-844f-4906-9897-7ef41516c0e2", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitMerge, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Attach a new file to a pull request. + * + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} fileName - The name of the file. + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + createAttachment(customHeaders, contentStream, fileName, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + fileName, + repositoryId, + pullRequestId + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965d9361-878b-413b-a494-45d5b5fd8ab7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("POST", url, contentStream, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.Attachment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a pull request attachment. + * + * @param {string} fileName - The name of the attachment to delete. + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + deleteAttachment(fileName, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + fileName, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965d9361-878b-413b-a494-45d5b5fd8ab7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the file content of a pull request attachment. + * + * @param {string} fileName - The name of the attachment. + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + getAttachmentContent(fileName, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + fileName, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965d9361-878b-413b-a494-45d5b5fd8ab7", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of files attached to a given pull request. + * + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + getAttachments(repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965d9361-878b-413b-a494-45d5b5fd8ab7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.Attachment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the file content of a pull request attachment. + * + * @param {string} fileName - The name of the attachment. + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + getAttachmentZip(fileName, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + fileName, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965d9361-878b-413b-a494-45d5b5fd8ab7", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add a like on a comment. + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} threadId - The ID of the thread that contains the comment. + * @param {number} commentId - The ID of the comment. + * @param {string} project - Project ID or project name + */ + createLike(repositoryId, pullRequestId, threadId, commentId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + threadId, + commentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5f2e2851-1389-425b-a00b-fb2adb3ef31b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a like on a comment. + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} threadId - The ID of the thread that contains the comment. + * @param {number} commentId - The ID of the comment. + * @param {string} project - Project ID or project name + */ + deleteLike(repositoryId, pullRequestId, threadId, commentId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + threadId, + commentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5f2e2851-1389-425b-a00b-fb2adb3ef31b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get likes for a comment. + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} threadId - The ID of the thread that contains the comment. + * @param {number} commentId - The ID of the comment. + * @param {string} project - Project ID or project name + */ + getLikes(repositoryId, pullRequestId, threadId, commentId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + threadId, + commentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "5f2e2851-1389-425b-a00b-fb2adb3ef31b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the commits for the specified iteration of a pull request. + * + * @param {string} repositoryId - ID or name of the repository. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} iterationId - ID of the iteration from which to get the commits. + * @param {string} project - Project ID or project name + * @param {number} top - Maximum number of commits to return. The maximum number of commits that can be returned per batch is 500. + * @param {number} skip - Number of commits to skip. + */ + getPullRequestIterationCommits(repositoryId, pullRequestId, iterationId, project, top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + iterationId + }; + let queryValues = { + top, + skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "e7ea0883-095f-4926-b5fb-f24691c26fb9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the commits for the specified pull request. + * + * @param {string} repositoryId - ID or name of the repository. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + getPullRequestCommits(repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "52823034-34a8-4576-922c-8d8b77e9e4c4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitCommitRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve one conflict for a pull request by ID + * + * @param {string} repositoryId + * @param {number} pullRequestId + * @param {number} conflictId + * @param {string} project - Project ID or project name + */ + getPullRequestConflict(repositoryId, pullRequestId, conflictId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + conflictId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "d840fb74-bbef-42d3-b250-564604c054a4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve all conflicts for a pull request + * + * @param {string} repositoryId - The repository of the Pull Request. + * @param {number} pullRequestId - The pull request ID. + * @param {string} project - Project ID or project name + * @param {number} skip - Conflicts to skip. + * @param {number} top - Conflicts to return after skip. + * @param {boolean} includeObsolete - Includes obsolete conflicts. + * @param {boolean} excludeResolved - Excludes conflicts already resolved. + * @param {boolean} onlyResolved - Returns only the conflicts that are resolved. + */ + getPullRequestConflicts(repositoryId, pullRequestId, project, skip, top, includeObsolete, excludeResolved, onlyResolved) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + let queryValues = { + "$skip": skip, + "$top": top, + includeObsolete, + excludeResolved, + onlyResolved + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "d840fb74-bbef-42d3-b250-564604c054a4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update merge conflict resolution + * + * @param {GitInterfaces.GitConflict} conflict + * @param {string} repositoryId + * @param {number} pullRequestId + * @param {number} conflictId + * @param {string} project - Project ID or project name + */ + updatePullRequestConflict(conflict, repositoryId, pullRequestId, conflictId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + conflictId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "d840fb74-bbef-42d3-b250-564604c054a4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, conflict, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update multiple merge conflict resolutions + * + * @param {GitInterfaces.GitConflict[]} conflictUpdates + * @param {string} repositoryId + * @param {number} pullRequestId + * @param {string} project - Project ID or project name + */ + updatePullRequestConflicts(conflictUpdates, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "d840fb74-bbef-42d3-b250-564604c054a4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, conflictUpdates, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflictUpdateResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve the changes made in a pull request between two iterations. + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} iterationId - ID of the pull request iteration.
Iteration one is the head of the source branch at the time the pull request is created and subsequent iterations are created when there are pushes to the source branch. Allowed values are between 1 and the maximum iteration on this pull request. + * @param {string} project - Project ID or project name + * @param {number} top - Optional. The number of changes to retrieve. The default value is 100 and the maximum value is 2000. + * @param {number} skip - Optional. The number of changes to ignore. For example, to retrieve changes 101-150, set top 50 and skip to 100. + * @param {number} compareTo - ID of the pull request iteration to compare against. The default value is zero which indicates the comparison is made against the common commit between the source and target branches + */ + getPullRequestIterationChanges(repositoryId, pullRequestId, iterationId, project, top, skip, compareTo) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + iterationId + }; + let queryValues = { + "$top": top, + "$skip": skip, + "$compareTo": compareTo + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4216bdcf-b6b1-4d59-8b82-c34cc183fc8b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestIterationChanges, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the specified iteration for a pull request. + * + * @param {string} repositoryId - ID or name of the repository. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} iterationId - ID of the pull request iteration to return. + * @param {string} project - Project ID or project name + */ + getPullRequestIteration(repositoryId, pullRequestId, iterationId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d43911ee-6958-46b0-a42b-8445b8a0d004", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestIteration, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the list of iterations for the specified pull request. + * + * @param {string} repositoryId - ID or name of the repository. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + * @param {boolean} includeCommits - If true, include the commits associated with each iteration in the response. + */ + getPullRequestIterations(repositoryId, pullRequestId, project, includeCommits) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + let queryValues = { + includeCommits + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "d43911ee-6958-46b0-a42b-8445b8a0d004", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestIteration, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a pull request status on the iteration. This operation will have the same result as Create status on pull request with specified iteration ID in the request body. + * + * @param {GitInterfaces.GitPullRequestStatus} status - Pull request status to create. + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} iterationId - ID of the pull request iteration. + * @param {string} project - Project ID or project name + */ + createPullRequestIterationStatus(status, repositoryId, pullRequestId, iterationId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "75cf11c5-979f-4038-a76e-058a06adf2bf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, status, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestStatus, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete pull request iteration status. + * + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} iterationId - ID of the pull request iteration. + * @param {number} statusId - ID of the pull request status. + * @param {string} project - Project ID or project name + */ + deletePullRequestIterationStatus(repositoryId, pullRequestId, iterationId, statusId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + iterationId, + statusId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "75cf11c5-979f-4038-a76e-058a06adf2bf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the specific pull request iteration status by ID. The status ID is unique within the pull request across all iterations. + * + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} iterationId - ID of the pull request iteration. + * @param {number} statusId - ID of the pull request status. + * @param {string} project - Project ID or project name + */ + getPullRequestIterationStatus(repositoryId, pullRequestId, iterationId, statusId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + iterationId, + statusId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "75cf11c5-979f-4038-a76e-058a06adf2bf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestStatus, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all the statuses associated with a pull request iteration. + * + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} iterationId - ID of the pull request iteration. + * @param {string} project - Project ID or project name + */ + getPullRequestIterationStatuses(repositoryId, pullRequestId, iterationId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "75cf11c5-979f-4038-a76e-058a06adf2bf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestStatus, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update pull request iteration statuses collection. The only supported operation type is `remove`. + * + * @param {VSSInterfaces.JsonPatchDocument} patchDocument - Operations to apply to the pull request statuses in JSON Patch format. + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} iterationId - ID of the pull request iteration. + * @param {string} project - Project ID or project name + */ + updatePullRequestIterationStatuses(customHeaders, patchDocument, repositoryId, pullRequestId, iterationId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + iterationId + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/json-patch+json"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "75cf11c5-979f-4038-a76e-058a06adf2bf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.update(url, patchDocument, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a tag (if that does not exists yet) and add that as a label (tag) for a specified pull request. The only required field is the name of the new label (tag). + * + * @param {TfsCoreInterfaces.WebApiCreateTagRequestData} label - Label to assign to the pull request. + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + * @param {string} projectId - Project ID or project name. + */ + createPullRequestLabel(label, repositoryId, pullRequestId, project, projectId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + let queryValues = { + projectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "f22387e3-984e-4c52-9c6d-fbb8f14c812d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, label, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a label (tag) from the set of those assigned to the pull request. The tag itself will not be deleted. + * + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} labelIdOrName - The name or ID of the label requested. + * @param {string} project - Project ID or project name + * @param {string} projectId - Project ID or project name. + */ + deletePullRequestLabels(repositoryId, pullRequestId, labelIdOrName, project, projectId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + labelIdOrName + }; + let queryValues = { + projectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "f22387e3-984e-4c52-9c6d-fbb8f14c812d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieves a single label (tag) that has been assigned to a pull request. + * + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} labelIdOrName - The name or ID of the label requested. + * @param {string} project - Project ID or project name + * @param {string} projectId - Project ID or project name. + */ + getPullRequestLabel(repositoryId, pullRequestId, labelIdOrName, project, projectId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + labelIdOrName + }; + let queryValues = { + projectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "f22387e3-984e-4c52-9c6d-fbb8f14c812d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all the labels (tags) assigned to a pull request. + * + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + * @param {string} projectId - Project ID or project name. + */ + getPullRequestLabels(repositoryId, pullRequestId, project, projectId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + let queryValues = { + projectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "f22387e3-984e-4c52-9c6d-fbb8f14c812d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get external properties of the pull request. + * + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + getPullRequestProperties(repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "48a52185-5b9e-4736-9dc1-bb1e2feac80b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create or update pull request external properties. The patch operation can be `add`, `replace` or `remove`. For `add` operation, the path can be empty. If the path is empty, the value must be a list of key value pairs. For `replace` operation, the path cannot be empty. If the path does not exist, the property will be added to the collection. For `remove` operation, the path cannot be empty. If the path does not exist, no action will be performed. + * + * @param {VSSInterfaces.JsonPatchDocument} patchDocument - Properties to add, replace or remove in JSON Patch format. + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + updatePullRequestProperties(customHeaders, patchDocument, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/json-patch+json"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "48a52185-5b9e-4736-9dc1-bb1e2feac80b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.update(url, patchDocument, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * This API is used to find what pull requests are related to a given commit. It can be used to either find the pull request that created a particular merge commit or it can be used to find all pull requests that have ever merged a particular commit. The input is a list of queries which each contain a list of commits. For each commit that you search against, you will get back a dictionary of commit -> pull requests. + * + * @param {GitInterfaces.GitPullRequestQuery} queries - The list of queries to perform. + * @param {string} repositoryId - ID of the repository. + * @param {string} project - Project ID or project name + */ + getPullRequestQuery(queries, repositoryId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "b3a6eebe-9cf0-49ea-b6cb-1a4c5f5007b0", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, queries, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestQuery, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add a reviewer to a pull request or cast a vote. + * + * @param {GitInterfaces.IdentityRefWithVote} reviewer - Reviewer's vote.
If the reviewer's ID is included here, it must match the reviewerID parameter.
Reviewers can set their own vote with this method. When adding other reviewers, vote must be set to zero. + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} reviewerId - ID of the reviewer. + * @param {string} project - Project ID or project name + */ + createPullRequestReviewer(reviewer, repositoryId, pullRequestId, reviewerId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + reviewerId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, reviewer, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add reviewers to a pull request. + * + * @param {VSSInterfaces.IdentityRef[]} reviewers - Reviewers to add to the pull request. + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + createPullRequestReviewers(reviewers, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, reviewers, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add an unmaterialized identity to the reviewers of a pull request. + * + * @param {GitInterfaces.IdentityRefWithVote} reviewer - Reviewer to add to the pull request. + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + createUnmaterializedPullRequestReviewer(reviewer, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, reviewer, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Remove a reviewer from a pull request. + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} reviewerId - ID of the reviewer to remove. + * @param {string} project - Project ID or project name + */ + deletePullRequestReviewer(repositoryId, pullRequestId, reviewerId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + reviewerId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve information about a particular reviewer on a pull request + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} reviewerId - ID of the reviewer. + * @param {string} project - Project ID or project name + */ + getPullRequestReviewer(repositoryId, pullRequestId, reviewerId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + reviewerId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve the reviewers for a pull request + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + getPullRequestReviewers(repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Edit a reviewer entry. These fields are patchable: isFlagged, hasDeclined + * + * @param {GitInterfaces.IdentityRefWithVote} reviewer - Reviewer data.
If the reviewer's ID is included here, it must match the reviewerID parameter. + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} reviewerId - ID of the reviewer. + * @param {string} project - Project ID or project name + */ + updatePullRequestReviewer(reviewer, repositoryId, pullRequestId, reviewerId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + reviewerId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, reviewer, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Reset the votes of multiple reviewers on a pull request. NOTE: This endpoint only supports updating votes, but does not support updating required reviewers (use policy) or display names. + * + * @param {GitInterfaces.IdentityRefWithVote[]} patchVotes - IDs of the reviewers whose votes will be reset to zero + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request + * @param {string} project - Project ID or project name + */ + updatePullRequestReviewers(patchVotes, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4b6702c7-aa35-4b89-9c96-b9abf6d3e540", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, patchVotes, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a pull request. + * + * @param {number} pullRequestId - The ID of the pull request to retrieve. + * @param {string} project - Project ID or project name + */ + getPullRequestById(pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "01a46dea-7d46-4d40-bc84-319e7c260d99", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve all pull requests matching a specified criteria. + * + * @param {string} project - Project ID or project name + * @param {GitInterfaces.GitPullRequestSearchCriteria} searchCriteria - Pull requests will be returned that match this search criteria. + * @param {number} maxCommentLength - Not used. + * @param {number} skip - The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100. + * @param {number} top - The number of pull requests to retrieve. + */ + getPullRequestsByProject(project, searchCriteria, maxCommentLength, skip, top) { + return __awaiter2(this, void 0, void 0, function* () { + if (searchCriteria == null) { + throw new TypeError("searchCriteria can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + searchCriteria, + maxCommentLength, + "$skip": skip, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "a5d28130-9cd2-40fa-9f08-902e7daa9efb", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a pull request. + * + * @param {GitInterfaces.GitPullRequest} gitPullRequestToCreate - The pull request to create. + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {string} project - Project ID or project name + * @param {boolean} supportsIterations - If true, subsequent pushes to the pull request will be individually reviewable. Set this to false for large pull requests for performance reasons if this functionality is not needed. + */ + createPullRequest(gitPullRequestToCreate, repositoryId, project, supportsIterations) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + supportsIterations + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "9946fd70-0d40-406e-b686-b4744cbbcc37", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, gitPullRequestToCreate, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a pull request. + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - The ID of the pull request to retrieve. + * @param {string} project - Project ID or project name + * @param {number} maxCommentLength - Not used. + * @param {number} skip - Not used. + * @param {number} top - Not used. + * @param {boolean} includeCommits - If true, the pull request will be returned with the associated commits. + * @param {boolean} includeWorkItemRefs - If true, the pull request will be returned with the associated work item references. + */ + getPullRequest(repositoryId, pullRequestId, project, maxCommentLength, skip, top, includeCommits, includeWorkItemRefs) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + let queryValues = { + maxCommentLength, + "$skip": skip, + "$top": top, + includeCommits, + includeWorkItemRefs + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "9946fd70-0d40-406e-b686-b4744cbbcc37", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve all pull requests matching a specified criteria. + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {GitInterfaces.GitPullRequestSearchCriteria} searchCriteria - Pull requests will be returned that match this search criteria. + * @param {string} project - Project ID or project name + * @param {number} maxCommentLength - Not used. + * @param {number} skip - The number of pull requests to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100. + * @param {number} top - The number of pull requests to retrieve. + */ + getPullRequests(repositoryId, searchCriteria, project, maxCommentLength, skip, top) { + return __awaiter2(this, void 0, void 0, function* () { + if (searchCriteria == null) { + throw new TypeError("searchCriteria can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + searchCriteria, + maxCommentLength, + "$skip": skip, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "9946fd70-0d40-406e-b686-b4744cbbcc37", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a pull request + * + * @param {GitInterfaces.GitPullRequest} gitPullRequestToUpdate - The pull request content that should be updated. + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request to update. + * @param {string} project - Project ID or project name + */ + updatePullRequest(gitPullRequestToUpdate, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "9946fd70-0d40-406e-b686-b4744cbbcc37", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, gitPullRequestToUpdate, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Sends an e-mail notification about a specific pull request to a set of recipients + * + * @param {GitInterfaces.ShareNotificationContext} userMessage + * @param {string} repositoryId - ID of the git repository. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + sharePullRequest(userMessage, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "696f3a82-47c9-487f-9117-b9d00972ca84", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, userMessage, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a pull request status. + * + * @param {GitInterfaces.GitPullRequestStatus} status - Pull request status to create. + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + createPullRequestStatus(status, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, status, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestStatus, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete pull request status. + * + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} statusId - ID of the pull request status. + * @param {string} project - Project ID or project name + */ + deletePullRequestStatus(repositoryId, pullRequestId, statusId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + statusId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the specific pull request status by ID. The status ID is unique within the pull request across all iterations. + * + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} statusId - ID of the pull request status. + * @param {string} project - Project ID or project name + */ + getPullRequestStatus(repositoryId, pullRequestId, statusId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + statusId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestStatus, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all the statuses associated with a pull request. + * + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + getPullRequestStatuses(repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestStatus, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update pull request statuses collection. The only supported operation type is `remove`. + * + * @param {VSSInterfaces.JsonPatchDocument} patchDocument - Operations to apply to the pull request statuses in JSON Patch format. + * @param {string} repositoryId - The repository ID of the pull request’s target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + updatePullRequestStatuses(customHeaders, patchDocument, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/json-patch+json"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "b5f6bb4f-8d1e-4d79-8d11-4c9172c99c35", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.update(url, patchDocument, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a comment on a specific thread in a pull request (up to 500 comments can be created per thread). + * + * @param {GitInterfaces.Comment} comment - The comment to create. Comments can be up to 150,000 characters. + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} threadId - ID of the thread that the desired comment is in. + * @param {string} project - Project ID or project name + */ + createComment(comment, repositoryId, pullRequestId, threadId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + threadId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, comment, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.Comment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a comment associated with a specific thread in a pull request. + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} threadId - ID of the thread that the desired comment is in. + * @param {number} commentId - ID of the comment. + * @param {string} project - Project ID or project name + */ + deleteComment(repositoryId, pullRequestId, threadId, commentId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + threadId, + commentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a comment associated with a specific thread in a pull request. + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} threadId - ID of the thread that the desired comment is in. + * @param {number} commentId - ID of the comment. + * @param {string} project - Project ID or project name + */ + getComment(repositoryId, pullRequestId, threadId, commentId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + threadId, + commentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.Comment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve all comments associated with a specific thread in a pull request. + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} threadId - ID of the thread. + * @param {string} project - Project ID or project name + */ + getComments(repositoryId, pullRequestId, threadId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + threadId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.Comment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a comment associated with a specific thread in a pull request. + * + * @param {GitInterfaces.Comment} comment - The comment content that should be updated. Comments can be up to 150,000 characters. + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} threadId - ID of the thread that the desired comment is in. + * @param {number} commentId - ID of the comment to update. + * @param {string} project - Project ID or project name + */ + updateComment(comment, repositoryId, pullRequestId, threadId, commentId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + threadId, + commentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "965a3ec7-5ed8-455a-bdcb-835a5ea7fe7b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, comment, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.Comment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a thread in a pull request. + * + * @param {GitInterfaces.GitPullRequestCommentThread} commentThread - The thread to create. Thread must contain at least one comment. + * @param {string} repositoryId - Repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + createThread(commentThread, repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "ab6e2e5d-a0b7-4153-b64a-a4efe0d49449", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, commentThread, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestCommentThread, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a thread in a pull request. + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} threadId - ID of the thread. + * @param {string} project - Project ID or project name + * @param {number} iteration - If specified, thread position will be tracked using this iteration as the right side of the diff. + * @param {number} baseIteration - If specified, thread position will be tracked using this iteration as the left side of the diff. + */ + getPullRequestThread(repositoryId, pullRequestId, threadId, project, iteration, baseIteration) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + threadId + }; + let queryValues = { + "$iteration": iteration, + "$baseIteration": baseIteration + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "ab6e2e5d-a0b7-4153-b64a-a4efe0d49449", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestCommentThread, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve all threads in a pull request. + * + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + * @param {number} iteration - If specified, thread positions will be tracked using this iteration as the right side of the diff. + * @param {number} baseIteration - If specified, thread positions will be tracked using this iteration as the left side of the diff. + */ + getThreads(repositoryId, pullRequestId, project, iteration, baseIteration) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + let queryValues = { + "$iteration": iteration, + "$baseIteration": baseIteration + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "ab6e2e5d-a0b7-4153-b64a-a4efe0d49449", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestCommentThread, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a thread in a pull request. + * + * @param {GitInterfaces.GitPullRequestCommentThread} commentThread - The thread content that should be updated. + * @param {string} repositoryId - The repository ID of the pull request's target branch. + * @param {number} pullRequestId - ID of the pull request. + * @param {number} threadId - ID of the thread to update. + * @param {string} project - Project ID or project name + */ + updateThread(commentThread, repositoryId, pullRequestId, threadId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId, + threadId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "ab6e2e5d-a0b7-4153-b64a-a4efe0d49449", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, commentThread, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPullRequestCommentThread, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a list of work items associated with a pull request. + * + * @param {string} repositoryId - ID or name of the repository. + * @param {number} pullRequestId - ID of the pull request. + * @param {string} project - Project ID or project name + */ + getPullRequestWorkItemRefs(repositoryId, pullRequestId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pullRequestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "0a637fcc-5370-4ce8-b0e8-98091f5f9482", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Push changes to the repository. + * + * @param {GitInterfaces.GitPush} push + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} project - Project ID or project name + */ + createPush(push2, repositoryId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "git", "ea98d07b-3c87-4971-8ede-a613694ffb55", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, push2, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPush, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieves a particular push. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {number} pushId - ID of the push. + * @param {string} project - Project ID or project name + * @param {number} includeCommits - The number of commits to include in the result. + * @param {boolean} includeRefUpdates - If true, include the list of refs that were updated by the push. + */ + getPush(repositoryId, pushId, project, includeCommits, includeRefUpdates) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + pushId + }; + let queryValues = { + includeCommits, + includeRefUpdates + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "git", "ea98d07b-3c87-4971-8ede-a613694ffb55", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPush, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieves pushes associated with the specified repository. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} project - Project ID or project name + * @param {number} skip - Number of pushes to skip. + * @param {number} top - Number of pushes to return. + * @param {GitInterfaces.GitPushSearchCriteria} searchCriteria - Search criteria attributes: fromDate, toDate, pusherId, refName, includeRefUpdates or includeLinks. fromDate: Start date to search from. toDate: End date to search to. pusherId: Identity of the person who submitted the push. refName: Branch name to consider. includeRefUpdates: If true, include the list of refs that were updated by the push. includeLinks: Whether to include the _links field on the shallow references. + */ + getPushes(repositoryId, project, skip, top, searchCriteria) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + "$skip": skip, + "$top": top, + searchCriteria + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "git", "ea98d07b-3c87-4971-8ede-a613694ffb55", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitPush, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Destroy (hard delete) a soft-deleted Git repository. + * + * @param {string} project - Project ID or project name + * @param {string} repositoryId - The ID of the repository. + */ + deleteRepositoryFromRecycleBin(project, repositoryId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "a663da97-81db-4eb3-8b83-287670f63073", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve soft-deleted git repositories from the recycle bin. + * + * @param {string} project - Project ID or project name + */ + getRecycleBinRepositories(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "a663da97-81db-4eb3-8b83-287670f63073", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitDeletedRepository, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Recover a soft-deleted Git repository. Recently deleted repositories go into a soft-delete state for a period of time before they are hard deleted and become unrecoverable. + * + * @param {GitInterfaces.GitRecycleBinRepositoryDetails} repositoryDetails + * @param {string} project - Project ID or project name + * @param {string} repositoryId - The ID of the repository. + */ + restoreRepositoryFromRecycleBin(repositoryDetails, project, repositoryId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "a663da97-81db-4eb3-8b83-287670f63073", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, repositoryDetails, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepository, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Queries the provided repository for its refs and returns them. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} project - Project ID or project name + * @param {string} filter - [optional] A filter to apply to the refs (starts with). + * @param {boolean} includeLinks - [optional] Specifies if referenceLinks should be included in the result. default is false. + * @param {boolean} includeStatuses - [optional] Includes up to the first 1000 commit statuses for each ref. The default value is false. + * @param {boolean} includeMyBranches - [optional] Includes only branches that the user owns, the branches the user favorites, and the default branch. The default value is false. Cannot be combined with the filter parameter. + * @param {boolean} latestStatusesOnly - [optional] True to include only the tip commit status for each ref. This option requires `includeStatuses` to be true. The default value is false. + * @param {boolean} peelTags - [optional] Annotated tags will populate the PeeledObjectId property. default is false. + * @param {string} filterContains - [optional] A filter to apply to the refs (contains). + */ + getRefs(repositoryId, project, filter2, includeLinks, includeStatuses, includeMyBranches, latestStatusesOnly, peelTags, filterContains) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + filter: filter2, + includeLinks, + includeStatuses, + includeMyBranches, + latestStatusesOnly, + peelTags, + filterContains + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "2d874a60-a811-4f62-9c9f-963a6ea0a55b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Lock or Unlock a branch. + * + * @param {GitInterfaces.GitRefUpdate} newRefInfo - The ref update action (lock/unlock) to perform + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} filter - The name of the branch to lock/unlock + * @param {string} project - Project ID or project name + * @param {string} projectId - ID or name of the team project. Optional if specifying an ID for repository. + */ + updateRef(newRefInfo, repositoryId, filter2, project, projectId) { + return __awaiter2(this, void 0, void 0, function* () { + if (filter2 == null) { + throw new TypeError("filter can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + filter: filter2, + projectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "2d874a60-a811-4f62-9c9f-963a6ea0a55b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, newRefInfo, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRef, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creating, updating, or deleting refs(branches). + * + * @param {GitInterfaces.GitRefUpdate[]} refUpdates - List of ref updates to attempt to perform + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} project - Project ID or project name + * @param {string} projectId - ID or name of the team project. Optional if specifying an ID for repository. + */ + updateRefs(refUpdates, repositoryId, project, projectId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + projectId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "2d874a60-a811-4f62-9c9f-963a6ea0a55b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, refUpdates, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRefUpdateResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a ref favorite + * + * @param {GitInterfaces.GitRefFavorite} favorite - The ref favorite to create. + * @param {string} project - Project ID or project name + */ + createFavorite(favorite, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "876f70af-5792-485a-a1c7-d0a7b2f42bbb", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, favorite, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRefFavorite, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes the refs favorite specified + * + * @param {string} project - Project ID or project name + * @param {number} favoriteId - The Id of the ref favorite to delete. + */ + deleteRefFavorite(project, favoriteId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + favoriteId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "876f70af-5792-485a-a1c7-d0a7b2f42bbb", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the refs favorite for a favorite Id. + * + * @param {string} project - Project ID or project name + * @param {number} favoriteId - The Id of the requested ref favorite. + */ + getRefFavorite(project, favoriteId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + favoriteId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "876f70af-5792-485a-a1c7-d0a7b2f42bbb", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRefFavorite, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the refs favorites for a repo and an identity. + * + * @param {string} project - Project ID or project name + * @param {string} repositoryId - The id of the repository. + * @param {string} identityId - The id of the identity whose favorites are to be retrieved. If null, the requesting identity is used. + */ + getRefFavorites(project, repositoryId, identityId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + repositoryId, + identityId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "876f70af-5792-485a-a1c7-d0a7b2f42bbb", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRefFavorite, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} identityId + */ + getRefFavoritesForProject(project, identityId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + identityId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "4720896c-594c-4a6d-b94c-12eddd80b34a", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRefFavorite, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a git repository in a team project. + * + * @param {GitInterfaces.GitRepositoryCreateOptions} gitRepositoryToCreate - Specify the repo name, team project and/or parent repository. Team project information can be omitted from gitRepositoryToCreate if the request is project-scoped (i.e., includes project Id). + * @param {string} project - Project ID or project name + * @param {string} sourceRef - [optional] Specify the source refs to use while creating a fork repo + */ + createRepository(gitRepositoryToCreate, project, sourceRef) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + sourceRef + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "225f7195-f9c7-4d14-ab28-a83f7ff77e1f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, gitRepositoryToCreate, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepository, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a git repository + * + * @param {string} repositoryId - The ID of the repository. + * @param {string} project - Project ID or project name + */ + deleteRepository(repositoryId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "225f7195-f9c7-4d14-ab28-a83f7ff77e1f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve git repositories. + * + * @param {string} project - Project ID or project name + * @param {boolean} includeLinks - [optional] True to include reference links. The default value is false. + * @param {boolean} includeAllUrls - [optional] True to include all remote URLs. The default value is false. + * @param {boolean} includeHidden - [optional] True to include hidden repositories. The default value is false. + */ + getRepositories(project, includeLinks, includeAllUrls, includeHidden) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + includeLinks, + includeAllUrls, + includeHidden + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "225f7195-f9c7-4d14-ab28-a83f7ff77e1f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepository, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a git repository. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {string} project - Project ID or project name + */ + getRepository(repositoryId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "225f7195-f9c7-4d14-ab28-a83f7ff77e1f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepository, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a git repository. + * + * @param {string} repositoryId - The name or ID of the repository. + * @param {boolean} includeParent - True to include parent repository. Only available in authenticated calls. + * @param {string} project - Project ID or project name + */ + getRepositoryWithParent(repositoryId, includeParent, project) { + return __awaiter2(this, void 0, void 0, function* () { + if (includeParent == null) { + throw new TypeError("includeParent can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + includeParent + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "225f7195-f9c7-4d14-ab28-a83f7ff77e1f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepository, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates the Git repository with either a new repo name or a new default branch. + * + * @param {GitInterfaces.GitRepository} newRepositoryInfo - Specify a new repo name or a new default branch of the repository + * @param {string} repositoryId - The ID of the repository. + * @param {string} project - Project ID or project name + */ + updateRepository(newRepositoryInfo, repositoryId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "225f7195-f9c7-4d14-ab28-a83f7ff77e1f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, newRepositoryInfo, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRepository, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve one conflict for a revert by ID + * + * @param {string} repositoryId + * @param {number} revertId + * @param {number} conflictId + * @param {string} project - Project ID or project name + */ + getRevertConflict(repositoryId, revertId, conflictId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + revertId, + conflictId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "10d7ae6d-1050-446d-852a-bd5d99f834bf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve all conflicts for a revert + * + * @param {string} repositoryId + * @param {number} revertId + * @param {string} project - Project ID or project name + * @param {string} continuationToken + * @param {number} top + * @param {boolean} excludeResolved + * @param {boolean} onlyResolved + * @param {boolean} includeObsolete + */ + getRevertConflicts(repositoryId, revertId, project, continuationToken, top, excludeResolved, onlyResolved, includeObsolete) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + revertId + }; + let queryValues = { + continuationToken, + "$top": top, + excludeResolved, + onlyResolved, + includeObsolete + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "10d7ae6d-1050-446d-852a-bd5d99f834bf", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update merge conflict resolution + * + * @param {GitInterfaces.GitConflict} conflict + * @param {string} repositoryId + * @param {number} revertId + * @param {number} conflictId + * @param {string} project - Project ID or project name + */ + updateRevertConflict(conflict, repositoryId, revertId, conflictId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + revertId, + conflictId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "10d7ae6d-1050-446d-852a-bd5d99f834bf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, conflict, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflict, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update multiple merge conflict resolutions + * + * @param {GitInterfaces.GitConflict[]} conflictUpdates + * @param {string} repositoryId + * @param {number} revertId + * @param {string} project - Project ID or project name + */ + updateRevertConflicts(conflictUpdates, repositoryId, revertId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + revertId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "10d7ae6d-1050-446d-852a-bd5d99f834bf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, conflictUpdates, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitConflictUpdateResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Starts the operation to create a new branch which reverts changes introduced by either a specific commit or commits that are associated to a pull request. + * + * @param {GitInterfaces.GitAsyncRefOperationParameters} revertToCreate + * @param {string} project - Project ID or project name + * @param {string} repositoryId - ID of the repository. + */ + createRevert(revertToCreate, project, repositoryId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "bc866058-5449-4715-9cf1-a510b6ff193c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, revertToCreate, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRevert, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve information about a revert operation by revert Id. + * + * @param {string} project - Project ID or project name + * @param {number} revertId - ID of the revert operation. + * @param {string} repositoryId - ID of the repository. + */ + getRevert(project, revertId, repositoryId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + revertId, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "bc866058-5449-4715-9cf1-a510b6ff193c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRevert, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve information about a revert operation for a specific branch. + * + * @param {string} project - Project ID or project name + * @param {string} repositoryId - ID of the repository. + * @param {string} refName - The GitAsyncRefOperationParameters generatedRefName used for the revert operation. + */ + getRevertForRefName(project, repositoryId, refName) { + return __awaiter2(this, void 0, void 0, function* () { + if (refName == null) { + throw new TypeError("refName can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + refName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "bc866058-5449-4715-9cf1-a510b6ff193c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitRevert, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create Git commit status. + * + * @param {GitInterfaces.GitStatus} gitCommitStatusToCreate - Git commit status object to create. + * @param {string} commitId - ID of the Git commit. + * @param {string} repositoryId - ID of the repository. + * @param {string} project - Project ID or project name + */ + createCommitStatus(gitCommitStatusToCreate, commitId, repositoryId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + commitId, + repositoryId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "428dd4fb-fda5-4722-af02-9313b80305da", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, gitCommitStatusToCreate, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitStatus, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get statuses associated with the Git commit. + * + * @param {string} commitId - ID of the Git commit. + * @param {string} repositoryId - ID of the repository. + * @param {string} project - Project ID or project name + * @param {number} top - Optional. The number of statuses to retrieve. Default is 1000. + * @param {number} skip - Optional. The number of statuses to ignore. Default is 0. For example, to retrieve results 101-150, set top to 50 and skip to 100. + * @param {boolean} latestOnly - The flag indicates whether to get only latest statuses grouped by `Context.Name` and `Context.Genre`. + */ + getStatuses(commitId, repositoryId, project, top, skip, latestOnly) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + commitId, + repositoryId + }; + let queryValues = { + top, + skip, + latestOnly + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "git", "428dd4fb-fda5-4722-af02-9313b80305da", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitStatus, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a pull request suggestion for a particular repository or team project. + * + * @param {string} repositoryId - ID of the git repository. + * @param {string} project - Project ID or project name + * @param {boolean} preferCompareBranch - If true, prefer the compare branch over the default branch as target branch for pull requests. + */ + getSuggestions(repositoryId, project, preferCompareBranch) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + preferCompareBranch + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "9393b4fb-4445-4919-972b-9ad16f442d83", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository. + * + * @param {string} repositoryId - Repository Id. + * @param {string} sha1 - SHA1 hash of the tree object. + * @param {string} project - Project ID or project name + * @param {string} projectId - Project Id. + * @param {boolean} recursive - Search recursively. Include trees underneath this tree. Default is false. + * @param {string} fileName - Name to use if a .zip file is returned. Default is the object ID. + */ + getTree(repositoryId, sha1, project, projectId, recursive, fileName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + sha1 + }; + let queryValues = { + projectId, + recursive, + fileName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "729f6437-6f92-44ec-8bee-273a7111063c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, GitInterfaces.TypeInfo.GitTreeRef, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * The Tree endpoint returns the collection of objects underneath the specified tree. Trees are folders in a Git repository. + * + * @param {string} repositoryId - Repository Id. + * @param {string} sha1 - SHA1 hash of the tree object. + * @param {string} project - Project ID or project name + * @param {string} projectId - Project Id. + * @param {boolean} recursive - Search recursively. Include trees underneath this tree. Default is false. + * @param {string} fileName - Name to use if a .zip file is returned. Default is the object ID. + */ + getTreeZip(repositoryId, sha1, project, projectId, recursive, fileName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId, + sha1 + }; + let queryValues = { + projectId, + recursive, + fileName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "git", "729f6437-6f92-44ec-8bee-273a7111063c", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.GitApi = GitApi; + GitApi.RESOURCE_AREA_ID = "4e080c62-fa21-4fbc-8fef-2a10a2b38049"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/common/VSSInterfaces.js +var require_VSSInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/common/VSSInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.UserProfileSyncState = exports2.UserProfileBackupState = exports2.Operation = exports2.JWTAlgorithm = exports2.DeploymentFlags = exports2.ConnectOptions = void 0; + var ConnectOptions; + (function(ConnectOptions2) { + ConnectOptions2[ConnectOptions2["None"] = 0] = "None"; + ConnectOptions2[ConnectOptions2["IncludeServices"] = 1] = "IncludeServices"; + ConnectOptions2[ConnectOptions2["IncludeLastUserAccess"] = 2] = "IncludeLastUserAccess"; + ConnectOptions2[ConnectOptions2["IncludeInheritedDefinitionsOnly"] = 4] = "IncludeInheritedDefinitionsOnly"; + ConnectOptions2[ConnectOptions2["IncludeNonInheritedDefinitionsOnly"] = 8] = "IncludeNonInheritedDefinitionsOnly"; + })(ConnectOptions = exports2.ConnectOptions || (exports2.ConnectOptions = {})); + var DeploymentFlags; + (function(DeploymentFlags2) { + DeploymentFlags2[DeploymentFlags2["None"] = 0] = "None"; + DeploymentFlags2[DeploymentFlags2["Hosted"] = 1] = "Hosted"; + DeploymentFlags2[DeploymentFlags2["OnPremises"] = 2] = "OnPremises"; + })(DeploymentFlags = exports2.DeploymentFlags || (exports2.DeploymentFlags = {})); + var JWTAlgorithm; + (function(JWTAlgorithm2) { + JWTAlgorithm2[JWTAlgorithm2["None"] = 0] = "None"; + JWTAlgorithm2[JWTAlgorithm2["HS256"] = 1] = "HS256"; + JWTAlgorithm2[JWTAlgorithm2["RS256"] = 2] = "RS256"; + })(JWTAlgorithm = exports2.JWTAlgorithm || (exports2.JWTAlgorithm = {})); + var Operation; + (function(Operation2) { + Operation2[Operation2["Add"] = 0] = "Add"; + Operation2[Operation2["Remove"] = 1] = "Remove"; + Operation2[Operation2["Replace"] = 2] = "Replace"; + Operation2[Operation2["Move"] = 3] = "Move"; + Operation2[Operation2["Copy"] = 4] = "Copy"; + Operation2[Operation2["Test"] = 5] = "Test"; + })(Operation = exports2.Operation || (exports2.Operation = {})); + var UserProfileBackupState; + (function(UserProfileBackupState2) { + UserProfileBackupState2[UserProfileBackupState2["Inactive"] = 0] = "Inactive"; + UserProfileBackupState2[UserProfileBackupState2["Active"] = 1] = "Active"; + })(UserProfileBackupState = exports2.UserProfileBackupState || (exports2.UserProfileBackupState = {})); + var UserProfileSyncState; + (function(UserProfileSyncState2) { + UserProfileSyncState2[UserProfileSyncState2["None"] = 0] = "None"; + UserProfileSyncState2[UserProfileSyncState2["Completed"] = 1] = "Completed"; + UserProfileSyncState2[UserProfileSyncState2["NewProfileDataAndImageRetrieved"] = 2] = "NewProfileDataAndImageRetrieved"; + UserProfileSyncState2[UserProfileSyncState2["ProfileDataBackupDone"] = 3] = "ProfileDataBackupDone"; + UserProfileSyncState2[UserProfileSyncState2["NewProfileDataSet"] = 4] = "NewProfileDataSet"; + UserProfileSyncState2[UserProfileSyncState2["NewProfileDataUpdateFailed"] = 5] = "NewProfileDataUpdateFailed"; + UserProfileSyncState2[UserProfileSyncState2["NewProfileImageUpdateFailed"] = 6] = "NewProfileImageUpdateFailed"; + })(UserProfileSyncState = exports2.UserProfileSyncState || (exports2.UserProfileSyncState = {})); + exports2.TypeInfo = { + ConnectOptions: { + enumValues: { + "none": 0, + "includeServices": 1, + "includeLastUserAccess": 2, + "includeInheritedDefinitionsOnly": 4, + "includeNonInheritedDefinitionsOnly": 8 + } + }, + DeploymentFlags: { + enumValues: { + "none": 0, + "hosted": 1, + "onPremises": 2 + } + }, + JsonPatchOperation: {}, + JWTAlgorithm: { + enumValues: { + "none": 0, + "hS256": 1, + "rS256": 2 + } + }, + Operation: { + enumValues: { + "add": 0, + "remove": 1, + "replace": 2, + "move": 3, + "copy": 4, + "test": 5 + } + }, + SignedUrl: {}, + TraceFilter: {}, + UserProfileBackupState: { + enumValues: { + "inactive": 0, + "active": 1 + } + }, + UserProfileSyncState: { + enumValues: { + "none": 0, + "completed": 1, + "newProfileDataAndImageRetrieved": 2, + "profileDataBackupDone": 3, + "newProfileDataSet": 4, + "newProfileDataUpdateFailed": 5, + "newProfileImageUpdateFailed": 6 + } + }, + VssNotificationEvent: {} + }; + exports2.TypeInfo.JsonPatchOperation.fields = { + op: { + enumType: exports2.TypeInfo.Operation + } + }; + exports2.TypeInfo.SignedUrl.fields = { + signatureExpires: { + isDate: true + } + }; + exports2.TypeInfo.TraceFilter.fields = { + timeCreated: { + isDate: true + } + }; + exports2.TypeInfo.VssNotificationEvent.fields = { + sourceEventCreatedTime: { + isDate: true + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/LocationsInterfaces.js +var require_LocationsInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/LocationsInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.ServiceStatus = exports2.RelativeToSetting = exports2.InheritLevel = void 0; + var VSSInterfaces = require_VSSInterfaces(); + var InheritLevel; + (function(InheritLevel2) { + InheritLevel2[InheritLevel2["None"] = 0] = "None"; + InheritLevel2[InheritLevel2["Deployment"] = 1] = "Deployment"; + InheritLevel2[InheritLevel2["Account"] = 2] = "Account"; + InheritLevel2[InheritLevel2["Collection"] = 4] = "Collection"; + InheritLevel2[InheritLevel2["All"] = 7] = "All"; + })(InheritLevel = exports2.InheritLevel || (exports2.InheritLevel = {})); + var RelativeToSetting; + (function(RelativeToSetting2) { + RelativeToSetting2[RelativeToSetting2["Context"] = 0] = "Context"; + RelativeToSetting2[RelativeToSetting2["WebApplication"] = 2] = "WebApplication"; + RelativeToSetting2[RelativeToSetting2["FullyQualified"] = 3] = "FullyQualified"; + })(RelativeToSetting = exports2.RelativeToSetting || (exports2.RelativeToSetting = {})); + var ServiceStatus; + (function(ServiceStatus2) { + ServiceStatus2[ServiceStatus2["Assigned"] = 0] = "Assigned"; + ServiceStatus2[ServiceStatus2["Active"] = 1] = "Active"; + ServiceStatus2[ServiceStatus2["Moving"] = 2] = "Moving"; + })(ServiceStatus = exports2.ServiceStatus || (exports2.ServiceStatus = {})); + exports2.TypeInfo = { + ConnectionData: {}, + InheritLevel: { + enumValues: { + "none": 0, + "deployment": 1, + "account": 2, + "collection": 4, + "all": 7 + } + }, + LocationServiceData: {}, + RelativeToSetting: { + enumValues: { + "context": 0, + "webApplication": 2, + "fullyQualified": 3 + } + }, + ServiceDefinition: {}, + ServiceStatus: { + enumValues: { + "assigned": 0, + "active": 1, + "moving": 2 + } + } + }; + exports2.TypeInfo.ConnectionData.fields = { + deploymentType: { + enumType: VSSInterfaces.TypeInfo.DeploymentFlags + }, + lastUserAccess: { + isDate: true + }, + locationServiceData: { + typeInfo: exports2.TypeInfo.LocationServiceData + } + }; + exports2.TypeInfo.LocationServiceData.fields = { + serviceDefinitions: { + isArray: true, + typeInfo: exports2.TypeInfo.ServiceDefinition + } + }; + exports2.TypeInfo.ServiceDefinition.fields = { + inheritLevel: { + enumType: exports2.TypeInfo.InheritLevel + }, + relativeToSetting: { + enumType: exports2.TypeInfo.RelativeToSetting + }, + status: { + enumType: exports2.TypeInfo.ServiceStatus + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/LocationsApi.js +var require_LocationsApi = __commonJS({ + "../node_modules/azure-devops-node-api/LocationsApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.LocationsApi = void 0; + var basem = require_ClientApiBases(); + var LocationsInterfaces = require_LocationsInterfaces(); + var LocationsApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Locations-api", options); + } + /** + * This was copied and adapted from TeamFoundationConnectionService.Connect() + * + * @param {VSSInterfaces.ConnectOptions} connectOptions + * @param {number} lastChangeId - Obsolete 32-bit LastChangeId + * @param {number} lastChangeId64 - Non-truncated 64-bit LastChangeId + */ + getConnectionData(connectOptions, lastChangeId, lastChangeId64) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + connectOptions, + lastChangeId, + lastChangeId64 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "00d9565f-ed9c-4a06-9a50-00e7896ccab4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, LocationsInterfaces.TypeInfo.ConnectionData, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} areaId + * @param {string} enterpriseName + * @param {string} organizationName + */ + getResourceArea(areaId, enterpriseName, organizationName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + areaId + }; + let queryValues = { + enterpriseName, + organizationName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "e81700f7-3be2-46de-8624-2eb35882fcaa", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} areaId + * @param {string} hostId + */ + getResourceAreaByHost(areaId, hostId) { + return __awaiter2(this, void 0, void 0, function* () { + if (hostId == null) { + throw new TypeError("hostId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + areaId + }; + let queryValues = { + hostId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "e81700f7-3be2-46de-8624-2eb35882fcaa", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} enterpriseName + * @param {string} organizationName + */ + getResourceAreas(enterpriseName, organizationName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + enterpriseName, + organizationName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "e81700f7-3be2-46de-8624-2eb35882fcaa", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} hostId + */ + getResourceAreasByHost(hostId) { + return __awaiter2(this, void 0, void 0, function* () { + if (hostId == null) { + throw new TypeError("hostId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + hostId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "e81700f7-3be2-46de-8624-2eb35882fcaa", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} serviceType + * @param {string} identifier + */ + deleteServiceDefinition(serviceType, identifier) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + serviceType, + identifier + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "d810a47d-f4f4-4a62-a03f-fa1860585c4c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Finds a given service definition. + * + * @param {string} serviceType + * @param {string} identifier + * @param {boolean} allowFaultIn - If true, we will attempt to fault in a host instance mapping if in SPS. + * @param {boolean} previewFaultIn - If true, we will calculate and return a host instance mapping, but not persist it. + */ + getServiceDefinition(serviceType, identifier, allowFaultIn, previewFaultIn) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + serviceType, + identifier + }; + let queryValues = { + allowFaultIn, + previewFaultIn + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "d810a47d-f4f4-4a62-a03f-fa1860585c4c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, LocationsInterfaces.TypeInfo.ServiceDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} serviceType + */ + getServiceDefinitions(serviceType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + serviceType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "d810a47d-f4f4-4a62-a03f-fa1860585c4c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, LocationsInterfaces.TypeInfo.ServiceDefinition, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {VSSInterfaces.VssJsonCollectionWrapperV} serviceDefinitions + */ + updateServiceDefinitions(serviceDefinitions) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Location", "d810a47d-f4f4-4a62-a03f-fa1860585c4c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, serviceDefinitions, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.LocationsApi = LocationsApi; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/ManagementInterfaces.js +var require_ManagementInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/ManagementInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.BillingMode = void 0; + var BillingMode; + (function(BillingMode2) { + BillingMode2[BillingMode2["None"] = 0] = "None"; + BillingMode2[BillingMode2["SingleOrg"] = 1] = "SingleOrg"; + BillingMode2[BillingMode2["MultiOrg"] = 2] = "MultiOrg"; + })(BillingMode = exports2.BillingMode || (exports2.BillingMode = {})); + exports2.TypeInfo = { + AdvSecEnablementSettings: {}, + AdvSecEnablementStatus: {}, + BillableCommitterDetails: {}, + BillingInfo: {}, + BillingMode: { + enumValues: { + "none": 0, + "singleOrg": 1, + "multiOrg": 2 + } + }, + MeterUsage: {} + }; + exports2.TypeInfo.AdvSecEnablementSettings.fields = { + reposEnablementStatus: { + isArray: true, + typeInfo: exports2.TypeInfo.AdvSecEnablementStatus + } + }; + exports2.TypeInfo.AdvSecEnablementStatus.fields = { + advSecEnablementLastChangedDate: { + isDate: true + } + }; + exports2.TypeInfo.BillableCommitterDetails.fields = { + commitTime: { + isDate: true + }, + pushedTime: { + isDate: true + } + }; + exports2.TypeInfo.BillingInfo.fields = { + advSecEnabledChangedOnDate: { + isDate: true + }, + advSecEnabledFirstChangedOnDate: { + isDate: true + }, + billingMode: { + enumType: exports2.TypeInfo.BillingMode + } + }; + exports2.TypeInfo.MeterUsage.fields = { + billingDate: { + isDate: true + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/ManagementApi.js +var require_ManagementApi = __commonJS({ + "../node_modules/azure-devops-node-api/ManagementApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ManagementApi = void 0; + var basem = require_ClientApiBases(); + var ManagementInterfaces = require_ManagementInterfaces(); + var ManagementApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Management-api", options); + } + /** + * Delete the billing info for an organization. + * + * @param {string} organizationId + */ + deleteBillingInfo(organizationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "Default", + organizationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "de45fbc6-60fd-46e2-95ef-490ad08d656a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete the meter usage history from Primary SU for an organization. + * + * @param {string} organizationId + */ + deleteMeterUsageHistory(organizationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "MeterUsageHistory", + organizationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "de45fbc6-60fd-46e2-95ef-490ad08d656a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the billing info for an organization. + * + * @param {string} organizationId - Organization ID to get billing info for. + */ + getBillingInfo(organizationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "Default", + organizationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "de45fbc6-60fd-46e2-95ef-490ad08d656a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ManagementInterfaces.TypeInfo.BillingInfo, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Save the billing info for an organization. + * + * @param {ManagementInterfaces.BillingInfo} billingInfo + * @param {string} organizationId + */ + saveBillingInfo(billingInfo, organizationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "Default", + organizationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "de45fbc6-60fd-46e2-95ef-490ad08d656a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, billingInfo, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * During multi-org billing computation in primary scale unit(EUS21), this API is used to create billing snapshot for a specific org. Primary scale unit will call this API for each org in different scsle units to create billing snapshot. Data will be stored in the org specific partition DB -> billing snapshot table. This is needed as customers will fetch billing data from their org specific partition DB. + * + * @param {ManagementInterfaces.MeterUsage} meterUsage + */ + createBillingSnapshot(meterUsage) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "Default" + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "e58d8091-3d07-48b1-9527-7d6295fd4081", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, meterUsage, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all billable committers details, including those not matched with a VSID. + * + * @param {Date} billingDate - The date to query, or if not provided, today + */ + getBillableCommitterDetails(billingDate) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "Details" + }; + let queryValues = { + billingDate + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "e58d8091-3d07-48b1-9527-7d6295fd4081", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ManagementInterfaces.TypeInfo.BillableCommitterDetails, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + */ + getLastMeterUsage() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "Last" + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "e58d8091-3d07-48b1-9527-7d6295fd4081", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ManagementInterfaces.TypeInfo.MeterUsage, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get commiters used when calculating billing information. + * + * @param {Date} billingDate - The date to query, or if not provided, today + */ + getMeterUsage(billingDate) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "Default" + }; + let queryValues = { + billingDate + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "e58d8091-3d07-48b1-9527-7d6295fd4081", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ManagementInterfaces.TypeInfo.MeterUsage, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the current status of Advanced Security for the organization + * + * @param {boolean} includeAllProperties - When true, also determine if pushes are blocked if they contain secrets + */ + getOrgEnablementStatus(includeAllProperties) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + includeAllProperties + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "d0c0450f-8882-46f4-a5a8-e48fea3095b0", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ManagementInterfaces.TypeInfo.AdvSecEnablementSettings, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update the status of Advanced Security for the organization + * + * @param {ManagementInterfaces.AdvSecEnablementSettingsUpdate} savedAdvSecEnablementStatus - The new status + */ + updateOrgEnablementStatus(savedAdvSecEnablementStatus) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "d0c0450f-8882-46f4-a5a8-e48fea3095b0", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, savedAdvSecEnablementStatus, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Estimate the committers that would be added to the customer's usage if Advanced Security was enabled for this organization. + * + */ + getEstimatedOrgBillablePushers() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "10a9e9c3-89bf-4312-92ed-139ddbcd2e28", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the current status of Advanced Security for a project + * + * @param {string} project - Project ID or project name + * @param {boolean} includeAllProperties - When true, also determine if pushes are blocked if they contain secrets + */ + getProjectEnablementStatus(project, includeAllProperties) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + includeAllProperties + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "6b9a4b47-5f2d-40f3-8286-b0152079074d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ManagementInterfaces.TypeInfo.AdvSecEnablementSettings, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update the status of Advanced Security for the project + * + * @param {ManagementInterfaces.AdvSecEnablementSettingsUpdate} savedAdvSecEnablementStatus - The new status + * @param {string} project - Project ID or project name + */ + updateProjectEnablementStatus(savedAdvSecEnablementStatus, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "6b9a4b47-5f2d-40f3-8286-b0152079074d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, savedAdvSecEnablementStatus, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Estimate the number of committers that would be added to the customer's usage if Advanced Security was enabled for this project. + * + * @param {string} project - Project ID or project name + */ + getEstimatedProjectBillablePushers(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "bf09cb40-ecf4-4496-8cf7-9ec60c64fd3e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Determine if Advanced Security is enabled for a repository + * + * @param {string} project - Project ID or project name + * @param {string} repository - The name or ID of the repository + * @param {boolean} includeAllProperties - When true, will also determine if pushes are blocked when secrets are detected + */ + getRepoEnablementStatus(project, repository, includeAllProperties) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repository + }; + let queryValues = { + includeAllProperties + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "d11a1c2b-b904-43dc-b970-bf42486262db", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ManagementInterfaces.TypeInfo.AdvSecEnablementStatus, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update the enablement of Advanced Security for a repository + * + * @param {ManagementInterfaces.AdvSecEnablementStatusUpdate} savedAdvSecEnablementStatus - new status + * @param {string} project - Project ID or project name + * @param {string} repository - Name or ID of the repository + */ + updateRepoAdvSecEnablementStatus(savedAdvSecEnablementStatus, project, repository) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repository + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "d11a1c2b-b904-43dc-b970-bf42486262db", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, savedAdvSecEnablementStatus, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Estimate the committers that would be added to the customer's usage if Advanced Security was enabled for this repository. + * + * @param {string} project - Project ID or project name + * @param {string} repository - The name or ID of the repository + */ + getEstimatedRepoBillableCommitters(project, repository) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repository + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Management", "b60f1ebf-ae77-4557-bd7f-ae3d5598dd1f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.ManagementApi = ManagementApi; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/NotificationInterfaces.js +var require_NotificationInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/NotificationInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.SubscriptionTemplateType = exports2.SubscriptionTemplateQueryFlags = exports2.SubscriptionStatus = exports2.SubscriptionQueryFlags = exports2.SubscriptionPermissions = exports2.SubscriptionFlags = exports2.SubscriptionFieldType = exports2.SubscriberFlags = exports2.NotificationSubscriberDeliveryPreference = exports2.NotificationStatisticType = exports2.NotificationReasonType = exports2.NotificationOperation = exports2.EventTypeQueryFlags = exports2.EventPublisherQueryFlags = exports2.EvaluationOperationStatus = exports2.DefaultGroupDeliveryPreference = void 0; + var DefaultGroupDeliveryPreference; + (function(DefaultGroupDeliveryPreference2) { + DefaultGroupDeliveryPreference2[DefaultGroupDeliveryPreference2["NoDelivery"] = -1] = "NoDelivery"; + DefaultGroupDeliveryPreference2[DefaultGroupDeliveryPreference2["EachMember"] = 2] = "EachMember"; + })(DefaultGroupDeliveryPreference = exports2.DefaultGroupDeliveryPreference || (exports2.DefaultGroupDeliveryPreference = {})); + var EvaluationOperationStatus; + (function(EvaluationOperationStatus2) { + EvaluationOperationStatus2[EvaluationOperationStatus2["NotSet"] = 0] = "NotSet"; + EvaluationOperationStatus2[EvaluationOperationStatus2["Queued"] = 1] = "Queued"; + EvaluationOperationStatus2[EvaluationOperationStatus2["InProgress"] = 2] = "InProgress"; + EvaluationOperationStatus2[EvaluationOperationStatus2["Cancelled"] = 3] = "Cancelled"; + EvaluationOperationStatus2[EvaluationOperationStatus2["Succeeded"] = 4] = "Succeeded"; + EvaluationOperationStatus2[EvaluationOperationStatus2["Failed"] = 5] = "Failed"; + EvaluationOperationStatus2[EvaluationOperationStatus2["TimedOut"] = 6] = "TimedOut"; + EvaluationOperationStatus2[EvaluationOperationStatus2["NotFound"] = 7] = "NotFound"; + })(EvaluationOperationStatus = exports2.EvaluationOperationStatus || (exports2.EvaluationOperationStatus = {})); + var EventPublisherQueryFlags; + (function(EventPublisherQueryFlags2) { + EventPublisherQueryFlags2[EventPublisherQueryFlags2["None"] = 0] = "None"; + EventPublisherQueryFlags2[EventPublisherQueryFlags2["IncludeRemoteServices"] = 2] = "IncludeRemoteServices"; + })(EventPublisherQueryFlags = exports2.EventPublisherQueryFlags || (exports2.EventPublisherQueryFlags = {})); + var EventTypeQueryFlags; + (function(EventTypeQueryFlags2) { + EventTypeQueryFlags2[EventTypeQueryFlags2["None"] = 0] = "None"; + EventTypeQueryFlags2[EventTypeQueryFlags2["IncludeFields"] = 1] = "IncludeFields"; + })(EventTypeQueryFlags = exports2.EventTypeQueryFlags || (exports2.EventTypeQueryFlags = {})); + var NotificationOperation; + (function(NotificationOperation2) { + NotificationOperation2[NotificationOperation2["None"] = 0] = "None"; + NotificationOperation2[NotificationOperation2["SuspendUnprocessed"] = 1] = "SuspendUnprocessed"; + })(NotificationOperation = exports2.NotificationOperation || (exports2.NotificationOperation = {})); + var NotificationReasonType; + (function(NotificationReasonType2) { + NotificationReasonType2[NotificationReasonType2["Unknown"] = 0] = "Unknown"; + NotificationReasonType2[NotificationReasonType2["Follows"] = 1] = "Follows"; + NotificationReasonType2[NotificationReasonType2["Personal"] = 2] = "Personal"; + NotificationReasonType2[NotificationReasonType2["PersonalAlias"] = 3] = "PersonalAlias"; + NotificationReasonType2[NotificationReasonType2["DirectMember"] = 4] = "DirectMember"; + NotificationReasonType2[NotificationReasonType2["IndirectMember"] = 5] = "IndirectMember"; + NotificationReasonType2[NotificationReasonType2["GroupAlias"] = 6] = "GroupAlias"; + NotificationReasonType2[NotificationReasonType2["SubscriptionAlias"] = 7] = "SubscriptionAlias"; + NotificationReasonType2[NotificationReasonType2["SingleRole"] = 8] = "SingleRole"; + NotificationReasonType2[NotificationReasonType2["DirectMemberGroupRole"] = 9] = "DirectMemberGroupRole"; + NotificationReasonType2[NotificationReasonType2["InDirectMemberGroupRole"] = 10] = "InDirectMemberGroupRole"; + NotificationReasonType2[NotificationReasonType2["AliasMemberGroupRole"] = 11] = "AliasMemberGroupRole"; + })(NotificationReasonType = exports2.NotificationReasonType || (exports2.NotificationReasonType = {})); + var NotificationStatisticType; + (function(NotificationStatisticType2) { + NotificationStatisticType2[NotificationStatisticType2["NotificationBySubscription"] = 0] = "NotificationBySubscription"; + NotificationStatisticType2[NotificationStatisticType2["EventsByEventType"] = 1] = "EventsByEventType"; + NotificationStatisticType2[NotificationStatisticType2["NotificationByEventType"] = 2] = "NotificationByEventType"; + NotificationStatisticType2[NotificationStatisticType2["EventsByEventTypePerUser"] = 3] = "EventsByEventTypePerUser"; + NotificationStatisticType2[NotificationStatisticType2["NotificationByEventTypePerUser"] = 4] = "NotificationByEventTypePerUser"; + NotificationStatisticType2[NotificationStatisticType2["Events"] = 5] = "Events"; + NotificationStatisticType2[NotificationStatisticType2["Notifications"] = 6] = "Notifications"; + NotificationStatisticType2[NotificationStatisticType2["NotificationFailureBySubscription"] = 7] = "NotificationFailureBySubscription"; + NotificationStatisticType2[NotificationStatisticType2["UnprocessedRangeStart"] = 100] = "UnprocessedRangeStart"; + NotificationStatisticType2[NotificationStatisticType2["UnprocessedEventsByPublisher"] = 101] = "UnprocessedEventsByPublisher"; + NotificationStatisticType2[NotificationStatisticType2["UnprocessedEventDelayByPublisher"] = 102] = "UnprocessedEventDelayByPublisher"; + NotificationStatisticType2[NotificationStatisticType2["UnprocessedNotificationsByChannelByPublisher"] = 103] = "UnprocessedNotificationsByChannelByPublisher"; + NotificationStatisticType2[NotificationStatisticType2["UnprocessedNotificationDelayByChannelByPublisher"] = 104] = "UnprocessedNotificationDelayByChannelByPublisher"; + NotificationStatisticType2[NotificationStatisticType2["DelayRangeStart"] = 200] = "DelayRangeStart"; + NotificationStatisticType2[NotificationStatisticType2["TotalPipelineTime"] = 201] = "TotalPipelineTime"; + NotificationStatisticType2[NotificationStatisticType2["NotificationPipelineTime"] = 202] = "NotificationPipelineTime"; + NotificationStatisticType2[NotificationStatisticType2["EventPipelineTime"] = 203] = "EventPipelineTime"; + NotificationStatisticType2[NotificationStatisticType2["HourlyRangeStart"] = 1e3] = "HourlyRangeStart"; + NotificationStatisticType2[NotificationStatisticType2["HourlyNotificationBySubscription"] = 1001] = "HourlyNotificationBySubscription"; + NotificationStatisticType2[NotificationStatisticType2["HourlyEventsByEventTypePerUser"] = 1002] = "HourlyEventsByEventTypePerUser"; + NotificationStatisticType2[NotificationStatisticType2["HourlyEvents"] = 1003] = "HourlyEvents"; + NotificationStatisticType2[NotificationStatisticType2["HourlyNotifications"] = 1004] = "HourlyNotifications"; + NotificationStatisticType2[NotificationStatisticType2["HourlyUnprocessedEventsByPublisher"] = 1101] = "HourlyUnprocessedEventsByPublisher"; + NotificationStatisticType2[NotificationStatisticType2["HourlyUnprocessedEventDelayByPublisher"] = 1102] = "HourlyUnprocessedEventDelayByPublisher"; + NotificationStatisticType2[NotificationStatisticType2["HourlyUnprocessedNotificationsByChannelByPublisher"] = 1103] = "HourlyUnprocessedNotificationsByChannelByPublisher"; + NotificationStatisticType2[NotificationStatisticType2["HourlyUnprocessedNotificationDelayByChannelByPublisher"] = 1104] = "HourlyUnprocessedNotificationDelayByChannelByPublisher"; + NotificationStatisticType2[NotificationStatisticType2["HourlyTotalPipelineTime"] = 1201] = "HourlyTotalPipelineTime"; + NotificationStatisticType2[NotificationStatisticType2["HourlyNotificationPipelineTime"] = 1202] = "HourlyNotificationPipelineTime"; + NotificationStatisticType2[NotificationStatisticType2["HourlyEventPipelineTime"] = 1203] = "HourlyEventPipelineTime"; + })(NotificationStatisticType = exports2.NotificationStatisticType || (exports2.NotificationStatisticType = {})); + var NotificationSubscriberDeliveryPreference; + (function(NotificationSubscriberDeliveryPreference2) { + NotificationSubscriberDeliveryPreference2[NotificationSubscriberDeliveryPreference2["NoDelivery"] = -1] = "NoDelivery"; + NotificationSubscriberDeliveryPreference2[NotificationSubscriberDeliveryPreference2["PreferredEmailAddress"] = 1] = "PreferredEmailAddress"; + NotificationSubscriberDeliveryPreference2[NotificationSubscriberDeliveryPreference2["EachMember"] = 2] = "EachMember"; + NotificationSubscriberDeliveryPreference2[NotificationSubscriberDeliveryPreference2["UseDefault"] = 3] = "UseDefault"; + })(NotificationSubscriberDeliveryPreference = exports2.NotificationSubscriberDeliveryPreference || (exports2.NotificationSubscriberDeliveryPreference = {})); + var SubscriberFlags; + (function(SubscriberFlags2) { + SubscriberFlags2[SubscriberFlags2["None"] = 0] = "None"; + SubscriberFlags2[SubscriberFlags2["DeliveryPreferencesEditable"] = 2] = "DeliveryPreferencesEditable"; + SubscriberFlags2[SubscriberFlags2["SupportsPreferredEmailAddressDelivery"] = 4] = "SupportsPreferredEmailAddressDelivery"; + SubscriberFlags2[SubscriberFlags2["SupportsEachMemberDelivery"] = 8] = "SupportsEachMemberDelivery"; + SubscriberFlags2[SubscriberFlags2["SupportsNoDelivery"] = 16] = "SupportsNoDelivery"; + SubscriberFlags2[SubscriberFlags2["IsUser"] = 32] = "IsUser"; + SubscriberFlags2[SubscriberFlags2["IsGroup"] = 64] = "IsGroup"; + SubscriberFlags2[SubscriberFlags2["IsTeam"] = 128] = "IsTeam"; + })(SubscriberFlags = exports2.SubscriberFlags || (exports2.SubscriberFlags = {})); + var SubscriptionFieldType; + (function(SubscriptionFieldType2) { + SubscriptionFieldType2[SubscriptionFieldType2["String"] = 1] = "String"; + SubscriptionFieldType2[SubscriptionFieldType2["Integer"] = 2] = "Integer"; + SubscriptionFieldType2[SubscriptionFieldType2["DateTime"] = 3] = "DateTime"; + SubscriptionFieldType2[SubscriptionFieldType2["PlainText"] = 5] = "PlainText"; + SubscriptionFieldType2[SubscriptionFieldType2["Html"] = 7] = "Html"; + SubscriptionFieldType2[SubscriptionFieldType2["TreePath"] = 8] = "TreePath"; + SubscriptionFieldType2[SubscriptionFieldType2["History"] = 9] = "History"; + SubscriptionFieldType2[SubscriptionFieldType2["Double"] = 10] = "Double"; + SubscriptionFieldType2[SubscriptionFieldType2["Guid"] = 11] = "Guid"; + SubscriptionFieldType2[SubscriptionFieldType2["Boolean"] = 12] = "Boolean"; + SubscriptionFieldType2[SubscriptionFieldType2["Identity"] = 13] = "Identity"; + SubscriptionFieldType2[SubscriptionFieldType2["PicklistInteger"] = 14] = "PicklistInteger"; + SubscriptionFieldType2[SubscriptionFieldType2["PicklistString"] = 15] = "PicklistString"; + SubscriptionFieldType2[SubscriptionFieldType2["PicklistDouble"] = 16] = "PicklistDouble"; + SubscriptionFieldType2[SubscriptionFieldType2["TeamProject"] = 17] = "TeamProject"; + })(SubscriptionFieldType = exports2.SubscriptionFieldType || (exports2.SubscriptionFieldType = {})); + var SubscriptionFlags; + (function(SubscriptionFlags2) { + SubscriptionFlags2[SubscriptionFlags2["None"] = 0] = "None"; + SubscriptionFlags2[SubscriptionFlags2["GroupSubscription"] = 1] = "GroupSubscription"; + SubscriptionFlags2[SubscriptionFlags2["ContributedSubscription"] = 2] = "ContributedSubscription"; + SubscriptionFlags2[SubscriptionFlags2["CanOptOut"] = 4] = "CanOptOut"; + SubscriptionFlags2[SubscriptionFlags2["TeamSubscription"] = 8] = "TeamSubscription"; + SubscriptionFlags2[SubscriptionFlags2["OneActorMatches"] = 16] = "OneActorMatches"; + })(SubscriptionFlags = exports2.SubscriptionFlags || (exports2.SubscriptionFlags = {})); + var SubscriptionPermissions; + (function(SubscriptionPermissions2) { + SubscriptionPermissions2[SubscriptionPermissions2["None"] = 0] = "None"; + SubscriptionPermissions2[SubscriptionPermissions2["View"] = 1] = "View"; + SubscriptionPermissions2[SubscriptionPermissions2["Edit"] = 2] = "Edit"; + SubscriptionPermissions2[SubscriptionPermissions2["Delete"] = 4] = "Delete"; + })(SubscriptionPermissions = exports2.SubscriptionPermissions || (exports2.SubscriptionPermissions = {})); + var SubscriptionQueryFlags; + (function(SubscriptionQueryFlags2) { + SubscriptionQueryFlags2[SubscriptionQueryFlags2["None"] = 0] = "None"; + SubscriptionQueryFlags2[SubscriptionQueryFlags2["IncludeInvalidSubscriptions"] = 2] = "IncludeInvalidSubscriptions"; + SubscriptionQueryFlags2[SubscriptionQueryFlags2["IncludeDeletedSubscriptions"] = 4] = "IncludeDeletedSubscriptions"; + SubscriptionQueryFlags2[SubscriptionQueryFlags2["IncludeFilterDetails"] = 8] = "IncludeFilterDetails"; + SubscriptionQueryFlags2[SubscriptionQueryFlags2["AlwaysReturnBasicInformation"] = 16] = "AlwaysReturnBasicInformation"; + SubscriptionQueryFlags2[SubscriptionQueryFlags2["IncludeSystemSubscriptions"] = 32] = "IncludeSystemSubscriptions"; + })(SubscriptionQueryFlags = exports2.SubscriptionQueryFlags || (exports2.SubscriptionQueryFlags = {})); + var SubscriptionStatus; + (function(SubscriptionStatus2) { + SubscriptionStatus2[SubscriptionStatus2["JailedByNotificationsVolume"] = -200] = "JailedByNotificationsVolume"; + SubscriptionStatus2[SubscriptionStatus2["PendingDeletion"] = -100] = "PendingDeletion"; + SubscriptionStatus2[SubscriptionStatus2["DisabledArgumentException"] = -12] = "DisabledArgumentException"; + SubscriptionStatus2[SubscriptionStatus2["DisabledProjectInvalid"] = -11] = "DisabledProjectInvalid"; + SubscriptionStatus2[SubscriptionStatus2["DisabledMissingPermissions"] = -10] = "DisabledMissingPermissions"; + SubscriptionStatus2[SubscriptionStatus2["DisabledFromProbation"] = -9] = "DisabledFromProbation"; + SubscriptionStatus2[SubscriptionStatus2["DisabledInactiveIdentity"] = -8] = "DisabledInactiveIdentity"; + SubscriptionStatus2[SubscriptionStatus2["DisabledMessageQueueNotSupported"] = -7] = "DisabledMessageQueueNotSupported"; + SubscriptionStatus2[SubscriptionStatus2["DisabledMissingIdentity"] = -6] = "DisabledMissingIdentity"; + SubscriptionStatus2[SubscriptionStatus2["DisabledInvalidRoleExpression"] = -5] = "DisabledInvalidRoleExpression"; + SubscriptionStatus2[SubscriptionStatus2["DisabledInvalidPathClause"] = -4] = "DisabledInvalidPathClause"; + SubscriptionStatus2[SubscriptionStatus2["DisabledAsDuplicateOfDefault"] = -3] = "DisabledAsDuplicateOfDefault"; + SubscriptionStatus2[SubscriptionStatus2["DisabledByAdmin"] = -2] = "DisabledByAdmin"; + SubscriptionStatus2[SubscriptionStatus2["Disabled"] = -1] = "Disabled"; + SubscriptionStatus2[SubscriptionStatus2["Enabled"] = 0] = "Enabled"; + SubscriptionStatus2[SubscriptionStatus2["EnabledOnProbation"] = 1] = "EnabledOnProbation"; + })(SubscriptionStatus = exports2.SubscriptionStatus || (exports2.SubscriptionStatus = {})); + var SubscriptionTemplateQueryFlags; + (function(SubscriptionTemplateQueryFlags2) { + SubscriptionTemplateQueryFlags2[SubscriptionTemplateQueryFlags2["None"] = 0] = "None"; + SubscriptionTemplateQueryFlags2[SubscriptionTemplateQueryFlags2["IncludeUser"] = 1] = "IncludeUser"; + SubscriptionTemplateQueryFlags2[SubscriptionTemplateQueryFlags2["IncludeGroup"] = 2] = "IncludeGroup"; + SubscriptionTemplateQueryFlags2[SubscriptionTemplateQueryFlags2["IncludeUserAndGroup"] = 4] = "IncludeUserAndGroup"; + SubscriptionTemplateQueryFlags2[SubscriptionTemplateQueryFlags2["IncludeEventTypeInformation"] = 22] = "IncludeEventTypeInformation"; + })(SubscriptionTemplateQueryFlags = exports2.SubscriptionTemplateQueryFlags || (exports2.SubscriptionTemplateQueryFlags = {})); + var SubscriptionTemplateType; + (function(SubscriptionTemplateType2) { + SubscriptionTemplateType2[SubscriptionTemplateType2["User"] = 0] = "User"; + SubscriptionTemplateType2[SubscriptionTemplateType2["Team"] = 1] = "Team"; + SubscriptionTemplateType2[SubscriptionTemplateType2["Both"] = 2] = "Both"; + SubscriptionTemplateType2[SubscriptionTemplateType2["None"] = 3] = "None"; + })(SubscriptionTemplateType = exports2.SubscriptionTemplateType || (exports2.SubscriptionTemplateType = {})); + exports2.TypeInfo = { + ActorNotificationReason: {}, + BatchNotificationOperation: {}, + DefaultGroupDeliveryPreference: { + enumValues: { + "noDelivery": -1, + "eachMember": 2 + } + }, + EvaluationOperationStatus: { + enumValues: { + "notSet": 0, + "queued": 1, + "inProgress": 2, + "cancelled": 3, + "succeeded": 4, + "failed": 5, + "timedOut": 6, + "notFound": 7 + } + }, + EventBacklogStatus: {}, + EventProcessingLog: {}, + EventPublisherQueryFlags: { + enumValues: { + "none": 0, + "includeRemoteServices": 2 + } + }, + EventTypeQueryFlags: { + enumValues: { + "none": 0, + "includeFields": 1 + } + }, + INotificationDiagnosticLog: {}, + NotificationAdminSettings: {}, + NotificationAdminSettingsUpdateParameters: {}, + NotificationBacklogStatus: {}, + NotificationDeliveryLog: {}, + NotificationDiagnosticLog: {}, + NotificationEventBacklogStatus: {}, + NotificationEventField: {}, + NotificationEventFieldType: {}, + NotificationEventType: {}, + NotificationJobDiagnosticLog: {}, + NotificationOperation: { + enumValues: { + "none": 0, + "suspendUnprocessed": 1 + } + }, + NotificationReason: {}, + NotificationReasonType: { + enumValues: { + "unknown": 0, + "follows": 1, + "personal": 2, + "personalAlias": 3, + "directMember": 4, + "indirectMember": 5, + "groupAlias": 6, + "subscriptionAlias": 7, + "singleRole": 8, + "directMemberGroupRole": 9, + "inDirectMemberGroupRole": 10, + "aliasMemberGroupRole": 11 + } + }, + NotificationStatistic: {}, + NotificationStatisticsQuery: {}, + NotificationStatisticsQueryConditions: {}, + NotificationStatisticType: { + enumValues: { + "notificationBySubscription": 0, + "eventsByEventType": 1, + "notificationByEventType": 2, + "eventsByEventTypePerUser": 3, + "notificationByEventTypePerUser": 4, + "events": 5, + "notifications": 6, + "notificationFailureBySubscription": 7, + "unprocessedRangeStart": 100, + "unprocessedEventsByPublisher": 101, + "unprocessedEventDelayByPublisher": 102, + "unprocessedNotificationsByChannelByPublisher": 103, + "unprocessedNotificationDelayByChannelByPublisher": 104, + "delayRangeStart": 200, + "totalPipelineTime": 201, + "notificationPipelineTime": 202, + "eventPipelineTime": 203, + "hourlyRangeStart": 1e3, + "hourlyNotificationBySubscription": 1001, + "hourlyEventsByEventTypePerUser": 1002, + "hourlyEvents": 1003, + "hourlyNotifications": 1004, + "hourlyUnprocessedEventsByPublisher": 1101, + "hourlyUnprocessedEventDelayByPublisher": 1102, + "hourlyUnprocessedNotificationsByChannelByPublisher": 1103, + "hourlyUnprocessedNotificationDelayByChannelByPublisher": 1104, + "hourlyTotalPipelineTime": 1201, + "hourlyNotificationPipelineTime": 1202, + "hourlyEventPipelineTime": 1203 + } + }, + NotificationSubscriber: {}, + NotificationSubscriberDeliveryPreference: { + enumValues: { + "noDelivery": -1, + "preferredEmailAddress": 1, + "eachMember": 2, + "useDefault": 3 + } + }, + NotificationSubscriberUpdateParameters: {}, + NotificationSubscription: {}, + NotificationSubscriptionTemplate: {}, + NotificationSubscriptionUpdateParameters: {}, + SubscriberFlags: { + enumValues: { + "none": 0, + "deliveryPreferencesEditable": 2, + "supportsPreferredEmailAddressDelivery": 4, + "supportsEachMemberDelivery": 8, + "supportsNoDelivery": 16, + "isUser": 32, + "isGroup": 64, + "isTeam": 128 + } + }, + SubscriptionDiagnostics: {}, + SubscriptionEvaluationRequest: {}, + SubscriptionEvaluationResult: {}, + SubscriptionFieldType: { + enumValues: { + "string": 1, + "integer": 2, + "dateTime": 3, + "plainText": 5, + "html": 7, + "treePath": 8, + "history": 9, + "double": 10, + "guid": 11, + "boolean": 12, + "identity": 13, + "picklistInteger": 14, + "picklistString": 15, + "picklistDouble": 16, + "teamProject": 17 + } + }, + SubscriptionFlags: { + enumValues: { + "none": 0, + "groupSubscription": 1, + "contributedSubscription": 2, + "canOptOut": 4, + "teamSubscription": 8, + "oneActorMatches": 16 + } + }, + SubscriptionPermissions: { + enumValues: { + "none": 0, + "view": 1, + "edit": 2, + "delete": 4 + } + }, + SubscriptionQuery: {}, + SubscriptionQueryCondition: {}, + SubscriptionQueryFlags: { + enumValues: { + "none": 0, + "includeInvalidSubscriptions": 2, + "includeDeletedSubscriptions": 4, + "includeFilterDetails": 8, + "alwaysReturnBasicInformation": 16, + "includeSystemSubscriptions": 32 + } + }, + SubscriptionStatus: { + enumValues: { + "jailedByNotificationsVolume": -200, + "pendingDeletion": -100, + "disabledArgumentException": -12, + "disabledProjectInvalid": -11, + "disabledMissingPermissions": -10, + "disabledFromProbation": -9, + "disabledInactiveIdentity": -8, + "disabledMessageQueueNotSupported": -7, + "disabledMissingIdentity": -6, + "disabledInvalidRoleExpression": -5, + "disabledInvalidPathClause": -4, + "disabledAsDuplicateOfDefault": -3, + "disabledByAdmin": -2, + "disabled": -1, + "enabled": 0, + "enabledOnProbation": 1 + } + }, + SubscriptionTemplateQueryFlags: { + enumValues: { + "none": 0, + "includeUser": 1, + "includeGroup": 2, + "includeUserAndGroup": 4, + "includeEventTypeInformation": 22 + } + }, + SubscriptionTemplateType: { + enumValues: { + "user": 0, + "team": 1, + "both": 2, + "none": 3 + } + }, + SubscriptionTraceDiagnosticLog: {}, + SubscriptionTraceEventProcessingLog: {}, + SubscriptionTraceNotificationDeliveryLog: {}, + SubscriptionTracing: {} + }; + exports2.TypeInfo.ActorNotificationReason.fields = { + notificationReasonType: { + enumType: exports2.TypeInfo.NotificationReasonType + } + }; + exports2.TypeInfo.BatchNotificationOperation.fields = { + notificationOperation: { + enumType: exports2.TypeInfo.NotificationOperation + } + }; + exports2.TypeInfo.EventBacklogStatus.fields = { + captureTime: { + isDate: true + }, + lastEventBatchStartTime: { + isDate: true + }, + lastEventProcessedTime: { + isDate: true + }, + lastJobBatchStartTime: { + isDate: true + }, + lastJobProcessedTime: { + isDate: true + }, + oldestPendingEventTime: { + isDate: true + } + }; + exports2.TypeInfo.EventProcessingLog.fields = { + endTime: { + isDate: true + }, + startTime: { + isDate: true + } + }; + exports2.TypeInfo.INotificationDiagnosticLog.fields = { + endTime: { + isDate: true + }, + startTime: { + isDate: true + } + }; + exports2.TypeInfo.NotificationAdminSettings.fields = { + defaultGroupDeliveryPreference: { + enumType: exports2.TypeInfo.DefaultGroupDeliveryPreference + } + }; + exports2.TypeInfo.NotificationAdminSettingsUpdateParameters.fields = { + defaultGroupDeliveryPreference: { + enumType: exports2.TypeInfo.DefaultGroupDeliveryPreference + } + }; + exports2.TypeInfo.NotificationBacklogStatus.fields = { + captureTime: { + isDate: true + }, + lastJobBatchStartTime: { + isDate: true + }, + lastJobProcessedTime: { + isDate: true + }, + lastNotificationBatchStartTime: { + isDate: true + }, + lastNotificationProcessedTime: { + isDate: true + }, + oldestPendingNotificationTime: { + isDate: true + } + }; + exports2.TypeInfo.NotificationDeliveryLog.fields = { + endTime: { + isDate: true + }, + startTime: { + isDate: true + } + }; + exports2.TypeInfo.NotificationDiagnosticLog.fields = { + endTime: { + isDate: true + }, + startTime: { + isDate: true + } + }; + exports2.TypeInfo.NotificationEventBacklogStatus.fields = { + eventBacklogStatus: { + isArray: true, + typeInfo: exports2.TypeInfo.EventBacklogStatus + }, + notificationBacklogStatus: { + isArray: true, + typeInfo: exports2.TypeInfo.NotificationBacklogStatus + } + }; + exports2.TypeInfo.NotificationEventField.fields = { + fieldType: { + typeInfo: exports2.TypeInfo.NotificationEventFieldType + } + }; + exports2.TypeInfo.NotificationEventFieldType.fields = { + subscriptionFieldType: { + enumType: exports2.TypeInfo.SubscriptionFieldType + } + }; + exports2.TypeInfo.NotificationEventType.fields = { + fields: { + isDictionary: true, + dictionaryValueTypeInfo: exports2.TypeInfo.NotificationEventField + } + }; + exports2.TypeInfo.NotificationJobDiagnosticLog.fields = { + endTime: { + isDate: true + }, + startTime: { + isDate: true + } + }; + exports2.TypeInfo.NotificationReason.fields = { + notificationReasonType: { + enumType: exports2.TypeInfo.NotificationReasonType + } + }; + exports2.TypeInfo.NotificationStatistic.fields = { + date: { + isDate: true + }, + type: { + enumType: exports2.TypeInfo.NotificationStatisticType + } + }; + exports2.TypeInfo.NotificationStatisticsQuery.fields = { + conditions: { + isArray: true, + typeInfo: exports2.TypeInfo.NotificationStatisticsQueryConditions + } + }; + exports2.TypeInfo.NotificationStatisticsQueryConditions.fields = { + endDate: { + isDate: true + }, + startDate: { + isDate: true + }, + type: { + enumType: exports2.TypeInfo.NotificationStatisticType + } + }; + exports2.TypeInfo.NotificationSubscriber.fields = { + deliveryPreference: { + enumType: exports2.TypeInfo.NotificationSubscriberDeliveryPreference + }, + flags: { + enumType: exports2.TypeInfo.SubscriberFlags + } + }; + exports2.TypeInfo.NotificationSubscriberUpdateParameters.fields = { + deliveryPreference: { + enumType: exports2.TypeInfo.NotificationSubscriberDeliveryPreference + } + }; + exports2.TypeInfo.NotificationSubscription.fields = { + diagnostics: { + typeInfo: exports2.TypeInfo.SubscriptionDiagnostics + }, + flags: { + enumType: exports2.TypeInfo.SubscriptionFlags + }, + modifiedDate: { + isDate: true + }, + permissions: { + enumType: exports2.TypeInfo.SubscriptionPermissions + }, + status: { + enumType: exports2.TypeInfo.SubscriptionStatus + } + }; + exports2.TypeInfo.NotificationSubscriptionTemplate.fields = { + notificationEventInformation: { + typeInfo: exports2.TypeInfo.NotificationEventType + }, + type: { + enumType: exports2.TypeInfo.SubscriptionTemplateType + } + }; + exports2.TypeInfo.NotificationSubscriptionUpdateParameters.fields = { + status: { + enumType: exports2.TypeInfo.SubscriptionStatus + } + }; + exports2.TypeInfo.SubscriptionDiagnostics.fields = { + deliveryResults: { + typeInfo: exports2.TypeInfo.SubscriptionTracing + }, + deliveryTracing: { + typeInfo: exports2.TypeInfo.SubscriptionTracing + }, + evaluationTracing: { + typeInfo: exports2.TypeInfo.SubscriptionTracing + } + }; + exports2.TypeInfo.SubscriptionEvaluationRequest.fields = { + minEventsCreatedDate: { + isDate: true + } + }; + exports2.TypeInfo.SubscriptionEvaluationResult.fields = { + evaluationJobStatus: { + enumType: exports2.TypeInfo.EvaluationOperationStatus + } + }; + exports2.TypeInfo.SubscriptionQuery.fields = { + conditions: { + isArray: true, + typeInfo: exports2.TypeInfo.SubscriptionQueryCondition + }, + queryFlags: { + enumType: exports2.TypeInfo.SubscriptionQueryFlags + } + }; + exports2.TypeInfo.SubscriptionQueryCondition.fields = { + flags: { + enumType: exports2.TypeInfo.SubscriptionFlags + } + }; + exports2.TypeInfo.SubscriptionTraceDiagnosticLog.fields = { + endTime: { + isDate: true + }, + startTime: { + isDate: true + } + }; + exports2.TypeInfo.SubscriptionTraceEventProcessingLog.fields = { + endTime: { + isDate: true + }, + startTime: { + isDate: true + } + }; + exports2.TypeInfo.SubscriptionTraceNotificationDeliveryLog.fields = { + endTime: { + isDate: true + }, + startTime: { + isDate: true + } + }; + exports2.TypeInfo.SubscriptionTracing.fields = { + endDate: { + isDate: true + }, + startDate: { + isDate: true + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/NotificationApi.js +var require_NotificationApi = __commonJS({ + "../node_modules/azure-devops-node-api/NotificationApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NotificationApi = void 0; + var basem = require_ClientApiBases(); + var NotificationInterfaces = require_NotificationInterfaces(); + var VSSInterfaces = require_VSSInterfaces(); + var NotificationApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Notification-api", options); + } + /** + * @param {NotificationInterfaces.BatchNotificationOperation} operation + */ + performBatchNotificationOperations(operation) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "8f3c6ab2-5bae-4537-b16e-f84e0955599e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, operation, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of diagnostic logs for this service. + * + * @param {string} source - ID specifying which type of logs to check diagnostics for. + * @param {string} entryId - The ID of the specific log to query for. + * @param {Date} startTime - Start time for the time range to query in. + * @param {Date} endTime - End time for the time range to query in. + */ + listLogs(source, entryId, startTime, endTime) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + source, + entryId + }; + let queryValues = { + startTime, + endTime + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "991842f3-eb16-4aea-ac81-81353ef2b75c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.INotificationDiagnosticLog, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the diagnostics settings for a subscription. + * + * @param {string} subscriptionId - The id of the notifications subscription. + */ + getSubscriptionDiagnostics(subscriptionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + subscriptionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "20f1929d-4be7-4c2e-a74e-d47640ff3418", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.SubscriptionDiagnostics, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update the diagnostics settings for a subscription. + * + * @param {NotificationInterfaces.UpdateSubscripitonDiagnosticsParameters} updateParameters + * @param {string} subscriptionId - The id of the notifications subscription. + */ + updateSubscriptionDiagnostics(updateParameters, subscriptionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + subscriptionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "20f1929d-4be7-4c2e-a74e-d47640ff3418", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, updateParameters, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.SubscriptionDiagnostics, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Publish an event. This request must be directed to the service "extmgmt". + * + * @param {VSSInterfaces.VssNotificationEvent} notificationEvent + */ + publishEvent(notificationEvent) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "14c57b7a-c0e6-4555-9f51-e067188fdd8e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, notificationEvent, options); + let ret = this.formatResponse(res.result, VSSInterfaces.TypeInfo.VssNotificationEvent, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Tranform a notification event. + * + * @param {NotificationInterfaces.EventTransformRequest} transformRequest - Object to be transformed. + */ + transformEvent(transformRequest) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "9463a800-1b44-450e-9083-f948ea174b45", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, transformRequest, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {NotificationInterfaces.FieldValuesQuery} inputValuesQuery + * @param {string} eventType + */ + queryEventTypes(inputValuesQuery, eventType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + eventType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "b5bbdd21-c178-4398-b6db-0166d910028a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, inputValuesQuery, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationEventField, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a specific event type. + * + * @param {string} eventType - The ID of the event type. + */ + getEventType(eventType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + eventType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "cc84fb5f-6247-4c7a-aeae-e5a3c3fddb21", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationEventType, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * List available event types for this service. Optionally filter by only event types for the specified publisher. + * + * @param {string} publisherId - Limit to event types for this publisher + */ + listEventTypes(publisherId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + publisherId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "cc84fb5f-6247-4c7a-aeae-e5a3c3fddb21", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationEventType, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} notificationId + */ + getNotificationReasons(notificationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + notificationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "19824fa9-1c76-40e6-9cce-cf0b9ca1cb60", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationReason, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} notificationIds + */ + listNotificationReasons(notificationIds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + notificationIds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "19824fa9-1c76-40e6-9cce-cf0b9ca1cb60", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationReason, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + */ + getSettings() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "cbe076d8-2803-45ff-8d8d-44653686ea2a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationAdminSettings, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {NotificationInterfaces.NotificationAdminSettingsUpdateParameters} updateParameters + */ + updateSettings(updateParameters) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "cbe076d8-2803-45ff-8d8d-44653686ea2a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, updateParameters, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationAdminSettings, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get delivery preferences of a notifications subscriber. + * + * @param {string} subscriberId - ID of the user or group. + */ + getSubscriber(subscriberId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + subscriberId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "4d5caff1-25ba-430b-b808-7a1f352cc197", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationSubscriber, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update delivery preferences of a notifications subscriber. + * + * @param {NotificationInterfaces.NotificationSubscriberUpdateParameters} updateParameters + * @param {string} subscriberId - ID of the user or group. + */ + updateSubscriber(updateParameters, subscriberId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + subscriberId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "4d5caff1-25ba-430b-b808-7a1f352cc197", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, updateParameters, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationSubscriber, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Query for subscriptions. A subscription is returned if it matches one or more of the specified conditions. + * + * @param {NotificationInterfaces.SubscriptionQuery} subscriptionQuery + */ + querySubscriptions(subscriptionQuery) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "6864db85-08c0-4006-8e8e-cc1bebe31675", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, subscriptionQuery, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationSubscription, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a new subscription. + * + * @param {NotificationInterfaces.NotificationSubscriptionCreateParameters} createParameters + */ + createSubscription(createParameters) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "70f911d6-abac-488c-85b3-a206bf57e165", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, createParameters, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationSubscription, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a subscription. + * + * @param {string} subscriptionId + */ + deleteSubscription(subscriptionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + subscriptionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "70f911d6-abac-488c-85b3-a206bf57e165", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a notification subscription by its ID. + * + * @param {string} subscriptionId + * @param {NotificationInterfaces.SubscriptionQueryFlags} queryFlags + */ + getSubscription(subscriptionId, queryFlags) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + subscriptionId + }; + let queryValues = { + queryFlags + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "70f911d6-abac-488c-85b3-a206bf57e165", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationSubscription, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of notification subscriptions, either by subscription IDs or by all subscriptions for a given user or group. + * + * @param {string} targetId - User or Group ID + * @param {string[]} ids - List of subscription IDs + * @param {NotificationInterfaces.SubscriptionQueryFlags} queryFlags + */ + listSubscriptions(targetId, ids, queryFlags) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + targetId, + ids: ids && ids.join(","), + queryFlags + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "70f911d6-abac-488c-85b3-a206bf57e165", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationSubscription, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update an existing subscription. Depending on the type of subscription and permissions, the caller can update the description, filter settings, channel (delivery) settings and more. + * + * @param {NotificationInterfaces.NotificationSubscriptionUpdateParameters} updateParameters + * @param {string} subscriptionId + */ + updateSubscription(updateParameters, subscriptionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + subscriptionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "70f911d6-abac-488c-85b3-a206bf57e165", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, updateParameters, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationSubscription, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get available subscription templates. + * + */ + getSubscriptionTemplates() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "fa5d24ba-7484-4f3d-888d-4ec6b1974082", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, NotificationInterfaces.TypeInfo.NotificationSubscriptionTemplate, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Publish an event. This request is only for the Token service since it's a deploy only service. + * + * @param {VSSInterfaces.VssNotificationEvent} notificationEvent + */ + publishTokenEvent(notificationEvent) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "31dc86a2-67e8-4452-99a4-2b301ba28291", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, notificationEvent, options); + let ret = this.formatResponse(res.result, VSSInterfaces.TypeInfo.VssNotificationEvent, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update the specified user's settings for the specified subscription. This API is typically used to opt in or out of a shared subscription. User settings can only be applied to shared subscriptions, like team subscriptions or default subscriptions. + * + * @param {NotificationInterfaces.SubscriptionUserSettings} userSettings + * @param {string} subscriptionId + * @param {string} userId - ID of the user + */ + updateSubscriptionUserSettings(userSettings, subscriptionId, userId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + subscriptionId, + userId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "notification", "ed5a3dff-aeb5-41b1-b4f7-89e66e58b62e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, userSettings, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.NotificationApi = NotificationApi; + } +}); + +// ../node_modules/azure-devops-node-api/PolicyApi.js +var require_PolicyApi = __commonJS({ + "../node_modules/azure-devops-node-api/PolicyApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.PolicyApi = void 0; + var basem = require_ClientApiBases(); + var PolicyInterfaces = require_PolicyInterfaces(); + var PolicyApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Policy-api", options); + } + /** + * Create a policy configuration of a given policy type. + * + * @param {PolicyInterfaces.PolicyConfiguration} configuration - The policy configuration to create. + * @param {string} project - Project ID or project name + */ + createPolicyConfiguration(configuration, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "policy", "dad91cbe-d183-45f8-9c6e-9c1164472121", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, configuration, options); + let ret = this.formatResponse(res.result, PolicyInterfaces.TypeInfo.PolicyConfiguration, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a policy configuration by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} configurationId - ID of the policy configuration to delete. + */ + deletePolicyConfiguration(project, configurationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + configurationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "policy", "dad91cbe-d183-45f8-9c6e-9c1164472121", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a policy configuration by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} configurationId - ID of the policy configuration + */ + getPolicyConfiguration(project, configurationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + configurationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "policy", "dad91cbe-d183-45f8-9c6e-9c1164472121", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PolicyInterfaces.TypeInfo.PolicyConfiguration, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of policy configurations in a project. + * + * @param {string} project - Project ID or project name + * @param {string} scope - [Provided for legacy reasons] The scope on which a subset of policies is defined. + * @param {string} policyType - Filter returned policies to only this type + */ + getPolicyConfigurations(project, scope, policyType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + scope, + policyType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "policy", "dad91cbe-d183-45f8-9c6e-9c1164472121", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PolicyInterfaces.TypeInfo.PolicyConfiguration, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a policy configuration by its ID. + * + * @param {PolicyInterfaces.PolicyConfiguration} configuration - The policy configuration to update. + * @param {string} project - Project ID or project name + * @param {number} configurationId - ID of the existing policy configuration to be updated. + */ + updatePolicyConfiguration(configuration, project, configurationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + configurationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "policy", "dad91cbe-d183-45f8-9c6e-9c1164472121", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, configuration, options); + let ret = this.formatResponse(res.result, PolicyInterfaces.TypeInfo.PolicyConfiguration, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the present evaluation state of a policy. + * + * @param {string} project - Project ID or project name + * @param {string} evaluationId - ID of the policy evaluation to be retrieved. + */ + getPolicyEvaluation(project, evaluationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + evaluationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "policy", "46aecb7a-5d2c-4647-897b-0209505a9fe4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PolicyInterfaces.TypeInfo.PolicyEvaluationRecord, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Requeue the policy evaluation. + * + * @param {string} project - Project ID or project name + * @param {string} evaluationId - ID of the policy evaluation to be retrieved. + */ + requeuePolicyEvaluation(project, evaluationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + evaluationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "policy", "46aecb7a-5d2c-4647-897b-0209505a9fe4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, null, options); + let ret = this.formatResponse(res.result, PolicyInterfaces.TypeInfo.PolicyEvaluationRecord, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieves a list of all the policy evaluation statuses for a specific pull request. + * + * @param {string} project - Project ID or project name + * @param {string} artifactId - A string which uniquely identifies the target of a policy evaluation. + * @param {boolean} includeNotApplicable - Some policies might determine that they do not apply to a specific pull request. Setting this parameter to true will return evaluation records even for policies which don't apply to this pull request. + * @param {number} top - The number of policy evaluation records to retrieve. + * @param {number} skip - The number of policy evaluation records to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100. + */ + getPolicyEvaluations(project, artifactId, includeNotApplicable, top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + if (artifactId == null) { + throw new TypeError("artifactId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + artifactId, + includeNotApplicable, + "$top": top, + "$skip": skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "policy", "c23ddff5-229c-4d04-a80b-0fdce9f360c8", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PolicyInterfaces.TypeInfo.PolicyEvaluationRecord, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a specific revision of a given policy by ID. + * + * @param {string} project - Project ID or project name + * @param {number} configurationId - The policy configuration ID. + * @param {number} revisionId - The revision ID. + */ + getPolicyConfigurationRevision(project, configurationId, revisionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + configurationId, + revisionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "policy", "fe1e68a2-60d3-43cb-855b-85e41ae97c95", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PolicyInterfaces.TypeInfo.PolicyConfiguration, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve all revisions for a given policy. + * + * @param {string} project - Project ID or project name + * @param {number} configurationId - The policy configuration ID. + * @param {number} top - The number of revisions to retrieve. + * @param {number} skip - The number of revisions to ignore. For example, to retrieve results 101-150, set top to 50 and skip to 100. + */ + getPolicyConfigurationRevisions(project, configurationId, top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + configurationId + }; + let queryValues = { + "$top": top, + "$skip": skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "policy", "fe1e68a2-60d3-43cb-855b-85e41ae97c95", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PolicyInterfaces.TypeInfo.PolicyConfiguration, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a specific policy type by ID. + * + * @param {string} project - Project ID or project name + * @param {string} typeId - The policy ID. + */ + getPolicyType(project, typeId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + typeId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "policy", "44096322-2d3d-466a-bb30-d1b7de69f61f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve all available policy types. + * + * @param {string} project - Project ID or project name + */ + getPolicyTypes(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "policy", "44096322-2d3d-466a-bb30-d1b7de69f61f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.PolicyApi = PolicyApi; + PolicyApi.RESOURCE_AREA_ID = "fb13a388-40dd-4a04-b530-013a739c72ef"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/ProfileInterfaces.js +var require_ProfileInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/ProfileInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.AvatarSize = void 0; + var AvatarSize; + (function(AvatarSize2) { + AvatarSize2[AvatarSize2["Small"] = 0] = "Small"; + AvatarSize2[AvatarSize2["Medium"] = 1] = "Medium"; + AvatarSize2[AvatarSize2["Large"] = 2] = "Large"; + })(AvatarSize = exports2.AvatarSize || (exports2.AvatarSize = {})); + exports2.TypeInfo = { + AttributeDescriptor: { + fields: null + }, + AttributesContainer: { + fields: null + }, + Avatar: { + fields: null + }, + AvatarSize: { + enumValues: { + "small": 0, + "medium": 1, + "large": 2 + } + }, + CoreProfileAttribute: { + fields: null + }, + Country: { + fields: null + }, + CreateProfileContext: { + fields: null + }, + GeoRegion: { + fields: null + }, + Profile: { + fields: null + }, + ProfileAttribute: { + fields: null + }, + ProfileAttributeBase: { + fields: null + }, + ProfileRegion: { + fields: null + }, + ProfileRegions: { + fields: null + } + }; + exports2.TypeInfo.AttributeDescriptor.fields = {}; + exports2.TypeInfo.AttributesContainer.fields = { + attributes: {} + }; + exports2.TypeInfo.Avatar.fields = { + size: { + enumType: exports2.TypeInfo.AvatarSize + }, + timeStamp: { + isDate: true + } + }; + exports2.TypeInfo.CoreProfileAttribute.fields = { + descriptor: { + typeInfo: exports2.TypeInfo.AttributeDescriptor + }, + timeStamp: { + isDate: true + } + }; + exports2.TypeInfo.Country.fields = {}; + exports2.TypeInfo.CreateProfileContext.fields = {}; + exports2.TypeInfo.GeoRegion.fields = {}; + exports2.TypeInfo.Profile.fields = { + applicationContainer: { + typeInfo: exports2.TypeInfo.AttributesContainer + }, + coreAttributes: {}, + timeStamp: { + isDate: true + } + }; + exports2.TypeInfo.ProfileAttribute.fields = { + descriptor: { + typeInfo: exports2.TypeInfo.AttributeDescriptor + }, + timeStamp: { + isDate: true + } + }; + exports2.TypeInfo.ProfileAttributeBase.fields = { + descriptor: { + typeInfo: exports2.TypeInfo.AttributeDescriptor + }, + timeStamp: { + isDate: true + } + }; + exports2.TypeInfo.ProfileRegion.fields = {}; + exports2.TypeInfo.ProfileRegions.fields = { + regions: { + isArray: true, + typeInfo: exports2.TypeInfo.ProfileRegion + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/ProfileApi.js +var require_ProfileApi = __commonJS({ + "../node_modules/azure-devops-node-api/ProfileApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ProfileApi = void 0; + var basem = require_ClientApiBases(); + var ProfileInterfaces = require_ProfileInterfaces(); + var ProfileApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Profile-api", options); + } + /** + * @param {string} id + * @param {string} descriptor + */ + deleteProfileAttribute(id, descriptor) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + let queryValues = { + descriptor + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.2", "Profile", "1392b6ac-d511-492e-af5b-2263e5545a5d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} id + * @param {string} descriptor + */ + getProfileAttribute(id, descriptor) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + let queryValues = { + descriptor + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.2", "Profile", "1392b6ac-d511-492e-af5b-2263e5545a5d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.ProfileAttribute, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} id + * @param {string} partition + * @param {string} modifiedSince + * @param {string} modifiedAfterRevision + * @param {boolean} withCoreAttributes + * @param {string} coreAttributes + */ + getProfileAttributes(id, partition, modifiedSince, modifiedAfterRevision, withCoreAttributes, coreAttributes) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + let queryValues = { + partition, + modifiedSince, + modifiedAfterRevision, + withCoreAttributes, + coreAttributes + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.2", "Profile", "1392b6ac-d511-492e-af5b-2263e5545a5d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.ProfileAttribute, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {any} container + * @param {string} id + * @param {string} descriptor + */ + setProfileAttribute(container, id, descriptor) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + let queryValues = { + descriptor + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.2", "Profile", "1392b6ac-d511-492e-af5b-2263e5545a5d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, container, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {VSSInterfaces.VssJsonCollectionWrapperV[]>} attributesCollection + * @param {string} id + */ + setProfileAttributes(attributesCollection, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.2", "Profile", "1392b6ac-d511-492e-af5b-2263e5545a5d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, attributesCollection, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} id + * @param {string} size + * @param {string} format + */ + getAvatar(id, size2, format) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + let queryValues = { + size: size2, + format + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "67436615-b382-462a-b659-5367a492fb3c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.Avatar, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {any} container + * @param {string} id + * @param {string} size + * @param {string} format + * @param {string} displayName + */ + getAvatarPreview(container, id, size2, format, displayName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + let queryValues = { + size: size2, + format, + displayName + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "67436615-b382-462a-b659-5367a492fb3c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, container, options); + let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.Avatar, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} id + */ + resetAvatar(id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "67436615-b382-462a-b659-5367a492fb3c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {any} container + * @param {string} id + */ + setAvatar(container, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "67436615-b382-462a-b659-5367a492fb3c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, container, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Lookup up country/region based on provided IPv4, null if using the remote IPv4 address. + * + * @param {string} ipaddress - IPv4 address to be used for reverse lookup, null if using RemoteIPAddress in request context + */ + getGeoRegion(ipaddress) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + ipaddress + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "3bcda9c0-3078-48a5-a1e0-83bd05931ad0", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create profile + * + * @param {ProfileInterfaces.CreateProfileContext} createProfileContext - Context for profile creation + * @param {boolean} autoCreate - Create profile automatically + */ + createProfile(createProfileContext, autoCreate) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + autoCreate + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.3", "Profile", "f83735dc-483f-4238-a291-d45f6080a9af", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, createProfileContext, options); + let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.Profile, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} id + * @param {boolean} details + * @param {boolean} withAttributes + * @param {string} partition + * @param {string} coreAttributes + * @param {boolean} forceRefresh + */ + getProfile(id, details, withAttributes, partition, coreAttributes, forceRefresh) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + let queryValues = { + details, + withAttributes, + partition, + coreAttributes, + forceRefresh + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.3", "Profile", "f83735dc-483f-4238-a291-d45f6080a9af", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.Profile, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update profile + * + * @param {ProfileInterfaces.Profile} profile - Update profile + * @param {string} id - Profile ID + */ + updateProfile(profile, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.3", "Profile", "f83735dc-483f-4238-a291-d45f6080a9af", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, profile, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + */ + getRegions() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "92d8d1c9-26b8-4774-a929-d640a73da524", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + */ + getSupportedLcids() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "d5bd1aa6-c269-4bcd-ad32-75fa17475584", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {boolean} includeAvatar + */ + getUserDefaults(includeAvatar) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + includeAvatar + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "b583a356-1da7-4237-9f4c-1deb2edbc7e8", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.Profile, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} id + */ + refreshUserDefaults(id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "Profile", "b583a356-1da7-4237-9f4c-1deb2edbc7e8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, options); + let ret = this.formatResponse(res.result, ProfileInterfaces.TypeInfo.Profile, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.ProfileApi = ProfileApi; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/ProjectAnalysisInterfaces.js +var require_ProjectAnalysisInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/ProjectAnalysisInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.ResultPhase = exports2.AggregationType = void 0; + var AggregationType; + (function(AggregationType2) { + AggregationType2[AggregationType2["Hourly"] = 0] = "Hourly"; + AggregationType2[AggregationType2["Daily"] = 1] = "Daily"; + })(AggregationType = exports2.AggregationType || (exports2.AggregationType = {})); + var ResultPhase; + (function(ResultPhase2) { + ResultPhase2[ResultPhase2["Preliminary"] = 0] = "Preliminary"; + ResultPhase2[ResultPhase2["Full"] = 1] = "Full"; + })(ResultPhase = exports2.ResultPhase || (exports2.ResultPhase = {})); + exports2.TypeInfo = { + AggregationType: { + enumValues: { + "hourly": 0, + "daily": 1 + } + }, + CodeChangeTrendItem: {}, + ProjectActivityMetrics: {}, + ProjectLanguageAnalytics: {}, + RepositoryActivityMetrics: {}, + RepositoryLanguageAnalytics: {}, + ResultPhase: { + enumValues: { + "preliminary": 0, + "full": 1 + } + } + }; + exports2.TypeInfo.CodeChangeTrendItem.fields = { + time: { + isDate: true + } + }; + exports2.TypeInfo.ProjectActivityMetrics.fields = { + codeChangesTrend: { + isArray: true, + typeInfo: exports2.TypeInfo.CodeChangeTrendItem + } + }; + exports2.TypeInfo.ProjectLanguageAnalytics.fields = { + repositoryLanguageAnalytics: { + isArray: true, + typeInfo: exports2.TypeInfo.RepositoryLanguageAnalytics + }, + resultPhase: { + enumType: exports2.TypeInfo.ResultPhase + } + }; + exports2.TypeInfo.RepositoryActivityMetrics.fields = { + codeChangesTrend: { + isArray: true, + typeInfo: exports2.TypeInfo.CodeChangeTrendItem + } + }; + exports2.TypeInfo.RepositoryLanguageAnalytics.fields = { + resultPhase: { + enumType: exports2.TypeInfo.ResultPhase + }, + updatedTime: { + isDate: true + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/ProjectAnalysisApi.js +var require_ProjectAnalysisApi = __commonJS({ + "../node_modules/azure-devops-node-api/ProjectAnalysisApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ProjectAnalysisApi = void 0; + var basem = require_ClientApiBases(); + var ProjectAnalysisInterfaces = require_ProjectAnalysisInterfaces(); + var ProjectAnalysisApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-ProjectAnalysis-api", options); + } + /** + * @param {string} project - Project ID or project name + */ + getProjectLanguageAnalytics(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "projectanalysis", "5b02a779-1867-433f-90b7-d23ed5e33e57", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ProjectAnalysisInterfaces.TypeInfo.ProjectLanguageAnalytics, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {Date} fromDate + * @param {ProjectAnalysisInterfaces.AggregationType} aggregationType + */ + getProjectActivityMetrics(project, fromDate, aggregationType) { + return __awaiter2(this, void 0, void 0, function* () { + if (fromDate == null) { + throw new TypeError("fromDate can not be null or undefined"); + } + if (aggregationType == null) { + throw new TypeError("aggregationType can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + fromDate, + aggregationType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "projectanalysis", "e40ae584-9ea6-4f06-a7c7-6284651b466b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ProjectAnalysisInterfaces.TypeInfo.ProjectActivityMetrics, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieves git activity metrics for repositories matching a specified criteria. + * + * @param {string} project - Project ID or project name + * @param {Date} fromDate - Date from which, the trends are to be fetched. + * @param {ProjectAnalysisInterfaces.AggregationType} aggregationType - Bucket size on which, trends are to be aggregated. + * @param {number} skip - The number of repositories to ignore. + * @param {number} top - The number of repositories for which activity metrics are to be retrieved. + */ + getGitRepositoriesActivityMetrics(project, fromDate, aggregationType, skip, top) { + return __awaiter2(this, void 0, void 0, function* () { + if (fromDate == null) { + throw new TypeError("fromDate can not be null or undefined"); + } + if (aggregationType == null) { + throw new TypeError("aggregationType can not be null or undefined"); + } + if (skip == null) { + throw new TypeError("skip can not be null or undefined"); + } + if (top == null) { + throw new TypeError("top can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + fromDate, + aggregationType, + "$skip": skip, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "projectanalysis", "df7fbbca-630a-40e3-8aa3-7a3faf66947e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ProjectAnalysisInterfaces.TypeInfo.RepositoryActivityMetrics, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} repositoryId + * @param {Date} fromDate + * @param {ProjectAnalysisInterfaces.AggregationType} aggregationType + */ + getRepositoryActivityMetrics(project, repositoryId, fromDate, aggregationType) { + return __awaiter2(this, void 0, void 0, function* () { + if (fromDate == null) { + throw new TypeError("fromDate can not be null or undefined"); + } + if (aggregationType == null) { + throw new TypeError("aggregationType can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + repositoryId + }; + let queryValues = { + fromDate, + aggregationType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "projectanalysis", "df7fbbca-630a-40e3-8aa3-7a3faf66947e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ProjectAnalysisInterfaces.TypeInfo.RepositoryActivityMetrics, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.ProjectAnalysisApi = ProjectAnalysisApi; + ProjectAnalysisApi.RESOURCE_AREA_ID = "7658fa33-b1bf-4580-990f-fac5896773d3"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/common/FormInputInterfaces.js +var require_FormInputInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/common/FormInputInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.InputMode = exports2.InputFilterOperator = exports2.InputDataType = void 0; + var InputDataType; + (function(InputDataType2) { + InputDataType2[InputDataType2["None"] = 0] = "None"; + InputDataType2[InputDataType2["String"] = 10] = "String"; + InputDataType2[InputDataType2["Number"] = 20] = "Number"; + InputDataType2[InputDataType2["Boolean"] = 30] = "Boolean"; + InputDataType2[InputDataType2["Guid"] = 40] = "Guid"; + InputDataType2[InputDataType2["Uri"] = 50] = "Uri"; + })(InputDataType = exports2.InputDataType || (exports2.InputDataType = {})); + var InputFilterOperator; + (function(InputFilterOperator2) { + InputFilterOperator2[InputFilterOperator2["Equals"] = 0] = "Equals"; + InputFilterOperator2[InputFilterOperator2["NotEquals"] = 1] = "NotEquals"; + })(InputFilterOperator = exports2.InputFilterOperator || (exports2.InputFilterOperator = {})); + var InputMode; + (function(InputMode2) { + InputMode2[InputMode2["None"] = 0] = "None"; + InputMode2[InputMode2["TextBox"] = 10] = "TextBox"; + InputMode2[InputMode2["PasswordBox"] = 20] = "PasswordBox"; + InputMode2[InputMode2["Combo"] = 30] = "Combo"; + InputMode2[InputMode2["RadioButtons"] = 40] = "RadioButtons"; + InputMode2[InputMode2["CheckBox"] = 50] = "CheckBox"; + InputMode2[InputMode2["TextArea"] = 60] = "TextArea"; + })(InputMode = exports2.InputMode || (exports2.InputMode = {})); + exports2.TypeInfo = { + InputDataType: { + enumValues: { + "none": 0, + "string": 10, + "number": 20, + "boolean": 30, + "guid": 40, + "uri": 50 + } + }, + InputDescriptor: { + fields: null + }, + InputFilter: { + fields: null + }, + InputFilterCondition: { + fields: null + }, + InputFilterOperator: { + enumValues: { + "equals": 0, + "notEquals": 1 + } + }, + InputMode: { + enumValues: { + "none": 0, + "textBox": 10, + "passwordBox": 20, + "combo": 30, + "radioButtons": 40, + "checkBox": 50, + "textArea": 60 + } + }, + InputValidation: { + fields: null + }, + InputValue: { + fields: null + }, + InputValues: { + fields: null + }, + InputValuesError: { + fields: null + }, + InputValuesQuery: { + fields: null + } + }; + exports2.TypeInfo.InputDescriptor.fields = { + inputMode: { + enumType: exports2.TypeInfo.InputMode + }, + validation: { + typeInfo: exports2.TypeInfo.InputValidation + }, + values: { + typeInfo: exports2.TypeInfo.InputValues + } + }; + exports2.TypeInfo.InputFilter.fields = { + conditions: { + isArray: true, + typeInfo: exports2.TypeInfo.InputFilterCondition + } + }; + exports2.TypeInfo.InputFilterCondition.fields = { + operator: { + enumType: exports2.TypeInfo.InputFilterOperator + } + }; + exports2.TypeInfo.InputValidation.fields = { + dataType: { + enumType: exports2.TypeInfo.InputDataType + } + }; + exports2.TypeInfo.InputValue.fields = {}; + exports2.TypeInfo.InputValues.fields = { + error: { + typeInfo: exports2.TypeInfo.InputValuesError + }, + possibleValues: { + isArray: true, + typeInfo: exports2.TypeInfo.InputValue + } + }; + exports2.TypeInfo.InputValuesError.fields = {}; + exports2.TypeInfo.InputValuesQuery.fields = { + inputValues: { + isArray: true, + typeInfo: exports2.TypeInfo.InputValues + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/ReleaseInterfaces.js +var require_ReleaseInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/ReleaseInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.YamlFileSourceTypes = exports2.VariableGroupActionFilter = exports2.TaskStatus = exports2.SingleReleaseExpands = exports2.SenderType = exports2.ScheduleDays = exports2.ReleaseTriggerType = exports2.ReleaseStatus = exports2.ReleaseReason = exports2.ReleaseQueryOrder = exports2.ReleaseExpands = exports2.ReleaseEnvironmentExpands = exports2.ReleaseDefinitionSource = exports2.ReleaseDefinitionQueryOrder = exports2.ReleaseDefinitionExpands = exports2.PullRequestSystemType = exports2.PropertySelectorType = exports2.PipelineProcessTypes = exports2.ParallelExecutionTypes = exports2.ManualInterventionStatus = exports2.MailSectionType = exports2.IssueSource = exports2.GateStatus = exports2.FolderPathQueryOrder = exports2.EnvironmentTriggerType = exports2.EnvironmentStatus = exports2.DeployPhaseTypes = exports2.DeployPhaseStatus = exports2.DeploymentStatus = exports2.DeploymentsQueryType = exports2.DeploymentReason = exports2.DeploymentOperationStatus = exports2.DeploymentExpands = exports2.DeploymentAuthorizationOwner = exports2.ConditionType = exports2.AuthorizationHeaderFor = exports2.AuditAction = exports2.ApprovalType = exports2.ApprovalStatus = exports2.ApprovalFilters = exports2.ApprovalExecutionOrder = exports2.AgentArtifactType = void 0; + var FormInputInterfaces = require_FormInputInterfaces(); + var AgentArtifactType; + (function(AgentArtifactType2) { + AgentArtifactType2[AgentArtifactType2["XamlBuild"] = 0] = "XamlBuild"; + AgentArtifactType2[AgentArtifactType2["Build"] = 1] = "Build"; + AgentArtifactType2[AgentArtifactType2["Jenkins"] = 2] = "Jenkins"; + AgentArtifactType2[AgentArtifactType2["FileShare"] = 3] = "FileShare"; + AgentArtifactType2[AgentArtifactType2["Nuget"] = 4] = "Nuget"; + AgentArtifactType2[AgentArtifactType2["TfsOnPrem"] = 5] = "TfsOnPrem"; + AgentArtifactType2[AgentArtifactType2["GitHub"] = 6] = "GitHub"; + AgentArtifactType2[AgentArtifactType2["TFGit"] = 7] = "TFGit"; + AgentArtifactType2[AgentArtifactType2["ExternalTfsBuild"] = 8] = "ExternalTfsBuild"; + AgentArtifactType2[AgentArtifactType2["Custom"] = 9] = "Custom"; + AgentArtifactType2[AgentArtifactType2["Tfvc"] = 10] = "Tfvc"; + })(AgentArtifactType = exports2.AgentArtifactType || (exports2.AgentArtifactType = {})); + var ApprovalExecutionOrder; + (function(ApprovalExecutionOrder2) { + ApprovalExecutionOrder2[ApprovalExecutionOrder2["BeforeGates"] = 1] = "BeforeGates"; + ApprovalExecutionOrder2[ApprovalExecutionOrder2["AfterSuccessfulGates"] = 2] = "AfterSuccessfulGates"; + ApprovalExecutionOrder2[ApprovalExecutionOrder2["AfterGatesAlways"] = 4] = "AfterGatesAlways"; + })(ApprovalExecutionOrder = exports2.ApprovalExecutionOrder || (exports2.ApprovalExecutionOrder = {})); + var ApprovalFilters; + (function(ApprovalFilters2) { + ApprovalFilters2[ApprovalFilters2["None"] = 0] = "None"; + ApprovalFilters2[ApprovalFilters2["ManualApprovals"] = 1] = "ManualApprovals"; + ApprovalFilters2[ApprovalFilters2["AutomatedApprovals"] = 2] = "AutomatedApprovals"; + ApprovalFilters2[ApprovalFilters2["ApprovalSnapshots"] = 4] = "ApprovalSnapshots"; + ApprovalFilters2[ApprovalFilters2["All"] = 7] = "All"; + })(ApprovalFilters = exports2.ApprovalFilters || (exports2.ApprovalFilters = {})); + var ApprovalStatus; + (function(ApprovalStatus2) { + ApprovalStatus2[ApprovalStatus2["Undefined"] = 0] = "Undefined"; + ApprovalStatus2[ApprovalStatus2["Pending"] = 1] = "Pending"; + ApprovalStatus2[ApprovalStatus2["Approved"] = 2] = "Approved"; + ApprovalStatus2[ApprovalStatus2["Rejected"] = 4] = "Rejected"; + ApprovalStatus2[ApprovalStatus2["Reassigned"] = 6] = "Reassigned"; + ApprovalStatus2[ApprovalStatus2["Canceled"] = 7] = "Canceled"; + ApprovalStatus2[ApprovalStatus2["Skipped"] = 8] = "Skipped"; + })(ApprovalStatus = exports2.ApprovalStatus || (exports2.ApprovalStatus = {})); + var ApprovalType; + (function(ApprovalType2) { + ApprovalType2[ApprovalType2["Undefined"] = 0] = "Undefined"; + ApprovalType2[ApprovalType2["PreDeploy"] = 1] = "PreDeploy"; + ApprovalType2[ApprovalType2["PostDeploy"] = 2] = "PostDeploy"; + ApprovalType2[ApprovalType2["All"] = 3] = "All"; + })(ApprovalType = exports2.ApprovalType || (exports2.ApprovalType = {})); + var AuditAction; + (function(AuditAction2) { + AuditAction2[AuditAction2["Add"] = 1] = "Add"; + AuditAction2[AuditAction2["Update"] = 2] = "Update"; + AuditAction2[AuditAction2["Delete"] = 3] = "Delete"; + AuditAction2[AuditAction2["Undelete"] = 4] = "Undelete"; + })(AuditAction = exports2.AuditAction || (exports2.AuditAction = {})); + var AuthorizationHeaderFor; + (function(AuthorizationHeaderFor2) { + AuthorizationHeaderFor2[AuthorizationHeaderFor2["RevalidateApproverIdentity"] = 0] = "RevalidateApproverIdentity"; + AuthorizationHeaderFor2[AuthorizationHeaderFor2["OnBehalfOf"] = 1] = "OnBehalfOf"; + })(AuthorizationHeaderFor = exports2.AuthorizationHeaderFor || (exports2.AuthorizationHeaderFor = {})); + var ConditionType; + (function(ConditionType2) { + ConditionType2[ConditionType2["Undefined"] = 0] = "Undefined"; + ConditionType2[ConditionType2["Event"] = 1] = "Event"; + ConditionType2[ConditionType2["EnvironmentState"] = 2] = "EnvironmentState"; + ConditionType2[ConditionType2["Artifact"] = 4] = "Artifact"; + })(ConditionType = exports2.ConditionType || (exports2.ConditionType = {})); + var DeploymentAuthorizationOwner; + (function(DeploymentAuthorizationOwner2) { + DeploymentAuthorizationOwner2[DeploymentAuthorizationOwner2["Automatic"] = 0] = "Automatic"; + DeploymentAuthorizationOwner2[DeploymentAuthorizationOwner2["DeploymentSubmitter"] = 1] = "DeploymentSubmitter"; + DeploymentAuthorizationOwner2[DeploymentAuthorizationOwner2["FirstPreDeploymentApprover"] = 2] = "FirstPreDeploymentApprover"; + })(DeploymentAuthorizationOwner = exports2.DeploymentAuthorizationOwner || (exports2.DeploymentAuthorizationOwner = {})); + var DeploymentExpands; + (function(DeploymentExpands2) { + DeploymentExpands2[DeploymentExpands2["All"] = 0] = "All"; + DeploymentExpands2[DeploymentExpands2["DeploymentOnly"] = 1] = "DeploymentOnly"; + DeploymentExpands2[DeploymentExpands2["Approvals"] = 2] = "Approvals"; + DeploymentExpands2[DeploymentExpands2["Artifacts"] = 4] = "Artifacts"; + })(DeploymentExpands = exports2.DeploymentExpands || (exports2.DeploymentExpands = {})); + var DeploymentOperationStatus; + (function(DeploymentOperationStatus2) { + DeploymentOperationStatus2[DeploymentOperationStatus2["Undefined"] = 0] = "Undefined"; + DeploymentOperationStatus2[DeploymentOperationStatus2["Queued"] = 1] = "Queued"; + DeploymentOperationStatus2[DeploymentOperationStatus2["Scheduled"] = 2] = "Scheduled"; + DeploymentOperationStatus2[DeploymentOperationStatus2["Pending"] = 4] = "Pending"; + DeploymentOperationStatus2[DeploymentOperationStatus2["Approved"] = 8] = "Approved"; + DeploymentOperationStatus2[DeploymentOperationStatus2["Rejected"] = 16] = "Rejected"; + DeploymentOperationStatus2[DeploymentOperationStatus2["Deferred"] = 32] = "Deferred"; + DeploymentOperationStatus2[DeploymentOperationStatus2["QueuedForAgent"] = 64] = "QueuedForAgent"; + DeploymentOperationStatus2[DeploymentOperationStatus2["PhaseInProgress"] = 128] = "PhaseInProgress"; + DeploymentOperationStatus2[DeploymentOperationStatus2["PhaseSucceeded"] = 256] = "PhaseSucceeded"; + DeploymentOperationStatus2[DeploymentOperationStatus2["PhasePartiallySucceeded"] = 512] = "PhasePartiallySucceeded"; + DeploymentOperationStatus2[DeploymentOperationStatus2["PhaseFailed"] = 1024] = "PhaseFailed"; + DeploymentOperationStatus2[DeploymentOperationStatus2["Canceled"] = 2048] = "Canceled"; + DeploymentOperationStatus2[DeploymentOperationStatus2["PhaseCanceled"] = 4096] = "PhaseCanceled"; + DeploymentOperationStatus2[DeploymentOperationStatus2["ManualInterventionPending"] = 8192] = "ManualInterventionPending"; + DeploymentOperationStatus2[DeploymentOperationStatus2["QueuedForPipeline"] = 16384] = "QueuedForPipeline"; + DeploymentOperationStatus2[DeploymentOperationStatus2["Cancelling"] = 32768] = "Cancelling"; + DeploymentOperationStatus2[DeploymentOperationStatus2["EvaluatingGates"] = 65536] = "EvaluatingGates"; + DeploymentOperationStatus2[DeploymentOperationStatus2["GateFailed"] = 131072] = "GateFailed"; + DeploymentOperationStatus2[DeploymentOperationStatus2["All"] = 258047] = "All"; + })(DeploymentOperationStatus = exports2.DeploymentOperationStatus || (exports2.DeploymentOperationStatus = {})); + var DeploymentReason; + (function(DeploymentReason2) { + DeploymentReason2[DeploymentReason2["None"] = 0] = "None"; + DeploymentReason2[DeploymentReason2["Manual"] = 1] = "Manual"; + DeploymentReason2[DeploymentReason2["Automated"] = 2] = "Automated"; + DeploymentReason2[DeploymentReason2["Scheduled"] = 4] = "Scheduled"; + DeploymentReason2[DeploymentReason2["RedeployTrigger"] = 8] = "RedeployTrigger"; + })(DeploymentReason = exports2.DeploymentReason || (exports2.DeploymentReason = {})); + var DeploymentsQueryType; + (function(DeploymentsQueryType2) { + DeploymentsQueryType2[DeploymentsQueryType2["Regular"] = 1] = "Regular"; + DeploymentsQueryType2[DeploymentsQueryType2["FailingSince"] = 2] = "FailingSince"; + })(DeploymentsQueryType = exports2.DeploymentsQueryType || (exports2.DeploymentsQueryType = {})); + var DeploymentStatus; + (function(DeploymentStatus2) { + DeploymentStatus2[DeploymentStatus2["Undefined"] = 0] = "Undefined"; + DeploymentStatus2[DeploymentStatus2["NotDeployed"] = 1] = "NotDeployed"; + DeploymentStatus2[DeploymentStatus2["InProgress"] = 2] = "InProgress"; + DeploymentStatus2[DeploymentStatus2["Succeeded"] = 4] = "Succeeded"; + DeploymentStatus2[DeploymentStatus2["PartiallySucceeded"] = 8] = "PartiallySucceeded"; + DeploymentStatus2[DeploymentStatus2["Failed"] = 16] = "Failed"; + DeploymentStatus2[DeploymentStatus2["All"] = 31] = "All"; + })(DeploymentStatus = exports2.DeploymentStatus || (exports2.DeploymentStatus = {})); + var DeployPhaseStatus; + (function(DeployPhaseStatus2) { + DeployPhaseStatus2[DeployPhaseStatus2["Undefined"] = 0] = "Undefined"; + DeployPhaseStatus2[DeployPhaseStatus2["NotStarted"] = 1] = "NotStarted"; + DeployPhaseStatus2[DeployPhaseStatus2["InProgress"] = 2] = "InProgress"; + DeployPhaseStatus2[DeployPhaseStatus2["PartiallySucceeded"] = 4] = "PartiallySucceeded"; + DeployPhaseStatus2[DeployPhaseStatus2["Succeeded"] = 8] = "Succeeded"; + DeployPhaseStatus2[DeployPhaseStatus2["Failed"] = 16] = "Failed"; + DeployPhaseStatus2[DeployPhaseStatus2["Canceled"] = 32] = "Canceled"; + DeployPhaseStatus2[DeployPhaseStatus2["Skipped"] = 64] = "Skipped"; + DeployPhaseStatus2[DeployPhaseStatus2["Cancelling"] = 128] = "Cancelling"; + })(DeployPhaseStatus = exports2.DeployPhaseStatus || (exports2.DeployPhaseStatus = {})); + var DeployPhaseTypes; + (function(DeployPhaseTypes2) { + DeployPhaseTypes2[DeployPhaseTypes2["Undefined"] = 0] = "Undefined"; + DeployPhaseTypes2[DeployPhaseTypes2["AgentBasedDeployment"] = 1] = "AgentBasedDeployment"; + DeployPhaseTypes2[DeployPhaseTypes2["RunOnServer"] = 2] = "RunOnServer"; + DeployPhaseTypes2[DeployPhaseTypes2["MachineGroupBasedDeployment"] = 4] = "MachineGroupBasedDeployment"; + DeployPhaseTypes2[DeployPhaseTypes2["DeploymentGates"] = 8] = "DeploymentGates"; + })(DeployPhaseTypes = exports2.DeployPhaseTypes || (exports2.DeployPhaseTypes = {})); + var EnvironmentStatus; + (function(EnvironmentStatus2) { + EnvironmentStatus2[EnvironmentStatus2["Undefined"] = 0] = "Undefined"; + EnvironmentStatus2[EnvironmentStatus2["NotStarted"] = 1] = "NotStarted"; + EnvironmentStatus2[EnvironmentStatus2["InProgress"] = 2] = "InProgress"; + EnvironmentStatus2[EnvironmentStatus2["Succeeded"] = 4] = "Succeeded"; + EnvironmentStatus2[EnvironmentStatus2["Canceled"] = 8] = "Canceled"; + EnvironmentStatus2[EnvironmentStatus2["Rejected"] = 16] = "Rejected"; + EnvironmentStatus2[EnvironmentStatus2["Queued"] = 32] = "Queued"; + EnvironmentStatus2[EnvironmentStatus2["Scheduled"] = 64] = "Scheduled"; + EnvironmentStatus2[EnvironmentStatus2["PartiallySucceeded"] = 128] = "PartiallySucceeded"; + })(EnvironmentStatus = exports2.EnvironmentStatus || (exports2.EnvironmentStatus = {})); + var EnvironmentTriggerType; + (function(EnvironmentTriggerType2) { + EnvironmentTriggerType2[EnvironmentTriggerType2["Undefined"] = 0] = "Undefined"; + EnvironmentTriggerType2[EnvironmentTriggerType2["DeploymentGroupRedeploy"] = 1] = "DeploymentGroupRedeploy"; + EnvironmentTriggerType2[EnvironmentTriggerType2["RollbackRedeploy"] = 2] = "RollbackRedeploy"; + })(EnvironmentTriggerType = exports2.EnvironmentTriggerType || (exports2.EnvironmentTriggerType = {})); + var FolderPathQueryOrder; + (function(FolderPathQueryOrder2) { + FolderPathQueryOrder2[FolderPathQueryOrder2["None"] = 0] = "None"; + FolderPathQueryOrder2[FolderPathQueryOrder2["Ascending"] = 1] = "Ascending"; + FolderPathQueryOrder2[FolderPathQueryOrder2["Descending"] = 2] = "Descending"; + })(FolderPathQueryOrder = exports2.FolderPathQueryOrder || (exports2.FolderPathQueryOrder = {})); + var GateStatus; + (function(GateStatus2) { + GateStatus2[GateStatus2["None"] = 0] = "None"; + GateStatus2[GateStatus2["Pending"] = 1] = "Pending"; + GateStatus2[GateStatus2["InProgress"] = 2] = "InProgress"; + GateStatus2[GateStatus2["Succeeded"] = 4] = "Succeeded"; + GateStatus2[GateStatus2["Failed"] = 8] = "Failed"; + GateStatus2[GateStatus2["Canceled"] = 16] = "Canceled"; + })(GateStatus = exports2.GateStatus || (exports2.GateStatus = {})); + var IssueSource; + (function(IssueSource2) { + IssueSource2[IssueSource2["None"] = 0] = "None"; + IssueSource2[IssueSource2["User"] = 1] = "User"; + IssueSource2[IssueSource2["System"] = 2] = "System"; + })(IssueSource = exports2.IssueSource || (exports2.IssueSource = {})); + var MailSectionType; + (function(MailSectionType2) { + MailSectionType2[MailSectionType2["Details"] = 0] = "Details"; + MailSectionType2[MailSectionType2["Environments"] = 1] = "Environments"; + MailSectionType2[MailSectionType2["Issues"] = 2] = "Issues"; + MailSectionType2[MailSectionType2["TestResults"] = 3] = "TestResults"; + MailSectionType2[MailSectionType2["WorkItems"] = 4] = "WorkItems"; + MailSectionType2[MailSectionType2["ReleaseInfo"] = 5] = "ReleaseInfo"; + })(MailSectionType = exports2.MailSectionType || (exports2.MailSectionType = {})); + var ManualInterventionStatus; + (function(ManualInterventionStatus2) { + ManualInterventionStatus2[ManualInterventionStatus2["Unknown"] = 0] = "Unknown"; + ManualInterventionStatus2[ManualInterventionStatus2["Pending"] = 1] = "Pending"; + ManualInterventionStatus2[ManualInterventionStatus2["Rejected"] = 2] = "Rejected"; + ManualInterventionStatus2[ManualInterventionStatus2["Approved"] = 4] = "Approved"; + ManualInterventionStatus2[ManualInterventionStatus2["Canceled"] = 8] = "Canceled"; + })(ManualInterventionStatus = exports2.ManualInterventionStatus || (exports2.ManualInterventionStatus = {})); + var ParallelExecutionTypes; + (function(ParallelExecutionTypes2) { + ParallelExecutionTypes2[ParallelExecutionTypes2["None"] = 0] = "None"; + ParallelExecutionTypes2[ParallelExecutionTypes2["MultiConfiguration"] = 1] = "MultiConfiguration"; + ParallelExecutionTypes2[ParallelExecutionTypes2["MultiMachine"] = 2] = "MultiMachine"; + })(ParallelExecutionTypes = exports2.ParallelExecutionTypes || (exports2.ParallelExecutionTypes = {})); + var PipelineProcessTypes; + (function(PipelineProcessTypes2) { + PipelineProcessTypes2[PipelineProcessTypes2["Designer"] = 1] = "Designer"; + PipelineProcessTypes2[PipelineProcessTypes2["Yaml"] = 2] = "Yaml"; + })(PipelineProcessTypes = exports2.PipelineProcessTypes || (exports2.PipelineProcessTypes = {})); + var PropertySelectorType; + (function(PropertySelectorType2) { + PropertySelectorType2[PropertySelectorType2["Inclusion"] = 0] = "Inclusion"; + PropertySelectorType2[PropertySelectorType2["Exclusion"] = 1] = "Exclusion"; + })(PropertySelectorType = exports2.PropertySelectorType || (exports2.PropertySelectorType = {})); + var PullRequestSystemType; + (function(PullRequestSystemType2) { + PullRequestSystemType2[PullRequestSystemType2["None"] = 0] = "None"; + PullRequestSystemType2[PullRequestSystemType2["TfsGit"] = 1] = "TfsGit"; + PullRequestSystemType2[PullRequestSystemType2["GitHub"] = 2] = "GitHub"; + })(PullRequestSystemType = exports2.PullRequestSystemType || (exports2.PullRequestSystemType = {})); + var ReleaseDefinitionExpands; + (function(ReleaseDefinitionExpands2) { + ReleaseDefinitionExpands2[ReleaseDefinitionExpands2["None"] = 0] = "None"; + ReleaseDefinitionExpands2[ReleaseDefinitionExpands2["Environments"] = 2] = "Environments"; + ReleaseDefinitionExpands2[ReleaseDefinitionExpands2["Artifacts"] = 4] = "Artifacts"; + ReleaseDefinitionExpands2[ReleaseDefinitionExpands2["Triggers"] = 8] = "Triggers"; + ReleaseDefinitionExpands2[ReleaseDefinitionExpands2["Variables"] = 16] = "Variables"; + ReleaseDefinitionExpands2[ReleaseDefinitionExpands2["Tags"] = 32] = "Tags"; + ReleaseDefinitionExpands2[ReleaseDefinitionExpands2["LastRelease"] = 64] = "LastRelease"; + })(ReleaseDefinitionExpands = exports2.ReleaseDefinitionExpands || (exports2.ReleaseDefinitionExpands = {})); + var ReleaseDefinitionQueryOrder; + (function(ReleaseDefinitionQueryOrder2) { + ReleaseDefinitionQueryOrder2[ReleaseDefinitionQueryOrder2["IdAscending"] = 0] = "IdAscending"; + ReleaseDefinitionQueryOrder2[ReleaseDefinitionQueryOrder2["IdDescending"] = 1] = "IdDescending"; + ReleaseDefinitionQueryOrder2[ReleaseDefinitionQueryOrder2["NameAscending"] = 2] = "NameAscending"; + ReleaseDefinitionQueryOrder2[ReleaseDefinitionQueryOrder2["NameDescending"] = 3] = "NameDescending"; + })(ReleaseDefinitionQueryOrder = exports2.ReleaseDefinitionQueryOrder || (exports2.ReleaseDefinitionQueryOrder = {})); + var ReleaseDefinitionSource; + (function(ReleaseDefinitionSource2) { + ReleaseDefinitionSource2[ReleaseDefinitionSource2["Undefined"] = 0] = "Undefined"; + ReleaseDefinitionSource2[ReleaseDefinitionSource2["RestApi"] = 1] = "RestApi"; + ReleaseDefinitionSource2[ReleaseDefinitionSource2["UserInterface"] = 2] = "UserInterface"; + ReleaseDefinitionSource2[ReleaseDefinitionSource2["Ibiza"] = 4] = "Ibiza"; + ReleaseDefinitionSource2[ReleaseDefinitionSource2["PortalExtensionApi"] = 8] = "PortalExtensionApi"; + })(ReleaseDefinitionSource = exports2.ReleaseDefinitionSource || (exports2.ReleaseDefinitionSource = {})); + var ReleaseEnvironmentExpands; + (function(ReleaseEnvironmentExpands2) { + ReleaseEnvironmentExpands2[ReleaseEnvironmentExpands2["None"] = 0] = "None"; + ReleaseEnvironmentExpands2[ReleaseEnvironmentExpands2["Tasks"] = 1] = "Tasks"; + })(ReleaseEnvironmentExpands = exports2.ReleaseEnvironmentExpands || (exports2.ReleaseEnvironmentExpands = {})); + var ReleaseExpands; + (function(ReleaseExpands2) { + ReleaseExpands2[ReleaseExpands2["None"] = 0] = "None"; + ReleaseExpands2[ReleaseExpands2["Environments"] = 2] = "Environments"; + ReleaseExpands2[ReleaseExpands2["Artifacts"] = 4] = "Artifacts"; + ReleaseExpands2[ReleaseExpands2["Approvals"] = 8] = "Approvals"; + ReleaseExpands2[ReleaseExpands2["ManualInterventions"] = 16] = "ManualInterventions"; + ReleaseExpands2[ReleaseExpands2["Variables"] = 32] = "Variables"; + ReleaseExpands2[ReleaseExpands2["Tags"] = 64] = "Tags"; + })(ReleaseExpands = exports2.ReleaseExpands || (exports2.ReleaseExpands = {})); + var ReleaseQueryOrder; + (function(ReleaseQueryOrder2) { + ReleaseQueryOrder2[ReleaseQueryOrder2["Descending"] = 0] = "Descending"; + ReleaseQueryOrder2[ReleaseQueryOrder2["Ascending"] = 1] = "Ascending"; + })(ReleaseQueryOrder = exports2.ReleaseQueryOrder || (exports2.ReleaseQueryOrder = {})); + var ReleaseReason; + (function(ReleaseReason2) { + ReleaseReason2[ReleaseReason2["None"] = 0] = "None"; + ReleaseReason2[ReleaseReason2["Manual"] = 1] = "Manual"; + ReleaseReason2[ReleaseReason2["ContinuousIntegration"] = 2] = "ContinuousIntegration"; + ReleaseReason2[ReleaseReason2["Schedule"] = 3] = "Schedule"; + ReleaseReason2[ReleaseReason2["PullRequest"] = 4] = "PullRequest"; + })(ReleaseReason = exports2.ReleaseReason || (exports2.ReleaseReason = {})); + var ReleaseStatus; + (function(ReleaseStatus2) { + ReleaseStatus2[ReleaseStatus2["Undefined"] = 0] = "Undefined"; + ReleaseStatus2[ReleaseStatus2["Draft"] = 1] = "Draft"; + ReleaseStatus2[ReleaseStatus2["Active"] = 2] = "Active"; + ReleaseStatus2[ReleaseStatus2["Abandoned"] = 4] = "Abandoned"; + })(ReleaseStatus = exports2.ReleaseStatus || (exports2.ReleaseStatus = {})); + var ReleaseTriggerType; + (function(ReleaseTriggerType2) { + ReleaseTriggerType2[ReleaseTriggerType2["Undefined"] = 0] = "Undefined"; + ReleaseTriggerType2[ReleaseTriggerType2["ArtifactSource"] = 1] = "ArtifactSource"; + ReleaseTriggerType2[ReleaseTriggerType2["Schedule"] = 2] = "Schedule"; + ReleaseTriggerType2[ReleaseTriggerType2["SourceRepo"] = 3] = "SourceRepo"; + ReleaseTriggerType2[ReleaseTriggerType2["ContainerImage"] = 4] = "ContainerImage"; + ReleaseTriggerType2[ReleaseTriggerType2["Package"] = 5] = "Package"; + ReleaseTriggerType2[ReleaseTriggerType2["PullRequest"] = 6] = "PullRequest"; + })(ReleaseTriggerType = exports2.ReleaseTriggerType || (exports2.ReleaseTriggerType = {})); + var ScheduleDays; + (function(ScheduleDays2) { + ScheduleDays2[ScheduleDays2["None"] = 0] = "None"; + ScheduleDays2[ScheduleDays2["Monday"] = 1] = "Monday"; + ScheduleDays2[ScheduleDays2["Tuesday"] = 2] = "Tuesday"; + ScheduleDays2[ScheduleDays2["Wednesday"] = 4] = "Wednesday"; + ScheduleDays2[ScheduleDays2["Thursday"] = 8] = "Thursday"; + ScheduleDays2[ScheduleDays2["Friday"] = 16] = "Friday"; + ScheduleDays2[ScheduleDays2["Saturday"] = 32] = "Saturday"; + ScheduleDays2[ScheduleDays2["Sunday"] = 64] = "Sunday"; + ScheduleDays2[ScheduleDays2["All"] = 127] = "All"; + })(ScheduleDays = exports2.ScheduleDays || (exports2.ScheduleDays = {})); + var SenderType; + (function(SenderType2) { + SenderType2[SenderType2["ServiceAccount"] = 1] = "ServiceAccount"; + SenderType2[SenderType2["RequestingUser"] = 2] = "RequestingUser"; + })(SenderType = exports2.SenderType || (exports2.SenderType = {})); + var SingleReleaseExpands; + (function(SingleReleaseExpands2) { + SingleReleaseExpands2[SingleReleaseExpands2["None"] = 0] = "None"; + SingleReleaseExpands2[SingleReleaseExpands2["Tasks"] = 1] = "Tasks"; + })(SingleReleaseExpands = exports2.SingleReleaseExpands || (exports2.SingleReleaseExpands = {})); + var TaskStatus; + (function(TaskStatus2) { + TaskStatus2[TaskStatus2["Unknown"] = 0] = "Unknown"; + TaskStatus2[TaskStatus2["Pending"] = 1] = "Pending"; + TaskStatus2[TaskStatus2["InProgress"] = 2] = "InProgress"; + TaskStatus2[TaskStatus2["Success"] = 3] = "Success"; + TaskStatus2[TaskStatus2["Failure"] = 4] = "Failure"; + TaskStatus2[TaskStatus2["Canceled"] = 5] = "Canceled"; + TaskStatus2[TaskStatus2["Skipped"] = 6] = "Skipped"; + TaskStatus2[TaskStatus2["Succeeded"] = 7] = "Succeeded"; + TaskStatus2[TaskStatus2["Failed"] = 8] = "Failed"; + TaskStatus2[TaskStatus2["PartiallySucceeded"] = 9] = "PartiallySucceeded"; + })(TaskStatus = exports2.TaskStatus || (exports2.TaskStatus = {})); + var VariableGroupActionFilter; + (function(VariableGroupActionFilter2) { + VariableGroupActionFilter2[VariableGroupActionFilter2["None"] = 0] = "None"; + VariableGroupActionFilter2[VariableGroupActionFilter2["Manage"] = 2] = "Manage"; + VariableGroupActionFilter2[VariableGroupActionFilter2["Use"] = 16] = "Use"; + })(VariableGroupActionFilter = exports2.VariableGroupActionFilter || (exports2.VariableGroupActionFilter = {})); + var YamlFileSourceTypes; + (function(YamlFileSourceTypes2) { + YamlFileSourceTypes2[YamlFileSourceTypes2["None"] = 0] = "None"; + YamlFileSourceTypes2[YamlFileSourceTypes2["TFSGit"] = 1] = "TFSGit"; + })(YamlFileSourceTypes = exports2.YamlFileSourceTypes || (exports2.YamlFileSourceTypes = {})); + exports2.TypeInfo = { + AgentArtifactDefinition: {}, + AgentArtifactType: { + enumValues: { + "xamlBuild": 0, + "build": 1, + "jenkins": 2, + "fileShare": 3, + "nuget": 4, + "tfsOnPrem": 5, + "gitHub": 6, + "tfGit": 7, + "externalTfsBuild": 8, + "custom": 9, + "tfvc": 10 + } + }, + AgentBasedDeployPhase: {}, + AgentDeploymentInput: {}, + ApprovalExecutionOrder: { + enumValues: { + "beforeGates": 1, + "afterSuccessfulGates": 2, + "afterGatesAlways": 4 + } + }, + ApprovalFilters: { + enumValues: { + "none": 0, + "manualApprovals": 1, + "automatedApprovals": 2, + "approvalSnapshots": 4, + "all": 7 + } + }, + ApprovalOptions: {}, + ApprovalStatus: { + enumValues: { + "undefined": 0, + "pending": 1, + "approved": 2, + "rejected": 4, + "reassigned": 6, + "canceled": 7, + "skipped": 8 + } + }, + ApprovalType: { + enumValues: { + "undefined": 0, + "preDeploy": 1, + "postDeploy": 2, + "all": 3 + } + }, + ArtifactContributionDefinition: {}, + ArtifactMetadata: {}, + ArtifactSourceTrigger: {}, + ArtifactTypeDefinition: {}, + ArtifactVersion: {}, + ArtifactVersionQueryResult: {}, + AuditAction: { + enumValues: { + "add": 1, + "update": 2, + "delete": 3, + "undelete": 4 + } + }, + AuthorizationHeaderFor: { + enumValues: { + "revalidateApproverIdentity": 0, + "onBehalfOf": 1 + } + }, + AutoTriggerIssue: {}, + AzureKeyVaultVariableGroupProviderData: {}, + AzureKeyVaultVariableValue: {}, + BuildVersion: {}, + Change: {}, + CodeRepositoryReference: {}, + Condition: {}, + ConditionType: { + enumValues: { + "undefined": 0, + "event": 1, + "environmentState": 2, + "artifact": 4 + } + }, + ContainerImageTrigger: {}, + ContinuousDeploymentTriggerIssue: {}, + Deployment: {}, + DeploymentApprovalCompletedEvent: {}, + DeploymentApprovalPendingEvent: {}, + DeploymentAttempt: {}, + DeploymentAuthorizationInfo: {}, + DeploymentAuthorizationOwner: { + enumValues: { + "automatic": 0, + "deploymentSubmitter": 1, + "firstPreDeploymentApprover": 2 + } + }, + DeploymentCompletedEvent: {}, + DeploymentExpands: { + enumValues: { + "all": 0, + "deploymentOnly": 1, + "approvals": 2, + "artifacts": 4 + } + }, + DeploymentJob: {}, + DeploymentManualInterventionPendingEvent: {}, + DeploymentOperationStatus: { + enumValues: { + "undefined": 0, + "queued": 1, + "scheduled": 2, + "pending": 4, + "approved": 8, + "rejected": 16, + "deferred": 32, + "queuedForAgent": 64, + "phaseInProgress": 128, + "phaseSucceeded": 256, + "phasePartiallySucceeded": 512, + "phaseFailed": 1024, + "canceled": 2048, + "phaseCanceled": 4096, + "manualInterventionPending": 8192, + "queuedForPipeline": 16384, + "cancelling": 32768, + "evaluatingGates": 65536, + "gateFailed": 131072, + "all": 258047 + } + }, + DeploymentQueryParameters: {}, + DeploymentReason: { + enumValues: { + "none": 0, + "manual": 1, + "automated": 2, + "scheduled": 4, + "redeployTrigger": 8 + } + }, + DeploymentsQueryType: { + enumValues: { + "regular": 1, + "failingSince": 2 + } + }, + DeploymentStartedEvent: {}, + DeploymentStatus: { + enumValues: { + "undefined": 0, + "notDeployed": 1, + "inProgress": 2, + "succeeded": 4, + "partiallySucceeded": 8, + "failed": 16, + "all": 31 + } + }, + DeployPhase: {}, + DeployPhaseStatus: { + enumValues: { + "undefined": 0, + "notStarted": 1, + "inProgress": 2, + "partiallySucceeded": 4, + "succeeded": 8, + "failed": 16, + "canceled": 32, + "skipped": 64, + "cancelling": 128 + } + }, + DeployPhaseTypes: { + enumValues: { + "undefined": 0, + "agentBasedDeployment": 1, + "runOnServer": 2, + "machineGroupBasedDeployment": 4, + "deploymentGates": 8 + } + }, + EnvironmentStatus: { + enumValues: { + "undefined": 0, + "notStarted": 1, + "inProgress": 2, + "succeeded": 4, + "canceled": 8, + "rejected": 16, + "queued": 32, + "scheduled": 64, + "partiallySucceeded": 128 + } + }, + EnvironmentTrigger: {}, + EnvironmentTriggerType: { + enumValues: { + "undefined": 0, + "deploymentGroupRedeploy": 1, + "rollbackRedeploy": 2 + } + }, + ExecutionInput: {}, + Folder: {}, + FolderPathQueryOrder: { + enumValues: { + "none": 0, + "ascending": 1, + "descending": 2 + } + }, + GatesDeployPhase: {}, + GateStatus: { + enumValues: { + "none": 0, + "pending": 1, + "inProgress": 2, + "succeeded": 4, + "failed": 8, + "canceled": 16 + } + }, + IgnoredGate: {}, + IssueSource: { + enumValues: { + "none": 0, + "user": 1, + "system": 2 + } + }, + MachineGroupBasedDeployPhase: {}, + MailMessage: {}, + MailSectionType: { + enumValues: { + "details": 0, + "environments": 1, + "issues": 2, + "testResults": 3, + "workItems": 4, + "releaseInfo": 5 + } + }, + ManualIntervention: {}, + ManualInterventionStatus: { + enumValues: { + "unknown": 0, + "pending": 1, + "rejected": 2, + "approved": 4, + "canceled": 8 + } + }, + ManualInterventionUpdateMetadata: {}, + MultiConfigInput: {}, + MultiMachineInput: {}, + PackageTrigger: {}, + ParallelExecutionInputBase: {}, + ParallelExecutionTypes: { + enumValues: { + "none": 0, + "multiConfiguration": 1, + "multiMachine": 2 + } + }, + PipelineProcess: {}, + PipelineProcessTypes: { + enumValues: { + "designer": 1, + "yaml": 2 + } + }, + PropertySelector: {}, + PropertySelectorType: { + enumValues: { + "inclusion": 0, + "exclusion": 1 + } + }, + PullRequestConfiguration: {}, + PullRequestSystemType: { + enumValues: { + "none": 0, + "tfsGit": 1, + "gitHub": 2 + } + }, + PullRequestTrigger: {}, + Release: {}, + ReleaseAbandonedEvent: {}, + ReleaseApproval: {}, + ReleaseApprovalHistory: {}, + ReleaseApprovalPendingEvent: {}, + ReleaseCondition: {}, + ReleaseCreatedEvent: {}, + ReleaseDefinition: {}, + ReleaseDefinitionApprovals: {}, + ReleaseDefinitionEnvironment: {}, + ReleaseDefinitionEnvironmentTemplate: {}, + ReleaseDefinitionExpands: { + enumValues: { + "none": 0, + "environments": 2, + "artifacts": 4, + "triggers": 8, + "variables": 16, + "tags": 32, + "lastRelease": 64 + } + }, + ReleaseDefinitionQueryOrder: { + enumValues: { + "idAscending": 0, + "idDescending": 1, + "nameAscending": 2, + "nameDescending": 3 + } + }, + ReleaseDefinitionRevision: {}, + ReleaseDefinitionSource: { + enumValues: { + "undefined": 0, + "restApi": 1, + "userInterface": 2, + "ibiza": 4, + "portalExtensionApi": 8 + } + }, + ReleaseDefinitionSummary: {}, + ReleaseDeployPhase: {}, + ReleaseEnvironment: {}, + ReleaseEnvironmentCompletedEvent: {}, + ReleaseEnvironmentExpands: { + enumValues: { + "none": 0, + "tasks": 1 + } + }, + ReleaseEnvironmentStatusUpdatedEvent: {}, + ReleaseEnvironmentUpdateMetadata: {}, + ReleaseExpands: { + enumValues: { + "none": 0, + "environments": 2, + "artifacts": 4, + "approvals": 8, + "manualInterventions": 16, + "variables": 32, + "tags": 64 + } + }, + ReleaseGates: {}, + ReleaseGatesPhase: {}, + ReleaseNotCreatedEvent: {}, + ReleaseQueryOrder: { + enumValues: { + "descending": 0, + "ascending": 1 + } + }, + ReleaseReason: { + enumValues: { + "none": 0, + "manual": 1, + "continuousIntegration": 2, + "schedule": 3, + "pullRequest": 4 + } + }, + ReleaseReference: {}, + ReleaseRevision: {}, + ReleaseSchedule: {}, + ReleaseStartMetadata: {}, + ReleaseStatus: { + enumValues: { + "undefined": 0, + "draft": 1, + "active": 2, + "abandoned": 4 + } + }, + ReleaseTask: {}, + ReleaseTaskAttachment: {}, + ReleaseTasksUpdatedEvent: {}, + ReleaseTriggerBase: {}, + ReleaseTriggerType: { + enumValues: { + "undefined": 0, + "artifactSource": 1, + "schedule": 2, + "sourceRepo": 3, + "containerImage": 4, + "package": 5, + "pullRequest": 6 + } + }, + ReleaseUpdatedEvent: {}, + ReleaseUpdateMetadata: {}, + RunOnServerDeployPhase: {}, + ScheduleDays: { + enumValues: { + "none": 0, + "monday": 1, + "tuesday": 2, + "wednesday": 4, + "thursday": 8, + "friday": 16, + "saturday": 32, + "sunday": 64, + "all": 127 + } + }, + ScheduledReleaseTrigger: {}, + SenderType: { + enumValues: { + "serviceAccount": 1, + "requestingUser": 2 + } + }, + ServerDeploymentInput: {}, + SingleReleaseExpands: { + enumValues: { + "none": 0, + "tasks": 1 + } + }, + SourcePullRequestVersion: {}, + SourceRepoTrigger: {}, + SummaryMailSection: {}, + TaskStatus: { + enumValues: { + "unknown": 0, + "pending": 1, + "inProgress": 2, + "success": 3, + "failure": 4, + "canceled": 5, + "skipped": 6, + "succeeded": 7, + "failed": 8, + "partiallySucceeded": 9 + } + }, + VariableGroup: {}, + VariableGroupActionFilter: { + enumValues: { + "none": 0, + "manage": 2, + "use": 16 + } + }, + YamlFileSource: {}, + YamlFileSourceTypes: { + enumValues: { + "none": 0, + "tfsGit": 1 + } + }, + YamlPipelineProcess: {} + }; + exports2.TypeInfo.AgentArtifactDefinition.fields = { + artifactType: { + enumType: exports2.TypeInfo.AgentArtifactType + } + }; + exports2.TypeInfo.AgentBasedDeployPhase.fields = { + deploymentInput: { + typeInfo: exports2.TypeInfo.AgentDeploymentInput + }, + phaseType: { + enumType: exports2.TypeInfo.DeployPhaseTypes + } + }; + exports2.TypeInfo.AgentDeploymentInput.fields = { + parallelExecution: { + typeInfo: exports2.TypeInfo.ExecutionInput + } + }; + exports2.TypeInfo.ApprovalOptions.fields = { + executionOrder: { + enumType: exports2.TypeInfo.ApprovalExecutionOrder + } + }; + exports2.TypeInfo.ArtifactContributionDefinition.fields = { + inputDescriptors: { + isArray: true, + typeInfo: FormInputInterfaces.TypeInfo.InputDescriptor + } + }; + exports2.TypeInfo.ArtifactMetadata.fields = { + instanceReference: { + typeInfo: exports2.TypeInfo.BuildVersion + } + }; + exports2.TypeInfo.ArtifactSourceTrigger.fields = { + triggerType: { + enumType: exports2.TypeInfo.ReleaseTriggerType + } + }; + exports2.TypeInfo.ArtifactTypeDefinition.fields = { + inputDescriptors: { + isArray: true, + typeInfo: FormInputInterfaces.TypeInfo.InputDescriptor + } + }; + exports2.TypeInfo.ArtifactVersion.fields = { + defaultVersion: { + typeInfo: exports2.TypeInfo.BuildVersion + }, + versions: { + isArray: true, + typeInfo: exports2.TypeInfo.BuildVersion + } + }; + exports2.TypeInfo.ArtifactVersionQueryResult.fields = { + artifactVersions: { + isArray: true, + typeInfo: exports2.TypeInfo.ArtifactVersion + } + }; + exports2.TypeInfo.AutoTriggerIssue.fields = { + issueSource: { + enumType: exports2.TypeInfo.IssueSource + }, + releaseTriggerType: { + enumType: exports2.TypeInfo.ReleaseTriggerType + } + }; + exports2.TypeInfo.AzureKeyVaultVariableGroupProviderData.fields = { + lastRefreshedOn: { + isDate: true + } + }; + exports2.TypeInfo.AzureKeyVaultVariableValue.fields = { + expires: { + isDate: true + } + }; + exports2.TypeInfo.BuildVersion.fields = { + sourcePullRequestVersion: { + typeInfo: exports2.TypeInfo.SourcePullRequestVersion + } + }; + exports2.TypeInfo.Change.fields = { + timestamp: { + isDate: true + } + }; + exports2.TypeInfo.CodeRepositoryReference.fields = { + systemType: { + enumType: exports2.TypeInfo.PullRequestSystemType + } + }; + exports2.TypeInfo.Condition.fields = { + conditionType: { + enumType: exports2.TypeInfo.ConditionType + } + }; + exports2.TypeInfo.ContainerImageTrigger.fields = { + triggerType: { + enumType: exports2.TypeInfo.ReleaseTriggerType + } + }; + exports2.TypeInfo.ContinuousDeploymentTriggerIssue.fields = { + issueSource: { + enumType: exports2.TypeInfo.IssueSource + }, + releaseTriggerType: { + enumType: exports2.TypeInfo.ReleaseTriggerType + } + }; + exports2.TypeInfo.Deployment.fields = { + completedOn: { + isDate: true + }, + conditions: { + isArray: true, + typeInfo: exports2.TypeInfo.Condition + }, + deploymentStatus: { + enumType: exports2.TypeInfo.DeploymentStatus + }, + lastModifiedOn: { + isDate: true + }, + operationStatus: { + enumType: exports2.TypeInfo.DeploymentOperationStatus + }, + postDeployApprovals: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseApproval + }, + preDeployApprovals: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseApproval + }, + queuedOn: { + isDate: true + }, + reason: { + enumType: exports2.TypeInfo.DeploymentReason + }, + release: { + typeInfo: exports2.TypeInfo.ReleaseReference + }, + scheduledDeploymentTime: { + isDate: true + }, + startedOn: { + isDate: true + } + }; + exports2.TypeInfo.DeploymentApprovalCompletedEvent.fields = { + approval: { + typeInfo: exports2.TypeInfo.ReleaseApproval + }, + release: { + typeInfo: exports2.TypeInfo.Release + } + }; + exports2.TypeInfo.DeploymentApprovalPendingEvent.fields = { + approval: { + typeInfo: exports2.TypeInfo.ReleaseApproval + }, + approvalOptions: { + typeInfo: exports2.TypeInfo.ApprovalOptions + }, + completedApprovals: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseApproval + }, + deployment: { + typeInfo: exports2.TypeInfo.Deployment + }, + pendingApprovals: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseApproval + }, + release: { + typeInfo: exports2.TypeInfo.Release + } + }; + exports2.TypeInfo.DeploymentAttempt.fields = { + job: { + typeInfo: exports2.TypeInfo.ReleaseTask + }, + lastModifiedOn: { + isDate: true + }, + operationStatus: { + enumType: exports2.TypeInfo.DeploymentOperationStatus + }, + postDeploymentGates: { + typeInfo: exports2.TypeInfo.ReleaseGates + }, + preDeploymentGates: { + typeInfo: exports2.TypeInfo.ReleaseGates + }, + queuedOn: { + isDate: true + }, + reason: { + enumType: exports2.TypeInfo.DeploymentReason + }, + releaseDeployPhases: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseDeployPhase + }, + status: { + enumType: exports2.TypeInfo.DeploymentStatus + }, + tasks: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseTask + } + }; + exports2.TypeInfo.DeploymentAuthorizationInfo.fields = { + authorizationHeaderFor: { + enumType: exports2.TypeInfo.AuthorizationHeaderFor + } + }; + exports2.TypeInfo.DeploymentCompletedEvent.fields = { + deployment: { + typeInfo: exports2.TypeInfo.Deployment + }, + environment: { + typeInfo: exports2.TypeInfo.ReleaseEnvironment + } + }; + exports2.TypeInfo.DeploymentJob.fields = { + job: { + typeInfo: exports2.TypeInfo.ReleaseTask + }, + tasks: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseTask + } + }; + exports2.TypeInfo.DeploymentManualInterventionPendingEvent.fields = { + approval: { + typeInfo: exports2.TypeInfo.ReleaseApproval + }, + deployment: { + typeInfo: exports2.TypeInfo.Deployment + }, + manualIntervention: { + typeInfo: exports2.TypeInfo.ManualIntervention + }, + release: { + typeInfo: exports2.TypeInfo.Release + } + }; + exports2.TypeInfo.DeploymentQueryParameters.fields = { + deploymentStatus: { + enumType: exports2.TypeInfo.DeploymentStatus + }, + expands: { + enumType: exports2.TypeInfo.DeploymentExpands + }, + maxModifiedTime: { + isDate: true + }, + minModifiedTime: { + isDate: true + }, + operationStatus: { + enumType: exports2.TypeInfo.DeploymentOperationStatus + }, + queryOrder: { + enumType: exports2.TypeInfo.ReleaseQueryOrder + }, + queryType: { + enumType: exports2.TypeInfo.DeploymentsQueryType + } + }; + exports2.TypeInfo.DeploymentStartedEvent.fields = { + environment: { + typeInfo: exports2.TypeInfo.ReleaseEnvironment + }, + release: { + typeInfo: exports2.TypeInfo.Release + } + }; + exports2.TypeInfo.DeployPhase.fields = { + phaseType: { + enumType: exports2.TypeInfo.DeployPhaseTypes + } + }; + exports2.TypeInfo.EnvironmentTrigger.fields = { + triggerType: { + enumType: exports2.TypeInfo.EnvironmentTriggerType + } + }; + exports2.TypeInfo.ExecutionInput.fields = { + parallelExecutionType: { + enumType: exports2.TypeInfo.ParallelExecutionTypes + } + }; + exports2.TypeInfo.Folder.fields = { + createdOn: { + isDate: true + }, + lastChangedDate: { + isDate: true + } + }; + exports2.TypeInfo.GatesDeployPhase.fields = { + phaseType: { + enumType: exports2.TypeInfo.DeployPhaseTypes + } + }; + exports2.TypeInfo.IgnoredGate.fields = { + lastModifiedOn: { + isDate: true + } + }; + exports2.TypeInfo.MachineGroupBasedDeployPhase.fields = { + phaseType: { + enumType: exports2.TypeInfo.DeployPhaseTypes + } + }; + exports2.TypeInfo.MailMessage.fields = { + replyBy: { + isDate: true + }, + sections: { + isArray: true, + enumType: exports2.TypeInfo.MailSectionType + }, + senderType: { + enumType: exports2.TypeInfo.SenderType + } + }; + exports2.TypeInfo.ManualIntervention.fields = { + createdOn: { + isDate: true + }, + modifiedOn: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.ManualInterventionStatus + } + }; + exports2.TypeInfo.ManualInterventionUpdateMetadata.fields = { + status: { + enumType: exports2.TypeInfo.ManualInterventionStatus + } + }; + exports2.TypeInfo.MultiConfigInput.fields = { + parallelExecutionType: { + enumType: exports2.TypeInfo.ParallelExecutionTypes + } + }; + exports2.TypeInfo.MultiMachineInput.fields = { + parallelExecutionType: { + enumType: exports2.TypeInfo.ParallelExecutionTypes + } + }; + exports2.TypeInfo.PackageTrigger.fields = { + triggerType: { + enumType: exports2.TypeInfo.ReleaseTriggerType + } + }; + exports2.TypeInfo.ParallelExecutionInputBase.fields = { + parallelExecutionType: { + enumType: exports2.TypeInfo.ParallelExecutionTypes + } + }; + exports2.TypeInfo.PipelineProcess.fields = { + type: { + enumType: exports2.TypeInfo.PipelineProcessTypes + } + }; + exports2.TypeInfo.PropertySelector.fields = { + selectorType: { + enumType: exports2.TypeInfo.PropertySelectorType + } + }; + exports2.TypeInfo.PullRequestConfiguration.fields = { + codeRepositoryReference: { + typeInfo: exports2.TypeInfo.CodeRepositoryReference + } + }; + exports2.TypeInfo.PullRequestTrigger.fields = { + pullRequestConfiguration: { + typeInfo: exports2.TypeInfo.PullRequestConfiguration + }, + triggerType: { + enumType: exports2.TypeInfo.ReleaseTriggerType + } + }; + exports2.TypeInfo.Release.fields = { + createdOn: { + isDate: true + }, + environments: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseEnvironment + }, + modifiedOn: { + isDate: true + }, + reason: { + enumType: exports2.TypeInfo.ReleaseReason + }, + status: { + enumType: exports2.TypeInfo.ReleaseStatus + }, + variableGroups: { + isArray: true, + typeInfo: exports2.TypeInfo.VariableGroup + } + }; + exports2.TypeInfo.ReleaseAbandonedEvent.fields = { + release: { + typeInfo: exports2.TypeInfo.Release + } + }; + exports2.TypeInfo.ReleaseApproval.fields = { + approvalType: { + enumType: exports2.TypeInfo.ApprovalType + }, + createdOn: { + isDate: true + }, + history: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseApprovalHistory + }, + modifiedOn: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.ApprovalStatus + } + }; + exports2.TypeInfo.ReleaseApprovalHistory.fields = { + createdOn: { + isDate: true + }, + modifiedOn: { + isDate: true + } + }; + exports2.TypeInfo.ReleaseApprovalPendingEvent.fields = { + approval: { + typeInfo: exports2.TypeInfo.ReleaseApproval + }, + approvalOptions: { + typeInfo: exports2.TypeInfo.ApprovalOptions + }, + completedApprovals: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseApproval + }, + deployment: { + typeInfo: exports2.TypeInfo.Deployment + }, + environments: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseEnvironment + }, + pendingApprovals: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseApproval + } + }; + exports2.TypeInfo.ReleaseCondition.fields = { + conditionType: { + enumType: exports2.TypeInfo.ConditionType + } + }; + exports2.TypeInfo.ReleaseCreatedEvent.fields = { + release: { + typeInfo: exports2.TypeInfo.Release + } + }; + exports2.TypeInfo.ReleaseDefinition.fields = { + createdOn: { + isDate: true + }, + environments: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseDefinitionEnvironment + }, + lastRelease: { + typeInfo: exports2.TypeInfo.ReleaseReference + }, + modifiedOn: { + isDate: true + }, + pipelineProcess: { + typeInfo: exports2.TypeInfo.PipelineProcess + }, + source: { + enumType: exports2.TypeInfo.ReleaseDefinitionSource + }, + triggers: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseTriggerBase + } + }; + exports2.TypeInfo.ReleaseDefinitionApprovals.fields = { + approvalOptions: { + typeInfo: exports2.TypeInfo.ApprovalOptions + } + }; + exports2.TypeInfo.ReleaseDefinitionEnvironment.fields = { + conditions: { + isArray: true, + typeInfo: exports2.TypeInfo.Condition + }, + deployPhases: { + isArray: true, + typeInfo: exports2.TypeInfo.DeployPhase + }, + environmentTriggers: { + isArray: true, + typeInfo: exports2.TypeInfo.EnvironmentTrigger + }, + postDeployApprovals: { + typeInfo: exports2.TypeInfo.ReleaseDefinitionApprovals + }, + preDeployApprovals: { + typeInfo: exports2.TypeInfo.ReleaseDefinitionApprovals + }, + schedules: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseSchedule + } + }; + exports2.TypeInfo.ReleaseDefinitionEnvironmentTemplate.fields = { + environment: { + typeInfo: exports2.TypeInfo.ReleaseDefinitionEnvironment + } + }; + exports2.TypeInfo.ReleaseDefinitionRevision.fields = { + changedDate: { + isDate: true + }, + changeType: { + enumType: exports2.TypeInfo.AuditAction + } + }; + exports2.TypeInfo.ReleaseDefinitionSummary.fields = { + releases: { + isArray: true, + typeInfo: exports2.TypeInfo.Release + } + }; + exports2.TypeInfo.ReleaseDeployPhase.fields = { + deploymentJobs: { + isArray: true, + typeInfo: exports2.TypeInfo.DeploymentJob + }, + manualInterventions: { + isArray: true, + typeInfo: exports2.TypeInfo.ManualIntervention + }, + phaseType: { + enumType: exports2.TypeInfo.DeployPhaseTypes + }, + startedOn: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.DeployPhaseStatus + } + }; + exports2.TypeInfo.ReleaseEnvironment.fields = { + conditions: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseCondition + }, + createdOn: { + isDate: true + }, + deployPhasesSnapshot: { + isArray: true, + typeInfo: exports2.TypeInfo.DeployPhase + }, + deploySteps: { + isArray: true, + typeInfo: exports2.TypeInfo.DeploymentAttempt + }, + modifiedOn: { + isDate: true + }, + nextScheduledUtcTime: { + isDate: true + }, + postApprovalsSnapshot: { + typeInfo: exports2.TypeInfo.ReleaseDefinitionApprovals + }, + postDeployApprovals: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseApproval + }, + preApprovalsSnapshot: { + typeInfo: exports2.TypeInfo.ReleaseDefinitionApprovals + }, + preDeployApprovals: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseApproval + }, + scheduledDeploymentTime: { + isDate: true + }, + schedules: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseSchedule + }, + status: { + enumType: exports2.TypeInfo.EnvironmentStatus + }, + variableGroups: { + isArray: true, + typeInfo: exports2.TypeInfo.VariableGroup + } + }; + exports2.TypeInfo.ReleaseEnvironmentCompletedEvent.fields = { + environment: { + typeInfo: exports2.TypeInfo.ReleaseEnvironment + }, + reason: { + enumType: exports2.TypeInfo.DeploymentReason + } + }; + exports2.TypeInfo.ReleaseEnvironmentStatusUpdatedEvent.fields = { + environmentStatus: { + enumType: exports2.TypeInfo.EnvironmentStatus + }, + latestDeploymentOperationStatus: { + enumType: exports2.TypeInfo.DeploymentOperationStatus + }, + latestDeploymentStatus: { + enumType: exports2.TypeInfo.DeploymentStatus + } + }; + exports2.TypeInfo.ReleaseEnvironmentUpdateMetadata.fields = { + scheduledDeploymentTime: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.EnvironmentStatus + } + }; + exports2.TypeInfo.ReleaseGates.fields = { + deploymentJobs: { + isArray: true, + typeInfo: exports2.TypeInfo.DeploymentJob + }, + ignoredGates: { + isArray: true, + typeInfo: exports2.TypeInfo.IgnoredGate + }, + lastModifiedOn: { + isDate: true + }, + stabilizationCompletedOn: { + isDate: true + }, + startedOn: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.GateStatus + }, + succeedingSince: { + isDate: true + } + }; + exports2.TypeInfo.ReleaseGatesPhase.fields = { + deploymentJobs: { + isArray: true, + typeInfo: exports2.TypeInfo.DeploymentJob + }, + ignoredGates: { + isArray: true, + typeInfo: exports2.TypeInfo.IgnoredGate + }, + manualInterventions: { + isArray: true, + typeInfo: exports2.TypeInfo.ManualIntervention + }, + phaseType: { + enumType: exports2.TypeInfo.DeployPhaseTypes + }, + stabilizationCompletedOn: { + isDate: true + }, + startedOn: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.DeployPhaseStatus + }, + succeedingSince: { + isDate: true + } + }; + exports2.TypeInfo.ReleaseNotCreatedEvent.fields = { + releaseReason: { + enumType: exports2.TypeInfo.ReleaseReason + } + }; + exports2.TypeInfo.ReleaseReference.fields = { + createdOn: { + isDate: true + }, + reason: { + enumType: exports2.TypeInfo.ReleaseReason + } + }; + exports2.TypeInfo.ReleaseRevision.fields = { + changedDate: { + isDate: true + } + }; + exports2.TypeInfo.ReleaseSchedule.fields = { + daysToRelease: { + enumType: exports2.TypeInfo.ScheduleDays + } + }; + exports2.TypeInfo.ReleaseStartMetadata.fields = { + artifacts: { + isArray: true, + typeInfo: exports2.TypeInfo.ArtifactMetadata + }, + reason: { + enumType: exports2.TypeInfo.ReleaseReason + } + }; + exports2.TypeInfo.ReleaseTask.fields = { + dateEnded: { + isDate: true + }, + dateStarted: { + isDate: true + }, + finishTime: { + isDate: true + }, + startTime: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.TaskStatus + } + }; + exports2.TypeInfo.ReleaseTaskAttachment.fields = { + createdOn: { + isDate: true + }, + modifiedOn: { + isDate: true + } + }; + exports2.TypeInfo.ReleaseTasksUpdatedEvent.fields = { + job: { + typeInfo: exports2.TypeInfo.ReleaseTask + }, + tasks: { + isArray: true, + typeInfo: exports2.TypeInfo.ReleaseTask + } + }; + exports2.TypeInfo.ReleaseTriggerBase.fields = { + triggerType: { + enumType: exports2.TypeInfo.ReleaseTriggerType + } + }; + exports2.TypeInfo.ReleaseUpdatedEvent.fields = { + release: { + typeInfo: exports2.TypeInfo.Release + } + }; + exports2.TypeInfo.ReleaseUpdateMetadata.fields = { + status: { + enumType: exports2.TypeInfo.ReleaseStatus + } + }; + exports2.TypeInfo.RunOnServerDeployPhase.fields = { + deploymentInput: { + typeInfo: exports2.TypeInfo.ServerDeploymentInput + }, + phaseType: { + enumType: exports2.TypeInfo.DeployPhaseTypes + } + }; + exports2.TypeInfo.ScheduledReleaseTrigger.fields = { + schedule: { + typeInfo: exports2.TypeInfo.ReleaseSchedule + }, + triggerType: { + enumType: exports2.TypeInfo.ReleaseTriggerType + } + }; + exports2.TypeInfo.ServerDeploymentInput.fields = { + parallelExecution: { + typeInfo: exports2.TypeInfo.ExecutionInput + } + }; + exports2.TypeInfo.SourcePullRequestVersion.fields = { + pullRequestMergedAt: { + isDate: true + } + }; + exports2.TypeInfo.SourceRepoTrigger.fields = { + triggerType: { + enumType: exports2.TypeInfo.ReleaseTriggerType + } + }; + exports2.TypeInfo.SummaryMailSection.fields = { + sectionType: { + enumType: exports2.TypeInfo.MailSectionType + } + }; + exports2.TypeInfo.VariableGroup.fields = { + createdOn: { + isDate: true + }, + modifiedOn: { + isDate: true + } + }; + exports2.TypeInfo.YamlFileSource.fields = { + type: { + enumType: exports2.TypeInfo.YamlFileSourceTypes + } + }; + exports2.TypeInfo.YamlPipelineProcess.fields = { + fileSource: { + typeInfo: exports2.TypeInfo.YamlFileSource + }, + type: { + enumType: exports2.TypeInfo.PipelineProcessTypes + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/ReleaseApi.js +var require_ReleaseApi = __commonJS({ + "../node_modules/azure-devops-node-api/ReleaseApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ReleaseApi = void 0; + var basem = require_ClientApiBases(); + var ReleaseInterfaces = require_ReleaseInterfaces(); + var ReleaseApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Release-api", options); + } + /** + * Returns the artifact details that automation agent requires + * + * @param {string} project - Project ID or project name + * @param {number} releaseId + */ + getAgentArtifactDefinitions(project, releaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "f2571c27-bf50-4938-b396-32d109ddef26", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.AgentArtifactDefinition, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of approvals + * + * @param {string} project - Project ID or project name + * @param {string} assignedToFilter - Approvals assigned to this user. + * @param {ReleaseInterfaces.ApprovalStatus} statusFilter - Approvals with this status. Default is 'pending'. + * @param {number[]} releaseIdsFilter - Approvals for release id(s) mentioned in the filter. Multiple releases can be mentioned by separating them with ',' e.g. releaseIdsFilter=1,2,3,4. + * @param {ReleaseInterfaces.ApprovalType} typeFilter - Approval with this type. + * @param {number} top - Number of approvals to get. Default is 50. + * @param {number} continuationToken - Gets the approvals after the continuation token provided. + * @param {ReleaseInterfaces.ReleaseQueryOrder} queryOrder - Gets the results in the defined order of created approvals. Default is 'descending'. + * @param {boolean} includeMyGroupApprovals - 'true' to include my group approvals. Default is 'false'. + */ + getApprovals(project, assignedToFilter, statusFilter, releaseIdsFilter, typeFilter, top, continuationToken, queryOrder, includeMyGroupApprovals) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + assignedToFilter, + statusFilter, + releaseIdsFilter: releaseIdsFilter && releaseIdsFilter.join(","), + typeFilter, + top, + continuationToken, + queryOrder, + includeMyGroupApprovals + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Release", "b47c6458-e73b-47cb-a770-4df1e8813a91", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseApproval, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get approval history. + * + * @param {string} project - Project ID or project name + * @param {number} approvalStepId - Id of the approval. + */ + getApprovalHistory(project, approvalStepId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + approvalStepId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Release", "250c7158-852e-4130-a00f-a0cce9b72d05", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseApproval, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get an approval. + * + * @param {string} project - Project ID or project name + * @param {number} approvalId - Id of the approval. + * @param {boolean} includeHistory - 'true' to include history of the approval. Default is 'false'. + */ + getApproval(project, approvalId, includeHistory) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + approvalId + }; + let queryValues = { + includeHistory + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Release", "9328e074-59fb-465a-89d9-b09c82ee5109", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseApproval, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update status of an approval + * + * @param {ReleaseInterfaces.ReleaseApproval} approval - ReleaseApproval object having status, approver and comments. + * @param {string} project - Project ID or project name + * @param {number} approvalId - Id of the approval. + */ + updateReleaseApproval(approval, project, approvalId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + approvalId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Release", "9328e074-59fb-465a-89d9-b09c82ee5109", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, approval, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseApproval, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {ReleaseInterfaces.ReleaseApproval[]} approvals + * @param {string} project - Project ID or project name + */ + updateReleaseApprovals(approvals, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Release", "c957584a-82aa-4131-8222-6d47f78bfa7a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, approvals, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseApproval, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a task attachment. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} environmentId - Id of the release environment. + * @param {number} attemptId - Attempt number of deployment. + * @param {string} timelineId - Timeline Id of the task. + * @param {string} recordId - Record Id of attachment. + * @param {string} type - Type of the attachment. + * @param {string} name - Name of the attachment. + */ + getTaskAttachmentContent(project, releaseId, environmentId, attemptId, timelineId, recordId, type, name) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId, + attemptId, + timelineId, + recordId, + type, + name + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c4071f6d-3697-46ca-858e-8b10ff09e52f", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a release task attachment. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} environmentId - Id of the release environment. + * @param {number} attemptId - Attempt number of deployment. + * @param {string} planId - Plan Id of the deploy phase. + * @param {string} timelineId - Timeline Id of the task. + * @param {string} recordId - Record Id of attachment. + * @param {string} type - Type of the attachment. + * @param {string} name - Name of the attachment. + */ + getReleaseTaskAttachmentContent(project, releaseId, environmentId, attemptId, planId, timelineId, recordId, type, name) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId, + attemptId, + planId, + timelineId, + recordId, + type, + name + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "60b86efb-7b8c-4853-8f9f-aa142b77b479", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the task attachments. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} environmentId - Id of the release environment. + * @param {number} attemptId - Attempt number of deployment. + * @param {string} timelineId - Timeline Id of the task. + * @param {string} type - Type of the attachment. + */ + getTaskAttachments(project, releaseId, environmentId, attemptId, timelineId, type) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId, + attemptId, + timelineId, + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "214111ee-2415-4df2-8ed2-74417f7d61f9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseTaskAttachment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the release task attachments. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} environmentId - Id of the release environment. + * @param {number} attemptId - Attempt number of deployment. + * @param {string} planId - Plan Id of the deploy phase. + * @param {string} type - Type of the attachment. + */ + getReleaseTaskAttachments(project, releaseId, environmentId, attemptId, planId, type) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId, + attemptId, + planId, + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "a4d06688-0dfa-4895-82a5-f43ec9452306", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseTaskAttachment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} artifactType + * @param {string} sourceId + * @param {string} artifactVersionId + * @param {string} project - Project ID or project name + */ + getAutoTriggerIssues(artifactType, sourceId, artifactVersionId, project) { + return __awaiter2(this, void 0, void 0, function* () { + if (artifactType == null) { + throw new TypeError("artifactType can not be null or undefined"); + } + if (sourceId == null) { + throw new TypeError("sourceId can not be null or undefined"); + } + if (artifactVersionId == null) { + throw new TypeError("artifactVersionId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + artifactType, + sourceId, + artifactVersionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c1a68497-69da-40fb-9423-cab19cfeeca9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.AutoTriggerIssue, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a badge that indicates the status of the most recent deployment for an environment. + * + * @param {string} projectId - The ID of the Project. + * @param {number} releaseDefinitionId - The ID of the Release Definition. + * @param {number} environmentId - The ID of the Environment. + * @param {string} branchName - The name of the branch. + */ + getDeploymentBadge(projectId, releaseDefinitionId, environmentId, branchName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + projectId, + releaseDefinitionId, + environmentId, + branchName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "1a60a35d-b8c9-45fb-bf67-da0829711147", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {number} baseReleaseId + * @param {number} top + * @param {string} artifactAlias + */ + getReleaseChanges(project, releaseId, baseReleaseId, top, artifactAlias) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + let queryValues = { + baseReleaseId, + "$top": top, + artifactAlias + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "8dcf9fe9-ca37-4113-8ee1-37928e98407c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Change, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} taskGroupId + * @param {string[]} propertyFilters + */ + getDefinitionEnvironments(project, taskGroupId, propertyFilters) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + taskGroupId, + propertyFilters: propertyFilters && propertyFilters.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "12b5d21a-f54c-430e-a8c1-7515d196890e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a release definition + * + * @param {ReleaseInterfaces.ReleaseDefinition} releaseDefinition - release definition object to create. + * @param {string} project - Project ID or project name + */ + createReleaseDefinition(releaseDefinition, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, releaseDefinition, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a release definition. + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - Id of the release definition. + * @param {string} comment - Comment for deleting a release definition. + * @param {boolean} forceDelete - 'true' to automatically cancel any in-progress release deployments and proceed with release definition deletion . Default is 'false'. + */ + deleteReleaseDefinition(project, definitionId, comment, forceDelete) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + let queryValues = { + comment, + forceDelete + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a release definition. + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - Id of the release definition. + * @param {string[]} propertyFilters - A comma-delimited list of extended properties to be retrieved. If set, the returned Release Definition will contain values for the specified property Ids (if they exist). If not set, properties will not be included. + */ + getReleaseDefinition(project, definitionId, propertyFilters) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + let queryValues = { + propertyFilters: propertyFilters && propertyFilters.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get release definition of a given revision. + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - Id of the release definition. + * @param {number} revision - Revision number of the release definition. + */ + getReleaseDefinitionRevision(project, definitionId, revision) { + return __awaiter2(this, void 0, void 0, function* () { + if (revision == null) { + throw new TypeError("revision can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + let queryValues = { + revision + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of release definitions. + * + * @param {string} project - Project ID or project name + * @param {string} searchText - Get release definitions with names containing searchText. + * @param {ReleaseInterfaces.ReleaseDefinitionExpands} expand - The properties that should be expanded in the list of Release definitions. + * @param {string} artifactType - Release definitions with given artifactType will be returned. Values can be Build, Jenkins, GitHub, Nuget, Team Build (external), ExternalTFSBuild, Git, TFVC, ExternalTfsXamlBuild. + * @param {string} artifactSourceId - Release definitions with given artifactSourceId will be returned. e.g. For build it would be {projectGuid}:{BuildDefinitionId}, for Jenkins it would be {JenkinsConnectionId}:{JenkinsDefinitionId}, for TfsOnPrem it would be {TfsOnPremConnectionId}:{ProjectName}:{TfsOnPremDefinitionId}. For third-party artifacts e.g. TeamCity, BitBucket you may refer 'uniqueSourceIdentifier' inside vss-extension.json at https://github.com/Microsoft/vsts-rm-extensions/blob/master/Extensions. + * @param {number} top - Number of release definitions to get. + * @param {string} continuationToken - Gets the release definitions after the continuation token provided. + * @param {ReleaseInterfaces.ReleaseDefinitionQueryOrder} queryOrder - Gets the results in the defined order. Default is 'IdAscending'. + * @param {string} path - Gets the release definitions under the specified path. + * @param {boolean} isExactNameMatch - 'true'to gets the release definitions with exact match as specified in searchText. Default is 'false'. + * @param {string[]} tagFilter - A comma-delimited list of tags. Only release definitions with these tags will be returned. + * @param {string[]} propertyFilters - A comma-delimited list of extended properties to be retrieved. If set, the returned Release Definitions will contain values for the specified property Ids (if they exist). If not set, properties will not be included. Note that this will not filter out any Release Definition from results irrespective of whether it has property set or not. + * @param {string[]} definitionIdFilter - A comma-delimited list of release definitions to retrieve. + * @param {boolean} isDeleted - 'true' to get release definitions that has been deleted. Default is 'false' + * @param {boolean} searchTextContainsFolderName - 'true' to get the release definitions under the folder with name as specified in searchText. Default is 'false'. + */ + getReleaseDefinitions(project, searchText, expand, artifactType, artifactSourceId, top, continuationToken, queryOrder, path2, isExactNameMatch, tagFilter, propertyFilters, definitionIdFilter, isDeleted, searchTextContainsFolderName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + searchText, + "$expand": expand, + artifactType, + artifactSourceId, + "$top": top, + continuationToken, + queryOrder, + path: path2, + isExactNameMatch, + tagFilter: tagFilter && tagFilter.join(","), + propertyFilters: propertyFilters && propertyFilters.join(","), + definitionIdFilter: definitionIdFilter && definitionIdFilter.join(","), + isDeleted, + searchTextContainsFolderName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinition, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Undelete a release definition. + * + * @param {ReleaseInterfaces.ReleaseDefinitionUndeleteParameter} releaseDefinitionUndeleteParameter - Object for undelete release definition. + * @param {string} project - Project ID or project name + * @param {number} definitionId - Id of the release definition to be undeleted + */ + undeleteReleaseDefinition(releaseDefinitionUndeleteParameter, project, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, releaseDefinitionUndeleteParameter, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a release definition. + * + * @param {ReleaseInterfaces.ReleaseDefinition} releaseDefinition - Release definition object to update. + * @param {string} project - Project ID or project name + */ + updateReleaseDefinition(releaseDefinition, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "d8f96f24-8ea7-4cb6-baab-2df8fc515665", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, releaseDefinition, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of deployments + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - List the deployments for a given definition id. + * @param {number} definitionEnvironmentId - List the deployments for a given definition environment id. + * @param {string} createdBy - List the deployments for which deployments are created as identity specified. + * @param {Date} minModifiedTime - List the deployments with LastModified time >= minModifiedTime. + * @param {Date} maxModifiedTime - List the deployments with LastModified time <= maxModifiedTime. + * @param {ReleaseInterfaces.DeploymentStatus} deploymentStatus - List the deployments with given deployment status. Defult is 'All'. + * @param {ReleaseInterfaces.DeploymentOperationStatus} operationStatus - List the deployments with given operation status. Default is 'All'. + * @param {boolean} latestAttemptsOnly - 'true' to include deployments with latest attempt only. Default is 'false'. + * @param {ReleaseInterfaces.ReleaseQueryOrder} queryOrder - List the deployments with given query order. Default is 'Descending'. + * @param {number} top - List the deployments with given top. Default top is '50' and Max top is '100'. + * @param {number} continuationToken - List the deployments with deployment id >= continuationToken. + * @param {string} createdFor - List the deployments for which deployments are requested as identity specified. + * @param {Date} minStartedTime - List the deployments with StartedOn time >= minStartedTime. + * @param {Date} maxStartedTime - List the deployments with StartedOn time <= maxStartedTime. + * @param {string} sourceBranch - List the deployments that are deployed from given branch name. + */ + getDeployments(project, definitionId, definitionEnvironmentId, createdBy, minModifiedTime, maxModifiedTime, deploymentStatus, operationStatus, latestAttemptsOnly, queryOrder, top, continuationToken, createdFor, minStartedTime, maxStartedTime, sourceBranch) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + definitionId, + definitionEnvironmentId, + createdBy, + minModifiedTime, + maxModifiedTime, + deploymentStatus, + operationStatus, + latestAttemptsOnly, + queryOrder, + "$top": top, + continuationToken, + createdFor, + minStartedTime, + maxStartedTime, + sourceBranch + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "b005ef73-cddc-448e-9ba2-5193bf36b19f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Deployment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {ReleaseInterfaces.DeploymentQueryParameters} queryParameters + * @param {string} project - Project ID or project name + */ + getDeploymentsForMultipleEnvironments(queryParameters, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "b005ef73-cddc-448e-9ba2-5193bf36b19f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, queryParameters, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Deployment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a release environment. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} environmentId - Id of the release environment. + * @param {ReleaseInterfaces.ReleaseEnvironmentExpands} expand - A property that should be expanded in the environment. + */ + getReleaseEnvironment(project, releaseId, environmentId, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "Release", "a7e426b1-03dc-48af-9dfe-c98bac612dcb", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseEnvironment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update the status of a release environment + * + * @param {ReleaseInterfaces.ReleaseEnvironmentUpdateMetadata} environmentUpdateData - Environment update meta data. + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} environmentId - Id of release environment. + */ + updateReleaseEnvironment(environmentUpdateData, project, releaseId, environmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.7", "Release", "a7e426b1-03dc-48af-9dfe-c98bac612dcb", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, environmentUpdateData, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseEnvironment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a definition environment template + * + * @param {ReleaseInterfaces.ReleaseDefinitionEnvironmentTemplate} template - Definition environment template to create + * @param {string} project - Project ID or project name + */ + createDefinitionEnvironmentTemplate(template2, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "6b03b696-824e-4479-8eb2-6644a51aba89", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, template2, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinitionEnvironmentTemplate, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a definition environment template + * + * @param {string} project - Project ID or project name + * @param {string} templateId - Id of the definition environment template + */ + deleteDefinitionEnvironmentTemplate(project, templateId) { + return __awaiter2(this, void 0, void 0, function* () { + if (templateId == null) { + throw new TypeError("templateId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + templateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "6b03b696-824e-4479-8eb2-6644a51aba89", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a definition environment template + * + * @param {string} project - Project ID or project name + * @param {string} templateId - Id of the definition environment template + */ + getDefinitionEnvironmentTemplate(project, templateId) { + return __awaiter2(this, void 0, void 0, function* () { + if (templateId == null) { + throw new TypeError("templateId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + templateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "6b03b696-824e-4479-8eb2-6644a51aba89", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinitionEnvironmentTemplate, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a list of definition environment templates + * + * @param {string} project - Project ID or project name + * @param {boolean} isDeleted - 'true' to get definition environment templates that have been deleted. Default is 'false' + */ + listDefinitionEnvironmentTemplates(project, isDeleted) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + isDeleted + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "6b03b696-824e-4479-8eb2-6644a51aba89", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinitionEnvironmentTemplate, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Undelete a release definition environment template. + * + * @param {string} project - Project ID or project name + * @param {string} templateId - Id of the definition environment template to be undeleted + */ + undeleteReleaseDefinitionEnvironmentTemplate(project, templateId) { + return __awaiter2(this, void 0, void 0, function* () { + if (templateId == null) { + throw new TypeError("templateId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + templateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "6b03b696-824e-4479-8eb2-6644a51aba89", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, null, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinitionEnvironmentTemplate, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {ReleaseInterfaces.FavoriteItem[]} favoriteItems + * @param {string} project - Project ID or project name + * @param {string} scope + * @param {string} identityId + */ + createFavorites(favoriteItems, project, scope, identityId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + scope + }; + let queryValues = { + identityId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "938f7222-9acb-48fe-b8a3-4eda04597171", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, favoriteItems, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} scope + * @param {string} identityId + * @param {string} favoriteItemIds + */ + deleteFavorites(project, scope, identityId, favoriteItemIds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + scope + }; + let queryValues = { + identityId, + favoriteItemIds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "938f7222-9acb-48fe-b8a3-4eda04597171", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} scope + * @param {string} identityId + */ + getFavorites(project, scope, identityId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + scope + }; + let queryValues = { + identityId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "938f7222-9acb-48fe-b8a3-4eda04597171", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} flightName + */ + getFlightAssignments(flightName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + flightName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "409d301f-3046-46f3-beb9-4357fbce0a8c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a new folder. + * + * @param {ReleaseInterfaces.Folder} folder - folder. + * @param {string} project - Project ID or project name + * @param {string} path - Path of the folder. + */ + createFolder(folder, project, path2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + path: path2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "f7ddf76d-ce0c-4d68-94ff-becaec5d9dea", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, folder, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Folder, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes a definition folder for given folder name and path and all it's existing definitions. + * + * @param {string} project - Project ID or project name + * @param {string} path - Path of the folder to delete. + */ + deleteFolder(project, path2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + path: path2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "f7ddf76d-ce0c-4d68-94ff-becaec5d9dea", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets folders. + * + * @param {string} project - Project ID or project name + * @param {string} path - Path of the folder. + * @param {ReleaseInterfaces.FolderPathQueryOrder} queryOrder - Gets the results in the defined order. Default is 'None'. + */ + getFolders(project, path2, queryOrder) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + path: path2 + }; + let queryValues = { + queryOrder + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "f7ddf76d-ce0c-4d68-94ff-becaec5d9dea", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Folder, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates an existing folder at given existing path. + * + * @param {ReleaseInterfaces.Folder} folder - folder. + * @param {string} project - Project ID or project name + * @param {string} path - Path of the folder to update. + */ + updateFolder(folder, project, path2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + path: path2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "f7ddf76d-ce0c-4d68-94ff-becaec5d9dea", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, folder, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Folder, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates the gate for a deployment. + * + * @param {ReleaseInterfaces.GateUpdateMetadata} gateUpdateMetadata - Metadata to patch the Release Gates. + * @param {string} project - Project ID or project name + * @param {number} gateStepId - Gate step Id. + */ + updateGates(gateUpdateMetadata, project, gateStepId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + gateStepId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "2666a539-2001-4f80-bcc7-0379956749d4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, gateUpdateMetadata, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseGates, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + */ + getReleaseHistory(project, releaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "23f461c8-629a-4144-a076-3054fa5f268a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseRevision, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {FormInputInterfaces.InputValuesQuery} query + * @param {string} project - Project ID or project name + */ + getInputValues(query, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "71dd499b-317d-45ea-9134-140ea1932b5e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, query, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {string} sourceId + */ + getIssues(project, buildId, sourceId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + let queryValues = { + sourceId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "cd42261a-f5c6-41c8-9259-f078989b9f25", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.AutoTriggerIssue, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets gate logs + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} environmentId - Id of release environment. + * @param {number} gateId - Id of the gate. + * @param {number} taskId - ReleaseTask Id for the log. + */ + getGateLog(project, releaseId, environmentId, gateId, taskId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId, + gateId, + taskId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "dec7ca5a-7f7f-4797-8bf1-8efc0dc93b28", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get logs for a release Id. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + */ + getLogs(project, releaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "c37fbab5-214b-48e4-a55b-cb6b4f6e4038", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets logs + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} environmentId - Id of release environment. + * @param {number} taskId - ReleaseTask Id for the log. + * @param {number} attemptId - Id of the attempt. + */ + getLog(project, releaseId, environmentId, taskId, attemptId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId, + taskId + }; + let queryValues = { + attemptId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "e71ba1ed-c0a4-4a28-a61f-2dd5f68cf3fd", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the task log of a release as a plain text file. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} environmentId - Id of release environment. + * @param {number} attemptId + * @param {string} timelineId + * @param {number} taskId - ReleaseTask Id for the log. + * @param {number} startLine - Starting line number for logs + * @param {number} endLine - Ending line number for logs + */ + getTaskLog2(project, releaseId, environmentId, attemptId, timelineId, taskId, startLine, endLine) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId, + attemptId, + timelineId, + taskId + }; + let queryValues = { + startLine, + endLine + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "2577e6c3-6999-4400-bc69-fe1d837755fe", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the task log of a release as a plain text file. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} environmentId - Id of release environment. + * @param {number} releaseDeployPhaseId - Release deploy phase Id. + * @param {number} taskId - ReleaseTask Id for the log. + * @param {number} startLine - Starting line number for logs + * @param {number} endLine - Ending line number for logs + */ + getTaskLog(project, releaseId, environmentId, releaseDeployPhaseId, taskId, startLine, endLine) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId, + releaseDeployPhaseId, + taskId + }; + let queryValues = { + startLine, + endLine + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "17c91af7-09fd-4256-bff1-c24ee4f73bc0", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get manual intervention for a given release and manual intervention id. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} manualInterventionId - Id of the manual intervention. + */ + getManualIntervention(project, releaseId, manualInterventionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + manualInterventionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "616c46e4-f370-4456-adaa-fbaf79c7b79e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ManualIntervention, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * List all manual interventions for a given release. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + */ + getManualInterventions(project, releaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "616c46e4-f370-4456-adaa-fbaf79c7b79e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ManualIntervention, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update manual intervention. + * + * @param {ReleaseInterfaces.ManualInterventionUpdateMetadata} manualInterventionUpdateMetadata - Meta data to update manual intervention. + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} manualInterventionId - Id of the manual intervention. + */ + updateManualIntervention(manualInterventionUpdateMetadata, project, releaseId, manualInterventionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + manualInterventionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "616c46e4-f370-4456-adaa-fbaf79c7b79e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, manualInterventionUpdateMetadata, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ManualIntervention, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {Date} minMetricsTime + */ + getMetrics(project, minMetricsTime) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + minMetricsTime + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "cd1502bb-3c73-4e11-80a6-d11308dceae5", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets Org pipeline release settings + * + */ + getOrgPipelineReleaseSettings() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "d156c759-ca4e-492b-90d4-db03971796ea", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates Org pipeline release settings + * + * @param {ReleaseInterfaces.OrgPipelineReleaseSettingsUpdateParameters} newSettings + */ + updateOrgPipelineReleaseSettings(newSettings) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "d156c759-ca4e-492b-90d4-db03971796ea", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, newSettings, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets pipeline release settings + * + * @param {string} project - Project ID or project name + */ + getPipelineReleaseSettings(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "e816b9f4-f9fe-46ba-bdcc-a9af6abf3144", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates pipeline release settings + * + * @param {ReleaseInterfaces.ProjectPipelineReleaseSettingsUpdateParameters} newSettings + * @param {string} project - Project ID or project name + */ + updatePipelineReleaseSettings(newSettings, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "e816b9f4-f9fe-46ba-bdcc-a9af6abf3144", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, newSettings, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} artifactType + * @param {string} artifactSourceId + */ + getReleaseProjects(artifactType, artifactSourceId) { + return __awaiter2(this, void 0, void 0, function* () { + if (artifactType == null) { + throw new TypeError("artifactType can not be null or undefined"); + } + if (artifactSourceId == null) { + throw new TypeError("artifactSourceId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + artifactType, + artifactSourceId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "917ace4a-79d1-45a7-987c-7be4db4268fa", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of releases + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - Releases from this release definition Id. + * @param {number} definitionEnvironmentId + * @param {string} searchText - Releases with names containing searchText. + * @param {string} createdBy - Releases created by this user. + * @param {ReleaseInterfaces.ReleaseStatus} statusFilter - Releases that have this status. + * @param {number} environmentStatusFilter + * @param {Date} minCreatedTime - Releases that were created after this time. + * @param {Date} maxCreatedTime - Releases that were created before this time. + * @param {ReleaseInterfaces.ReleaseQueryOrder} queryOrder - Gets the results in the defined order of created date for releases. Default is descending. + * @param {number} top - Number of releases to get. Default is 50. + * @param {number} continuationToken - Gets the releases after the continuation token provided. + * @param {ReleaseInterfaces.ReleaseExpands} expand - The property that should be expanded in the list of releases. + * @param {string} artifactTypeId - Releases with given artifactTypeId will be returned. Values can be Build, Jenkins, GitHub, Nuget, Team Build (external), ExternalTFSBuild, Git, TFVC, ExternalTfsXamlBuild. + * @param {string} sourceId - Unique identifier of the artifact used. e.g. For build it would be {projectGuid}:{BuildDefinitionId}, for Jenkins it would be {JenkinsConnectionId}:{JenkinsDefinitionId}, for TfsOnPrem it would be {TfsOnPremConnectionId}:{ProjectName}:{TfsOnPremDefinitionId}. For third-party artifacts e.g. TeamCity, BitBucket you may refer 'uniqueSourceIdentifier' inside vss-extension.json https://github.com/Microsoft/vsts-rm-extensions/blob/master/Extensions. + * @param {string} artifactVersionId - Releases with given artifactVersionId will be returned. E.g. in case of Build artifactType, it is buildId. + * @param {string} sourceBranchFilter - Releases with given sourceBranchFilter will be returned. + * @param {boolean} isDeleted - Gets the soft deleted releases, if true. + * @param {string[]} tagFilter - A comma-delimited list of tags. Only releases with these tags will be returned. + * @param {string[]} propertyFilters - A comma-delimited list of extended properties to be retrieved. If set, the returned Releases will contain values for the specified property Ids (if they exist). If not set, properties will not be included. Note that this will not filter out any Release from results irrespective of whether it has property set or not. + * @param {number[]} releaseIdFilter - A comma-delimited list of releases Ids. Only releases with these Ids will be returned. + * @param {string} path - Releases under this folder path will be returned + */ + getReleases(project, definitionId, definitionEnvironmentId, searchText, createdBy, statusFilter, environmentStatusFilter, minCreatedTime, maxCreatedTime, queryOrder, top, continuationToken, expand, artifactTypeId, sourceId, artifactVersionId, sourceBranchFilter, isDeleted, tagFilter, propertyFilters, releaseIdFilter, path2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + definitionId, + definitionEnvironmentId, + searchText, + createdBy, + statusFilter, + environmentStatusFilter, + minCreatedTime, + maxCreatedTime, + queryOrder, + "$top": top, + continuationToken, + "$expand": expand, + artifactTypeId, + sourceId, + artifactVersionId, + sourceBranchFilter, + isDeleted, + tagFilter: tagFilter && tagFilter.join(","), + propertyFilters: propertyFilters && propertyFilters.join(","), + releaseIdFilter: releaseIdFilter && releaseIdFilter.join(","), + path: path2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Release, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a release. + * + * @param {ReleaseInterfaces.ReleaseStartMetadata} releaseStartMetadata - Metadata to create a release. + * @param {string} project - Project ID or project name + */ + createRelease(releaseStartMetadata, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, releaseStartMetadata, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Release, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Soft delete a release + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {string} comment - Comment for deleting a release. + */ + deleteRelease(project, releaseId, comment) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + let queryValues = { + comment + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a Release + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {ReleaseInterfaces.ApprovalFilters} approvalFilters - A filter which would allow fetching approval steps selectively based on whether it is automated, or manual. This would also decide whether we should fetch pre and post approval snapshots. Assumes All by default + * @param {string[]} propertyFilters - A comma-delimited list of extended properties to be retrieved. If set, the returned Release will contain values for the specified property Ids (if they exist). If not set, properties will not be included. + * @param {ReleaseInterfaces.SingleReleaseExpands} expand - A property that should be expanded in the release. + * @param {number} topGateRecords - Number of release gate records to get. Default is 5. + */ + getRelease(project, releaseId, approvalFilters, propertyFilters, expand, topGateRecords) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + let queryValues = { + approvalFilters, + propertyFilters: propertyFilters && propertyFilters.join(","), + "$expand": expand, + "$topGateRecords": topGateRecords + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Release, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get release summary of a given definition Id. + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - Id of the definition to get release summary. + * @param {number} releaseCount - Count of releases to be included in summary. + * @param {boolean} includeArtifact - Include artifact details.Default is 'false'. + * @param {number[]} definitionEnvironmentIdsFilter + */ + getReleaseDefinitionSummary(project, definitionId, releaseCount, includeArtifact, definitionEnvironmentIdsFilter) { + return __awaiter2(this, void 0, void 0, function* () { + if (definitionId == null) { + throw new TypeError("definitionId can not be null or undefined"); + } + if (releaseCount == null) { + throw new TypeError("releaseCount can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + definitionId, + releaseCount, + includeArtifact, + definitionEnvironmentIdsFilter: definitionEnvironmentIdsFilter && definitionEnvironmentIdsFilter.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinitionSummary, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get release for a given revision number. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release. + * @param {number} definitionSnapshotRevision - Definition snapshot revision number. + */ + getReleaseRevision(project, releaseId, definitionSnapshotRevision) { + return __awaiter2(this, void 0, void 0, function* () { + if (definitionSnapshotRevision == null) { + throw new TypeError("definitionSnapshotRevision can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + let queryValues = { + definitionSnapshotRevision + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Undelete a soft deleted release. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of release to be undeleted. + * @param {string} comment - Any comment for undeleting. + */ + undeleteRelease(project, releaseId, comment) { + return __awaiter2(this, void 0, void 0, function* () { + if (comment == null) { + throw new TypeError("comment can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + let queryValues = { + comment + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a complete release object. + * + * @param {ReleaseInterfaces.Release} release - Release object for update. + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release to update. + */ + updateRelease(release, project, releaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, release, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Release, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update few properties of a release. + * + * @param {ReleaseInterfaces.ReleaseUpdateMetadata} releaseUpdateMetadata - Properties of release to update. + * @param {string} project - Project ID or project name + * @param {number} releaseId - Id of the release to update. + */ + updateReleaseResource(releaseUpdateMetadata, project, releaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.8", "Release", "a166fde7-27ad-408e-ba75-703c2cc9d500", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, releaseUpdateMetadata, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.Release, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the release settings + * + * @param {string} project - Project ID or project name + */ + getReleaseSettings(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c63c3718-7cfd-41e0-b89b-81c1ca143437", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates the release settings + * + * @param {ReleaseInterfaces.ReleaseSettings} releaseSettings + * @param {string} project - Project ID or project name + */ + updateReleaseSettings(releaseSettings, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c63c3718-7cfd-41e0-b89b-81c1ca143437", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, releaseSettings, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get release definition for a given definitionId and revision + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - Id of the definition. + * @param {number} revision - Id of the revision. + */ + getDefinitionRevision(project, definitionId, revision) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId, + revision + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "258b82e0-9d41-43f3-86d6-fef14ddd44bc", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get revision history for a release definition + * + * @param {string} project - Project ID or project name + * @param {number} definitionId - Id of the definition. + */ + getReleaseDefinitionHistory(project, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Release", "258b82e0-9d41-43f3-86d6-fef14ddd44bc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseDefinitionRevision, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + */ + getSummaryMailSections(project, releaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "224e92b2-8d13-4c14-b120-13d877c516f8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.SummaryMailSection, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {ReleaseInterfaces.MailMessage} mailMessage + * @param {string} project - Project ID or project name + * @param {number} releaseId + */ + sendSummaryMail(mailMessage, project, releaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "224e92b2-8d13-4c14-b120-13d877c516f8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, mailMessage, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} definitionId + */ + getSourceBranches(project, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "0e5def23-78b3-461f-8198-1558f25041c8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a tag to a definition + * + * @param {string} project - Project ID or project name + * @param {number} releaseDefinitionId + * @param {string} tag + */ + addDefinitionTag(project, releaseDefinitionId, tag) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseDefinitionId, + tag + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "3d21b4c8-c32e-45b2-a7cb-770a369012f4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, null, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds multiple tags to a definition + * + * @param {string[]} tags + * @param {string} project - Project ID or project name + * @param {number} releaseDefinitionId + */ + addDefinitionTags(tags, project, releaseDefinitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseDefinitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "3d21b4c8-c32e-45b2-a7cb-770a369012f4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, tags, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes a tag from a definition + * + * @param {string} project - Project ID or project name + * @param {number} releaseDefinitionId + * @param {string} tag + */ + deleteDefinitionTag(project, releaseDefinitionId, tag) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseDefinitionId, + tag + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "3d21b4c8-c32e-45b2-a7cb-770a369012f4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the tags for a definition + * + * @param {string} project - Project ID or project name + * @param {number} releaseDefinitionId + */ + getDefinitionTags(project, releaseDefinitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseDefinitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "3d21b4c8-c32e-45b2-a7cb-770a369012f4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a tag to a releaseId + * + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {string} tag + */ + addReleaseTag(project, releaseId, tag) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + tag + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c5b602b6-d1b3-4363-8a51-94384f78068f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, null, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds tag to a release + * + * @param {string[]} tags + * @param {string} project - Project ID or project name + * @param {number} releaseId + */ + addReleaseTags(tags, project, releaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c5b602b6-d1b3-4363-8a51-94384f78068f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, tags, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes a tag from a release + * + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {string} tag + */ + deleteReleaseTag(project, releaseId, tag) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + tag + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c5b602b6-d1b3-4363-8a51-94384f78068f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the tags for a release + * + * @param {string} project - Project ID or project name + * @param {number} releaseId + */ + getReleaseTags(project, releaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "c5b602b6-d1b3-4363-8a51-94384f78068f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + */ + getTags(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "86cee25a-68ba-4ba3-9171-8ad6ffc6df93", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {number} environmentId + * @param {number} releaseDeployPhaseId + */ + getTasksForTaskGroup(project, releaseId, environmentId, releaseDeployPhaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId, + releaseDeployPhaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "4259191d-4b0a-4409-9fb3-09f22ab9bc47", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseTask, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {number} environmentId + * @param {number} attemptId + * @param {string} timelineId + */ + getTasks2(project, releaseId, environmentId, attemptId, timelineId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId, + attemptId, + timelineId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "4259291d-4b0a-4409-9fb3-04f22ab9bc47", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseTask, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {number} environmentId + * @param {number} attemptId + */ + getTasks(project, releaseId, environmentId, attemptId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId, + environmentId + }; + let queryValues = { + attemptId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Release", "36b276e0-3c70-4320-a63c-1a2e1466a0d1", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ReleaseTask, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + */ + getArtifactTypeDefinitions(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "8efc2a3c-1fc8-4f6d-9822-75e98cecb48f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ArtifactTypeDefinition, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseDefinitionId + */ + getArtifactVersions(project, releaseDefinitionId) { + return __awaiter2(this, void 0, void 0, function* () { + if (releaseDefinitionId == null) { + throw new TypeError("releaseDefinitionId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + releaseDefinitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "30fc787e-a9e0-4a07-9fbc-3e903aa051d2", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ArtifactVersionQueryResult, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {ReleaseInterfaces.Artifact[]} artifacts + * @param {string} project - Project ID or project name + */ + getArtifactVersionsForSources(artifacts, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "30fc787e-a9e0-4a07-9fbc-3e903aa051d2", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, artifacts, options); + let ret = this.formatResponse(res.result, ReleaseInterfaces.TypeInfo.ArtifactVersionQueryResult, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {number} baseReleaseId + * @param {number} top + * @param {string} artifactAlias + */ + getReleaseWorkItemsRefs(project, releaseId, baseReleaseId, top, artifactAlias) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + releaseId + }; + let queryValues = { + baseReleaseId, + "$top": top, + artifactAlias + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Release", "4f165cc0-875c-4768-b148-f12f78769fab", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.ReleaseApi = ReleaseApi; + ReleaseApi.RESOURCE_AREA_ID = "efc2f575-36ef-48e9-b672-0c6fb4a48ac5"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/SecurityRolesInterfaces.js +var require_SecurityRolesInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/SecurityRolesInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.RoleAccess = void 0; + var RoleAccess; + (function(RoleAccess2) { + RoleAccess2[RoleAccess2["Assigned"] = 1] = "Assigned"; + RoleAccess2[RoleAccess2["Inherited"] = 2] = "Inherited"; + })(RoleAccess = exports2.RoleAccess || (exports2.RoleAccess = {})); + exports2.TypeInfo = { + RoleAccess: { + enumValues: { + "assigned": 1, + "inherited": 2 + } + }, + RoleAssignment: {} + }; + exports2.TypeInfo.RoleAssignment.fields = { + access: { + enumType: exports2.TypeInfo.RoleAccess + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/SecurityRolesApi.js +var require_SecurityRolesApi = __commonJS({ + "../node_modules/azure-devops-node-api/SecurityRolesApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SecurityRolesApi = void 0; + var basem = require_ClientApiBases(); + var SecurityRolesInterfaces = require_SecurityRolesInterfaces(); + var SecurityRolesApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-SecurityRoles-api", options); + } + /** + * @param {string} scopeId + * @param {string} resourceId + */ + getRoleAssignments(scopeId, resourceId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeId, + resourceId + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "securityroles", "9461c234-c84c-4ed2-b918-2f0f92ad0a35", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, SecurityRolesInterfaces.TypeInfo.RoleAssignment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeId + * @param {string} resourceId + * @param {string} identityId + */ + removeRoleAssignment(scopeId, resourceId, identityId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeId, + resourceId, + identityId + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "securityroles", "9461c234-c84c-4ed2-b918-2f0f92ad0a35", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string[]} identityIds + * @param {string} scopeId + * @param {string} resourceId + */ + removeRoleAssignments(identityIds, scopeId, resourceId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeId, + resourceId + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "securityroles", "9461c234-c84c-4ed2-b918-2f0f92ad0a35", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, identityIds, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {SecurityRolesInterfaces.UserRoleAssignmentRef} roleAssignment + * @param {string} scopeId + * @param {string} resourceId + * @param {string} identityId + */ + setRoleAssignment(roleAssignment, scopeId, resourceId, identityId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeId, + resourceId, + identityId + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "securityroles", "9461c234-c84c-4ed2-b918-2f0f92ad0a35", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, roleAssignment, options); + let ret = this.formatResponse(res.result, SecurityRolesInterfaces.TypeInfo.RoleAssignment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {SecurityRolesInterfaces.UserRoleAssignmentRef[]} roleAssignments + * @param {string} scopeId + * @param {string} resourceId + */ + setRoleAssignments(roleAssignments, scopeId, resourceId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeId, + resourceId + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "securityroles", "9461c234-c84c-4ed2-b918-2f0f92ad0a35", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, roleAssignments, options); + let ret = this.formatResponse(res.result, SecurityRolesInterfaces.TypeInfo.RoleAssignment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeId + */ + getRoleDefinitions(scopeId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeId + }; + try { + let verData = yield this.vsoClient.getVersioningData("3.2-preview.1", "securityroles", "f4cc9a86-453c-48d2-b44d-d3bd5c105f4f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.SecurityRolesApi = SecurityRolesApi; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/TaskAgentInterfaces.js +var require_TaskAgentInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/TaskAgentInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.VariableGroupQueryOrder = exports2.VariableGroupActionFilter = exports2.TimelineRecordState = exports2.TaskResult = exports2.TaskOrchestrationPlanState = exports2.TaskOrchestrationItemType = exports2.TaskGroupQueryOrder = exports2.TaskGroupExpands = exports2.TaskDefinitionStatus = exports2.TaskCommandMode = exports2.TaskAgentUpdateReasonType = exports2.TaskAgentStatusFilter = exports2.TaskAgentStatus = exports2.TaskAgentRequestUpdateOptions = exports2.TaskAgentQueueActionFilter = exports2.TaskAgentPoolType = exports2.TaskAgentPoolOptions = exports2.TaskAgentPoolMaintenanceScheduleDays = exports2.TaskAgentPoolMaintenanceJobStatus = exports2.TaskAgentPoolMaintenanceJobResult = exports2.TaskAgentPoolActionFilter = exports2.TaskAgentJobStepType = exports2.TaskAgentJobResultFilter = exports2.SecureFileActionFilter = exports2.ResourceLockStatus = exports2.PlanGroupStatusFilter = exports2.PlanGroupStatus = exports2.OrchestrationType = exports2.OperationType = exports2.OperatingSystemType = exports2.MaskType = exports2.MachineGroupActionFilter = exports2.LogLevel = exports2.IssueType = exports2.ExclusiveLockType = exports2.EnvironmentResourceType = exports2.EnvironmentExpands = exports2.EnvironmentActionFilter = exports2.ElasticPoolState = exports2.ElasticNodeState = exports2.ElasticComputeState = exports2.ElasticAgentState = exports2.DeploymentTargetExpands = exports2.DeploymentPoolSummaryExpands = exports2.DeploymentMachineExpands = exports2.DeploymentGroupExpands = exports2.DeploymentGroupActionFilter = exports2.DemandSourceType = exports2.AuditAction = exports2.AadLoginPromptOption = void 0; + var FormInputInterfaces = require_FormInputInterfaces(); + var AadLoginPromptOption; + (function(AadLoginPromptOption2) { + AadLoginPromptOption2[AadLoginPromptOption2["NoOption"] = 0] = "NoOption"; + AadLoginPromptOption2[AadLoginPromptOption2["Login"] = 1] = "Login"; + AadLoginPromptOption2[AadLoginPromptOption2["SelectAccount"] = 2] = "SelectAccount"; + AadLoginPromptOption2[AadLoginPromptOption2["FreshLogin"] = 3] = "FreshLogin"; + AadLoginPromptOption2[AadLoginPromptOption2["FreshLoginWithMfa"] = 4] = "FreshLoginWithMfa"; + })(AadLoginPromptOption = exports2.AadLoginPromptOption || (exports2.AadLoginPromptOption = {})); + var AuditAction; + (function(AuditAction2) { + AuditAction2[AuditAction2["Add"] = 1] = "Add"; + AuditAction2[AuditAction2["Update"] = 2] = "Update"; + AuditAction2[AuditAction2["Delete"] = 3] = "Delete"; + AuditAction2[AuditAction2["Undelete"] = 4] = "Undelete"; + })(AuditAction = exports2.AuditAction || (exports2.AuditAction = {})); + var DemandSourceType; + (function(DemandSourceType2) { + DemandSourceType2[DemandSourceType2["Task"] = 0] = "Task"; + DemandSourceType2[DemandSourceType2["Feature"] = 1] = "Feature"; + })(DemandSourceType = exports2.DemandSourceType || (exports2.DemandSourceType = {})); + var DeploymentGroupActionFilter; + (function(DeploymentGroupActionFilter2) { + DeploymentGroupActionFilter2[DeploymentGroupActionFilter2["None"] = 0] = "None"; + DeploymentGroupActionFilter2[DeploymentGroupActionFilter2["Manage"] = 2] = "Manage"; + DeploymentGroupActionFilter2[DeploymentGroupActionFilter2["Use"] = 16] = "Use"; + })(DeploymentGroupActionFilter = exports2.DeploymentGroupActionFilter || (exports2.DeploymentGroupActionFilter = {})); + var DeploymentGroupExpands; + (function(DeploymentGroupExpands2) { + DeploymentGroupExpands2[DeploymentGroupExpands2["None"] = 0] = "None"; + DeploymentGroupExpands2[DeploymentGroupExpands2["Machines"] = 2] = "Machines"; + DeploymentGroupExpands2[DeploymentGroupExpands2["Tags"] = 4] = "Tags"; + })(DeploymentGroupExpands = exports2.DeploymentGroupExpands || (exports2.DeploymentGroupExpands = {})); + var DeploymentMachineExpands; + (function(DeploymentMachineExpands2) { + DeploymentMachineExpands2[DeploymentMachineExpands2["None"] = 0] = "None"; + DeploymentMachineExpands2[DeploymentMachineExpands2["Capabilities"] = 2] = "Capabilities"; + DeploymentMachineExpands2[DeploymentMachineExpands2["AssignedRequest"] = 4] = "AssignedRequest"; + })(DeploymentMachineExpands = exports2.DeploymentMachineExpands || (exports2.DeploymentMachineExpands = {})); + var DeploymentPoolSummaryExpands; + (function(DeploymentPoolSummaryExpands2) { + DeploymentPoolSummaryExpands2[DeploymentPoolSummaryExpands2["None"] = 0] = "None"; + DeploymentPoolSummaryExpands2[DeploymentPoolSummaryExpands2["DeploymentGroups"] = 2] = "DeploymentGroups"; + DeploymentPoolSummaryExpands2[DeploymentPoolSummaryExpands2["Resource"] = 4] = "Resource"; + })(DeploymentPoolSummaryExpands = exports2.DeploymentPoolSummaryExpands || (exports2.DeploymentPoolSummaryExpands = {})); + var DeploymentTargetExpands; + (function(DeploymentTargetExpands2) { + DeploymentTargetExpands2[DeploymentTargetExpands2["None"] = 0] = "None"; + DeploymentTargetExpands2[DeploymentTargetExpands2["Capabilities"] = 2] = "Capabilities"; + DeploymentTargetExpands2[DeploymentTargetExpands2["AssignedRequest"] = 4] = "AssignedRequest"; + DeploymentTargetExpands2[DeploymentTargetExpands2["LastCompletedRequest"] = 8] = "LastCompletedRequest"; + })(DeploymentTargetExpands = exports2.DeploymentTargetExpands || (exports2.DeploymentTargetExpands = {})); + var ElasticAgentState; + (function(ElasticAgentState2) { + ElasticAgentState2[ElasticAgentState2["None"] = 0] = "None"; + ElasticAgentState2[ElasticAgentState2["Enabled"] = 1] = "Enabled"; + ElasticAgentState2[ElasticAgentState2["Online"] = 2] = "Online"; + ElasticAgentState2[ElasticAgentState2["Assigned"] = 4] = "Assigned"; + })(ElasticAgentState = exports2.ElasticAgentState || (exports2.ElasticAgentState = {})); + var ElasticComputeState; + (function(ElasticComputeState2) { + ElasticComputeState2[ElasticComputeState2["None"] = 0] = "None"; + ElasticComputeState2[ElasticComputeState2["Healthy"] = 1] = "Healthy"; + ElasticComputeState2[ElasticComputeState2["Creating"] = 2] = "Creating"; + ElasticComputeState2[ElasticComputeState2["Deleting"] = 3] = "Deleting"; + ElasticComputeState2[ElasticComputeState2["Failed"] = 4] = "Failed"; + ElasticComputeState2[ElasticComputeState2["Stopped"] = 5] = "Stopped"; + ElasticComputeState2[ElasticComputeState2["Reimaging"] = 6] = "Reimaging"; + ElasticComputeState2[ElasticComputeState2["UnhealthyVm"] = 7] = "UnhealthyVm"; + ElasticComputeState2[ElasticComputeState2["UnhealthyVmssVm"] = 8] = "UnhealthyVmssVm"; + })(ElasticComputeState = exports2.ElasticComputeState || (exports2.ElasticComputeState = {})); + var ElasticNodeState; + (function(ElasticNodeState2) { + ElasticNodeState2[ElasticNodeState2["None"] = 0] = "None"; + ElasticNodeState2[ElasticNodeState2["New"] = 1] = "New"; + ElasticNodeState2[ElasticNodeState2["CreatingCompute"] = 2] = "CreatingCompute"; + ElasticNodeState2[ElasticNodeState2["StartingAgent"] = 3] = "StartingAgent"; + ElasticNodeState2[ElasticNodeState2["Idle"] = 4] = "Idle"; + ElasticNodeState2[ElasticNodeState2["Assigned"] = 5] = "Assigned"; + ElasticNodeState2[ElasticNodeState2["Offline"] = 6] = "Offline"; + ElasticNodeState2[ElasticNodeState2["PendingReimage"] = 7] = "PendingReimage"; + ElasticNodeState2[ElasticNodeState2["PendingDelete"] = 8] = "PendingDelete"; + ElasticNodeState2[ElasticNodeState2["Saved"] = 9] = "Saved"; + ElasticNodeState2[ElasticNodeState2["DeletingCompute"] = 10] = "DeletingCompute"; + ElasticNodeState2[ElasticNodeState2["Deleted"] = 11] = "Deleted"; + ElasticNodeState2[ElasticNodeState2["Lost"] = 12] = "Lost"; + ElasticNodeState2[ElasticNodeState2["ReimagingCompute"] = 13] = "ReimagingCompute"; + ElasticNodeState2[ElasticNodeState2["RestartingAgent"] = 14] = "RestartingAgent"; + ElasticNodeState2[ElasticNodeState2["FailedToStartPendingDelete"] = 15] = "FailedToStartPendingDelete"; + ElasticNodeState2[ElasticNodeState2["FailedToRestartPendingDelete"] = 16] = "FailedToRestartPendingDelete"; + ElasticNodeState2[ElasticNodeState2["FailedVMPendingDelete"] = 17] = "FailedVMPendingDelete"; + ElasticNodeState2[ElasticNodeState2["AssignedPendingDelete"] = 18] = "AssignedPendingDelete"; + ElasticNodeState2[ElasticNodeState2["RetryDelete"] = 19] = "RetryDelete"; + ElasticNodeState2[ElasticNodeState2["UnhealthyVm"] = 20] = "UnhealthyVm"; + ElasticNodeState2[ElasticNodeState2["UnhealthyVmPendingDelete"] = 21] = "UnhealthyVmPendingDelete"; + })(ElasticNodeState = exports2.ElasticNodeState || (exports2.ElasticNodeState = {})); + var ElasticPoolState; + (function(ElasticPoolState2) { + ElasticPoolState2[ElasticPoolState2["Online"] = 0] = "Online"; + ElasticPoolState2[ElasticPoolState2["Offline"] = 1] = "Offline"; + ElasticPoolState2[ElasticPoolState2["Unhealthy"] = 2] = "Unhealthy"; + ElasticPoolState2[ElasticPoolState2["New"] = 3] = "New"; + })(ElasticPoolState = exports2.ElasticPoolState || (exports2.ElasticPoolState = {})); + var EnvironmentActionFilter; + (function(EnvironmentActionFilter2) { + EnvironmentActionFilter2[EnvironmentActionFilter2["None"] = 0] = "None"; + EnvironmentActionFilter2[EnvironmentActionFilter2["Manage"] = 2] = "Manage"; + EnvironmentActionFilter2[EnvironmentActionFilter2["Use"] = 16] = "Use"; + })(EnvironmentActionFilter = exports2.EnvironmentActionFilter || (exports2.EnvironmentActionFilter = {})); + var EnvironmentExpands; + (function(EnvironmentExpands2) { + EnvironmentExpands2[EnvironmentExpands2["None"] = 0] = "None"; + EnvironmentExpands2[EnvironmentExpands2["ResourceReferences"] = 1] = "ResourceReferences"; + })(EnvironmentExpands = exports2.EnvironmentExpands || (exports2.EnvironmentExpands = {})); + var EnvironmentResourceType; + (function(EnvironmentResourceType2) { + EnvironmentResourceType2[EnvironmentResourceType2["Undefined"] = 0] = "Undefined"; + EnvironmentResourceType2[EnvironmentResourceType2["Generic"] = 1] = "Generic"; + EnvironmentResourceType2[EnvironmentResourceType2["VirtualMachine"] = 2] = "VirtualMachine"; + EnvironmentResourceType2[EnvironmentResourceType2["Kubernetes"] = 4] = "Kubernetes"; + })(EnvironmentResourceType = exports2.EnvironmentResourceType || (exports2.EnvironmentResourceType = {})); + var ExclusiveLockType; + (function(ExclusiveLockType2) { + ExclusiveLockType2[ExclusiveLockType2["RunLatest"] = 0] = "RunLatest"; + ExclusiveLockType2[ExclusiveLockType2["Sequential"] = 1] = "Sequential"; + ExclusiveLockType2[ExclusiveLockType2["BranchRunLatest"] = 2] = "BranchRunLatest"; + ExclusiveLockType2[ExclusiveLockType2["Parallel"] = 3] = "Parallel"; + })(ExclusiveLockType = exports2.ExclusiveLockType || (exports2.ExclusiveLockType = {})); + var IssueType; + (function(IssueType2) { + IssueType2[IssueType2["Error"] = 1] = "Error"; + IssueType2[IssueType2["Warning"] = 2] = "Warning"; + })(IssueType = exports2.IssueType || (exports2.IssueType = {})); + var LogLevel; + (function(LogLevel2) { + LogLevel2[LogLevel2["Error"] = 0] = "Error"; + LogLevel2[LogLevel2["Warning"] = 1] = "Warning"; + LogLevel2[LogLevel2["Info"] = 2] = "Info"; + })(LogLevel = exports2.LogLevel || (exports2.LogLevel = {})); + var MachineGroupActionFilter; + (function(MachineGroupActionFilter2) { + MachineGroupActionFilter2[MachineGroupActionFilter2["None"] = 0] = "None"; + MachineGroupActionFilter2[MachineGroupActionFilter2["Manage"] = 2] = "Manage"; + MachineGroupActionFilter2[MachineGroupActionFilter2["Use"] = 16] = "Use"; + })(MachineGroupActionFilter = exports2.MachineGroupActionFilter || (exports2.MachineGroupActionFilter = {})); + var MaskType; + (function(MaskType2) { + MaskType2[MaskType2["Variable"] = 1] = "Variable"; + MaskType2[MaskType2["Regex"] = 2] = "Regex"; + })(MaskType = exports2.MaskType || (exports2.MaskType = {})); + var OperatingSystemType; + (function(OperatingSystemType2) { + OperatingSystemType2[OperatingSystemType2["Windows"] = 0] = "Windows"; + OperatingSystemType2[OperatingSystemType2["Linux"] = 1] = "Linux"; + })(OperatingSystemType = exports2.OperatingSystemType || (exports2.OperatingSystemType = {})); + var OperationType; + (function(OperationType2) { + OperationType2[OperationType2["ConfigurationJob"] = 0] = "ConfigurationJob"; + OperationType2[OperationType2["SizingJob"] = 1] = "SizingJob"; + OperationType2[OperationType2["IncreaseCapacity"] = 2] = "IncreaseCapacity"; + OperationType2[OperationType2["Reimage"] = 3] = "Reimage"; + OperationType2[OperationType2["DeleteVMs"] = 4] = "DeleteVMs"; + })(OperationType = exports2.OperationType || (exports2.OperationType = {})); + var OrchestrationType; + (function(OrchestrationType2) { + OrchestrationType2[OrchestrationType2["Uniform"] = 0] = "Uniform"; + OrchestrationType2[OrchestrationType2["Flexible"] = 1] = "Flexible"; + })(OrchestrationType = exports2.OrchestrationType || (exports2.OrchestrationType = {})); + var PlanGroupStatus; + (function(PlanGroupStatus2) { + PlanGroupStatus2[PlanGroupStatus2["Running"] = 1] = "Running"; + PlanGroupStatus2[PlanGroupStatus2["Queued"] = 2] = "Queued"; + PlanGroupStatus2[PlanGroupStatus2["All"] = 3] = "All"; + })(PlanGroupStatus = exports2.PlanGroupStatus || (exports2.PlanGroupStatus = {})); + var PlanGroupStatusFilter; + (function(PlanGroupStatusFilter2) { + PlanGroupStatusFilter2[PlanGroupStatusFilter2["Running"] = 1] = "Running"; + PlanGroupStatusFilter2[PlanGroupStatusFilter2["Queued"] = 2] = "Queued"; + PlanGroupStatusFilter2[PlanGroupStatusFilter2["All"] = 3] = "All"; + })(PlanGroupStatusFilter = exports2.PlanGroupStatusFilter || (exports2.PlanGroupStatusFilter = {})); + var ResourceLockStatus; + (function(ResourceLockStatus2) { + ResourceLockStatus2[ResourceLockStatus2["Queued"] = 0] = "Queued"; + ResourceLockStatus2[ResourceLockStatus2["InUse"] = 1] = "InUse"; + ResourceLockStatus2[ResourceLockStatus2["Finished"] = 2] = "Finished"; + ResourceLockStatus2[ResourceLockStatus2["TimedOut"] = 3] = "TimedOut"; + ResourceLockStatus2[ResourceLockStatus2["Canceled"] = 4] = "Canceled"; + ResourceLockStatus2[ResourceLockStatus2["Abandoned"] = 5] = "Abandoned"; + ResourceLockStatus2[ResourceLockStatus2["WaitingOnChecks"] = 6] = "WaitingOnChecks"; + })(ResourceLockStatus = exports2.ResourceLockStatus || (exports2.ResourceLockStatus = {})); + var SecureFileActionFilter; + (function(SecureFileActionFilter2) { + SecureFileActionFilter2[SecureFileActionFilter2["None"] = 0] = "None"; + SecureFileActionFilter2[SecureFileActionFilter2["Manage"] = 2] = "Manage"; + SecureFileActionFilter2[SecureFileActionFilter2["Use"] = 16] = "Use"; + })(SecureFileActionFilter = exports2.SecureFileActionFilter || (exports2.SecureFileActionFilter = {})); + var TaskAgentJobResultFilter; + (function(TaskAgentJobResultFilter2) { + TaskAgentJobResultFilter2[TaskAgentJobResultFilter2["Failed"] = 1] = "Failed"; + TaskAgentJobResultFilter2[TaskAgentJobResultFilter2["Passed"] = 2] = "Passed"; + TaskAgentJobResultFilter2[TaskAgentJobResultFilter2["NeverDeployed"] = 4] = "NeverDeployed"; + TaskAgentJobResultFilter2[TaskAgentJobResultFilter2["All"] = 7] = "All"; + })(TaskAgentJobResultFilter = exports2.TaskAgentJobResultFilter || (exports2.TaskAgentJobResultFilter = {})); + var TaskAgentJobStepType; + (function(TaskAgentJobStepType2) { + TaskAgentJobStepType2[TaskAgentJobStepType2["Task"] = 1] = "Task"; + TaskAgentJobStepType2[TaskAgentJobStepType2["Action"] = 2] = "Action"; + })(TaskAgentJobStepType = exports2.TaskAgentJobStepType || (exports2.TaskAgentJobStepType = {})); + var TaskAgentPoolActionFilter; + (function(TaskAgentPoolActionFilter2) { + TaskAgentPoolActionFilter2[TaskAgentPoolActionFilter2["None"] = 0] = "None"; + TaskAgentPoolActionFilter2[TaskAgentPoolActionFilter2["Manage"] = 2] = "Manage"; + TaskAgentPoolActionFilter2[TaskAgentPoolActionFilter2["Use"] = 16] = "Use"; + })(TaskAgentPoolActionFilter = exports2.TaskAgentPoolActionFilter || (exports2.TaskAgentPoolActionFilter = {})); + var TaskAgentPoolMaintenanceJobResult; + (function(TaskAgentPoolMaintenanceJobResult2) { + TaskAgentPoolMaintenanceJobResult2[TaskAgentPoolMaintenanceJobResult2["Succeeded"] = 1] = "Succeeded"; + TaskAgentPoolMaintenanceJobResult2[TaskAgentPoolMaintenanceJobResult2["Failed"] = 2] = "Failed"; + TaskAgentPoolMaintenanceJobResult2[TaskAgentPoolMaintenanceJobResult2["Canceled"] = 4] = "Canceled"; + })(TaskAgentPoolMaintenanceJobResult = exports2.TaskAgentPoolMaintenanceJobResult || (exports2.TaskAgentPoolMaintenanceJobResult = {})); + var TaskAgentPoolMaintenanceJobStatus; + (function(TaskAgentPoolMaintenanceJobStatus2) { + TaskAgentPoolMaintenanceJobStatus2[TaskAgentPoolMaintenanceJobStatus2["InProgress"] = 1] = "InProgress"; + TaskAgentPoolMaintenanceJobStatus2[TaskAgentPoolMaintenanceJobStatus2["Completed"] = 2] = "Completed"; + TaskAgentPoolMaintenanceJobStatus2[TaskAgentPoolMaintenanceJobStatus2["Cancelling"] = 4] = "Cancelling"; + TaskAgentPoolMaintenanceJobStatus2[TaskAgentPoolMaintenanceJobStatus2["Queued"] = 8] = "Queued"; + })(TaskAgentPoolMaintenanceJobStatus = exports2.TaskAgentPoolMaintenanceJobStatus || (exports2.TaskAgentPoolMaintenanceJobStatus = {})); + var TaskAgentPoolMaintenanceScheduleDays; + (function(TaskAgentPoolMaintenanceScheduleDays2) { + TaskAgentPoolMaintenanceScheduleDays2[TaskAgentPoolMaintenanceScheduleDays2["None"] = 0] = "None"; + TaskAgentPoolMaintenanceScheduleDays2[TaskAgentPoolMaintenanceScheduleDays2["Monday"] = 1] = "Monday"; + TaskAgentPoolMaintenanceScheduleDays2[TaskAgentPoolMaintenanceScheduleDays2["Tuesday"] = 2] = "Tuesday"; + TaskAgentPoolMaintenanceScheduleDays2[TaskAgentPoolMaintenanceScheduleDays2["Wednesday"] = 4] = "Wednesday"; + TaskAgentPoolMaintenanceScheduleDays2[TaskAgentPoolMaintenanceScheduleDays2["Thursday"] = 8] = "Thursday"; + TaskAgentPoolMaintenanceScheduleDays2[TaskAgentPoolMaintenanceScheduleDays2["Friday"] = 16] = "Friday"; + TaskAgentPoolMaintenanceScheduleDays2[TaskAgentPoolMaintenanceScheduleDays2["Saturday"] = 32] = "Saturday"; + TaskAgentPoolMaintenanceScheduleDays2[TaskAgentPoolMaintenanceScheduleDays2["Sunday"] = 64] = "Sunday"; + TaskAgentPoolMaintenanceScheduleDays2[TaskAgentPoolMaintenanceScheduleDays2["All"] = 127] = "All"; + })(TaskAgentPoolMaintenanceScheduleDays = exports2.TaskAgentPoolMaintenanceScheduleDays || (exports2.TaskAgentPoolMaintenanceScheduleDays = {})); + var TaskAgentPoolOptions; + (function(TaskAgentPoolOptions2) { + TaskAgentPoolOptions2[TaskAgentPoolOptions2["None"] = 0] = "None"; + TaskAgentPoolOptions2[TaskAgentPoolOptions2["ElasticPool"] = 1] = "ElasticPool"; + TaskAgentPoolOptions2[TaskAgentPoolOptions2["SingleUseAgents"] = 2] = "SingleUseAgents"; + TaskAgentPoolOptions2[TaskAgentPoolOptions2["PreserveAgentOnJobFailure"] = 4] = "PreserveAgentOnJobFailure"; + })(TaskAgentPoolOptions = exports2.TaskAgentPoolOptions || (exports2.TaskAgentPoolOptions = {})); + var TaskAgentPoolType; + (function(TaskAgentPoolType2) { + TaskAgentPoolType2[TaskAgentPoolType2["Automation"] = 1] = "Automation"; + TaskAgentPoolType2[TaskAgentPoolType2["Deployment"] = 2] = "Deployment"; + })(TaskAgentPoolType = exports2.TaskAgentPoolType || (exports2.TaskAgentPoolType = {})); + var TaskAgentQueueActionFilter; + (function(TaskAgentQueueActionFilter2) { + TaskAgentQueueActionFilter2[TaskAgentQueueActionFilter2["None"] = 0] = "None"; + TaskAgentQueueActionFilter2[TaskAgentQueueActionFilter2["Manage"] = 2] = "Manage"; + TaskAgentQueueActionFilter2[TaskAgentQueueActionFilter2["Use"] = 16] = "Use"; + })(TaskAgentQueueActionFilter = exports2.TaskAgentQueueActionFilter || (exports2.TaskAgentQueueActionFilter = {})); + var TaskAgentRequestUpdateOptions; + (function(TaskAgentRequestUpdateOptions2) { + TaskAgentRequestUpdateOptions2[TaskAgentRequestUpdateOptions2["None"] = 0] = "None"; + TaskAgentRequestUpdateOptions2[TaskAgentRequestUpdateOptions2["BumpRequestToTop"] = 1] = "BumpRequestToTop"; + })(TaskAgentRequestUpdateOptions = exports2.TaskAgentRequestUpdateOptions || (exports2.TaskAgentRequestUpdateOptions = {})); + var TaskAgentStatus; + (function(TaskAgentStatus2) { + TaskAgentStatus2[TaskAgentStatus2["Offline"] = 1] = "Offline"; + TaskAgentStatus2[TaskAgentStatus2["Online"] = 2] = "Online"; + })(TaskAgentStatus = exports2.TaskAgentStatus || (exports2.TaskAgentStatus = {})); + var TaskAgentStatusFilter; + (function(TaskAgentStatusFilter2) { + TaskAgentStatusFilter2[TaskAgentStatusFilter2["Offline"] = 1] = "Offline"; + TaskAgentStatusFilter2[TaskAgentStatusFilter2["Online"] = 2] = "Online"; + TaskAgentStatusFilter2[TaskAgentStatusFilter2["All"] = 3] = "All"; + })(TaskAgentStatusFilter = exports2.TaskAgentStatusFilter || (exports2.TaskAgentStatusFilter = {})); + var TaskAgentUpdateReasonType; + (function(TaskAgentUpdateReasonType2) { + TaskAgentUpdateReasonType2[TaskAgentUpdateReasonType2["Manual"] = 1] = "Manual"; + TaskAgentUpdateReasonType2[TaskAgentUpdateReasonType2["MinAgentVersionRequired"] = 2] = "MinAgentVersionRequired"; + TaskAgentUpdateReasonType2[TaskAgentUpdateReasonType2["Downgrade"] = 3] = "Downgrade"; + })(TaskAgentUpdateReasonType = exports2.TaskAgentUpdateReasonType || (exports2.TaskAgentUpdateReasonType = {})); + var TaskCommandMode; + (function(TaskCommandMode2) { + TaskCommandMode2[TaskCommandMode2["Any"] = 0] = "Any"; + TaskCommandMode2[TaskCommandMode2["Restricted"] = 1] = "Restricted"; + })(TaskCommandMode = exports2.TaskCommandMode || (exports2.TaskCommandMode = {})); + var TaskDefinitionStatus; + (function(TaskDefinitionStatus2) { + TaskDefinitionStatus2[TaskDefinitionStatus2["Preinstalled"] = 1] = "Preinstalled"; + TaskDefinitionStatus2[TaskDefinitionStatus2["ReceivedInstallOrUpdate"] = 2] = "ReceivedInstallOrUpdate"; + TaskDefinitionStatus2[TaskDefinitionStatus2["Installed"] = 3] = "Installed"; + TaskDefinitionStatus2[TaskDefinitionStatus2["ReceivedUninstall"] = 4] = "ReceivedUninstall"; + TaskDefinitionStatus2[TaskDefinitionStatus2["Uninstalled"] = 5] = "Uninstalled"; + TaskDefinitionStatus2[TaskDefinitionStatus2["RequestedUpdate"] = 6] = "RequestedUpdate"; + TaskDefinitionStatus2[TaskDefinitionStatus2["Updated"] = 7] = "Updated"; + TaskDefinitionStatus2[TaskDefinitionStatus2["AlreadyUpToDate"] = 8] = "AlreadyUpToDate"; + TaskDefinitionStatus2[TaskDefinitionStatus2["InlineUpdateReceived"] = 9] = "InlineUpdateReceived"; + })(TaskDefinitionStatus = exports2.TaskDefinitionStatus || (exports2.TaskDefinitionStatus = {})); + var TaskGroupExpands; + (function(TaskGroupExpands2) { + TaskGroupExpands2[TaskGroupExpands2["None"] = 0] = "None"; + TaskGroupExpands2[TaskGroupExpands2["Tasks"] = 2] = "Tasks"; + })(TaskGroupExpands = exports2.TaskGroupExpands || (exports2.TaskGroupExpands = {})); + var TaskGroupQueryOrder; + (function(TaskGroupQueryOrder2) { + TaskGroupQueryOrder2[TaskGroupQueryOrder2["CreatedOnAscending"] = 0] = "CreatedOnAscending"; + TaskGroupQueryOrder2[TaskGroupQueryOrder2["CreatedOnDescending"] = 1] = "CreatedOnDescending"; + })(TaskGroupQueryOrder = exports2.TaskGroupQueryOrder || (exports2.TaskGroupQueryOrder = {})); + var TaskOrchestrationItemType; + (function(TaskOrchestrationItemType2) { + TaskOrchestrationItemType2[TaskOrchestrationItemType2["Container"] = 0] = "Container"; + TaskOrchestrationItemType2[TaskOrchestrationItemType2["Job"] = 1] = "Job"; + })(TaskOrchestrationItemType = exports2.TaskOrchestrationItemType || (exports2.TaskOrchestrationItemType = {})); + var TaskOrchestrationPlanState; + (function(TaskOrchestrationPlanState2) { + TaskOrchestrationPlanState2[TaskOrchestrationPlanState2["InProgress"] = 1] = "InProgress"; + TaskOrchestrationPlanState2[TaskOrchestrationPlanState2["Queued"] = 2] = "Queued"; + TaskOrchestrationPlanState2[TaskOrchestrationPlanState2["Completed"] = 4] = "Completed"; + TaskOrchestrationPlanState2[TaskOrchestrationPlanState2["Throttled"] = 8] = "Throttled"; + })(TaskOrchestrationPlanState = exports2.TaskOrchestrationPlanState || (exports2.TaskOrchestrationPlanState = {})); + var TaskResult; + (function(TaskResult2) { + TaskResult2[TaskResult2["Succeeded"] = 0] = "Succeeded"; + TaskResult2[TaskResult2["SucceededWithIssues"] = 1] = "SucceededWithIssues"; + TaskResult2[TaskResult2["Failed"] = 2] = "Failed"; + TaskResult2[TaskResult2["Canceled"] = 3] = "Canceled"; + TaskResult2[TaskResult2["Skipped"] = 4] = "Skipped"; + TaskResult2[TaskResult2["Abandoned"] = 5] = "Abandoned"; + })(TaskResult = exports2.TaskResult || (exports2.TaskResult = {})); + var TimelineRecordState; + (function(TimelineRecordState2) { + TimelineRecordState2[TimelineRecordState2["Pending"] = 0] = "Pending"; + TimelineRecordState2[TimelineRecordState2["InProgress"] = 1] = "InProgress"; + TimelineRecordState2[TimelineRecordState2["Completed"] = 2] = "Completed"; + })(TimelineRecordState = exports2.TimelineRecordState || (exports2.TimelineRecordState = {})); + var VariableGroupActionFilter; + (function(VariableGroupActionFilter2) { + VariableGroupActionFilter2[VariableGroupActionFilter2["None"] = 0] = "None"; + VariableGroupActionFilter2[VariableGroupActionFilter2["Manage"] = 2] = "Manage"; + VariableGroupActionFilter2[VariableGroupActionFilter2["Use"] = 16] = "Use"; + })(VariableGroupActionFilter = exports2.VariableGroupActionFilter || (exports2.VariableGroupActionFilter = {})); + var VariableGroupQueryOrder; + (function(VariableGroupQueryOrder2) { + VariableGroupQueryOrder2[VariableGroupQueryOrder2["IdAscending"] = 0] = "IdAscending"; + VariableGroupQueryOrder2[VariableGroupQueryOrder2["IdDescending"] = 1] = "IdDescending"; + })(VariableGroupQueryOrder = exports2.VariableGroupQueryOrder || (exports2.VariableGroupQueryOrder = {})); + exports2.TypeInfo = { + AadLoginPromptOption: { + enumValues: { + "noOption": 0, + "login": 1, + "selectAccount": 2, + "freshLogin": 3, + "freshLoginWithMfa": 4 + } + }, + AgentChangeEvent: {}, + AgentJobRequestMessage: {}, + AgentPoolEvent: {}, + AgentQueueEvent: {}, + AgentQueuesEvent: {}, + AuditAction: { + enumValues: { + "add": 1, + "update": 2, + "delete": 3, + "undelete": 4 + } + }, + AzureKeyVaultVariableGroupProviderData: {}, + AzureKeyVaultVariableValue: {}, + DemandMinimumVersion: {}, + DemandSource: {}, + DemandSourceType: { + enumValues: { + "task": 0, + "feature": 1 + } + }, + DeploymentGroup: {}, + DeploymentGroupActionFilter: { + enumValues: { + "none": 0, + "manage": 2, + "use": 16 + } + }, + DeploymentGroupExpands: { + enumValues: { + "none": 0, + "machines": 2, + "tags": 4 + } + }, + DeploymentGroupMetrics: {}, + DeploymentGroupReference: {}, + DeploymentMachine: {}, + DeploymentMachineChangedData: {}, + DeploymentMachineExpands: { + enumValues: { + "none": 0, + "capabilities": 2, + "assignedRequest": 4 + } + }, + DeploymentMachineGroup: {}, + DeploymentMachineGroupReference: {}, + DeploymentMachinesChangeEvent: {}, + DeploymentPoolSummary: {}, + DeploymentPoolSummaryExpands: { + enumValues: { + "none": 0, + "deploymentGroups": 2, + "resource": 4 + } + }, + DeploymentTargetExpands: { + enumValues: { + "none": 0, + "capabilities": 2, + "assignedRequest": 4, + "lastCompletedRequest": 8 + } + }, + ElasticAgentState: { + enumValues: { + "none": 0, + "enabled": 1, + "online": 2, + "assigned": 4 + } + }, + ElasticComputeState: { + enumValues: { + "none": 0, + "healthy": 1, + "creating": 2, + "deleting": 3, + "failed": 4, + "stopped": 5, + "reimaging": 6, + "unhealthyVm": 7, + "unhealthyVmssVm": 8 + } + }, + ElasticNode: {}, + ElasticNodeSettings: {}, + ElasticNodeState: { + enumValues: { + "none": 0, + "new": 1, + "creatingCompute": 2, + "startingAgent": 3, + "idle": 4, + "assigned": 5, + "offline": 6, + "pendingReimage": 7, + "pendingDelete": 8, + "saved": 9, + "deletingCompute": 10, + "deleted": 11, + "lost": 12, + "reimagingCompute": 13, + "restartingAgent": 14, + "failedToStartPendingDelete": 15, + "failedToRestartPendingDelete": 16, + "failedVMPendingDelete": 17, + "assignedPendingDelete": 18, + "retryDelete": 19, + "unhealthyVm": 20, + "unhealthyVmPendingDelete": 21 + } + }, + ElasticPool: {}, + ElasticPoolCreationResult: {}, + ElasticPoolLog: {}, + ElasticPoolSettings: {}, + ElasticPoolState: { + enumValues: { + "online": 0, + "offline": 1, + "unhealthy": 2, + "new": 3 + } + }, + EnvironmentActionFilter: { + enumValues: { + "none": 0, + "manage": 2, + "use": 16 + } + }, + EnvironmentDeploymentExecutionRecord: {}, + EnvironmentExpands: { + enumValues: { + "none": 0, + "resourceReferences": 1 + } + }, + EnvironmentInstance: {}, + EnvironmentResource: {}, + EnvironmentResourceDeploymentExecutionRecord: {}, + EnvironmentResourceReference: {}, + EnvironmentResourceType: { + enumValues: { + "undefined": 0, + "generic": 1, + "virtualMachine": 2, + "kubernetes": 4 + } + }, + ExclusiveLockType: { + enumValues: { + "runLatest": 0, + "sequential": 1, + "branchRunLatest": 2, + "parallel": 3 + } + }, + Issue: {}, + IssueType: { + enumValues: { + "error": 1, + "warning": 2 + } + }, + JobAssignedEvent: {}, + JobCompletedEvent: {}, + JobEnvironment: {}, + JobRequestMessage: {}, + KubernetesResource: {}, + LogLevel: { + enumValues: { + "error": 0, + "warning": 1, + "info": 2 + } + }, + MachineGroupActionFilter: { + enumValues: { + "none": 0, + "manage": 2, + "use": 16 + } + }, + MaskHint: {}, + MaskType: { + enumValues: { + "variable": 1, + "regex": 2 + } + }, + OperatingSystemType: { + enumValues: { + "windows": 0, + "linux": 1 + } + }, + OperationType: { + enumValues: { + "configurationJob": 0, + "sizingJob": 1, + "increaseCapacity": 2, + "reimage": 3, + "deleteVMs": 4 + } + }, + OrchestrationType: { + enumValues: { + "uniform": 0, + "flexible": 1 + } + }, + PackageMetadata: {}, + PlanEnvironment: {}, + PlanGroupStatus: { + enumValues: { + "running": 1, + "queued": 2, + "all": 3 + } + }, + PlanGroupStatusFilter: { + enumValues: { + "running": 1, + "queued": 2, + "all": 3 + } + }, + ResourceLockRequest: {}, + ResourceLockStatus: { + enumValues: { + "queued": 0, + "inUse": 1, + "finished": 2, + "timedOut": 3, + "canceled": 4, + "abandoned": 5, + "waitingOnChecks": 6 + } + }, + ResourceUsage: {}, + SecureFile: {}, + SecureFileActionFilter: { + enumValues: { + "none": 0, + "manage": 2, + "use": 16 + } + }, + SecureFileEvent: {}, + ServerTaskRequestMessage: {}, + ServiceEndpointAuthenticationScheme: {}, + ServiceEndpointExecutionData: {}, + ServiceEndpointExecutionRecord: {}, + ServiceEndpointExecutionRecordsInput: {}, + ServiceEndpointRequestResult: {}, + ServiceEndpointType: {}, + TaskAgent: {}, + TaskAgentCloudRequest: {}, + TaskAgentCloudType: {}, + TaskAgentDowngrade: {}, + TaskAgentJob: {}, + TaskAgentJobRequest: {}, + TaskAgentJobResultFilter: { + enumValues: { + "failed": 1, + "passed": 2, + "neverDeployed": 4, + "all": 7 + } + }, + TaskAgentJobStep: {}, + TaskAgentJobStepType: { + enumValues: { + "task": 1, + "action": 2 + } + }, + TaskAgentManualUpdate: {}, + TaskAgentMinAgentVersionRequiredUpdate: {}, + TaskAgentPool: {}, + TaskAgentPoolActionFilter: { + enumValues: { + "none": 0, + "manage": 2, + "use": 16 + } + }, + TaskAgentPoolMaintenanceDefinition: {}, + TaskAgentPoolMaintenanceJob: {}, + TaskAgentPoolMaintenanceJobResult: { + enumValues: { + "succeeded": 1, + "failed": 2, + "canceled": 4 + } + }, + TaskAgentPoolMaintenanceJobStatus: { + enumValues: { + "inProgress": 1, + "completed": 2, + "cancelling": 4, + "queued": 8 + } + }, + TaskAgentPoolMaintenanceJobTargetAgent: {}, + TaskAgentPoolMaintenanceSchedule: {}, + TaskAgentPoolMaintenanceScheduleDays: { + enumValues: { + "none": 0, + "monday": 1, + "tuesday": 2, + "wednesday": 4, + "thursday": 8, + "friday": 16, + "saturday": 32, + "sunday": 64, + "all": 127 + } + }, + TaskAgentPoolOptions: { + enumValues: { + "none": 0, + "elasticPool": 1, + "singleUseAgents": 2, + "preserveAgentOnJobFailure": 4 + } + }, + TaskAgentPoolReference: {}, + TaskAgentPoolStatus: {}, + TaskAgentPoolSummary: {}, + TaskAgentPoolType: { + enumValues: { + "automation": 1, + "deployment": 2 + } + }, + TaskAgentQueue: {}, + TaskAgentQueueActionFilter: { + enumValues: { + "none": 0, + "manage": 2, + "use": 16 + } + }, + TaskAgentReference: {}, + TaskAgentRequestUpdateOptions: { + enumValues: { + "none": 0, + "bumpRequestToTop": 1 + } + }, + TaskAgentSession: {}, + TaskAgentStatus: { + enumValues: { + "offline": 1, + "online": 2 + } + }, + TaskAgentStatusFilter: { + enumValues: { + "offline": 1, + "online": 2, + "all": 3 + } + }, + TaskAgentUpdate: {}, + TaskAgentUpdateReason: {}, + TaskAgentUpdateReasonType: { + enumValues: { + "manual": 1, + "minAgentVersionRequired": 2, + "downgrade": 3 + } + }, + TaskAttachment: {}, + TaskCommandMode: { + enumValues: { + "any": 0, + "restricted": 1 + } + }, + TaskCommandRestrictions: {}, + TaskCompletedEvent: {}, + TaskDefinition: {}, + TaskDefinitionStatus: { + enumValues: { + "preinstalled": 1, + "receivedInstallOrUpdate": 2, + "installed": 3, + "receivedUninstall": 4, + "uninstalled": 5, + "requestedUpdate": 6, + "updated": 7, + "alreadyUpToDate": 8, + "inlineUpdateReceived": 9 + } + }, + TaskGroup: {}, + TaskGroupExpands: { + enumValues: { + "none": 0, + "tasks": 2 + } + }, + TaskGroupQueryOrder: { + enumValues: { + "createdOnAscending": 0, + "createdOnDescending": 1 + } + }, + TaskGroupRevision: {}, + TaskLog: {}, + TaskOrchestrationContainer: {}, + TaskOrchestrationItem: {}, + TaskOrchestrationItemType: { + enumValues: { + "container": 0, + "job": 1 + } + }, + TaskOrchestrationJob: {}, + TaskOrchestrationPlan: {}, + TaskOrchestrationPlanGroup: {}, + TaskOrchestrationPlanGroupsQueueMetrics: {}, + TaskOrchestrationPlanState: { + enumValues: { + "inProgress": 1, + "queued": 2, + "completed": 4, + "throttled": 8 + } + }, + TaskOrchestrationQueuedPlan: {}, + TaskOrchestrationQueuedPlanGroup: {}, + TaskRestrictions: {}, + TaskResult: { + enumValues: { + "succeeded": 0, + "succeededWithIssues": 1, + "failed": 2, + "canceled": 3, + "skipped": 4, + "abandoned": 5 + } + }, + Timeline: {}, + TimelineRecord: {}, + TimelineRecordReference: {}, + TimelineRecordState: { + enumValues: { + "pending": 0, + "inProgress": 1, + "completed": 2 + } + }, + VariableGroup: {}, + VariableGroupActionFilter: { + enumValues: { + "none": 0, + "manage": 2, + "use": 16 + } + }, + VariableGroupQueryOrder: { + enumValues: { + "idAscending": 0, + "idDescending": 1 + } + }, + VirtualMachine: {}, + VirtualMachineGroup: {}, + VirtualMachineResource: {}, + VirtualMachineResourceCreateParameters: {} + }; + exports2.TypeInfo.AgentChangeEvent.fields = { + agent: { + typeInfo: exports2.TypeInfo.TaskAgent + }, + pool: { + typeInfo: exports2.TypeInfo.TaskAgentPoolReference + }, + timeStamp: { + isDate: true + } + }; + exports2.TypeInfo.AgentJobRequestMessage.fields = { + environment: { + typeInfo: exports2.TypeInfo.JobEnvironment + }, + lockedUntil: { + isDate: true + } + }; + exports2.TypeInfo.AgentPoolEvent.fields = { + pool: { + typeInfo: exports2.TypeInfo.TaskAgentPool + } + }; + exports2.TypeInfo.AgentQueueEvent.fields = { + queue: { + typeInfo: exports2.TypeInfo.TaskAgentQueue + } + }; + exports2.TypeInfo.AgentQueuesEvent.fields = { + queues: { + isArray: true, + typeInfo: exports2.TypeInfo.TaskAgentQueue + } + }; + exports2.TypeInfo.AzureKeyVaultVariableGroupProviderData.fields = { + lastRefreshedOn: { + isDate: true + } + }; + exports2.TypeInfo.AzureKeyVaultVariableValue.fields = { + expires: { + isDate: true + } + }; + exports2.TypeInfo.DemandMinimumVersion.fields = { + source: { + typeInfo: exports2.TypeInfo.DemandSource + } + }; + exports2.TypeInfo.DemandSource.fields = { + sourceType: { + enumType: exports2.TypeInfo.DemandSourceType + } + }; + exports2.TypeInfo.DeploymentGroup.fields = { + machines: { + isArray: true, + typeInfo: exports2.TypeInfo.DeploymentMachine + }, + pool: { + typeInfo: exports2.TypeInfo.TaskAgentPoolReference + } + }; + exports2.TypeInfo.DeploymentGroupMetrics.fields = { + deploymentGroup: { + typeInfo: exports2.TypeInfo.DeploymentGroupReference + } + }; + exports2.TypeInfo.DeploymentGroupReference.fields = { + pool: { + typeInfo: exports2.TypeInfo.TaskAgentPoolReference + } + }; + exports2.TypeInfo.DeploymentMachine.fields = { + agent: { + typeInfo: exports2.TypeInfo.TaskAgent + } + }; + exports2.TypeInfo.DeploymentMachineChangedData.fields = { + agent: { + typeInfo: exports2.TypeInfo.TaskAgent + } + }; + exports2.TypeInfo.DeploymentMachineGroup.fields = { + machines: { + isArray: true, + typeInfo: exports2.TypeInfo.DeploymentMachine + }, + pool: { + typeInfo: exports2.TypeInfo.TaskAgentPoolReference + } + }; + exports2.TypeInfo.DeploymentMachineGroupReference.fields = { + pool: { + typeInfo: exports2.TypeInfo.TaskAgentPoolReference + } + }; + exports2.TypeInfo.DeploymentMachinesChangeEvent.fields = { + machineGroupReference: { + typeInfo: exports2.TypeInfo.DeploymentGroupReference + }, + machines: { + isArray: true, + typeInfo: exports2.TypeInfo.DeploymentMachineChangedData + } + }; + exports2.TypeInfo.DeploymentPoolSummary.fields = { + deploymentGroups: { + isArray: true, + typeInfo: exports2.TypeInfo.DeploymentGroupReference + }, + pool: { + typeInfo: exports2.TypeInfo.TaskAgentPoolReference + }, + resource: { + typeInfo: exports2.TypeInfo.EnvironmentResourceReference + } + }; + exports2.TypeInfo.ElasticNode.fields = { + agentState: { + enumType: exports2.TypeInfo.ElasticAgentState + }, + computeState: { + enumType: exports2.TypeInfo.ElasticComputeState + }, + desiredState: { + enumType: exports2.TypeInfo.ElasticNodeState + }, + state: { + enumType: exports2.TypeInfo.ElasticNodeState + }, + stateChangedOn: { + isDate: true + } + }; + exports2.TypeInfo.ElasticNodeSettings.fields = { + state: { + enumType: exports2.TypeInfo.ElasticNodeState + } + }; + exports2.TypeInfo.ElasticPool.fields = { + offlineSince: { + isDate: true + }, + orchestrationType: { + enumType: exports2.TypeInfo.OrchestrationType + }, + osType: { + enumType: exports2.TypeInfo.OperatingSystemType + }, + state: { + enumType: exports2.TypeInfo.ElasticPoolState + } + }; + exports2.TypeInfo.ElasticPoolCreationResult.fields = { + agentPool: { + typeInfo: exports2.TypeInfo.TaskAgentPool + }, + agentQueue: { + typeInfo: exports2.TypeInfo.TaskAgentQueue + }, + elasticPool: { + typeInfo: exports2.TypeInfo.ElasticPool + } + }; + exports2.TypeInfo.ElasticPoolLog.fields = { + level: { + enumType: exports2.TypeInfo.LogLevel + }, + operation: { + enumType: exports2.TypeInfo.OperationType + }, + timestamp: { + isDate: true + } + }; + exports2.TypeInfo.ElasticPoolSettings.fields = { + orchestrationType: { + enumType: exports2.TypeInfo.OrchestrationType + }, + osType: { + enumType: exports2.TypeInfo.OperatingSystemType + } + }; + exports2.TypeInfo.EnvironmentDeploymentExecutionRecord.fields = { + finishTime: { + isDate: true + }, + queueTime: { + isDate: true + }, + result: { + enumType: exports2.TypeInfo.TaskResult + }, + startTime: { + isDate: true + } + }; + exports2.TypeInfo.EnvironmentInstance.fields = { + createdOn: { + isDate: true + }, + lastModifiedOn: { + isDate: true + }, + resources: { + isArray: true, + typeInfo: exports2.TypeInfo.EnvironmentResourceReference + } + }; + exports2.TypeInfo.EnvironmentResource.fields = { + createdOn: { + isDate: true + }, + lastModifiedOn: { + isDate: true + }, + type: { + enumType: exports2.TypeInfo.EnvironmentResourceType + } + }; + exports2.TypeInfo.EnvironmentResourceDeploymentExecutionRecord.fields = { + finishTime: { + isDate: true + }, + result: { + enumType: exports2.TypeInfo.TaskResult + }, + startTime: { + isDate: true + } + }; + exports2.TypeInfo.EnvironmentResourceReference.fields = { + type: { + enumType: exports2.TypeInfo.EnvironmentResourceType + } + }; + exports2.TypeInfo.Issue.fields = { + type: { + enumType: exports2.TypeInfo.IssueType + } + }; + exports2.TypeInfo.JobAssignedEvent.fields = { + request: { + typeInfo: exports2.TypeInfo.TaskAgentJobRequest + } + }; + exports2.TypeInfo.JobCompletedEvent.fields = { + result: { + enumType: exports2.TypeInfo.TaskResult + } + }; + exports2.TypeInfo.JobEnvironment.fields = { + mask: { + isArray: true, + typeInfo: exports2.TypeInfo.MaskHint + }, + secureFiles: { + isArray: true, + typeInfo: exports2.TypeInfo.SecureFile + } + }; + exports2.TypeInfo.JobRequestMessage.fields = { + environment: { + typeInfo: exports2.TypeInfo.JobEnvironment + } + }; + exports2.TypeInfo.KubernetesResource.fields = { + createdOn: { + isDate: true + }, + lastModifiedOn: { + isDate: true + }, + type: { + enumType: exports2.TypeInfo.EnvironmentResourceType + } + }; + exports2.TypeInfo.MaskHint.fields = { + type: { + enumType: exports2.TypeInfo.MaskType + } + }; + exports2.TypeInfo.PackageMetadata.fields = { + createdOn: { + isDate: true + } + }; + exports2.TypeInfo.PlanEnvironment.fields = { + mask: { + isArray: true, + typeInfo: exports2.TypeInfo.MaskHint + } + }; + exports2.TypeInfo.ResourceLockRequest.fields = { + assignTime: { + isDate: true + }, + finishTime: { + isDate: true + }, + lockType: { + enumType: exports2.TypeInfo.ExclusiveLockType + }, + queueTime: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.ResourceLockStatus + } + }; + exports2.TypeInfo.ResourceUsage.fields = { + runningRequests: { + isArray: true, + typeInfo: exports2.TypeInfo.TaskAgentJobRequest + } + }; + exports2.TypeInfo.SecureFile.fields = { + createdOn: { + isDate: true + }, + modifiedOn: { + isDate: true + } + }; + exports2.TypeInfo.SecureFileEvent.fields = { + secureFiles: { + isArray: true, + typeInfo: exports2.TypeInfo.SecureFile + } + }; + exports2.TypeInfo.ServerTaskRequestMessage.fields = { + environment: { + typeInfo: exports2.TypeInfo.JobEnvironment + }, + taskDefinition: { + typeInfo: exports2.TypeInfo.TaskDefinition + } + }; + exports2.TypeInfo.ServiceEndpointAuthenticationScheme.fields = { + inputDescriptors: { + isArray: true, + typeInfo: FormInputInterfaces.TypeInfo.InputDescriptor + } + }; + exports2.TypeInfo.ServiceEndpointExecutionData.fields = { + finishTime: { + isDate: true + }, + result: { + enumType: exports2.TypeInfo.TaskResult + }, + startTime: { + isDate: true + } + }; + exports2.TypeInfo.ServiceEndpointExecutionRecord.fields = { + data: { + typeInfo: exports2.TypeInfo.ServiceEndpointExecutionData + } + }; + exports2.TypeInfo.ServiceEndpointExecutionRecordsInput.fields = { + data: { + typeInfo: exports2.TypeInfo.ServiceEndpointExecutionData + } + }; + exports2.TypeInfo.ServiceEndpointRequestResult.fields = {}; + exports2.TypeInfo.ServiceEndpointType.fields = { + authenticationSchemes: { + isArray: true, + typeInfo: exports2.TypeInfo.ServiceEndpointAuthenticationScheme + }, + inputDescriptors: { + isArray: true, + typeInfo: FormInputInterfaces.TypeInfo.InputDescriptor + } + }; + exports2.TypeInfo.TaskAgent.fields = { + assignedAgentCloudRequest: { + typeInfo: exports2.TypeInfo.TaskAgentCloudRequest + }, + assignedRequest: { + typeInfo: exports2.TypeInfo.TaskAgentJobRequest + }, + createdOn: { + isDate: true + }, + lastCompletedRequest: { + typeInfo: exports2.TypeInfo.TaskAgentJobRequest + }, + pendingUpdate: { + typeInfo: exports2.TypeInfo.TaskAgentUpdate + }, + status: { + enumType: exports2.TypeInfo.TaskAgentStatus + }, + statusChangedOn: { + isDate: true + } + }; + exports2.TypeInfo.TaskAgentCloudRequest.fields = { + agent: { + typeInfo: exports2.TypeInfo.TaskAgentReference + }, + agentConnectedTime: { + isDate: true + }, + pool: { + typeInfo: exports2.TypeInfo.TaskAgentPoolReference + }, + provisionedTime: { + isDate: true + }, + provisionRequestTime: { + isDate: true + }, + releaseRequestTime: { + isDate: true + } + }; + exports2.TypeInfo.TaskAgentCloudType.fields = { + inputDescriptors: { + isArray: true, + typeInfo: FormInputInterfaces.TypeInfo.InputDescriptor + } + }; + exports2.TypeInfo.TaskAgentDowngrade.fields = { + code: { + enumType: exports2.TypeInfo.TaskAgentUpdateReasonType + } + }; + exports2.TypeInfo.TaskAgentJob.fields = { + steps: { + isArray: true, + typeInfo: exports2.TypeInfo.TaskAgentJobStep + } + }; + exports2.TypeInfo.TaskAgentJobRequest.fields = { + assignTime: { + isDate: true + }, + finishTime: { + isDate: true + }, + lockedUntil: { + isDate: true + }, + matchedAgents: { + isArray: true, + typeInfo: exports2.TypeInfo.TaskAgentReference + }, + queueTime: { + isDate: true + }, + receiveTime: { + isDate: true + }, + reservedAgent: { + typeInfo: exports2.TypeInfo.TaskAgentReference + }, + result: { + enumType: exports2.TypeInfo.TaskResult + } + }; + exports2.TypeInfo.TaskAgentJobStep.fields = { + type: { + enumType: exports2.TypeInfo.TaskAgentJobStepType + } + }; + exports2.TypeInfo.TaskAgentManualUpdate.fields = { + code: { + enumType: exports2.TypeInfo.TaskAgentUpdateReasonType + } + }; + exports2.TypeInfo.TaskAgentMinAgentVersionRequiredUpdate.fields = { + code: { + enumType: exports2.TypeInfo.TaskAgentUpdateReasonType + } + }; + exports2.TypeInfo.TaskAgentPool.fields = { + createdOn: { + isDate: true + }, + options: { + enumType: exports2.TypeInfo.TaskAgentPoolOptions + }, + poolType: { + enumType: exports2.TypeInfo.TaskAgentPoolType + } + }; + exports2.TypeInfo.TaskAgentPoolMaintenanceDefinition.fields = { + pool: { + typeInfo: exports2.TypeInfo.TaskAgentPoolReference + }, + scheduleSetting: { + typeInfo: exports2.TypeInfo.TaskAgentPoolMaintenanceSchedule + } + }; + exports2.TypeInfo.TaskAgentPoolMaintenanceJob.fields = { + finishTime: { + isDate: true + }, + pool: { + typeInfo: exports2.TypeInfo.TaskAgentPoolReference + }, + queueTime: { + isDate: true + }, + result: { + enumType: exports2.TypeInfo.TaskAgentPoolMaintenanceJobResult + }, + startTime: { + isDate: true + }, + status: { + enumType: exports2.TypeInfo.TaskAgentPoolMaintenanceJobStatus + }, + targetAgents: { + isArray: true, + typeInfo: exports2.TypeInfo.TaskAgentPoolMaintenanceJobTargetAgent + } + }; + exports2.TypeInfo.TaskAgentPoolMaintenanceJobTargetAgent.fields = { + agent: { + typeInfo: exports2.TypeInfo.TaskAgentReference + }, + result: { + enumType: exports2.TypeInfo.TaskAgentPoolMaintenanceJobResult + }, + status: { + enumType: exports2.TypeInfo.TaskAgentPoolMaintenanceJobStatus + } + }; + exports2.TypeInfo.TaskAgentPoolMaintenanceSchedule.fields = { + daysToBuild: { + enumType: exports2.TypeInfo.TaskAgentPoolMaintenanceScheduleDays + } + }; + exports2.TypeInfo.TaskAgentPoolReference.fields = { + options: { + enumType: exports2.TypeInfo.TaskAgentPoolOptions + }, + poolType: { + enumType: exports2.TypeInfo.TaskAgentPoolType + } + }; + exports2.TypeInfo.TaskAgentPoolStatus.fields = { + options: { + enumType: exports2.TypeInfo.TaskAgentPoolOptions + }, + poolType: { + enumType: exports2.TypeInfo.TaskAgentPoolType + } + }; + exports2.TypeInfo.TaskAgentPoolSummary.fields = { + deploymentGroups: { + isArray: true, + typeInfo: exports2.TypeInfo.DeploymentGroupReference + }, + pool: { + typeInfo: exports2.TypeInfo.TaskAgentPoolReference + }, + queues: { + isArray: true, + typeInfo: exports2.TypeInfo.TaskAgentQueue + } + }; + exports2.TypeInfo.TaskAgentQueue.fields = { + pool: { + typeInfo: exports2.TypeInfo.TaskAgentPoolReference + } + }; + exports2.TypeInfo.TaskAgentReference.fields = { + status: { + enumType: exports2.TypeInfo.TaskAgentStatus + } + }; + exports2.TypeInfo.TaskAgentSession.fields = { + agent: { + typeInfo: exports2.TypeInfo.TaskAgentReference + } + }; + exports2.TypeInfo.TaskAgentUpdate.fields = { + reason: { + typeInfo: exports2.TypeInfo.TaskAgentUpdateReason + }, + requestTime: { + isDate: true + } + }; + exports2.TypeInfo.TaskAgentUpdateReason.fields = { + code: { + enumType: exports2.TypeInfo.TaskAgentUpdateReasonType + } + }; + exports2.TypeInfo.TaskAttachment.fields = { + createdOn: { + isDate: true + }, + lastChangedOn: { + isDate: true + } + }; + exports2.TypeInfo.TaskCommandRestrictions.fields = { + mode: { + enumType: exports2.TypeInfo.TaskCommandMode + } + }; + exports2.TypeInfo.TaskCompletedEvent.fields = { + result: { + enumType: exports2.TypeInfo.TaskResult + } + }; + exports2.TypeInfo.TaskDefinition.fields = { + restrictions: { + typeInfo: exports2.TypeInfo.TaskRestrictions + } + }; + exports2.TypeInfo.TaskGroup.fields = { + createdOn: { + isDate: true + }, + modifiedOn: { + isDate: true + }, + restrictions: { + typeInfo: exports2.TypeInfo.TaskRestrictions + } + }; + exports2.TypeInfo.TaskGroupRevision.fields = { + changedDate: { + isDate: true + }, + changeType: { + enumType: exports2.TypeInfo.AuditAction + } + }; + exports2.TypeInfo.TaskLog.fields = { + createdOn: { + isDate: true + }, + lastChangedOn: { + isDate: true + } + }; + exports2.TypeInfo.TaskOrchestrationContainer.fields = { + children: { + isArray: true, + typeInfo: exports2.TypeInfo.TaskOrchestrationItem + }, + itemType: { + enumType: exports2.TypeInfo.TaskOrchestrationItemType + }, + rollback: { + typeInfo: exports2.TypeInfo.TaskOrchestrationContainer + } + }; + exports2.TypeInfo.TaskOrchestrationItem.fields = { + itemType: { + enumType: exports2.TypeInfo.TaskOrchestrationItemType + } + }; + exports2.TypeInfo.TaskOrchestrationJob.fields = { + itemType: { + enumType: exports2.TypeInfo.TaskOrchestrationItemType + } + }; + exports2.TypeInfo.TaskOrchestrationPlan.fields = { + environment: { + typeInfo: exports2.TypeInfo.PlanEnvironment + }, + finishTime: { + isDate: true + }, + implementation: { + typeInfo: exports2.TypeInfo.TaskOrchestrationContainer + }, + result: { + enumType: exports2.TypeInfo.TaskResult + }, + startTime: { + isDate: true + }, + state: { + enumType: exports2.TypeInfo.TaskOrchestrationPlanState + } + }; + exports2.TypeInfo.TaskOrchestrationPlanGroup.fields = { + runningRequests: { + isArray: true, + typeInfo: exports2.TypeInfo.TaskAgentJobRequest + } + }; + exports2.TypeInfo.TaskOrchestrationPlanGroupsQueueMetrics.fields = { + status: { + enumType: exports2.TypeInfo.PlanGroupStatus + } + }; + exports2.TypeInfo.TaskOrchestrationQueuedPlan.fields = { + assignTime: { + isDate: true + }, + queueTime: { + isDate: true + } + }; + exports2.TypeInfo.TaskOrchestrationQueuedPlanGroup.fields = { + plans: { + isArray: true, + typeInfo: exports2.TypeInfo.TaskOrchestrationQueuedPlan + } + }; + exports2.TypeInfo.TaskRestrictions.fields = { + commands: { + typeInfo: exports2.TypeInfo.TaskCommandRestrictions + } + }; + exports2.TypeInfo.Timeline.fields = { + lastChangedOn: { + isDate: true + }, + records: { + isArray: true, + typeInfo: exports2.TypeInfo.TimelineRecord + } + }; + exports2.TypeInfo.TimelineRecord.fields = { + finishTime: { + isDate: true + }, + issues: { + isArray: true, + typeInfo: exports2.TypeInfo.Issue + }, + lastModified: { + isDate: true + }, + result: { + enumType: exports2.TypeInfo.TaskResult + }, + startTime: { + isDate: true + }, + state: { + enumType: exports2.TypeInfo.TimelineRecordState + } + }; + exports2.TypeInfo.TimelineRecordReference.fields = { + state: { + enumType: exports2.TypeInfo.TimelineRecordState + } + }; + exports2.TypeInfo.VariableGroup.fields = { + createdOn: { + isDate: true + }, + modifiedOn: { + isDate: true + } + }; + exports2.TypeInfo.VirtualMachine.fields = { + agent: { + typeInfo: exports2.TypeInfo.TaskAgent + } + }; + exports2.TypeInfo.VirtualMachineGroup.fields = { + createdOn: { + isDate: true + }, + lastModifiedOn: { + isDate: true + }, + type: { + enumType: exports2.TypeInfo.EnvironmentResourceType + } + }; + exports2.TypeInfo.VirtualMachineResource.fields = { + agent: { + typeInfo: exports2.TypeInfo.TaskAgent + }, + createdOn: { + isDate: true + }, + lastModifiedOn: { + isDate: true + }, + type: { + enumType: exports2.TypeInfo.EnvironmentResourceType + } + }; + exports2.TypeInfo.VirtualMachineResourceCreateParameters.fields = { + virtualMachineResource: { + typeInfo: exports2.TypeInfo.VirtualMachineResource + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/TaskAgentApiBase.js +var require_TaskAgentApiBase = __commonJS({ + "../node_modules/azure-devops-node-api/TaskAgentApiBase.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TaskAgentApiBase = void 0; + var basem = require_ClientApiBases(); + var TaskAgentInterfaces = require_TaskAgentInterfaces(); + var TaskAgentApiBase = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-TaskAgent-api", options); + } + /** + * @param {TaskAgentInterfaces.TaskAgentCloud} agentCloud + */ + addAgentCloud(agentCloud) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "bfa72b3d-0fc6-43fb-932b-a7f6559f93b9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, agentCloud, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} agentCloudId + */ + deleteAgentCloud(agentCloudId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + agentCloudId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "bfa72b3d-0fc6-43fb-932b-a7f6559f93b9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} agentCloudId + */ + getAgentCloud(agentCloudId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + agentCloudId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "bfa72b3d-0fc6-43fb-932b-a7f6559f93b9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + */ + getAgentClouds() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "bfa72b3d-0fc6-43fb-932b-a7f6559f93b9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskAgentCloud} updatedCloud + * @param {number} agentCloudId + */ + updateAgentCloud(updatedCloud, agentCloudId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + agentCloudId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "bfa72b3d-0fc6-43fb-932b-a7f6559f93b9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, updatedCloud, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get agent cloud types. + * + */ + getAgentCloudTypes() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "5932e193-f376-469d-9c3e-e5588ce12cb5", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentCloudType, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} queueId + * @param {number} top + * @param {string} continuationToken + */ + getAgentRequestsForQueue(project, queueId, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (top == null) { + throw new TypeError("top can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + queueId + }; + let queryValues = { + "$top": top, + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "f5f81ffb-f396-498d-85b1-5ada145e648a", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskAgentJobRequest} request + * @param {string} project - Project ID or project name + * @param {number} queueId + */ + queueAgentRequest(request, project, queueId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + queueId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "f5f81ffb-f396-498d-85b1-5ada145e648a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, request, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds an agent to a pool. You probably don't want to call this endpoint directly. Instead, [configure an agent](https://docs.microsoft.com/azure/devops/pipelines/agents/agents) using the agent download package. + * + * @param {TaskAgentInterfaces.TaskAgent} agent - Details about the agent being added + * @param {number} poolId - The agent pool in which to add the agent + */ + addAgent(agent, poolId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e298ef32-5878-4cab-993c-043836571f42", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, agent, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete an agent. You probably don't want to call this endpoint directly. Instead, [use the agent configuration script](https://docs.microsoft.com/azure/devops/pipelines/agents/agents) to remove an agent from your organization. + * + * @param {number} poolId - The pool ID to remove the agent from + * @param {number} agentId - The agent ID to remove + */ + deleteAgent(poolId, agentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + agentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e298ef32-5878-4cab-993c-043836571f42", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get information about an agent. + * + * @param {number} poolId - The agent pool containing the agent + * @param {number} agentId - The agent ID to get information about + * @param {boolean} includeCapabilities - Whether to include the agent's capabilities in the response + * @param {boolean} includeAssignedRequest - Whether to include details about the agent's current work + * @param {boolean} includeLastCompletedRequest - Whether to include details about the agents' most recent completed work + * @param {string[]} propertyFilters - Filter which custom properties will be returned + */ + getAgent(poolId, agentId, includeCapabilities, includeAssignedRequest, includeLastCompletedRequest, propertyFilters) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + agentId + }; + let queryValues = { + includeCapabilities, + includeAssignedRequest, + includeLastCompletedRequest, + propertyFilters: propertyFilters && propertyFilters.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e298ef32-5878-4cab-993c-043836571f42", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of agents. + * + * @param {number} poolId - The agent pool containing the agents + * @param {string} agentName - Filter on agent name + * @param {boolean} includeCapabilities - Whether to include the agents' capabilities in the response + * @param {boolean} includeAssignedRequest - Whether to include details about the agents' current work + * @param {boolean} includeLastCompletedRequest - Whether to include details about the agents' most recent completed work + * @param {string[]} propertyFilters - Filter which custom properties will be returned + * @param {string[]} demands - Filter by demands the agents can satisfy + */ + getAgents(poolId, agentName, includeCapabilities, includeAssignedRequest, includeLastCompletedRequest, propertyFilters, demands) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + let queryValues = { + agentName, + includeCapabilities, + includeAssignedRequest, + includeLastCompletedRequest, + propertyFilters: propertyFilters && propertyFilters.join(","), + demands: demands && demands.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e298ef32-5878-4cab-993c-043836571f42", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Replace an agent. You probably don't want to call this endpoint directly. Instead, [use the agent configuration script](https://docs.microsoft.com/azure/devops/pipelines/agents/agents) to remove and reconfigure an agent from your organization. + * + * @param {TaskAgentInterfaces.TaskAgent} agent - Updated details about the replacing agent + * @param {number} poolId - The agent pool to use + * @param {number} agentId - The agent to replace + */ + replaceAgent(agent, poolId, agentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + agentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e298ef32-5878-4cab-993c-043836571f42", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, agent, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update agent details. + * + * @param {TaskAgentInterfaces.TaskAgent} agent - Updated details about the agent + * @param {number} poolId - The agent pool to use + * @param {number} agentId - The agent to update + */ + updateAgent(agent, poolId, agentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + agentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e298ef32-5878-4cab-993c-043836571f42", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, agent, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns list of azure subscriptions + * + */ + getAzureManagementGroups() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "39fe3bf2-7ee0-4198-a469-4a29929afa9c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns list of azure subscriptions + * + */ + getAzureSubscriptions() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "bcd6189c-0303-471f-a8e1-acb22b74d700", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * GET a PAT token for managing (configuring, removing, tagging) deployment targets in a deployment group. + * + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group in which deployment targets are managed. + */ + generateDeploymentGroupAccessToken(project, deploymentGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "3d197ba2-c3e9-4253-882f-0ee2440f8174", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a deployment group. + * + * @param {TaskAgentInterfaces.DeploymentGroupCreateParameter} deploymentGroup - Deployment group to create. + * @param {string} project - Project ID or project name + */ + addDeploymentGroup(deploymentGroup, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "083c4d89-ab35-45af-aa11-7cf66895c53e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, deploymentGroup, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a deployment group. + * + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group to be deleted. + */ + deleteDeploymentGroup(project, deploymentGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "083c4d89-ab35-45af-aa11-7cf66895c53e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a deployment group by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group. + * @param {TaskAgentInterfaces.DeploymentGroupActionFilter} actionFilter - Get the deployment group only if this action can be performed on it. + * @param {TaskAgentInterfaces.DeploymentGroupExpands} expand - Include these additional details in the returned object. + */ + getDeploymentGroup(project, deploymentGroupId, actionFilter, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + let queryValues = { + actionFilter, + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "083c4d89-ab35-45af-aa11-7cf66895c53e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of deployment groups by name or IDs. + * + * @param {string} project - Project ID or project name + * @param {string} name - Name of the deployment group. + * @param {TaskAgentInterfaces.DeploymentGroupActionFilter} actionFilter - Get only deployment groups on which this action can be performed. + * @param {TaskAgentInterfaces.DeploymentGroupExpands} expand - Include these additional details in the returned objects. + * @param {string} continuationToken - Get deployment groups with names greater than this continuationToken lexicographically. + * @param {number} top - Maximum number of deployment groups to return. Default is **1000**. + * @param {number[]} ids - Comma separated list of IDs of the deployment groups. + */ + getDeploymentGroups(project, name, actionFilter, expand, continuationToken, top, ids) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + name, + actionFilter, + "$expand": expand, + continuationToken, + "$top": top, + ids: ids && ids.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "083c4d89-ab35-45af-aa11-7cf66895c53e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentGroup, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a deployment group. + * + * @param {TaskAgentInterfaces.DeploymentGroupUpdateParameter} deploymentGroup - Deployment group to update. + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group. + */ + updateDeploymentGroup(deploymentGroup, project, deploymentGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "083c4d89-ab35-45af-aa11-7cf66895c53e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, deploymentGroup, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of deployment group metrics. + * + * @param {string} project - Project ID or project name + * @param {string} deploymentGroupName - Name of the deployment group. + * @param {string} continuationToken - Get metrics for deployment groups with names greater than this continuationToken lexicographically. + * @param {number} top - Maximum number of deployment group metrics to return. Default is **50**. + */ + getDeploymentGroupsMetrics(project, deploymentGroupName, continuationToken, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + deploymentGroupName, + continuationToken, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "281c6308-427a-49e1-b83a-dac0f4862189", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentGroupMetrics, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId + * @param {number} machineId + * @param {number} completedRequestCount + */ + getAgentRequestsForDeploymentMachine(project, deploymentGroupId, machineId, completedRequestCount) { + return __awaiter2(this, void 0, void 0, function* () { + if (machineId == null) { + throw new TypeError("machineId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + let queryValues = { + machineId, + completedRequestCount + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a3540e5b-f0dc-4668-963b-b752459be545", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId + * @param {number[]} machineIds + * @param {number} completedRequestCount + */ + getAgentRequestsForDeploymentMachines(project, deploymentGroupId, machineIds, completedRequestCount) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + let queryValues = { + machineIds: machineIds && machineIds.join(","), + completedRequestCount + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a3540e5b-f0dc-4668-963b-b752459be545", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId + */ + refreshDeploymentMachines(project, deploymentGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "91006ac4-0f68-4d82-a2bc-540676bd73ce", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * GET a PAT token for managing (configuring, removing, tagging) deployment agents in a deployment pool. + * + * @param {number} poolId - ID of the deployment pool in which deployment agents are managed. + */ + generateDeploymentPoolAccessToken(poolId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "e077ee4a-399b-420b-841f-c43fbc058e0b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of deployment pool summaries. + * + * @param {string} poolName - Name of the deployment pool. + * @param {TaskAgentInterfaces.DeploymentPoolSummaryExpands} expands - Include these additional details in the returned objects. + * @param {number[]} poolIds - List of deployment pool ids. + */ + getDeploymentPoolsSummary(poolName, expands, poolIds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + poolName, + expands, + poolIds: poolIds && poolIds.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6525d6c6-258f-40e0-a1a9-8a24a3957625", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentPoolSummary, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get agent requests for a deployment target. + * + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group to which the target belongs. + * @param {number} targetId - ID of the deployment target. + * @param {number} completedRequestCount - Maximum number of completed requests to return. Default is **50** + */ + getAgentRequestsForDeploymentTarget(project, deploymentGroupId, targetId, completedRequestCount) { + return __awaiter2(this, void 0, void 0, function* () { + if (targetId == null) { + throw new TypeError("targetId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + let queryValues = { + targetId, + completedRequestCount + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2fac0be3-8c8f-4473-ab93-c1389b08a2c9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get agent requests for a list deployment targets. + * + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group to which the targets belong. + * @param {number[]} targetIds - Comma separated list of IDs of the deployment targets. + * @param {number} ownerId - Id of owner of agent job request. + * @param {Date} completedOn - Datetime to return request after this time. + * @param {number} completedRequestCount - Maximum number of completed requests to return for each target. Default is **50** + */ + getAgentRequestsForDeploymentTargets(project, deploymentGroupId, targetIds, ownerId, completedOn, completedRequestCount) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + let queryValues = { + targetIds: targetIds && targetIds.join(","), + ownerId, + completedOn, + completedRequestCount + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2fac0be3-8c8f-4473-ab93-c1389b08a2c9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Upgrade the deployment targets in a deployment group. + * + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group. + */ + refreshDeploymentTargets(project, deploymentGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "1c1a817f-f23d-41c6-bf8d-14b638f64152", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Proxy for a GET request defined by an 'endpoint'. The request is authorized using a service connection. The response is filtered using an XPath/Json based selector. + * + * @param {TaskAgentInterfaces.TaskDefinitionEndpoint} endpoint - Describes the URL to fetch. + */ + queryEndpoint(endpoint) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "f223b809-8c33-4b7d-b53f-07232569b5d6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, endpoint, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get environment deployment execution history + * + * @param {string} project - Project ID or project name + * @param {number} environmentId + * @param {string} continuationToken + * @param {number} top + */ + getEnvironmentDeploymentExecutionRecords(project, environmentId, continuationToken, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId + }; + let queryValues = { + continuationToken, + top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "51bb5d21-4305-4ea6-9dbb-b7488af73334", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.EnvironmentDeploymentExecutionRecord, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create an environment. + * + * @param {TaskAgentInterfaces.EnvironmentCreateParameter} environmentCreateParameter - Environment to create. + * @param {string} project - Project ID or project name + */ + addEnvironment(environmentCreateParameter, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8572b1fc-2482-47fa-8f74-7e3ed53ee54b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, environmentCreateParameter, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.EnvironmentInstance, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete the specified environment. + * + * @param {string} project - Project ID or project name + * @param {number} environmentId - ID of the environment. + */ + deleteEnvironment(project, environmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8572b1fc-2482-47fa-8f74-7e3ed53ee54b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get an environment by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} environmentId - ID of the environment. + * @param {TaskAgentInterfaces.EnvironmentExpands} expands - Include these additional details in the returned objects. + */ + getEnvironmentById(project, environmentId, expands) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId + }; + let queryValues = { + expands + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8572b1fc-2482-47fa-8f74-7e3ed53ee54b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.EnvironmentInstance, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all environments. + * + * @param {string} project - Project ID or project name + * @param {string} name + * @param {string} continuationToken + * @param {number} top + */ + getEnvironments(project, name, continuationToken, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + name, + continuationToken, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8572b1fc-2482-47fa-8f74-7e3ed53ee54b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.EnvironmentInstance, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update the specified environment. + * + * @param {TaskAgentInterfaces.EnvironmentUpdateParameter} environmentUpdateParameter - Environment data to update. + * @param {string} project - Project ID or project name + * @param {number} environmentId - ID of the environment. + */ + updateEnvironment(environmentUpdateParameter, project, environmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8572b1fc-2482-47fa-8f74-7e3ed53ee54b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, environmentUpdateParameter, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.EnvironmentInstance, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} hubName + * @param {boolean} includeEnterpriseUsersCount + * @param {boolean} includeHostedAgentMinutesCount + */ + getTaskHubLicenseDetails(hubName, includeEnterpriseUsersCount, includeHostedAgentMinutesCount) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + hubName + }; + let queryValues = { + includeEnterpriseUsersCount, + includeHostedAgentMinutesCount + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "distributedtask", "f9f0f436-b8a1-4475-9041-1ccdbf8f0128", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskHubLicenseDetails} taskHubLicenseDetails + * @param {string} hubName + */ + updateTaskHubLicenseDetails(taskHubLicenseDetails, hubName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + hubName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "distributedtask", "f9f0f436-b8a1-4475-9041-1ccdbf8f0128", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, taskHubLicenseDetails, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.InputValidationRequest} inputValidationRequest + */ + validateInputs(inputValidationRequest) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "58475b1e-adaf-4155-9bc1-e04bf1fff4c2", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, inputValidationRequest, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} requestId + * @param {string} lockToken + * @param {TaskAgentInterfaces.TaskResult} result + * @param {boolean} agentShuttingDown + */ + deleteAgentRequest(poolId, requestId, lockToken, result2, agentShuttingDown) { + return __awaiter2(this, void 0, void 0, function* () { + if (lockToken == null) { + throw new TypeError("lockToken can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + requestId + }; + let queryValues = { + lockToken, + result: result2, + agentShuttingDown + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} requestId + * @param {boolean} includeStatus + */ + getAgentRequest(poolId, requestId, includeStatus) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + requestId + }; + let queryValues = { + includeStatus + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} top + * @param {string} continuationToken + */ + getAgentRequests(poolId, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (top == null) { + throw new TypeError("top can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + let queryValues = { + "$top": top, + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} agentId + * @param {number} completedRequestCount + */ + getAgentRequestsForAgent(poolId, agentId, completedRequestCount) { + return __awaiter2(this, void 0, void 0, function* () { + if (agentId == null) { + throw new TypeError("agentId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + let queryValues = { + agentId, + completedRequestCount + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number[]} agentIds + * @param {number} completedRequestCount + */ + getAgentRequestsForAgents(poolId, agentIds, completedRequestCount) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + let queryValues = { + agentIds: agentIds && agentIds.join(","), + completedRequestCount + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {string} planId + * @param {string} jobId + */ + getAgentRequestsForPlan(poolId, planId, jobId) { + return __awaiter2(this, void 0, void 0, function* () { + if (planId == null) { + throw new TypeError("planId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + let queryValues = { + planId, + jobId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskAgentJobRequest} request + * @param {number} poolId + */ + queueAgentRequestByPool(request, poolId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, request, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskAgentJobRequest} request + * @param {number} poolId + * @param {number} requestId + * @param {string} lockToken + * @param {TaskAgentInterfaces.TaskAgentRequestUpdateOptions} updateOptions + */ + updateAgentRequest(request, poolId, requestId, lockToken, updateOptions) { + return __awaiter2(this, void 0, void 0, function* () { + if (lockToken == null) { + throw new TypeError("lockToken can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + requestId + }; + let queryValues = { + lockToken, + updateOptions + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "fc825784-c92a-4299-9221-998a02d1b54f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, request, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJobRequest, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.KubernetesResourceCreateParameters} createParameters + * @param {string} project - Project ID or project name + * @param {number} environmentId + */ + addKubernetesResource(createParameters, project, environmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "73fba52f-15ab-42b3-a538-ce67a9223a04", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, createParameters, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.KubernetesResource, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} environmentId + * @param {number} resourceId + */ + deleteKubernetesResource(project, environmentId, resourceId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId, + resourceId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "73fba52f-15ab-42b3-a538-ce67a9223a04", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} environmentId + * @param {number} resourceId + */ + getKubernetesResource(project, environmentId, resourceId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId, + resourceId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "73fba52f-15ab-42b3-a538-ce67a9223a04", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.KubernetesResource, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} machineGroupId + */ + generateDeploymentMachineGroupAccessToken(project, machineGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + machineGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "f8c7c0de-ac0d-469b-9cb1-c21f72d67693", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.DeploymentMachineGroup} machineGroup + * @param {string} project - Project ID or project name + */ + addDeploymentMachineGroup(machineGroup, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "d4adf50f-80c6-4ac8-9ca1-6e4e544286e9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, machineGroup, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachineGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} machineGroupId + */ + deleteDeploymentMachineGroup(project, machineGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + machineGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "d4adf50f-80c6-4ac8-9ca1-6e4e544286e9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} machineGroupId + * @param {TaskAgentInterfaces.MachineGroupActionFilter} actionFilter + */ + getDeploymentMachineGroup(project, machineGroupId, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + machineGroupId + }; + let queryValues = { + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "d4adf50f-80c6-4ac8-9ca1-6e4e544286e9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachineGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} machineGroupName + * @param {TaskAgentInterfaces.MachineGroupActionFilter} actionFilter + */ + getDeploymentMachineGroups(project, machineGroupName, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + machineGroupName, + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "d4adf50f-80c6-4ac8-9ca1-6e4e544286e9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachineGroup, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.DeploymentMachineGroup} machineGroup + * @param {string} project - Project ID or project name + * @param {number} machineGroupId + */ + updateDeploymentMachineGroup(machineGroup, project, machineGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + machineGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "d4adf50f-80c6-4ac8-9ca1-6e4e544286e9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, machineGroup, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachineGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} machineGroupId + * @param {string[]} tagFilters + */ + getDeploymentMachineGroupMachines(project, machineGroupId, tagFilters) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + machineGroupId + }; + let queryValues = { + tagFilters: tagFilters && tagFilters.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "966c3874-c347-4b18-a90c-d509116717fd", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.DeploymentMachine[]} deploymentMachines + * @param {string} project - Project ID or project name + * @param {number} machineGroupId + */ + updateDeploymentMachineGroupMachines(deploymentMachines, project, machineGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + machineGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "966c3874-c347-4b18-a90c-d509116717fd", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, deploymentMachines, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.DeploymentMachine} machine + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId + */ + addDeploymentMachine(machine, project, deploymentGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, machine, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId + * @param {number} machineId + */ + deleteDeploymentMachine(project, deploymentGroupId, machineId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId, + machineId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId + * @param {number} machineId + * @param {TaskAgentInterfaces.DeploymentMachineExpands} expand + */ + getDeploymentMachine(project, deploymentGroupId, machineId, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId, + machineId + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId + * @param {string[]} tags + * @param {string} name + * @param {TaskAgentInterfaces.DeploymentMachineExpands} expand + */ + getDeploymentMachines(project, deploymentGroupId, tags, name, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + let queryValues = { + tags: tags && tags.join(","), + name, + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.DeploymentMachine} machine + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId + * @param {number} machineId + */ + replaceDeploymentMachine(machine, project, deploymentGroupId, machineId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId, + machineId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, machine, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.DeploymentMachine} machine + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId + * @param {number} machineId + */ + updateDeploymentMachine(machine, project, deploymentGroupId, machineId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId, + machineId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, machine, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.DeploymentMachine[]} machines + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId + */ + updateDeploymentMachines(machines, project, deploymentGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6f6d406f-cfe6-409c-9327-7009928077e7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, machines, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskAgentPoolMaintenanceDefinition} definition + * @param {number} poolId + */ + createAgentPoolMaintenanceDefinition(definition, poolId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "80572e16-58f0-4419-ac07-d19fde32195c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, definition, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} definitionId + */ + deleteAgentPoolMaintenanceDefinition(poolId, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "80572e16-58f0-4419-ac07-d19fde32195c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} definitionId + */ + getAgentPoolMaintenanceDefinition(poolId, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "80572e16-58f0-4419-ac07-d19fde32195c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + */ + getAgentPoolMaintenanceDefinitions(poolId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "80572e16-58f0-4419-ac07-d19fde32195c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceDefinition, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskAgentPoolMaintenanceDefinition} definition + * @param {number} poolId + * @param {number} definitionId + */ + updateAgentPoolMaintenanceDefinition(definition, poolId, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "80572e16-58f0-4419-ac07-d19fde32195c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, definition, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} jobId + */ + deleteAgentPoolMaintenanceJob(poolId, jobId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + jobId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "15e7ab6e-abce-4601-a6d8-e111fe148f46", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} jobId + */ + getAgentPoolMaintenanceJob(poolId, jobId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + jobId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "15e7ab6e-abce-4601-a6d8-e111fe148f46", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceJob, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} jobId + */ + getAgentPoolMaintenanceJobLogs(poolId, jobId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + jobId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "15e7ab6e-abce-4601-a6d8-e111fe148f46", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} definitionId + */ + getAgentPoolMaintenanceJobs(poolId, definitionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + let queryValues = { + definitionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "15e7ab6e-abce-4601-a6d8-e111fe148f46", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceJob, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskAgentPoolMaintenanceJob} job + * @param {number} poolId + */ + queueAgentPoolMaintenanceJob(job, poolId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "15e7ab6e-abce-4601-a6d8-e111fe148f46", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, job, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceJob, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskAgentPoolMaintenanceJob} job + * @param {number} poolId + * @param {number} jobId + */ + updateAgentPoolMaintenanceJob(job, poolId, jobId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + jobId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "15e7ab6e-abce-4601-a6d8-e111fe148f46", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, job, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPoolMaintenanceJob, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} messageId + * @param {string} sessionId + */ + deleteMessage(poolId, messageId, sessionId) { + return __awaiter2(this, void 0, void 0, function* () { + if (sessionId == null) { + throw new TypeError("sessionId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + messageId + }; + let queryValues = { + sessionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {string} sessionId + * @param {number} lastMessageId + */ + getMessage(poolId, sessionId, lastMessageId) { + return __awaiter2(this, void 0, void 0, function* () { + if (sessionId == null) { + throw new TypeError("sessionId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + let queryValues = { + sessionId, + lastMessageId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} agentId + */ + refreshAgent(poolId, agentId) { + return __awaiter2(this, void 0, void 0, function* () { + if (agentId == null) { + throw new TypeError("agentId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + let queryValues = { + agentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + */ + refreshAgents(poolId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskAgentMessage} message + * @param {number} poolId + * @param {number} requestId + */ + sendMessage(message, poolId, requestId) { + return __awaiter2(this, void 0, void 0, function* () { + if (requestId == null) { + throw new TypeError("requestId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + let queryValues = { + requestId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "c3a054f6-7a8a-49c0-944e-3a8e5d7adfd7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, message, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} packageType + * @param {string} platform + * @param {string} version + */ + getPackage(packageType, platform, version2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + packageType, + platform, + version: version2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "8ffcd551-079c-493a-9c02-54346299d144", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.PackageMetadata, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} packageType + * @param {string} platform + * @param {number} top + */ + getPackages(packageType, platform, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + packageType, + platform + }; + let queryValues = { + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "8ffcd551-079c-493a-9c02-54346299d144", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.PackageMetadata, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + */ + getAgentPoolMetadata(poolId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "0d62f887-9f53-48b9-9161-4c35d5735b0f", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {any} agentPoolMetadata + * @param {number} poolId + */ + setAgentPoolMetadata(customHeaders, agentPoolMetadata, poolId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "0d62f887-9f53-48b9-9161-4c35d5735b0f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.replace(url, agentPoolMetadata, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Checks if current identity has passed permissions on a pool. + * + * @param {number} poolId - Id of the pool to check + * @param {number} permissions - Permissions to check. Multiple permissions might be merged into single value using bitwise OR operator (e.g. AgentPoolPermissions.Manage | AgentPoolPermissions.View) + */ + hasPoolPermissions(poolId, permissions) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + permissions + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "162778f3-4b48-48f3-9d58-436fb9c407bc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create an agent pool. + * + * @param {TaskAgentInterfaces.TaskAgentPool} pool - Details about the new agent pool + */ + addAgentPool(pool) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a8c47e17-4d56-4a56-92bb-de7ea7dc65be", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, pool, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPool, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete an agent pool. + * + * @param {number} poolId - ID of the agent pool to delete + */ + deleteAgentPool(poolId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a8c47e17-4d56-4a56-92bb-de7ea7dc65be", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get information about an agent pool. + * + * @param {number} poolId - An agent pool ID + * @param {string[]} properties - Agent pool properties (comma-separated) + * @param {TaskAgentInterfaces.TaskAgentPoolActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions + */ + getAgentPool(poolId, properties, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + let queryValues = { + properties: properties && properties.join(","), + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a8c47e17-4d56-4a56-92bb-de7ea7dc65be", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPool, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of agent pools. + * + * @param {string} poolName - Filter by name + * @param {string[]} properties - Filter by agent pool properties (comma-separated) + * @param {TaskAgentInterfaces.TaskAgentPoolType} poolType - Filter by pool type + * @param {TaskAgentInterfaces.TaskAgentPoolActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions + */ + getAgentPools(poolName, properties, poolType, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + poolName, + properties: properties && properties.join(","), + poolType, + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a8c47e17-4d56-4a56-92bb-de7ea7dc65be", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPool, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of agent pools. + * + * @param {number[]} poolIds - pool Ids to fetch + * @param {TaskAgentInterfaces.TaskAgentPoolActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions + */ + getAgentPoolsByIds(poolIds, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + if (poolIds == null) { + throw new TypeError("poolIds can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + poolIds: poolIds && poolIds.join(","), + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a8c47e17-4d56-4a56-92bb-de7ea7dc65be", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPool, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update properties on an agent pool + * + * @param {TaskAgentInterfaces.TaskAgentPool} pool - Updated agent pool details + * @param {number} poolId - The agent pool to update + */ + updateAgentPool(pool, poolId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "a8c47e17-4d56-4a56-92bb-de7ea7dc65be", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, pool, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentPool, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a new agent queue to connect a project to an agent pool. + * + * @param {TaskAgentInterfaces.TaskAgentQueue} queue - Details about the queue to create + * @param {string} project - Project ID or project name + * @param {boolean} authorizePipelines - Automatically authorize this queue when using YAML + */ + addAgentQueue(queue, project, authorizePipelines) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + authorizePipelines + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, queue, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentQueue, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a new team project. + * + * @param {string} project - Project ID or project name + */ + createTeamProject(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes an agent queue from a project. + * + * @param {number} queueId - The agent queue to remove + * @param {string} project - Project ID or project name + */ + deleteAgentQueue(queueId, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + queueId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get information about an agent queue. + * + * @param {number} queueId - The agent queue to get information about + * @param {string} project - Project ID or project name + * @param {TaskAgentInterfaces.TaskAgentQueueActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions + */ + getAgentQueue(queueId, project, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + queueId + }; + let queryValues = { + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentQueue, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of agent queues. + * + * @param {string} project - Project ID or project name + * @param {string} queueName - Filter on the agent queue name + * @param {TaskAgentInterfaces.TaskAgentQueueActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions + */ + getAgentQueues(project, queueName, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + queueName, + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentQueue, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of agent queues by their IDs + * + * @param {number[]} queueIds - A comma-separated list of agent queue IDs to retrieve + * @param {string} project - Project ID or project name + * @param {TaskAgentInterfaces.TaskAgentQueueActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions + */ + getAgentQueuesByIds(queueIds, project, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + if (queueIds == null) { + throw new TypeError("queueIds can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + queueIds: queueIds && queueIds.join(","), + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentQueue, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of agent queues by their names + * + * @param {string[]} queueNames - A comma-separated list of agent names to retrieve + * @param {string} project - Project ID or project name + * @param {TaskAgentInterfaces.TaskAgentQueueActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions + */ + getAgentQueuesByNames(queueNames, project, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + if (queueNames == null) { + throw new TypeError("queueNames can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + queueNames: queueNames && queueNames.join(","), + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentQueue, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of agent queues by pool ids + * + * @param {number[]} poolIds - A comma-separated list of pool ids to get the corresponding queues for + * @param {string} project - Project ID or project name + * @param {TaskAgentInterfaces.TaskAgentQueueActionFilter} actionFilter - Filter by whether the calling user has use or manage permissions + */ + getAgentQueuesForPools(poolIds, project, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + if (poolIds == null) { + throw new TypeError("poolIds can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + poolIds: poolIds && poolIds.join(","), + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "900fa995-c559-4923-aae7-f8424fe4fbea", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentQueue, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} agentCloudId + */ + getAgentCloudRequests(agentCloudId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + agentCloudId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "20189bd7-5134-49c2-b8e9-f9e856eea2b2", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentCloudRequest, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + */ + getResourceLimits() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "1f1f0557-c445-42a6-b4a0-0df605a3a0f8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} parallelismTag + * @param {boolean} poolIsHosted + * @param {boolean} includeRunningRequests + */ + getResourceUsage(parallelismTag, poolIsHosted, includeRunningRequests) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + parallelismTag, + poolIsHosted, + includeRunningRequests + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "eae1d376-a8b1-4475-9041-1dfdbe8f0143", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.ResourceUsage, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} taskGroupId + */ + getTaskGroupHistory(project, taskGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + taskGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "100cc92a-b255-47fa-9ab3-e44a2985a3ac", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroupRevision, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a secure file + * + * @param {string} project - Project ID or project name + * @param {string} secureFileId - The unique secure file Id + */ + deleteSecureFile(project, secureFileId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + secureFileId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Download a secure file by Id + * + * @param {string} project - Project ID or project name + * @param {string} secureFileId - The unique secure file Id + * @param {string} ticket - A valid download ticket + * @param {boolean} download - If download is true, the file is sent as attachement in the response body. If download is false, the response body contains the file stream. + */ + downloadSecureFile(project, secureFileId, ticket, download) { + return __awaiter2(this, void 0, void 0, function* () { + if (ticket == null) { + throw new TypeError("ticket can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + secureFileId + }; + let queryValues = { + ticket, + download + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a secure file + * + * @param {string} project - Project ID or project name + * @param {string} secureFileId - The unique secure file Id + * @param {boolean} includeDownloadTicket - If includeDownloadTicket is true and the caller has permissions, a download ticket is included in the response. + * @param {TaskAgentInterfaces.SecureFileActionFilter} actionFilter + */ + getSecureFile(project, secureFileId, includeDownloadTicket, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + secureFileId + }; + let queryValues = { + includeDownloadTicket, + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get secure files + * + * @param {string} project - Project ID or project name + * @param {string} namePattern - Name of the secure file to match. Can include wildcards to match multiple files. + * @param {boolean} includeDownloadTickets - If includeDownloadTickets is true and the caller has permissions, a download ticket for each secure file is included in the response. + * @param {TaskAgentInterfaces.SecureFileActionFilter} actionFilter - Filter by secure file permissions for View, Manage or Use action. Defaults to View. + */ + getSecureFiles(project, namePattern, includeDownloadTickets, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + namePattern, + includeDownloadTickets, + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get secure files + * + * @param {string} project - Project ID or project name + * @param {string[]} secureFileIds - A list of secure file Ids + * @param {boolean} includeDownloadTickets - If includeDownloadTickets is true and the caller has permissions, a download ticket for each secure file is included in the response. + * @param {TaskAgentInterfaces.SecureFileActionFilter} actionFilter + */ + getSecureFilesByIds(project, secureFileIds, includeDownloadTickets, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + if (secureFileIds == null) { + throw new TypeError("secureFileIds can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + secureFileIds: secureFileIds && secureFileIds.join(","), + includeDownloadTickets, + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get secure files + * + * @param {string} project - Project ID or project name + * @param {string[]} secureFileNames - A list of secure file Ids + * @param {boolean} includeDownloadTickets - If includeDownloadTickets is true and the caller has permissions, a download ticket for each secure file is included in the response. + * @param {TaskAgentInterfaces.SecureFileActionFilter} actionFilter + */ + getSecureFilesByNames(project, secureFileNames, includeDownloadTickets, actionFilter) { + return __awaiter2(this, void 0, void 0, function* () { + if (secureFileNames == null) { + throw new TypeError("secureFileNames can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + secureFileNames: secureFileNames && secureFileNames.join(","), + includeDownloadTickets, + actionFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Query secure files using a name pattern and a condition on file properties. + * + * @param {string} condition - The main condition syntax is described [here](https://go.microsoft.com/fwlink/?linkid=842996). Use the *property('property-name')* function to access the value of the specified property of a secure file. It returns null if the property is not set. E.g. ``` and( eq( property('devices'), '2' ), in( property('provisioning profile type'), 'ad hoc', 'development' ) ) ``` + * @param {string} project - Project ID or project name + * @param {string} namePattern - Name of the secure file to match. Can include wildcards to match multiple files. + */ + querySecureFilesByProperties(condition, project, namePattern) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + namePattern + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, condition, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update the name or properties of an existing secure file + * + * @param {TaskAgentInterfaces.SecureFile} secureFile - The secure file with updated name and/or properties + * @param {string} project - Project ID or project name + * @param {string} secureFileId - The unique secure file Id + */ + updateSecureFile(secureFile, project, secureFileId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + secureFileId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, secureFile, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update properties and/or names of a set of secure files. Files are identified by their IDs. Properties provided override the existing one entirely, i.e. do not merge. + * + * @param {TaskAgentInterfaces.SecureFile[]} secureFiles - A list of secure file objects. Only three field must be populated Id, Name, and Properties. The rest of fields in the object are ignored. + * @param {string} project - Project ID or project name + */ + updateSecureFiles(secureFiles, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, secureFiles, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Upload a secure file, include the file stream in the request body + * + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} project - Project ID or project name + * @param {string} name - Name of the file to upload + * @param {boolean} authorizePipelines - If authorizePipelines is true, then the secure file is authorized for use by all pipelines in the project. + */ + uploadSecureFile(customHeaders, contentStream, project, name, authorizePipelines) { + return __awaiter2(this, void 0, void 0, function* () { + if (name == null) { + throw new TypeError("name can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + name, + authorizePipelines + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "adcfd8bc-b184-43ba-bd84-7c8c6a2ff421", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("POST", url, contentStream, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.SecureFile, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskAgentSession} session + * @param {number} poolId + */ + createAgentSession(session, poolId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "134e239e-2df3-4794-a6f6-24f1f19ec8dc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, session, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentSession, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {string} sessionId + */ + deleteAgentSession(poolId, sessionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + sessionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "134e239e-2df3-4794-a6f6-24f1f19ec8dc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Register a deployment target to a deployment group. Generally this is called by agent configuration tool. + * + * @param {TaskAgentInterfaces.DeploymentMachine} machine - Deployment target to register. + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group to which the deployment target is registered. + */ + addDeploymentTarget(machine, project, deploymentGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, machine, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a deployment target in a deployment group. This deletes the agent from associated deployment pool too. + * + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group in which deployment target is deleted. + * @param {number} targetId - ID of the deployment target to delete. + */ + deleteDeploymentTarget(project, deploymentGroupId, targetId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId, + targetId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a deployment target by its ID in a deployment group + * + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group to which deployment target belongs. + * @param {number} targetId - ID of the deployment target to return. + * @param {TaskAgentInterfaces.DeploymentTargetExpands} expand - Include these additional details in the returned objects. + */ + getDeploymentTarget(project, deploymentGroupId, targetId, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId, + targetId + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of deployment targets in a deployment group. + * + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group. + * @param {string[]} tags - Get only the deployment targets that contain all these comma separted list of tags. + * @param {string} name - Name pattern of the deployment targets to return. + * @param {boolean} partialNameMatch - When set to true, treats **name** as pattern. Else treats it as absolute match. Default is **false**. + * @param {TaskAgentInterfaces.DeploymentTargetExpands} expand - Include these additional details in the returned objects. + * @param {TaskAgentInterfaces.TaskAgentStatusFilter} agentStatus - Get only deployment targets that have this status. + * @param {TaskAgentInterfaces.TaskAgentJobResultFilter} agentJobResult - Get only deployment targets that have this last job result. + * @param {string} continuationToken - Get deployment targets with names greater than this continuationToken lexicographically. + * @param {number} top - Maximum number of deployment targets to return. Default is **1000**. + * @param {boolean} enabled - Get only deployment targets that are enabled or disabled. Default is 'null' which returns all the targets. + * @param {string[]} propertyFilters + */ + getDeploymentTargets(project, deploymentGroupId, tags, name, partialNameMatch, expand, agentStatus, agentJobResult, continuationToken, top, enabled, propertyFilters) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + let queryValues = { + tags: tags && tags.join(","), + name, + partialNameMatch, + "$expand": expand, + agentStatus, + agentJobResult, + continuationToken, + "$top": top, + enabled, + propertyFilters: propertyFilters && propertyFilters.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Replace a deployment target in a deployment group. Generally this is called by agent configuration tool. + * + * @param {TaskAgentInterfaces.DeploymentMachine} machine - New deployment target. + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group in which deployment target is replaced. + * @param {number} targetId - ID of the deployment target to replace. + */ + replaceDeploymentTarget(machine, project, deploymentGroupId, targetId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId, + targetId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, machine, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a deployment target and its agent properties in a deployment group. Generally this is called by agent configuration tool. + * + * @param {TaskAgentInterfaces.DeploymentMachine} machine - Deployment target to update. + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group in which deployment target is updated. + * @param {number} targetId - ID of the deployment target to update. + */ + updateDeploymentTarget(machine, project, deploymentGroupId, targetId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId, + targetId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, machine, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update tags of a list of deployment targets in a deployment group. + * + * @param {TaskAgentInterfaces.DeploymentTargetUpdateParameter[]} machines - Deployment targets with tags to udpdate. + * @param {string} project - Project ID or project name + * @param {number} deploymentGroupId - ID of the deployment group in which deployment targets are updated. + */ + updateDeploymentTargets(machines, project, deploymentGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + deploymentGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "2f0aa599-c121-4256-a5fd-ba370e0ae7b6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, machines, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.DeploymentMachine, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a task group. + * + * @param {TaskAgentInterfaces.TaskGroupCreateParameter} taskGroup - Task group object to create. + * @param {string} project - Project ID or project name + */ + addTaskGroup(taskGroup, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, taskGroup, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a task group. + * + * @param {string} project - Project ID or project name + * @param {string} taskGroupId - Id of the task group to be deleted. + * @param {string} comment - Comments to delete. + */ + deleteTaskGroup(project, taskGroupId, comment) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + taskGroupId + }; + let queryValues = { + comment + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get task group. + * + * @param {string} project - Project ID or project name + * @param {string} taskGroupId - Id of the task group. + * @param {string} versionSpec - version specification of the task group. examples: 1, 1.0. + * @param {TaskAgentInterfaces.TaskGroupExpands} expand - The properties that should be expanded. example $expand=Tasks will expand nested task groups. + */ + getTaskGroup(project, taskGroupId, versionSpec, expand) { + return __awaiter2(this, void 0, void 0, function* () { + if (versionSpec == null) { + throw new TypeError("versionSpec can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + taskGroupId + }; + let queryValues = { + versionSpec, + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} taskGroupId + * @param {number} revision + */ + getTaskGroupRevision(project, taskGroupId, revision) { + return __awaiter2(this, void 0, void 0, function* () { + if (revision == null) { + throw new TypeError("revision can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + taskGroupId + }; + let queryValues = { + revision + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * List task groups. + * + * @param {string} project - Project ID or project name + * @param {string} taskGroupId - Id of the task group. + * @param {boolean} expanded - 'true' to recursively expand task groups. Default is 'false'. + * @param {string} taskIdFilter - Guid of the taskId to filter. + * @param {boolean} deleted - 'true'to include deleted task groups. Default is 'false'. + * @param {number} top - Number of task groups to get. + * @param {Date} continuationToken - Gets the task groups after the continuation token provided. + * @param {TaskAgentInterfaces.TaskGroupQueryOrder} queryOrder - Gets the results in the defined order. Default is 'CreatedOnDescending'. + */ + getTaskGroups(project, taskGroupId, expanded, taskIdFilter, deleted, top, continuationToken, queryOrder) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + taskGroupId + }; + let queryValues = { + expanded, + taskIdFilter, + deleted, + "$top": top, + continuationToken, + queryOrder + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.PublishTaskGroupMetadata} taskGroupMetadata + * @param {string} project - Project ID or project name + * @param {string} parentTaskGroupId + */ + publishTaskGroup(taskGroupMetadata, project, parentTaskGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + if (parentTaskGroupId == null) { + throw new TypeError("parentTaskGroupId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + parentTaskGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, taskGroupMetadata, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskGroup} taskGroup + * @param {string} project - Project ID or project name + */ + undeleteTaskGroup(taskGroup, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, taskGroup, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a task group. + * + * @param {TaskAgentInterfaces.TaskGroupUpdateParameter} taskGroup - Task group to update. + * @param {string} project - Project ID or project name + * @param {string} taskGroupId - Id of the task group to update. + */ + updateTaskGroup(taskGroup, project, taskGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + taskGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, taskGroup, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.TaskGroupUpdatePropertiesBase} taskGroupUpdateProperties + * @param {string} project - Project ID or project name + * @param {string} taskGroupId + * @param {boolean} disablePriorVersions + */ + updateTaskGroupProperties(taskGroupUpdateProperties, project, taskGroupId, disablePriorVersions) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + taskGroupId + }; + let queryValues = { + disablePriorVersions + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "6c08ffbf-dbf1-4f9a-94e5-a1cbd47005e7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, taskGroupUpdateProperties, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskGroup, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} taskId + */ + deleteTaskDefinition(taskId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + taskId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} taskId + * @param {string} versionString + * @param {string[]} visibility + * @param {boolean} scopeLocal + */ + getTaskContentZip(taskId, versionString, visibility, scopeLocal) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + taskId, + versionString + }; + let queryValues = { + visibility, + scopeLocal + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} taskId + * @param {string} versionString + * @param {string[]} visibility + * @param {boolean} scopeLocal + */ + getTaskDefinition(taskId, versionString, visibility, scopeLocal) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + taskId, + versionString + }; + let queryValues = { + visibility, + scopeLocal + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskDefinition, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} taskId + * @param {string[]} visibility + * @param {boolean} scopeLocal + * @param {boolean} allVersions + */ + getTaskDefinitions(taskId, visibility, scopeLocal, allVersions) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + taskId + }; + let queryValues = { + visibility, + scopeLocal, + allVersions + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskDefinition, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {number} poolId + * @param {number} agentId + * @param {string} currentState + */ + updateAgentUpdateState(poolId, agentId, currentState) { + return __awaiter2(this, void 0, void 0, function* () { + if (currentState == null) { + throw new TypeError("currentState can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + agentId + }; + let queryValues = { + currentState + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8cc1b02b-ae49-4516-b5ad-4f9b29967c30", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {{ [key: string] : string; }} userCapabilities + * @param {number} poolId + * @param {number} agentId + */ + updateAgentUserCapabilities(userCapabilities, poolId, agentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + poolId, + agentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "30ba3ada-fedf-4da8-bbb5-dacf2f82e176", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, userCapabilities, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgent, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add a variable group. + * + * @param {TaskAgentInterfaces.VariableGroupParameters} variableGroupParameters + */ + addVariableGroup(variableGroupParameters) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "ef5b7057-ffc3-4c77-bbad-c10b4a4abcc7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, variableGroupParameters, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VariableGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a variable group + * + * @param {number} groupId - Id of the variable group. + * @param {string[]} projectIds + */ + deleteVariableGroup(groupId, projectIds) { + return __awaiter2(this, void 0, void 0, function* () { + if (projectIds == null) { + throw new TypeError("projectIds can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + groupId + }; + let queryValues = { + projectIds: projectIds && projectIds.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "ef5b7057-ffc3-4c77-bbad-c10b4a4abcc7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add a variable group. + * + * @param {TaskAgentInterfaces.VariableGroupProjectReference[]} variableGroupProjectReferences + * @param {number} variableGroupId + */ + shareVariableGroup(variableGroupProjectReferences, variableGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + if (variableGroupId == null) { + throw new TypeError("variableGroupId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + variableGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "ef5b7057-ffc3-4c77-bbad-c10b4a4abcc7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, variableGroupProjectReferences, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a variable group. + * + * @param {TaskAgentInterfaces.VariableGroupParameters} variableGroupParameters + * @param {number} groupId - Id of the variable group to update. + */ + updateVariableGroup(variableGroupParameters, groupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + groupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "ef5b7057-ffc3-4c77-bbad-c10b4a4abcc7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, variableGroupParameters, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VariableGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a variable group. + * + * @param {string} project - Project ID or project name + * @param {number} groupId - Id of the variable group. + */ + getVariableGroup(project, groupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + groupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "f5b09dd5-9d54-45a1-8b5a-1c8287d634cc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VariableGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get variable groups. + * + * @param {string} project - Project ID or project name + * @param {string} groupName - Name of variable group. + * @param {TaskAgentInterfaces.VariableGroupActionFilter} actionFilter - Action filter for the variable group. It specifies the action which can be performed on the variable groups. + * @param {number} top - Number of variable groups to get. + * @param {number} continuationToken - Gets the variable groups after the continuation token provided. + * @param {TaskAgentInterfaces.VariableGroupQueryOrder} queryOrder - Gets the results in the defined order. Default is 'IdDescending'. + */ + getVariableGroups(project, groupName, actionFilter, top, continuationToken, queryOrder) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + groupName, + actionFilter, + "$top": top, + continuationToken, + queryOrder + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "f5b09dd5-9d54-45a1-8b5a-1c8287d634cc", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VariableGroup, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get variable groups by ids. + * + * @param {string} project - Project ID or project name + * @param {number[]} groupIds - Comma separated list of Ids of variable groups. + * @param {boolean} loadSecrets + */ + getVariableGroupsById(project, groupIds, loadSecrets) { + return __awaiter2(this, void 0, void 0, function* () { + if (groupIds == null) { + throw new TypeError("groupIds can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + groupIds: groupIds && groupIds.join(","), + loadSecrets + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "f5b09dd5-9d54-45a1-8b5a-1c8287d634cc", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VariableGroup, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.VirtualMachineGroupCreateParameters} createParameters + * @param {string} project - Project ID or project name + * @param {number} environmentId + */ + addVirtualMachineGroup(createParameters, project, environmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "9e597901-4af7-4cc3-8d92-47d54db8ebfb", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, createParameters, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VirtualMachineGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} environmentId + * @param {number} resourceId + */ + deleteVirtualMachineGroup(project, environmentId, resourceId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId, + resourceId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "9e597901-4af7-4cc3-8d92-47d54db8ebfb", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} environmentId + * @param {number} resourceId + */ + getVirtualMachineGroup(project, environmentId, resourceId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId, + resourceId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "9e597901-4af7-4cc3-8d92-47d54db8ebfb", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VirtualMachineGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.VirtualMachineGroup} resource + * @param {string} project - Project ID or project name + * @param {number} environmentId + */ + updateVirtualMachineGroup(resource, project, environmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "9e597901-4af7-4cc3-8d92-47d54db8ebfb", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, resource, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VirtualMachineGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} environmentId + * @param {number} resourceId + * @param {string} continuationToken + * @param {string} name + * @param {boolean} partialNameMatch + * @param {string[]} tags + * @param {number} top + */ + getVirtualMachines(project, environmentId, resourceId, continuationToken, name, partialNameMatch, tags, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId, + resourceId + }; + let queryValues = { + continuationToken, + name, + partialNameMatch, + tags: tags && tags.join(","), + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "48700676-2ba5-4282-8ec8-083280d169c7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VirtualMachine, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.VirtualMachine[]} machines + * @param {string} project - Project ID or project name + * @param {number} environmentId + * @param {number} resourceId + */ + updateVirtualMachines(machines, project, environmentId, resourceId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + environmentId, + resourceId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "48700676-2ba5-4282-8ec8-083280d169c7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, machines, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.VirtualMachine, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} tenantId + * @param {string} redirectUri + * @param {TaskAgentInterfaces.AadLoginPromptOption} promptOption + * @param {string} completeCallbackPayload + * @param {boolean} completeCallbackByAuthCode + */ + createAadOAuthRequest(tenantId, redirectUri, promptOption, completeCallbackPayload, completeCallbackByAuthCode) { + return __awaiter2(this, void 0, void 0, function* () { + if (tenantId == null) { + throw new TypeError("tenantId can not be null or undefined"); + } + if (redirectUri == null) { + throw new TypeError("redirectUri can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + tenantId, + redirectUri, + promptOption, + completeCallbackPayload, + completeCallbackByAuthCode + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "9c63205e-3a0f-42a0-ad88-095200f13607", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + */ + getVstsAadTenantId() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "9c63205e-3a0f-42a0-ad88-095200f13607", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * GET the Yaml schema used for Yaml file validation. + * + * @param {boolean} validateTaskNames - Whether the schema should validate that tasks are actually installed (useful for offline tools where you don't want validation). + */ + getYamlSchema(validateTaskNames) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + validateTaskNames + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "1f9990b9-1dba-441f-9c2e-6485888c42b6", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.TaskAgentApiBase = TaskAgentApiBase; + TaskAgentApiBase.RESOURCE_AREA_ID = "a85b8835-c1a1-4aac-ae97-1c3d0ba72dbd"; + } +}); + +// ../node_modules/azure-devops-node-api/TaskAgentApi.js +var require_TaskAgentApi = __commonJS({ + "../node_modules/azure-devops-node-api/TaskAgentApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TaskAgentApi = void 0; + var taskagentbasem = require_TaskAgentApiBase(); + var url = require("url"); + var TaskAgentApi = class _TaskAgentApi extends taskagentbasem.TaskAgentApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, options); + this._handlers = handlers; + this._options = options; + } + /** + * @param {string} taskId + * @param onResult callback function + */ + deleteTaskDefinition(taskId) { + let promise = this.vsoClient.beginGetLocation("distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd").then((location) => { + if (location) { + return super.deleteTaskDefinition(taskId); + } else { + var fallbackClient = this._getFallbackClient(this.baseUrl); + if (!fallbackClient) { + throw new Error("Failed to find api location for area: distributedtask id: 60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd"); + } else { + return fallbackClient.deleteTaskDefinition(taskId); + } + } + }); + return promise; + } + /** + * @param {string} taskId + * @param {string} versionString + * @param {string[]} visibility + * @param {boolean} scopeLocal + * @param onResult callback function with the resulting ArrayBuffer + */ + getTaskContentZip(taskId, versionString, visibility, scopeLocal) { + let promise = this.vsoClient.beginGetLocation("distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd").then((location) => { + if (location) { + return super.getTaskContentZip(taskId, versionString, visibility, scopeLocal); + } else { + var fallbackClient = this._getFallbackClient(this.baseUrl); + if (!fallbackClient) { + throw new Error("Failed to find api location for area: distributedtask id: 60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd"); + } else { + return fallbackClient.getTaskContentZip(taskId, versionString, visibility, scopeLocal); + } + } + }); + return promise; + } + /** + * @param {string} taskId + * @param {string} versionString + * @param {string[]} visibility + * @param {boolean} scopeLocal + * @param onResult callback function with the resulting TaskAgentInterfaces.TaskDefinition + */ + getTaskDefinition(taskId, versionString, visibility, scopeLocal) { + let promise = this.vsoClient.beginGetLocation("distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd").then((location) => { + if (location) { + return super.getTaskDefinition(taskId, versionString, visibility, scopeLocal); + } else { + var fallbackClient = this._getFallbackClient(this.baseUrl); + if (!fallbackClient) { + throw new Error("Failed to find api location for area: distributedtask id: 60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd"); + } else { + return fallbackClient.getTaskDefinition(taskId, versionString, visibility, scopeLocal); + } + } + }); + return promise; + } + /** + * @param {string} taskId + * @param {string[]} visibility + * @param {boolean} scopeLocal + * @param onResult callback function with the resulting TaskAgentInterfaces.TaskDefinition[] + */ + getTaskDefinitions(taskId, visibility, scopeLocal) { + let promise = this.vsoClient.beginGetLocation("distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd").then((location) => { + if (location) { + return super.getTaskDefinitions(taskId, visibility, scopeLocal); + } else { + var fallbackClient = this._getFallbackClient(this.baseUrl); + if (!fallbackClient) { + throw new Error("Failed to find api location for area: distributedtask id: 60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd"); + } else { + return fallbackClient.getTaskDefinitions(taskId, visibility, scopeLocal); + } + } + }); + return promise; + } + /** + * @param {NodeJS.ReadableStream} contentStream + * @param {string} taskId + * @param {boolean} overwrite + * @param onResult callback function + */ + uploadTaskDefinition(customHeaders, contentStream, taskId, overwrite) { + return __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + taskId + }; + let queryValues = { + overwrite + }; + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("3.0-preview.1", "distributedtask", "60aac929-f0cd-4bc8-9ce4-6b30e8f1b1bd", routeValues, queryValues); + let url2 = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("PUT", url2, contentStream, options); + resolve(res.result); + } catch (err) { + reject2(err); + } + })); + }); + } + _getFallbackClient(baseUrl) { + if (!this._fallbackClient) { + var accountUrl = this._getAccountUrl(baseUrl); + if (accountUrl) { + this._fallbackClient = new _TaskAgentApi(accountUrl, this._handlers, this._options); + } + } + return this._fallbackClient; + } + _getAccountUrl(collectionUrl) { + var purl = url.parse(collectionUrl); + if (!purl.protocol || !purl.host) { + return null; + } + var accountUrl = purl.protocol + "//" + purl.host; + var splitPath = purl.path.split("/").slice(1); + if (splitPath.length === 0 || splitPath.length === 1 && splitPath[0] === "") { + return null; + } + if (splitPath[0] === "tfs" && (splitPath.length === 2 || splitPath.length === 3 && splitPath[2].length === 0)) { + accountUrl += "/tfs"; + } else if (splitPath.length === 2 && splitPath[0] === "") { + return accountUrl; + } else if (splitPath.length > 1) { + return null; + } + return accountUrl; + } + }; + exports2.TaskAgentApi = TaskAgentApi; + } +}); + +// ../node_modules/azure-devops-node-api/TaskApi.js +var require_TaskApi = __commonJS({ + "../node_modules/azure-devops-node-api/TaskApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TaskApi = void 0; + var basem = require_ClientApiBases(); + var TaskAgentInterfaces = require_TaskAgentInterfaces(); + var TaskApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Task-api", options); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {string} type + */ + getPlanAttachments(scopeIdentifier, hubName, planId, type) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "eb55e5d6-2f30-4295-b5ed-38da50b1fc52", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAttachment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {string} timelineId + * @param {string} recordId + * @param {string} type + * @param {string} name + */ + createAttachment(customHeaders, contentStream, scopeIdentifier, hubName, planId, timelineId, recordId, type, name) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + timelineId, + recordId, + type, + name + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "7898f959-9cdf-4096-b29e-7f293031629e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("PUT", url, contentStream, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAttachment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {string} timelineId + * @param {string} recordId + * @param {string} type + * @param {string} name + * @param {string} artifactHash + * @param {number} length + */ + createAttachmentFromArtifact(scopeIdentifier, hubName, planId, timelineId, recordId, type, name, artifactHash, length) { + return __awaiter2(this, void 0, void 0, function* () { + if (artifactHash == null) { + throw new TypeError("artifactHash can not be null or undefined"); + } + if (length == null) { + throw new TypeError("length can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + timelineId, + recordId, + type, + name + }; + let queryValues = { + artifactHash, + length + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "7898f959-9cdf-4096-b29e-7f293031629e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAttachment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {string} timelineId + * @param {string} recordId + * @param {string} type + * @param {string} name + */ + getAttachment(scopeIdentifier, hubName, planId, timelineId, recordId, type, name) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + timelineId, + recordId, + type, + name + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "7898f959-9cdf-4096-b29e-7f293031629e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAttachment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {string} timelineId + * @param {string} recordId + * @param {string} type + * @param {string} name + */ + getAttachmentContent(scopeIdentifier, hubName, planId, timelineId, recordId, type, name) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + timelineId, + recordId, + type, + name + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "7898f959-9cdf-4096-b29e-7f293031629e", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {string} timelineId + * @param {string} recordId + * @param {string} type + */ + getAttachments(scopeIdentifier, hubName, planId, timelineId, recordId, type) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + timelineId, + recordId, + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "7898f959-9cdf-4096-b29e-7f293031629e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAttachment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Append content to timeline record feed. + * + * @param {TaskAgentInterfaces.TimelineRecordFeedLinesWrapper} lines - Content to be appended to the timeline record feed. + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId - ID of the plan. + * @param {string} timelineId - ID of the task's timeline. + * @param {string} recordId - ID of the timeline record. + */ + appendTimelineRecordFeed(lines, scopeIdentifier, hubName, planId, timelineId, recordId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + timelineId, + recordId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "858983e4-19bd-4c5e-864c-507b59b58b12", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, lines, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {string} timelineId + * @param {string} recordId + * @param {string} stepId + * @param {number} endLine + * @param {number} takeCount + * @param {string} continuationToken + */ + getLines(scopeIdentifier, hubName, planId, timelineId, recordId, stepId, endLine, takeCount, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (stepId == null) { + throw new TypeError("stepId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + timelineId, + recordId + }; + let queryValues = { + stepId, + endLine, + takeCount, + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "858983e4-19bd-4c5e-864c-507b59b58b12", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} orchestrationId + */ + getJobInstance(scopeIdentifier, hubName, orchestrationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + orchestrationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "0a1efd25-abda-43bd-9629-6c7bdd2e0d60", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskAgentJob, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Append a log to a task's log. The log should be sent in the body of the request as a TaskLog object stream. + * + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId - The ID of the plan. + * @param {number} logId - The ID of the log. + */ + appendLogContent(customHeaders, contentStream, scopeIdentifier, hubName, planId, logId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + logId + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "46f5667d-263a-4684-91b1-dff7fdcf64e2", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("POST", url, contentStream, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskLog, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {number} logId + * @param {string} serializedBlobId + * @param {number} lineCount + */ + associateLog(scopeIdentifier, hubName, planId, logId, serializedBlobId, lineCount) { + return __awaiter2(this, void 0, void 0, function* () { + if (serializedBlobId == null) { + throw new TypeError("serializedBlobId can not be null or undefined"); + } + if (lineCount == null) { + throw new TypeError("lineCount can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + logId + }; + let queryValues = { + serializedBlobId, + lineCount + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "46f5667d-263a-4684-91b1-dff7fdcf64e2", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskLog, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a log and connect it to a pipeline run's execution plan. + * + * @param {TaskAgentInterfaces.TaskLog} log - An object that contains information about log's path. + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId - The ID of the plan. + */ + createLog(log, scopeIdentifier, hubName, planId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "46f5667d-263a-4684-91b1-dff7fdcf64e2", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, log, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskLog, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {number} logId + * @param {number} startLine + * @param {number} endLine + */ + getLog(scopeIdentifier, hubName, planId, logId, startLine, endLine) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + logId + }; + let queryValues = { + startLine, + endLine + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "46f5667d-263a-4684-91b1-dff7fdcf64e2", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + */ + getLogs(scopeIdentifier, hubName, planId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "46f5667d-263a-4684-91b1-dff7fdcf64e2", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskLog, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + */ + getPlanGroupsQueueMetrics(scopeIdentifier, hubName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "038fd4d5-cda7-44ca-92c0-935843fee1a7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskOrchestrationPlanGroupsQueueMetrics, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {{ [key: string] : string; }} claims + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {string} jobId + * @param {string} serviceConnectionId + */ + createOidcToken(claims, scopeIdentifier, hubName, planId, jobId, serviceConnectionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + jobId + }; + let queryValues = { + serviceConnectionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "69a319f4-28c1-4bfd-93e6-ea0ff5c6f1a2", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, claims, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {TaskAgentInterfaces.PlanGroupStatus} statusFilter + * @param {number} count + */ + getQueuedPlanGroups(scopeIdentifier, hubName, statusFilter, count) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName + }; + let queryValues = { + statusFilter, + count + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "0dd73091-3e36-4f43-b443-1b76dd426d84", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskOrchestrationQueuedPlanGroup, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planGroup + */ + getQueuedPlanGroup(scopeIdentifier, hubName, planGroup) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planGroup + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "65fd0708-bc1e-447b-a731-0587c5464e5b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskOrchestrationQueuedPlanGroup, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + */ + getPlan(scopeIdentifier, hubName, planId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "distributedtask", "5cecd946-d704-471e-a45f-3b4064fcfaba", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TaskOrchestrationPlan, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {string} timelineId + * @param {number} changeId + */ + getRecords(scopeIdentifier, hubName, planId, timelineId, changeId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + timelineId + }; + let queryValues = { + changeId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8893bc5b-35b2-4be7-83cb-99e683551db4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TimelineRecord, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update timeline records if they already exist, otherwise create new ones for the same timeline. + * + * @param {VSSInterfaces.VssJsonCollectionWrapperV} records - The array of timeline records to be updated. + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId - The ID of the plan. + * @param {string} timelineId - The ID of the timeline. + */ + updateRecords(records, scopeIdentifier, hubName, planId, timelineId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + timelineId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "8893bc5b-35b2-4be7-83cb-99e683551db4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, records, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.TimelineRecord, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TaskAgentInterfaces.Timeline} timeline + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + */ + createTimeline(timeline, scopeIdentifier, hubName, planId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "83597576-cc2c-453c-bea6-2882ae6a1653", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, timeline, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.Timeline, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {string} timelineId + */ + deleteTimeline(scopeIdentifier, hubName, planId, timelineId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + timelineId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "83597576-cc2c-453c-bea6-2882ae6a1653", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + * @param {string} timelineId + * @param {number} changeId + * @param {boolean} includeRecords + */ + getTimeline(scopeIdentifier, hubName, planId, timelineId, changeId, includeRecords) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId, + timelineId + }; + let queryValues = { + changeId, + includeRecords + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "83597576-cc2c-453c-bea6-2882ae6a1653", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.Timeline, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} scopeIdentifier - The project GUID to scope the request + * @param {string} hubName - The name of the server hub. Common examples: "build", "rm", "checks" + * @param {string} planId + */ + getTimelines(scopeIdentifier, hubName, planId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + scopeIdentifier, + hubName, + planId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "distributedtask", "83597576-cc2c-453c-bea6-2882ae6a1653", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TaskAgentInterfaces.TypeInfo.Timeline, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.TaskApi = TaskApi; + } +}); + +// ../node_modules/azure-devops-node-api/TestApi.js +var require_TestApi = __commonJS({ + "../node_modules/azure-devops-node-api/TestApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TestApi = void 0; + var basem = require_ClientApiBases(); + var TestInterfaces = require_TestInterfaces(); + var TestApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Test-api", options); + } + /** + * Attach a file to test step result + * + * @param {TestInterfaces.TestAttachmentRequestModel} attachmentRequestModel - Attachment details TestAttachmentRequestModel + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run that contains the result. + * @param {number} testCaseResultId - ID of the test result that contains the iteration + * @param {number} iterationId - ID of the test result iteration. + * @param {string} actionPath - Hex value of test result action path. + */ + createTestIterationResultAttachment(attachmentRequestModel, project, runId, testCaseResultId, iterationId, actionPath) { + return __awaiter2(this, void 0, void 0, function* () { + if (iterationId == null) { + throw new TypeError("iterationId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + let queryValues = { + iterationId, + actionPath + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, attachmentRequestModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Attach a file to a test result. + * + * @param {TestInterfaces.TestAttachmentRequestModel} attachmentRequestModel - Attachment details TestAttachmentRequestModel + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run that contains the result. + * @param {number} testCaseResultId - ID of the test result against which attachment has to be uploaded. + */ + createTestResultAttachment(attachmentRequestModel, project, runId, testCaseResultId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, attachmentRequestModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Attach a file to a test result + * + * @param {TestInterfaces.TestAttachmentRequestModel} attachmentRequestModel - Attachment Request Model. + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run that contains the result. + * @param {number} testCaseResultId - ID of the test results that contains sub result. + * @param {number} testSubResultId - ID of the test sub results against which attachment has to be uploaded. + */ + createTestSubResultAttachment(attachmentRequestModel, project, runId, testCaseResultId, testSubResultId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testSubResultId == null) { + throw new TypeError("testSubResultId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + let queryValues = { + testSubResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, attachmentRequestModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Download a test result attachment by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run that contains the testCaseResultId. + * @param {number} testCaseResultId - ID of the test result whose attachment has to be downloaded. + * @param {number} attachmentId - ID of the test result attachment to be downloaded. + */ + getTestResultAttachmentContent(project, runId, testCaseResultId, attachmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId, + attachmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get list of test result attachments reference. + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run that contains the result. + * @param {number} testCaseResultId - ID of the test result. + */ + getTestResultAttachments(project, runId, testCaseResultId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestAttachment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Download a test result attachment by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run that contains the testCaseResultId. + * @param {number} testCaseResultId - ID of the test result whose attachment has to be downloaded. + * @param {number} attachmentId - ID of the test result attachment to be downloaded. + */ + getTestResultAttachmentZip(project, runId, testCaseResultId, attachmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId, + attachmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Download a test sub result attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run that contains the result. + * @param {number} testCaseResultId - ID of the test results that contains sub result. + * @param {number} attachmentId - ID of the test result attachment to be downloaded + * @param {number} testSubResultId - ID of the test sub result whose attachment has to be downloaded + */ + getTestSubResultAttachmentContent(project, runId, testCaseResultId, attachmentId, testSubResultId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testSubResultId == null) { + throw new TypeError("testSubResultId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId, + attachmentId + }; + let queryValues = { + testSubResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get list of test sub result attachments + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run that contains the result. + * @param {number} testCaseResultId - ID of the test results that contains sub result. + * @param {number} testSubResultId - ID of the test sub result whose attachment has to be downloaded + */ + getTestSubResultAttachments(project, runId, testCaseResultId, testSubResultId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testSubResultId == null) { + throw new TypeError("testSubResultId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + let queryValues = { + testSubResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestAttachment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Download a test sub result attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run that contains the result. + * @param {number} testCaseResultId - ID of the test results that contains sub result. + * @param {number} attachmentId - ID of the test result attachment to be downloaded + * @param {number} testSubResultId - ID of the test sub result whose attachment has to be downloaded + */ + getTestSubResultAttachmentZip(project, runId, testCaseResultId, attachmentId, testSubResultId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testSubResultId == null) { + throw new TypeError("testSubResultId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId, + attachmentId + }; + let queryValues = { + testSubResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "2bffebe9-2f0f-4639-9af8-56129e9fed2d", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Attach a file to a test run. + * + * @param {TestInterfaces.TestAttachmentRequestModel} attachmentRequestModel - Attachment details TestAttachmentRequestModel + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run against which attachment has to be uploaded. + */ + createTestRunAttachment(attachmentRequestModel, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "4f004af4-a507-489c-9b13-cb62060beb11", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, attachmentRequestModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Download a test run attachment by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run whose attachment has to be downloaded. + * @param {number} attachmentId - ID of the test run attachment to be downloaded. + */ + getTestRunAttachmentContent(project, runId, attachmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + attachmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "4f004af4-a507-489c-9b13-cb62060beb11", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get list of test run attachments reference. + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run. + */ + getTestRunAttachments(project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "4f004af4-a507-489c-9b13-cb62060beb11", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestAttachment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Download a test run attachment by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run whose attachment has to be downloaded. + * @param {number} attachmentId - ID of the test run attachment to be downloaded. + */ + getTestRunAttachmentZip(project, runId, attachmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + attachmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "4f004af4-a507-489c-9b13-cb62060beb11", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + */ + getBugsLinkedToTestResult(project, runId, testCaseResultId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "6de20ca2-67de-4faf-97fa-38c5d585eb00", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get code coverage data for a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - ID of the build for which code coverage data needs to be fetched. + * @param {number} flags - Value of flags determine the level of code coverage details to be fetched. Flags are additive. Expected Values are 1 for Modules, 2 for Functions, 4 for BlockData. + */ + getBuildCodeCoverage(project, buildId, flags) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + if (flags == null) { + throw new TypeError("flags can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + flags + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "77560e8a-4e8c-4d59-894e-a5f264c24444", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.BuildCoverage, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get Code Coverage Summary for Build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - ID of the build for which code coverage data needs to be fetched. + * @param {number} deltaBuildId - Delta Build id (optional) + */ + getCodeCoverageSummary(project, buildId, deltaBuildId) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + deltaBuildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "77560e8a-4e8c-4d59-894e-a5f264c24444", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.CodeCoverageSummary, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * http://(tfsserver):8080/tfs/DefaultCollection/_apis/test/CodeCoverage?buildId=10 Request: Json of code coverage summary + * + * @param {TestInterfaces.CodeCoverageData} coverageData + * @param {string} project - Project ID or project name + * @param {number} buildId + */ + updateCodeCoverageSummary(coverageData, project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "77560e8a-4e8c-4d59-894e-a5f264c24444", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, coverageData, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get code coverage data for a test run + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run for which code coverage data needs to be fetched. + * @param {number} flags - Value of flags determine the level of code coverage details to be fetched. Flags are additive. Expected Values are 1 for Modules, 2 for Functions, 4 for BlockData. + */ + getTestRunCodeCoverage(project, runId, flags) { + return __awaiter2(this, void 0, void 0, function* () { + if (flags == null) { + throw new TypeError("flags can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + flags + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "9629116f-3b89-4ed8-b358-d4694efda160", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TestInterfaces.CustomTestFieldDefinition[]} newFields + * @param {string} project - Project ID or project name + */ + addCustomFields(newFields, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "8ce1923b-f4c7-4e22-b93b-f6284e525ec2", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, newFields, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.CustomTestFieldDefinition, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {TestInterfaces.CustomTestFieldScope} scopeFilter + */ + queryCustomFields(project, scopeFilter) { + return __awaiter2(this, void 0, void 0, function* () { + if (scopeFilter == null) { + throw new TypeError("scopeFilter can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + scopeFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "8ce1923b-f4c7-4e22-b93b-f6284e525ec2", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.CustomTestFieldDefinition, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TestInterfaces.ResultsFilter} filter + * @param {string} project - Project ID or project name + */ + queryTestResultHistory(filter2, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "234616f5-429c-4e7b-9192-affd76731dfd", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, filter2, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultHistory, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get iteration for a result + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run that contains the result. + * @param {number} testCaseResultId - ID of the test result that contains the iterations. + * @param {number} iterationId - Id of the test results Iteration. + * @param {boolean} includeActionResults - Include result details for each action performed in the test iteration. ActionResults refer to outcome (pass/fail) of test steps that are executed as part of a running a manual test. Including the ActionResults flag gets the outcome of test steps in the actionResults section and test parameters in the parameters section for each test iteration. + */ + getTestIteration(project, runId, testCaseResultId, iterationId, includeActionResults) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId, + iterationId + }; + let queryValues = { + includeActionResults + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "73eb9074-3446-4c44-8296-2f811950ff8d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestIterationDetailsModel, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get iterations for a result + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the test run that contains the result. + * @param {number} testCaseResultId - ID of the test result that contains the iterations. + * @param {boolean} includeActionResults - Include result details for each action performed in the test iteration. ActionResults refer to outcome (pass/fail) of test steps that are executed as part of a running a manual test. Including the ActionResults flag gets the outcome of test steps in the actionResults section and test parameters in the parameters section for each test iteration. + */ + getTestIterations(project, runId, testCaseResultId, includeActionResults) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + let queryValues = { + includeActionResults + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "73eb9074-3446-4c44-8296-2f811950ff8d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestIterationDetailsModel, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TestInterfaces.LinkedWorkItemsQuery} workItemQuery + * @param {string} project - Project ID or project name + */ + getLinkedWorkItemsByQuery(workItemQuery, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "a4dcb25b-9878-49ea-abfd-e440bd9b1dcd", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, workItemQuery, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get test run message logs + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the run to get. + */ + getTestRunLogs(project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "a1e55200-637e-42e9-a7c0-7e5bfdedb1b3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestMessageLogDetails, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a test point. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan. + * @param {number} suiteId - ID of the suite that contains the point. + * @param {number} pointIds - ID of the test point to get. + * @param {string} witFields - Comma-separated list of work item field names. + */ + getPoint(project, planId, suiteId, pointIds, witFields) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId, + pointIds + }; + let queryValues = { + witFields + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "3bcfd5c8-be62-488e-b1da-b8289ce9299c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestPoint, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of test points. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan. + * @param {number} suiteId - ID of the suite that contains the points. + * @param {string} witFields - Comma-separated list of work item field names. + * @param {string} configurationId - Get test points for specific configuration. + * @param {string} testCaseId - Get test points for a specific test case, valid when configurationId is not set. + * @param {string} testPointIds - Get test points for comma-separated list of test point IDs, valid only when configurationId and testCaseId are not set. + * @param {boolean} includePointDetails - Include all properties for the test point. + * @param {number} skip - Number of test points to skip.. + * @param {number} top - Number of test points to return. + */ + getPoints(project, planId, suiteId, witFields, configurationId, testCaseId, testPointIds, includePointDetails, skip, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId + }; + let queryValues = { + witFields, + configurationId, + testCaseId, + testPointIds, + includePointDetails, + "$skip": skip, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "3bcfd5c8-be62-488e-b1da-b8289ce9299c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestPoint, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update test points. + * + * @param {TestInterfaces.PointUpdateModel} pointUpdateModel - Data to update. + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan. + * @param {number} suiteId - ID of the suite that contains the points. + * @param {string} pointIds - ID of the test point to get. Use a comma-separated list of IDs to update multiple test points. + */ + updateTestPoints(pointUpdateModel, project, planId, suiteId, pointIds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId, + pointIds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "3bcfd5c8-be62-488e-b1da-b8289ce9299c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, pointUpdateModel, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestPoint, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get test points using query. + * + * @param {TestInterfaces.TestPointsQuery} query - TestPointsQuery to get test points. + * @param {string} project - Project ID or project name + * @param {number} skip - Number of test points to skip.. + * @param {number} top - Number of test points to return. + */ + getPointsByQuery(query, project, skip, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + "$skip": skip, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "b4264fd0-a5d1-43e2-82a5-b9c46b7da9ce", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, query, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestPointsQuery, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {string} publishContext + * @param {string} groupBy + * @param {string} filter + * @param {string} orderby + * @param {boolean} shouldIncludeResults + * @param {boolean} queryRunSummaryForInProgress + */ + getTestResultDetailsForBuild(project, buildId, publishContext, groupBy, filter2, orderby, shouldIncludeResults, queryRunSummaryForInProgress) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + publishContext, + groupBy, + "$filter": filter2, + "$orderby": orderby, + shouldIncludeResults, + queryRunSummaryForInProgress + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "efb387b0-10d5-42e7-be40-95e06ee9430f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultsDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {number} releaseEnvId + * @param {string} publishContext + * @param {string} groupBy + * @param {string} filter + * @param {string} orderby + * @param {boolean} shouldIncludeResults + * @param {boolean} queryRunSummaryForInProgress + */ + getTestResultDetailsForRelease(project, releaseId, releaseEnvId, publishContext, groupBy, filter2, orderby, shouldIncludeResults, queryRunSummaryForInProgress) { + return __awaiter2(this, void 0, void 0, function* () { + if (releaseId == null) { + throw new TypeError("releaseId can not be null or undefined"); + } + if (releaseEnvId == null) { + throw new TypeError("releaseEnvId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + releaseId, + releaseEnvId, + publishContext, + groupBy, + "$filter": filter2, + "$orderby": orderby, + shouldIncludeResults, + queryRunSummaryForInProgress + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "b834ec7e-35bb-450f-a3c8-802e70ca40dd", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultsDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TestInterfaces.TestResultDocument} document + * @param {string} project - Project ID or project name + * @param {number} runId + */ + publishTestResultDocument(document, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "370ca04b-8eec-4ca8-8ba3-d24dca228791", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, document, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {string} publishContext + * @param {string[]} fields + * @param {string} continuationToken + */ + getResultGroupsByBuild(project, buildId, publishContext, fields, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + if (publishContext == null) { + throw new TypeError("publishContext can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + publishContext, + fields: fields && fields.join(","), + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "d279d052-c55a-4204-b913-42f733b52958", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {string} publishContext + * @param {number} releaseEnvId + * @param {string[]} fields + * @param {string} continuationToken + */ + getResultGroupsByRelease(project, releaseId, publishContext, releaseEnvId, fields, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (releaseId == null) { + throw new TypeError("releaseId can not be null or undefined"); + } + if (publishContext == null) { + throw new TypeError("publishContext can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + releaseId, + publishContext, + releaseEnvId, + fields: fields && fields.join(","), + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "ef5ce5d4-a4e5-47ee-804c-354518f8d03f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get list of test Result meta data details for corresponding testcasereferenceId + * + * @param {string[]} testReferenceIds - TestCaseReference Ids of the test Result to be queried, comma separated list of valid ids (limit no. of ids 200). + * @param {string} project - Project ID or project name + */ + queryTestResultsMetaData(testReferenceIds, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "afa7830e-67a7-4336-8090-2b448ca80295", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testReferenceIds, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get test result retention settings + * + * @param {string} project - Project ID or project name + */ + getResultRetentionSettings(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "a3206d9e-fa8d-42d3-88cb-f75c51e69cde", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.ResultRetentionSettings, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update test result retention settings + * + * @param {TestInterfaces.ResultRetentionSettings} retentionSettings - Test result retention settings details to be updated + * @param {string} project - Project ID or project name + */ + updateResultRetentionSettings(retentionSettings, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "a3206d9e-fa8d-42d3-88cb-f75c51e69cde", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, retentionSettings, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.ResultRetentionSettings, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add test results to a test run. + * + * @param {TestInterfaces.TestCaseResult[]} results - List of test results to add. + * @param {string} project - Project ID or project name + * @param {number} runId - Test run ID into which test results to add. + */ + addTestResultsToTestRun(results, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.6", "Test", "4637d869-3a76-4468-8057-0bb02aa385cf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, results, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestCaseResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a test result for a test run. + * + * @param {string} project - Project ID or project name + * @param {number} runId - Test run ID of a test result to fetch. + * @param {number} testCaseResultId - Test result ID. + * @param {TestInterfaces.ResultDetails} detailsToInclude - Details to include with test results. Default is None. Other values are Iterations, WorkItems and SubResults. + */ + getTestResultById(project, runId, testCaseResultId, detailsToInclude) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + let queryValues = { + detailsToInclude + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.6", "Test", "4637d869-3a76-4468-8057-0bb02aa385cf", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestCaseResult, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get test results for a test run. + * + * @param {string} project - Project ID or project name + * @param {number} runId - Test run ID of test results to fetch. + * @param {TestInterfaces.ResultDetails} detailsToInclude - Details to include with test results. Default is None. Other values are Iterations and WorkItems. + * @param {number} skip - Number of test results to skip from beginning. + * @param {number} top - Number of test results to return. Maximum is 1000 when detailsToInclude is None and 200 otherwise. + * @param {TestInterfaces.TestOutcome[]} outcomes - Comma separated list of test outcomes to filter test results. + */ + getTestResults(project, runId, detailsToInclude, skip, top, outcomes) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + detailsToInclude, + "$skip": skip, + "$top": top, + outcomes: outcomes && outcomes.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.6", "Test", "4637d869-3a76-4468-8057-0bb02aa385cf", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestCaseResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update test results in a test run. + * + * @param {TestInterfaces.TestCaseResult[]} results - List of test results to update. + * @param {string} project - Project ID or project name + * @param {number} runId - Test run ID whose test results to update. + */ + updateTestResults(results, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.6", "Test", "4637d869-3a76-4468-8057-0bb02aa385cf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, results, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestCaseResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * This API will return results by Ids with fields specified/trend for particular automated test method. We are still improving this API and have not finalized proper signature and contract. + * + * @param {TestInterfaces.TestResultsQuery} query + * @param {string} project - Project ID or project name + */ + getTestResultsByQuery(query, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.6", "Test", "6711da49-8e6f-4d35-9f73-cef7a3c81a5b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, query, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultsQuery, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {string} publishContext + * @param {TestInterfaces.TestOutcome[]} outcomes + * @param {number} top + * @param {string} continuationToken + */ + getTestResultsByBuild(project, buildId, publishContext, outcomes, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + publishContext, + outcomes: outcomes && outcomes.join(","), + "$top": top, + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "3c191b88-615b-4be2-b7d9-5ff9141e91d4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {number} releaseEnvid + * @param {string} publishContext + * @param {TestInterfaces.TestOutcome[]} outcomes + * @param {number} top + * @param {string} continuationToken + */ + getTestResultsByRelease(project, releaseId, releaseEnvid, publishContext, outcomes, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (releaseId == null) { + throw new TypeError("releaseId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + releaseId, + releaseEnvid, + publishContext, + outcomes: outcomes && outcomes.join(","), + "$top": top, + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "ce01820b-83f3-4c15-a583-697a43292c4e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {string} publishContext + * @param {boolean} includeFailureDetails + * @param {TestInterfaces.BuildReference} buildToCompare + */ + queryTestResultsReportForBuild(project, buildId, publishContext, includeFailureDetails, buildToCompare) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + publishContext, + includeFailureDetails, + buildToCompare + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "000ef77b-fea2-498d-a10d-ad1a037f559f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultSummary, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {number} releaseEnvId + * @param {string} publishContext + * @param {boolean} includeFailureDetails + * @param {TestInterfaces.ReleaseReference} releaseToCompare + */ + queryTestResultsReportForRelease(project, releaseId, releaseEnvId, publishContext, includeFailureDetails, releaseToCompare) { + return __awaiter2(this, void 0, void 0, function* () { + if (releaseId == null) { + throw new TypeError("releaseId can not be null or undefined"); + } + if (releaseEnvId == null) { + throw new TypeError("releaseEnvId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + releaseId, + releaseEnvId, + publishContext, + includeFailureDetails, + releaseToCompare + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "85765790-ac68-494e-b268-af36c3929744", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultSummary, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TestInterfaces.ReleaseReference[]} releases + * @param {string} project - Project ID or project name + */ + queryTestResultsSummaryForReleases(releases, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "85765790-ac68-494e-b268-af36c3929744", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, releases, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestResultSummary, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TestInterfaces.TestResultsContext} resultsContext + * @param {string} project - Project ID or project name + * @param {number[]} workItemIds + */ + queryTestSummaryByRequirement(resultsContext, project, workItemIds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + workItemIds: workItemIds && workItemIds.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "cd08294e-308d-4460-a46e-4cfdefba0b4b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, resultsContext, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestSummaryForWorkItem, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TestInterfaces.TestResultTrendFilter} filter + * @param {string} project - Project ID or project name + */ + queryResultTrendForBuild(filter2, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "fbc82a85-0786-4442-88bb-eb0fda6b01b0", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, filter2, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.AggregatedDataForResultTrend, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TestInterfaces.TestResultTrendFilter} filter + * @param {string} project - Project ID or project name + */ + queryResultTrendForRelease(filter2, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "dd178e93-d8dd-4887-9635-d6b9560b7b6e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, filter2, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.AggregatedDataForResultTrend, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get test run statistics , used when we want to get summary of a run by outcome. + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the run to get. + */ + getTestRunStatistics(project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "0a42c424-d764-4a16-a2d5-5c85f87d0ae8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestRunStatistic, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create new test run. + * + * @param {TestInterfaces.RunCreateModel} testRun - Run details RunCreateModel + * @param {string} project - Project ID or project name + */ + createTestRun(testRun, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "cadb3810-d47d-4a3c-a234-fe5f3be50138", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testRun, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestRun, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a test run by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the run to delete. + */ + deleteTestRun(project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "cadb3810-d47d-4a3c-a234-fe5f3be50138", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a test run by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the run to get. + * @param {boolean} includeDetails - Default value is true. It includes details like run statistics, release, build, test environment, post process state, and more. + */ + getTestRunById(project, runId, includeDetails) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + includeDetails + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "cadb3810-d47d-4a3c-a234-fe5f3be50138", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestRun, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of test runs. + * + * @param {string} project - Project ID or project name + * @param {string} buildUri - URI of the build that the runs used. + * @param {string} owner - Team foundation ID of the owner of the runs. + * @param {string} tmiRunId + * @param {number} planId - ID of the test plan that the runs are a part of. + * @param {boolean} includeRunDetails - If true, include all the properties of the runs. + * @param {boolean} automated - If true, only returns automated runs. + * @param {number} skip - Number of test runs to skip. + * @param {number} top - Number of test runs to return. + */ + getTestRuns(project, buildUri, owner, tmiRunId, planId, includeRunDetails, automated, skip, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildUri, + owner, + tmiRunId, + planId, + includeRunDetails, + automated, + "$skip": skip, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "cadb3810-d47d-4a3c-a234-fe5f3be50138", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestRun, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Query Test Runs based on filters. Mandatory fields are minLastUpdatedDate and maxLastUpdatedDate. + * + * @param {string} project - Project ID or project name + * @param {Date} minLastUpdatedDate - Minimum Last Modified Date of run to be queried (Mandatory). + * @param {Date} maxLastUpdatedDate - Maximum Last Modified Date of run to be queried (Mandatory, difference between min and max date can be atmost 7 days). + * @param {TestInterfaces.TestRunState} state - Current state of the Runs to be queried. + * @param {number[]} planIds - Plan Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + * @param {boolean} isAutomated - Automation type of the Runs to be queried. + * @param {TestInterfaces.TestRunPublishContext} publishContext - PublishContext of the Runs to be queried. + * @param {number[]} buildIds - Build Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + * @param {number[]} buildDefIds - Build Definition Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + * @param {string} branchName - Source Branch name of the Runs to be queried. + * @param {number[]} releaseIds - Release Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + * @param {number[]} releaseDefIds - Release Definition Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + * @param {number[]} releaseEnvIds - Release Environment Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + * @param {number[]} releaseEnvDefIds - Release Environment Definition Ids of the Runs to be queried, comma separated list of valid ids (limit no. of ids 10). + * @param {string} runTitle - Run Title of the Runs to be queried. + * @param {number} top - Number of runs to be queried. Limit is 100 + * @param {string} continuationToken - continuationToken received from previous batch or null for first batch. It is not supposed to be created (or altered, if received from last batch) by user. + */ + queryTestRuns(project, minLastUpdatedDate, maxLastUpdatedDate, state, planIds, isAutomated, publishContext, buildIds, buildDefIds, branchName, releaseIds, releaseDefIds, releaseEnvIds, releaseEnvDefIds, runTitle, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (minLastUpdatedDate == null) { + throw new TypeError("minLastUpdatedDate can not be null or undefined"); + } + if (maxLastUpdatedDate == null) { + throw new TypeError("maxLastUpdatedDate can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + minLastUpdatedDate, + maxLastUpdatedDate, + state, + planIds: planIds && planIds.join(","), + isAutomated, + publishContext, + buildIds: buildIds && buildIds.join(","), + buildDefIds: buildDefIds && buildDefIds.join(","), + branchName, + releaseIds: releaseIds && releaseIds.join(","), + releaseDefIds: releaseDefIds && releaseDefIds.join(","), + releaseEnvIds: releaseEnvIds && releaseEnvIds.join(","), + releaseEnvDefIds: releaseEnvDefIds && releaseEnvDefIds.join(","), + runTitle, + "$top": top, + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "cadb3810-d47d-4a3c-a234-fe5f3be50138", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestRun, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update test run by its ID. + * + * @param {TestInterfaces.RunUpdateModel} runUpdateModel - Run details RunUpdateModel + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the run to update. + */ + updateTestRun(runUpdateModel, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "cadb3810-d47d-4a3c-a234-fe5f3be50138", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, runUpdateModel, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestRun, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a test session + * + * @param {TestInterfaces.TestSession} testSession - Test session details for creation + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + createTestSession(testSession, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "1500b4b4-6c69-4ca6-9b18-35e9e97fe2ac", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testSession, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestSession, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of test sessions + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {number} period - Period in days from now, for which test sessions are fetched. + * @param {boolean} allSessions - If false, returns test sessions for current user. Otherwise, it returns test sessions for all users + * @param {boolean} includeAllProperties - If true, it returns all properties of the test sessions. Otherwise, it returns the skinny version. + * @param {TestInterfaces.TestSessionSource} source - Source of the test session. + * @param {boolean} includeOnlyCompletedSessions - If true, it returns test sessions in completed state. Otherwise, it returns test sessions for all states + */ + getTestSessions(teamContext, period, allSessions, includeAllProperties, source, includeOnlyCompletedSessions) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + let queryValues = { + period, + allSessions, + includeAllProperties, + source, + includeOnlyCompletedSessions + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "1500b4b4-6c69-4ca6-9b18-35e9e97fe2ac", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestSession, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a test session + * + * @param {TestInterfaces.TestSession} testSession - Test session details for update + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + updateTestSession(testSession, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "1500b4b4-6c69-4ca6-9b18-35e9e97fe2ac", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, testSession, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestSession, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} sharedParameterId + */ + deleteSharedParameter(project, sharedParameterId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + sharedParameterId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "8300eeca-0f8c-4eff-a089-d2dda409c41f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} sharedStepId + */ + deleteSharedStep(project, sharedStepId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + sharedStepId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "fabb3cc9-e3f8-40b7-8b62-24cc4b73fccf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add test cases to suite. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan that contains the suite. + * @param {number} suiteId - ID of the test suite to which the test cases must be added. + * @param {string} testCaseIds - IDs of the test cases to add to the suite. Ids are specified in comma separated format. + */ + addTestCasesToSuite(project, planId, suiteId, testCaseIds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "TestCases", + project, + planId, + suiteId, + testCaseIds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "a4a1ec1c-b03f-41ca-8857-704594ecf58e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a specific test case in a test suite with test case id. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan that contains the suites. + * @param {number} suiteId - ID of the suite that contains the test case. + * @param {number} testCaseIds - ID of the test case to get. + */ + getTestCaseById(project, planId, suiteId, testCaseIds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "TestCases", + project, + planId, + suiteId, + testCaseIds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "a4a1ec1c-b03f-41ca-8857-704594ecf58e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all test cases in a suite. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan that contains the suites. + * @param {number} suiteId - ID of the suite to get. + */ + getTestCases(project, planId, suiteId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "TestCases", + project, + planId, + suiteId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "a4a1ec1c-b03f-41ca-8857-704594ecf58e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * The test points associated with the test cases are removed from the test suite. The test case work item is not deleted from the system. See test cases resource to delete a test case permanently. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan that contains the suite. + * @param {number} suiteId - ID of the suite to get. + * @param {string} testCaseIds - IDs of the test cases to remove from the suite. + */ + removeTestCasesFromSuiteUrl(project, planId, suiteId, testCaseIds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "TestCases", + project, + planId, + suiteId, + testCaseIds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "a4a1ec1c-b03f-41ca-8857-704594ecf58e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates the properties of the test case association in a suite. + * + * @param {TestInterfaces.SuiteTestCaseUpdateModel} suiteTestCaseUpdateModel - Model for updation of the properties of test case suite association. + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan that contains the suite. + * @param {number} suiteId - ID of the test suite to which the test cases must be added. + * @param {string} testCaseIds - IDs of the test cases to add to the suite. Ids are specified in comma separated format. + */ + updateSuiteTestCases(suiteTestCaseUpdateModel, project, planId, suiteId, testCaseIds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + action: "TestCases", + project, + planId, + suiteId, + testCaseIds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "Test", "a4a1ec1c-b03f-41ca-8857-704594ecf58e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, suiteTestCaseUpdateModel, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a test case. + * + * @param {string} project - Project ID or project name + * @param {number} testCaseId - Id of test case to delete. + */ + deleteTestCase(project, testCaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + testCaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "4d472e0f-e32c-4ef8-adf4-a4078772889c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get history of a test method using TestHistoryQuery + * + * @param {TestInterfaces.TestHistoryQuery} filter - TestHistoryQuery to get history + * @param {string} project - Project ID or project name + */ + queryTestHistory(filter2, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "Test", "929fd86c-3e38-4d8c-b4b6-90df256e5971", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, filter2, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.TestHistoryQuery, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TestInterfaces.TestSettings} testSettings + * @param {string} project - Project ID or project name + */ + createTestSettings(testSettings, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "8133ce14-962f-42af-a5f9-6aa9defcb9c8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testSettings, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} testSettingsId + */ + deleteTestSettings(project, testSettingsId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + testSettingsId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "8133ce14-962f-42af-a5f9-6aa9defcb9c8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} testSettingsId + */ + getTestSettingsById(project, testSettingsId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + testSettingsId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "8133ce14-962f-42af-a5f9-6aa9defcb9c8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TestInterfaces.WorkItemToTestLinks} workItemToTestLinks + * @param {string} project - Project ID or project name + */ + addWorkItemToTestLinks(workItemToTestLinks, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "371b1655-ce05-412e-a113-64cc77bb78d2", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, workItemToTestLinks, options); + let ret = this.formatResponse(res.result, TestInterfaces.TypeInfo.WorkItemToTestLinks, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} testName + * @param {number} workItemId + */ + deleteTestMethodToWorkItemLink(project, testName, workItemId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testName == null) { + throw new TypeError("testName can not be null or undefined"); + } + if (workItemId == null) { + throw new TypeError("workItemId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + testName, + workItemId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "7b0bdee3-a354-47f9-a42c-89018d7808d5", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} testName + */ + queryTestMethodLinkedWorkItems(project, testName) { + return __awaiter2(this, void 0, void 0, function* () { + if (testName == null) { + throw new TypeError("testName can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + testName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "7b0bdee3-a354-47f9-a42c-89018d7808d5", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} workItemCategory + * @param {string} automatedTestName + * @param {number} testCaseId + * @param {Date} maxCompleteDate + * @param {number} days + * @param {number} workItemCount + */ + queryTestResultWorkItems(project, workItemCategory, automatedTestName, testCaseId, maxCompleteDate, days, workItemCount) { + return __awaiter2(this, void 0, void 0, function* () { + if (workItemCategory == null) { + throw new TypeError("workItemCategory can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + workItemCategory, + automatedTestName, + testCaseId, + maxCompleteDate, + days, + "$workItemCount": workItemCount + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "Test", "926ff5dc-137f-45f0-bd51-9412fa9810ce", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.TestApi = TestApi; + TestApi.RESOURCE_AREA_ID = "c2aa639c-3ccc-4740-b3b6-ce2a1e1d984e"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/TestPlanInterfaces.js +var require_TestPlanInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/TestPlanInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.UserFriendlyTestOutcome = exports2.TestSuiteType = exports2.TestPlansLibraryWorkItemFilterMode = exports2.TestPlansLibraryQuery = exports2.TestEntityTypes = exports2.SuiteExpand = exports2.SuiteEntryTypes = exports2.ResultState = exports2.PointState = exports2.Outcome = exports2.LibraryTestCasesDataReturnCode = exports2.LastResolutionState = exports2.FailureType = exports2.ExcludeFlags = void 0; + var TFS_TestManagement_Contracts = require_TestInterfaces(); + var TfsCoreInterfaces = require_CoreInterfaces(); + var ExcludeFlags; + (function(ExcludeFlags2) { + ExcludeFlags2[ExcludeFlags2["None"] = 0] = "None"; + ExcludeFlags2[ExcludeFlags2["PointAssignments"] = 1] = "PointAssignments"; + ExcludeFlags2[ExcludeFlags2["ExtraInformation"] = 2] = "ExtraInformation"; + })(ExcludeFlags = exports2.ExcludeFlags || (exports2.ExcludeFlags = {})); + var FailureType; + (function(FailureType2) { + FailureType2[FailureType2["None"] = 0] = "None"; + FailureType2[FailureType2["Regression"] = 1] = "Regression"; + FailureType2[FailureType2["New_Issue"] = 2] = "New_Issue"; + FailureType2[FailureType2["Known_Issue"] = 3] = "Known_Issue"; + FailureType2[FailureType2["Unknown"] = 4] = "Unknown"; + FailureType2[FailureType2["Null_Value"] = 5] = "Null_Value"; + FailureType2[FailureType2["MaxValue"] = 5] = "MaxValue"; + })(FailureType = exports2.FailureType || (exports2.FailureType = {})); + var LastResolutionState; + (function(LastResolutionState2) { + LastResolutionState2[LastResolutionState2["None"] = 0] = "None"; + LastResolutionState2[LastResolutionState2["NeedsInvestigation"] = 1] = "NeedsInvestigation"; + LastResolutionState2[LastResolutionState2["TestIssue"] = 2] = "TestIssue"; + LastResolutionState2[LastResolutionState2["ProductIssue"] = 3] = "ProductIssue"; + LastResolutionState2[LastResolutionState2["ConfigurationIssue"] = 4] = "ConfigurationIssue"; + LastResolutionState2[LastResolutionState2["NullValue"] = 5] = "NullValue"; + LastResolutionState2[LastResolutionState2["MaxValue"] = 5] = "MaxValue"; + })(LastResolutionState = exports2.LastResolutionState || (exports2.LastResolutionState = {})); + var LibraryTestCasesDataReturnCode; + (function(LibraryTestCasesDataReturnCode2) { + LibraryTestCasesDataReturnCode2[LibraryTestCasesDataReturnCode2["Success"] = 0] = "Success"; + LibraryTestCasesDataReturnCode2[LibraryTestCasesDataReturnCode2["Error"] = 1] = "Error"; + })(LibraryTestCasesDataReturnCode = exports2.LibraryTestCasesDataReturnCode || (exports2.LibraryTestCasesDataReturnCode = {})); + var Outcome; + (function(Outcome2) { + Outcome2[Outcome2["Unspecified"] = 0] = "Unspecified"; + Outcome2[Outcome2["None"] = 1] = "None"; + Outcome2[Outcome2["Passed"] = 2] = "Passed"; + Outcome2[Outcome2["Failed"] = 3] = "Failed"; + Outcome2[Outcome2["Inconclusive"] = 4] = "Inconclusive"; + Outcome2[Outcome2["Timeout"] = 5] = "Timeout"; + Outcome2[Outcome2["Aborted"] = 6] = "Aborted"; + Outcome2[Outcome2["Blocked"] = 7] = "Blocked"; + Outcome2[Outcome2["NotExecuted"] = 8] = "NotExecuted"; + Outcome2[Outcome2["Warning"] = 9] = "Warning"; + Outcome2[Outcome2["Error"] = 10] = "Error"; + Outcome2[Outcome2["NotApplicable"] = 11] = "NotApplicable"; + Outcome2[Outcome2["Paused"] = 12] = "Paused"; + Outcome2[Outcome2["InProgress"] = 13] = "InProgress"; + Outcome2[Outcome2["NotImpacted"] = 14] = "NotImpacted"; + Outcome2[Outcome2["MaxValue"] = 14] = "MaxValue"; + })(Outcome = exports2.Outcome || (exports2.Outcome = {})); + var PointState; + (function(PointState2) { + PointState2[PointState2["None"] = 0] = "None"; + PointState2[PointState2["Ready"] = 1] = "Ready"; + PointState2[PointState2["Completed"] = 2] = "Completed"; + PointState2[PointState2["NotReady"] = 3] = "NotReady"; + PointState2[PointState2["InProgress"] = 4] = "InProgress"; + PointState2[PointState2["MaxValue"] = 4] = "MaxValue"; + })(PointState = exports2.PointState || (exports2.PointState = {})); + var ResultState; + (function(ResultState2) { + ResultState2[ResultState2["Unspecified"] = 0] = "Unspecified"; + ResultState2[ResultState2["Pending"] = 1] = "Pending"; + ResultState2[ResultState2["Queued"] = 2] = "Queued"; + ResultState2[ResultState2["InProgress"] = 3] = "InProgress"; + ResultState2[ResultState2["Paused"] = 4] = "Paused"; + ResultState2[ResultState2["Completed"] = 5] = "Completed"; + ResultState2[ResultState2["MaxValue"] = 5] = "MaxValue"; + })(ResultState = exports2.ResultState || (exports2.ResultState = {})); + var SuiteEntryTypes; + (function(SuiteEntryTypes2) { + SuiteEntryTypes2[SuiteEntryTypes2["TestCase"] = 0] = "TestCase"; + SuiteEntryTypes2[SuiteEntryTypes2["Suite"] = 1] = "Suite"; + })(SuiteEntryTypes = exports2.SuiteEntryTypes || (exports2.SuiteEntryTypes = {})); + var SuiteExpand; + (function(SuiteExpand2) { + SuiteExpand2[SuiteExpand2["None"] = 0] = "None"; + SuiteExpand2[SuiteExpand2["Children"] = 1] = "Children"; + SuiteExpand2[SuiteExpand2["DefaultTesters"] = 2] = "DefaultTesters"; + })(SuiteExpand = exports2.SuiteExpand || (exports2.SuiteExpand = {})); + var TestEntityTypes; + (function(TestEntityTypes2) { + TestEntityTypes2[TestEntityTypes2["TestCase"] = 0] = "TestCase"; + TestEntityTypes2[TestEntityTypes2["TestPoint"] = 1] = "TestPoint"; + })(TestEntityTypes = exports2.TestEntityTypes || (exports2.TestEntityTypes = {})); + var TestPlansLibraryQuery; + (function(TestPlansLibraryQuery2) { + TestPlansLibraryQuery2[TestPlansLibraryQuery2["None"] = 0] = "None"; + TestPlansLibraryQuery2[TestPlansLibraryQuery2["AllTestCases"] = 1] = "AllTestCases"; + TestPlansLibraryQuery2[TestPlansLibraryQuery2["TestCasesWithActiveBugs"] = 2] = "TestCasesWithActiveBugs"; + TestPlansLibraryQuery2[TestPlansLibraryQuery2["TestCasesNotLinkedToRequirements"] = 3] = "TestCasesNotLinkedToRequirements"; + TestPlansLibraryQuery2[TestPlansLibraryQuery2["TestCasesLinkedToRequirements"] = 4] = "TestCasesLinkedToRequirements"; + TestPlansLibraryQuery2[TestPlansLibraryQuery2["AllSharedSteps"] = 11] = "AllSharedSteps"; + TestPlansLibraryQuery2[TestPlansLibraryQuery2["SharedStepsNotLinkedToRequirement"] = 12] = "SharedStepsNotLinkedToRequirement"; + })(TestPlansLibraryQuery = exports2.TestPlansLibraryQuery || (exports2.TestPlansLibraryQuery = {})); + var TestPlansLibraryWorkItemFilterMode; + (function(TestPlansLibraryWorkItemFilterMode2) { + TestPlansLibraryWorkItemFilterMode2[TestPlansLibraryWorkItemFilterMode2["Or"] = 0] = "Or"; + TestPlansLibraryWorkItemFilterMode2[TestPlansLibraryWorkItemFilterMode2["And"] = 1] = "And"; + })(TestPlansLibraryWorkItemFilterMode = exports2.TestPlansLibraryWorkItemFilterMode || (exports2.TestPlansLibraryWorkItemFilterMode = {})); + var TestSuiteType; + (function(TestSuiteType2) { + TestSuiteType2[TestSuiteType2["None"] = 0] = "None"; + TestSuiteType2[TestSuiteType2["DynamicTestSuite"] = 1] = "DynamicTestSuite"; + TestSuiteType2[TestSuiteType2["StaticTestSuite"] = 2] = "StaticTestSuite"; + TestSuiteType2[TestSuiteType2["RequirementTestSuite"] = 3] = "RequirementTestSuite"; + })(TestSuiteType = exports2.TestSuiteType || (exports2.TestSuiteType = {})); + var UserFriendlyTestOutcome; + (function(UserFriendlyTestOutcome2) { + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["InProgress"] = 0] = "InProgress"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["Blocked"] = 1] = "Blocked"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["Failed"] = 2] = "Failed"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["Passed"] = 3] = "Passed"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["Ready"] = 4] = "Ready"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["NotApplicable"] = 5] = "NotApplicable"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["Paused"] = 6] = "Paused"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["Timeout"] = 7] = "Timeout"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["Warning"] = 8] = "Warning"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["Error"] = 9] = "Error"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["NotExecuted"] = 10] = "NotExecuted"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["Inconclusive"] = 11] = "Inconclusive"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["Aborted"] = 12] = "Aborted"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["None"] = 13] = "None"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["NotImpacted"] = 14] = "NotImpacted"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["Unspecified"] = 15] = "Unspecified"; + UserFriendlyTestOutcome2[UserFriendlyTestOutcome2["MaxValue"] = 15] = "MaxValue"; + })(UserFriendlyTestOutcome = exports2.UserFriendlyTestOutcome || (exports2.UserFriendlyTestOutcome = {})); + exports2.TypeInfo = { + CloneOperationCommonResponse: {}, + CloneTestCaseOperationInformation: {}, + CloneTestPlanOperationInformation: {}, + CloneTestPlanParams: {}, + CloneTestSuiteOperationInformation: {}, + DestinationTestPlanCloneParams: {}, + ExcludeFlags: { + enumValues: { + "none": 0, + "pointAssignments": 1, + "extraInformation": 2 + } + }, + FailureType: { + enumValues: { + "none": 0, + "regression": 1, + "new_Issue": 2, + "known_Issue": 3, + "unknown": 4, + "null_Value": 5, + "maxValue": 5 + } + }, + LastResolutionState: { + enumValues: { + "none": 0, + "needsInvestigation": 1, + "testIssue": 2, + "productIssue": 3, + "configurationIssue": 4, + "nullValue": 5, + "maxValue": 5 + } + }, + LibraryTestCasesDataReturnCode: { + enumValues: { + "success": 0, + "error": 1 + } + }, + LibraryWorkItemsData: {}, + LibraryWorkItemsDataProviderRequest: {}, + Outcome: { + enumValues: { + "unspecified": 0, + "none": 1, + "passed": 2, + "failed": 3, + "inconclusive": 4, + "timeout": 5, + "aborted": 6, + "blocked": 7, + "notExecuted": 8, + "warning": 9, + "error": 10, + "notApplicable": 11, + "paused": 12, + "inProgress": 13, + "notImpacted": 14, + "maxValue": 14 + } + }, + PointState: { + enumValues: { + "none": 0, + "ready": 1, + "completed": 2, + "notReady": 3, + "inProgress": 4, + "maxValue": 4 + } + }, + Results: {}, + ResultState: { + enumValues: { + "unspecified": 0, + "pending": 1, + "queued": 2, + "inProgress": 3, + "paused": 4, + "completed": 5, + "maxValue": 5 + } + }, + SourceTestplanResponse: {}, + SourceTestSuiteResponse: {}, + SuiteEntry: {}, + SuiteEntryTypes: { + enumValues: { + "testCase": 0, + "suite": 1 + } + }, + SuiteEntryUpdateParams: {}, + SuiteExpand: { + enumValues: { + "none": 0, + "children": 1, + "defaultTesters": 2 + } + }, + TestCase: {}, + TestCaseAssociatedResult: {}, + TestCaseResultsData: {}, + TestConfiguration: {}, + TestConfigurationCreateUpdateParameters: {}, + TestEntityTypes: { + enumValues: { + "testCase": 0, + "testPoint": 1 + } + }, + TestPlan: {}, + TestPlanCreateParams: {}, + TestPlanDetailedReference: {}, + TestPlansHubRefreshData: {}, + TestPlansLibraryQuery: { + enumValues: { + "none": 0, + "allTestCases": 1, + "testCasesWithActiveBugs": 2, + "testCasesNotLinkedToRequirements": 3, + "testCasesLinkedToRequirements": 4, + "allSharedSteps": 11, + "sharedStepsNotLinkedToRequirement": 12 + } + }, + TestPlansLibraryWorkItemFilter: {}, + TestPlansLibraryWorkItemFilterMode: { + enumValues: { + "or": 0, + "and": 1 + } + }, + TestPlanUpdateParams: {}, + TestPoint: {}, + TestPointResults: {}, + TestPointUpdateParams: {}, + TestSuite: {}, + TestSuiteCreateParams: {}, + TestSuiteReferenceWithProject: {}, + TestSuiteType: { + enumValues: { + "none": 0, + "dynamicTestSuite": 1, + "staticTestSuite": 2, + "requirementTestSuite": 3 + } + }, + TestVariable: {}, + UserFriendlyTestOutcome: { + enumValues: { + "inProgress": 0, + "blocked": 1, + "failed": 2, + "passed": 3, + "ready": 4, + "notApplicable": 5, + "paused": 6, + "timeout": 7, + "warning": 8, + "error": 9, + "notExecuted": 10, + "inconclusive": 11, + "aborted": 12, + "none": 13, + "notImpacted": 14, + "unspecified": 15, + "maxValue": 15 + } + } + }; + exports2.TypeInfo.CloneOperationCommonResponse.fields = { + completionDate: { + isDate: true + }, + creationDate: { + isDate: true + }, + state: { + enumType: TFS_TestManagement_Contracts.TypeInfo.CloneOperationState + } + }; + exports2.TypeInfo.CloneTestCaseOperationInformation.fields = { + cloneOperationResponse: { + typeInfo: exports2.TypeInfo.CloneOperationCommonResponse + }, + destinationTestSuite: { + typeInfo: exports2.TypeInfo.TestSuiteReferenceWithProject + }, + sourceTestSuite: { + typeInfo: exports2.TypeInfo.SourceTestSuiteResponse + } + }; + exports2.TypeInfo.CloneTestPlanOperationInformation.fields = { + cloneOperationResponse: { + typeInfo: exports2.TypeInfo.CloneOperationCommonResponse + }, + destinationTestPlan: { + typeInfo: exports2.TypeInfo.TestPlan + }, + sourceTestPlan: { + typeInfo: exports2.TypeInfo.SourceTestplanResponse + } + }; + exports2.TypeInfo.CloneTestPlanParams.fields = { + destinationTestPlan: { + typeInfo: exports2.TypeInfo.DestinationTestPlanCloneParams + } + }; + exports2.TypeInfo.CloneTestSuiteOperationInformation.fields = { + clonedTestSuite: { + typeInfo: exports2.TypeInfo.TestSuiteReferenceWithProject + }, + cloneOperationResponse: { + typeInfo: exports2.TypeInfo.CloneOperationCommonResponse + }, + destinationTestSuite: { + typeInfo: exports2.TypeInfo.TestSuiteReferenceWithProject + }, + sourceTestSuite: { + typeInfo: exports2.TypeInfo.TestSuiteReferenceWithProject + } + }; + exports2.TypeInfo.DestinationTestPlanCloneParams.fields = { + endDate: { + isDate: true + }, + startDate: { + isDate: true + } + }; + exports2.TypeInfo.LibraryWorkItemsData.fields = { + returnCode: { + enumType: exports2.TypeInfo.LibraryTestCasesDataReturnCode + } + }; + exports2.TypeInfo.LibraryWorkItemsDataProviderRequest.fields = { + filterValues: { + isArray: true, + typeInfo: exports2.TypeInfo.TestPlansLibraryWorkItemFilter + }, + libraryQueryType: { + enumType: exports2.TypeInfo.TestPlansLibraryQuery + } + }; + exports2.TypeInfo.Results.fields = { + outcome: { + enumType: exports2.TypeInfo.Outcome + } + }; + exports2.TypeInfo.SourceTestplanResponse.fields = { + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.SourceTestSuiteResponse.fields = { + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.SuiteEntry.fields = { + suiteEntryType: { + enumType: exports2.TypeInfo.SuiteEntryTypes + } + }; + exports2.TypeInfo.SuiteEntryUpdateParams.fields = { + suiteEntryType: { + enumType: exports2.TypeInfo.SuiteEntryTypes + } + }; + exports2.TypeInfo.TestCase.fields = { + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.TestCaseAssociatedResult.fields = { + completedDate: { + isDate: true + }, + outcome: { + enumType: exports2.TypeInfo.UserFriendlyTestOutcome + } + }; + exports2.TypeInfo.TestCaseResultsData.fields = { + results: { + isArray: true, + typeInfo: exports2.TypeInfo.TestCaseAssociatedResult + } + }; + exports2.TypeInfo.TestConfiguration.fields = { + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + }, + state: { + enumType: TFS_TestManagement_Contracts.TypeInfo.TestConfigurationState + } + }; + exports2.TypeInfo.TestConfigurationCreateUpdateParameters.fields = { + state: { + enumType: TFS_TestManagement_Contracts.TypeInfo.TestConfigurationState + } + }; + exports2.TypeInfo.TestPlan.fields = { + endDate: { + isDate: true + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + }, + startDate: { + isDate: true + }, + updatedDate: { + isDate: true + } + }; + exports2.TypeInfo.TestPlanCreateParams.fields = { + endDate: { + isDate: true + }, + startDate: { + isDate: true + } + }; + exports2.TypeInfo.TestPlanDetailedReference.fields = { + endDate: { + isDate: true + }, + startDate: { + isDate: true + } + }; + exports2.TypeInfo.TestPlansHubRefreshData.fields = { + testCases: { + isArray: true, + typeInfo: exports2.TypeInfo.TestCase + }, + testPlan: { + typeInfo: exports2.TypeInfo.TestPlanDetailedReference + }, + testPoints: { + isArray: true, + typeInfo: exports2.TypeInfo.TestPoint + }, + testSuites: { + isArray: true, + typeInfo: exports2.TypeInfo.TestSuite + } + }; + exports2.TypeInfo.TestPlansLibraryWorkItemFilter.fields = { + filterMode: { + enumType: exports2.TypeInfo.TestPlansLibraryWorkItemFilterMode + } + }; + exports2.TypeInfo.TestPlanUpdateParams.fields = { + endDate: { + isDate: true + }, + startDate: { + isDate: true + } + }; + exports2.TypeInfo.TestPoint.fields = { + lastResetToActive: { + isDate: true + }, + lastUpdatedDate: { + isDate: true + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + }, + results: { + typeInfo: exports2.TypeInfo.TestPointResults + } + }; + exports2.TypeInfo.TestPointResults.fields = { + failureType: { + enumType: exports2.TypeInfo.FailureType + }, + lastResolutionState: { + enumType: exports2.TypeInfo.LastResolutionState + }, + lastResultDetails: { + typeInfo: TFS_TestManagement_Contracts.TypeInfo.LastResultDetails + }, + lastResultState: { + enumType: exports2.TypeInfo.ResultState + }, + outcome: { + enumType: exports2.TypeInfo.Outcome + }, + state: { + enumType: exports2.TypeInfo.PointState + } + }; + exports2.TypeInfo.TestPointUpdateParams.fields = { + results: { + typeInfo: exports2.TypeInfo.Results + } + }; + exports2.TypeInfo.TestSuite.fields = { + children: { + isArray: true, + typeInfo: exports2.TypeInfo.TestSuite + }, + lastPopulatedDate: { + isDate: true + }, + lastUpdatedDate: { + isDate: true + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + }, + suiteType: { + enumType: exports2.TypeInfo.TestSuiteType + } + }; + exports2.TypeInfo.TestSuiteCreateParams.fields = { + suiteType: { + enumType: exports2.TypeInfo.TestSuiteType + } + }; + exports2.TypeInfo.TestSuiteReferenceWithProject.fields = { + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.TestVariable.fields = { + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/TestPlanApi.js +var require_TestPlanApi = __commonJS({ + "../node_modules/azure-devops-node-api/TestPlanApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TestPlanApi = void 0; + var basem = require_ClientApiBases(); + var TestPlanInterfaces = require_TestPlanInterfaces(); + var TestPlanApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-TestPlan-api", options); + } + /** + * Create a test configuration. + * + * @param {TestPlanInterfaces.TestConfigurationCreateUpdateParameters} testConfigurationCreateUpdateParameters - TestConfigurationCreateUpdateParameters + * @param {string} project - Project ID or project name + */ + createTestConfiguration(testConfigurationCreateUpdateParameters, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "8369318e-38fa-4e84-9043-4b2a75d2c256", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testConfigurationCreateUpdateParameters, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestConfiguration, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a test configuration by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} testConfiguartionId - ID of the test configuration to delete. + */ + deleteTestConfguration(project, testConfiguartionId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testConfiguartionId == null) { + throw new TypeError("testConfiguartionId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + testConfiguartionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "8369318e-38fa-4e84-9043-4b2a75d2c256", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a test configuration + * + * @param {string} project - Project ID or project name + * @param {number} testConfigurationId - ID of the test configuration to get. + */ + getTestConfigurationById(project, testConfigurationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + testConfigurationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "8369318e-38fa-4e84-9043-4b2a75d2c256", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestConfiguration, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of test configurations. + * + * @param {string} project - Project ID or project name + * @param {string} continuationToken - If the list of configurations returned is not complete, a continuation token to query next batch of configurations is included in the response header as "x-ms-continuationtoken". Omit this parameter to get the first batch of test configurations. + */ + getTestConfigurations(project, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "8369318e-38fa-4e84-9043-4b2a75d2c256", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestConfiguration, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a test configuration by its ID. + * + * @param {TestPlanInterfaces.TestConfigurationCreateUpdateParameters} testConfigurationCreateUpdateParameters - TestConfigurationCreateUpdateParameters + * @param {string} project - Project ID or project name + * @param {number} testConfiguartionId - ID of the test configuration to update. + */ + updateTestConfiguration(testConfigurationCreateUpdateParameters, project, testConfiguartionId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testConfiguartionId == null) { + throw new TypeError("testConfiguartionId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + testConfiguartionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "8369318e-38fa-4e84-9043-4b2a75d2c256", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, testConfigurationCreateUpdateParameters, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestConfiguration, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} planId + * @param {string} states + * @param {TestPlanInterfaces.UserFriendlyTestOutcome} outcome + * @param {string} configurations + * @param {string} testers + * @param {string} assignedTo + * @param {TestPlanInterfaces.TestEntityTypes} entity + */ + getTestEntityCountByPlanId(project, planId, states, outcome, configurations, testers, assignedTo, entity) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId + }; + let queryValues = { + states, + outcome, + configurations, + testers, + assignedTo, + entity + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "300578da-7b40-4c1e-9542-7aed6029e504", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a test plan. + * + * @param {TestPlanInterfaces.TestPlanCreateParams} testPlanCreateParams - A testPlanCreateParams object.TestPlanCreateParams + * @param {string} project - Project ID or project name + */ + createTestPlan(testPlanCreateParams, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "0e292477-a0c2-47f3-a9b6-34f153d627f4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testPlanCreateParams, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPlan, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a test plan. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan to be deleted. + */ + deleteTestPlan(project, planId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "0e292477-a0c2-47f3-a9b6-34f153d627f4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a test plan by Id. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan to get. + */ + getTestPlanById(project, planId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "0e292477-a0c2-47f3-a9b6-34f153d627f4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPlan, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of test plans + * + * @param {string} project - Project ID or project name + * @param {string} owner - Filter for test plan by owner ID or name + * @param {string} continuationToken - If the list of plans returned is not complete, a continuation token to query next batch of plans is included in the response header as "x-ms-continuationtoken". Omit this parameter to get the first batch of test plans. + * @param {boolean} includePlanDetails - Get all properties of the test plan + * @param {boolean} filterActivePlans - Get just the active plans + */ + getTestPlans(project, owner, continuationToken, includePlanDetails, filterActivePlans) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + owner, + continuationToken, + includePlanDetails, + filterActivePlans + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "0e292477-a0c2-47f3-a9b6-34f153d627f4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPlan, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a test plan. + * + * @param {TestPlanInterfaces.TestPlanUpdateParams} testPlanUpdateParams - A testPlanUpdateParams object.TestPlanUpdateParams + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan to be updated. + */ + updateTestPlan(testPlanUpdateParams, project, planId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "0e292477-a0c2-47f3-a9b6-34f153d627f4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, testPlanUpdateParams, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPlan, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of test suite entries in the test suite. + * + * @param {string} project - Project ID or project name + * @param {number} suiteId - Id of the parent suite. + * @param {TestPlanInterfaces.SuiteEntryTypes} suiteEntryType + */ + getSuiteEntries(project, suiteId, suiteEntryType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + suiteId + }; + let queryValues = { + suiteEntryType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "d6733edf-72f1-4252-925b-c560dfe9b75a", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.SuiteEntry, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Reorder test suite entries in the test suite. + * + * @param {TestPlanInterfaces.SuiteEntryUpdateParams[]} suiteEntries - List of SuiteEntry to reorder. + * @param {string} project - Project ID or project name + * @param {number} suiteId - Id of the parent test suite. + */ + reorderSuiteEntries(suiteEntries, project, suiteId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + suiteId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "d6733edf-72f1-4252-925b-c560dfe9b75a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, suiteEntries, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.SuiteEntry, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create bulk requirement based test suites. + * + * @param {TestPlanInterfaces.TestSuiteCreateParams[]} testSuiteCreateParams - Parameters for suite creation + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan where requirement based suites need to be created. + * @param {number} parentSuiteId - ID of the parent suite under which requirement based suites will be created + */ + createBulkTestSuites(testSuiteCreateParams, project, planId, parentSuiteId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + parentSuiteId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "1e58fbe6-1761-43ce-97f6-5492ec9d438e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testSuiteCreateParams, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestSuite, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create test suite. + * + * @param {TestPlanInterfaces.TestSuiteCreateParams} testSuiteCreateParams - Parameters for suite creation + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan that contains the suites. + */ + createTestSuite(testSuiteCreateParams, project, planId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "1046d5d3-ab61-4ca7-a65a-36118a978256", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testSuiteCreateParams, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestSuite, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete test suite. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan that contains the suite. + * @param {number} suiteId - ID of the test suite to delete. + */ + deleteTestSuite(project, planId, suiteId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "1046d5d3-ab61-4ca7-a65a-36118a978256", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get test suite by suite id. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan that contains the suites. + * @param {number} suiteId - ID of the suite to get. + * @param {TestPlanInterfaces.SuiteExpand} expand - Include the children suites and testers details + */ + getTestSuiteById(project, planId, suiteId, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId + }; + let queryValues = { + expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "1046d5d3-ab61-4ca7-a65a-36118a978256", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestSuite, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get test suites for plan. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan for which suites are requested. + * @param {TestPlanInterfaces.SuiteExpand} expand - Include the children suites and testers details. + * @param {string} continuationToken - If the list of suites returned is not complete, a continuation token to query next batch of suites is included in the response header as "x-ms-continuationtoken". Omit this parameter to get the first batch of test suites. + * @param {boolean} asTreeView - If the suites returned should be in a tree structure. + */ + getTestSuitesForPlan(project, planId, expand, continuationToken, asTreeView) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId + }; + let queryValues = { + expand, + continuationToken, + asTreeView + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "1046d5d3-ab61-4ca7-a65a-36118a978256", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestSuite, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update test suite. + * + * @param {TestPlanInterfaces.TestSuiteUpdateParams} testSuiteUpdateParams - Parameters for suite updation + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan that contains the suites. + * @param {number} suiteId - ID of the parent suite. + */ + updateTestSuite(testSuiteUpdateParams, project, planId, suiteId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "1046d5d3-ab61-4ca7-a65a-36118a978256", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, testSuiteUpdateParams, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestSuite, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Find the list of all test suites in which a given test case is present. This is helpful if you need to find out which test suites are using a test case, when you need to make changes to a test case. + * + * @param {number} testCaseId - ID of the test case for which suites need to be fetched. + */ + getSuitesByTestCaseId(testCaseId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testCaseId == null) { + throw new TypeError("testCaseId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + testCaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "a4080e84-f17b-4fad-84f1-7960b6525bf2", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestSuite, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add test cases to a suite with specified configurations + * + * @param {TestPlanInterfaces.SuiteTestCaseCreateUpdateParameters[]} suiteTestCaseCreateUpdateParameters - SuiteTestCaseCreateUpdateParameters object. + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan to which test cases are to be added. + * @param {number} suiteId - ID of the test suite to which test cases are to be added. + */ + addTestCasesToSuite(suiteTestCaseCreateUpdateParameters, project, planId, suiteId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testplan", "a9bd61ac-45cf-4d13-9441-43dcd01edf8d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, suiteTestCaseCreateUpdateParameters, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestCase, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a particular Test Case from a Suite. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan for which test cases are requested. + * @param {number} suiteId - ID of the test suite for which test cases are requested. + * @param {string} testCaseId - Test Case Id to be fetched. + * @param {string} witFields - Get the list of witFields. + * @param {boolean} returnIdentityRef - If set to true, returns all identity fields, like AssignedTo, ActivatedBy etc., as IdentityRef objects. If set to false, these fields are returned as unique names in string format. This is false by default. + */ + getTestCase(project, planId, suiteId, testCaseId, witFields, returnIdentityRef) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId, + testCaseId + }; + let queryValues = { + witFields, + returnIdentityRef + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testplan", "a9bd61ac-45cf-4d13-9441-43dcd01edf8d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestCase, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get Test Case List return those test cases which have all the configuration Ids as mentioned in the optional parameter. If configuration Ids is null, it return all the test cases + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan for which test cases are requested. + * @param {number} suiteId - ID of the test suite for which test cases are requested. + * @param {string} testIds - Test Case Ids to be fetched. + * @param {string} configurationIds - Fetch Test Cases which contains all the configuration Ids specified. + * @param {string} witFields - Get the list of witFields. + * @param {string} continuationToken - If the list of test cases returned is not complete, a continuation token to query next batch of test cases is included in the response header as "x-ms-continuationtoken". Omit this parameter to get the first batch of test cases. + * @param {boolean} returnIdentityRef - If set to true, returns all identity fields, like AssignedTo, ActivatedBy etc., as IdentityRef objects. If set to false, these fields are returned as unique names in string format. This is false by default. + * @param {boolean} expand - If set to false, will get a smaller payload containing only basic details about the suite test case object + * @param {TestPlanInterfaces.ExcludeFlags} excludeFlags - Flag to exclude various values from payload. For example to remove point assignments pass exclude = 1. To remove extra information (links, test plan , test suite) pass exclude = 2. To remove both extra information and point assignments pass exclude = 3 (1 + 2). + * @param {boolean} isRecursive + */ + getTestCaseList(project, planId, suiteId, testIds, configurationIds, witFields, continuationToken, returnIdentityRef, expand, excludeFlags, isRecursive) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId + }; + let queryValues = { + testIds, + configurationIds, + witFields, + continuationToken, + returnIdentityRef, + expand, + excludeFlags, + isRecursive + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testplan", "a9bd61ac-45cf-4d13-9441-43dcd01edf8d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestCase, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes test cases from a suite based on the list of test case Ids provided. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan from which test cases are to be removed. + * @param {number} suiteId - ID of the test suite from which test cases are to be removed. + * @param {string} testCaseIds - Test Case Ids to be removed. + */ + removeTestCasesFromSuite(project, planId, suiteId, testCaseIds) { + return __awaiter2(this, void 0, void 0, function* () { + if (testCaseIds == null) { + throw new TypeError("testCaseIds can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId + }; + let queryValues = { + testCaseIds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testplan", "a9bd61ac-45cf-4d13-9441-43dcd01edf8d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes test cases from a suite based on the list of test case Ids provided. This API can be used to remove a larger number of test cases. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan from which test cases are to be removed. + * @param {number} suiteId - ID of the test suite from which test cases are to be removed. + * @param {string} testIds - Comma separated string of Test Case Ids to be removed. + */ + removeTestCasesListFromSuite(project, planId, suiteId, testIds) { + return __awaiter2(this, void 0, void 0, function* () { + if (testIds == null) { + throw new TypeError("testIds can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId + }; + let queryValues = { + testIds + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testplan", "a9bd61ac-45cf-4d13-9441-43dcd01edf8d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update the configurations for test cases + * + * @param {TestPlanInterfaces.SuiteTestCaseCreateUpdateParameters[]} suiteTestCaseCreateUpdateParameters - A SuiteTestCaseCreateUpdateParameters object. + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan to which test cases are to be updated. + * @param {number} suiteId - ID of the test suite to which test cases are to be updated. + */ + updateSuiteTestCases(suiteTestCaseCreateUpdateParameters, project, planId, suiteId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testplan", "a9bd61ac-45cf-4d13-9441-43dcd01edf8d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, suiteTestCaseCreateUpdateParameters, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestCase, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TestPlanInterfaces.CloneTestCaseParams} cloneRequestBody + * @param {string} project - Project ID or project name + */ + cloneTestCase(cloneRequestBody, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "529b2b8d-82f4-4893-b1e4-1e74ea534673", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, cloneRequestBody, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.CloneTestCaseOperationInformation, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get clone information. + * + * @param {string} project - Project ID or project name + * @param {number} cloneOperationId - Operation ID returned when we queue a clone operation + */ + getTestCaseCloneInformation(project, cloneOperationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + cloneOperationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "529b2b8d-82f4-4893-b1e4-1e74ea534673", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.CloneTestCaseOperationInformation, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Exports a set of test cases from a suite to a file. Currently supported formats: xlsx + * + * @param {TestPlanInterfaces.ExportTestCaseParams} exportTestCaseRequestBody - A ExportTestCaseParams object.ExportTestCaseParams + * @param {string} project - Project ID or project name + */ + exportTestCases(exportTestCaseRequestBody, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "3b9d1c87-6b1a-4e7d-9e7d-1a8e543112bb", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a test case. + * + * @param {string} project - Project ID or project name + * @param {number} testCaseId - Id of test case to be deleted. + */ + deleteTestCase(project, testCaseId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + testCaseId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "29006fb5-816b-4ff7-a329-599943569229", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Clone test plan + * + * @param {TestPlanInterfaces.CloneTestPlanParams} cloneRequestBody - Plan Clone Request Body detail TestPlanCloneRequest + * @param {string} project - Project ID or project name + * @param {boolean} deepClone - Clones all the associated test cases as well + */ + cloneTestPlan(cloneRequestBody, project, deepClone) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + deepClone + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "e65df662-d8a3-46c7-ae1c-14e2d4df57e1", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, cloneRequestBody, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.CloneTestPlanOperationInformation, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get clone information. + * + * @param {string} project - Project ID or project name + * @param {number} cloneOperationId - Operation ID returned when we queue a clone operation + */ + getCloneInformation(project, cloneOperationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + cloneOperationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "e65df662-d8a3-46c7-ae1c-14e2d4df57e1", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.CloneTestPlanOperationInformation, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a particular Test Point from a suite. + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan for which test points are requested. + * @param {number} suiteId - ID of the test suite for which test points are requested. + * @param {string} pointId - ID of test point to be fetched. + * @param {boolean} returnIdentityRef - If set to true, returns the AssignedTo field in TestCaseReference as IdentityRef object. + * @param {boolean} includePointDetails - If set to false, will get a smaller payload containing only basic details about the test point object + */ + getPoints(project, planId, suiteId, pointId, returnIdentityRef, includePointDetails) { + return __awaiter2(this, void 0, void 0, function* () { + if (pointId == null) { + throw new TypeError("pointId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId + }; + let queryValues = { + pointId, + returnIdentityRef, + includePointDetails + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "52df686e-bae4-4334-b0ee-b6cf4e6f6b73", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPoint, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all the points inside a suite based on some filters + * + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan for which test points are requested. + * @param {number} suiteId - ID of the test suite for which test points are requested + * @param {string} testPointIds - ID of test points to fetch. + * @param {string} testCaseId - Get Test Points for specific test case Ids. + * @param {string} continuationToken - If the list of test point returned is not complete, a continuation token to query next batch of test points is included in the response header as "x-ms-continuationtoken". Omit this parameter to get the first batch of test points. + * @param {boolean} returnIdentityRef - If set to true, returns the AssignedTo field in TestCaseReference as IdentityRef object. + * @param {boolean} includePointDetails - If set to false, will get a smaller payload containing only basic details about the test point object + * @param {boolean} isRecursive - If set to true, will also fetch test points belonging to child suites recursively. + */ + getPointsList(project, planId, suiteId, testPointIds, testCaseId, continuationToken, returnIdentityRef, includePointDetails, isRecursive) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId + }; + let queryValues = { + testPointIds, + testCaseId, + continuationToken, + returnIdentityRef, + includePointDetails, + isRecursive + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "52df686e-bae4-4334-b0ee-b6cf4e6f6b73", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPoint, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update Test Points. This is used to Reset test point to active, update the outcome of a test point or update the tester of a test point + * + * @param {TestPlanInterfaces.TestPointUpdateParams[]} testPointUpdateParams - A TestPointUpdateParams Object. + * @param {string} project - Project ID or project name + * @param {number} planId - ID of the test plan for which test points are requested. + * @param {number} suiteId - ID of the test suite for which test points are requested. + * @param {boolean} includePointDetails - If set to false, will get a smaller payload containing only basic details about the test point object + * @param {boolean} returnIdentityRef - If set to true, returns the AssignedTo field in TestCaseReference as IdentityRef object. + */ + updateTestPoints(testPointUpdateParams, project, planId, suiteId, includePointDetails, returnIdentityRef) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + planId, + suiteId + }; + let queryValues = { + includePointDetails, + returnIdentityRef + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "52df686e-bae4-4334-b0ee-b6cf4e6f6b73", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, testPointUpdateParams, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestPoint, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Clone test suite + * + * @param {TestPlanInterfaces.CloneTestSuiteParams} cloneRequestBody - Suite Clone Request Body detail TestSuiteCloneRequest + * @param {string} project - Project ID or project name + * @param {boolean} deepClone - Clones all the associated test cases as well + */ + cloneTestSuite(cloneRequestBody, project, deepClone) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + deepClone + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "181d4c97-0e98-4ee2-ad6a-4cada675e555", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, cloneRequestBody, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.CloneTestSuiteOperationInformation, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get clone information. + * + * @param {string} project - Project ID or project name + * @param {number} cloneOperationId - Operation ID returned when we queue a clone operation + */ + getSuiteCloneInformation(project, cloneOperationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + cloneOperationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testplan", "181d4c97-0e98-4ee2-ad6a-4cada675e555", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.CloneTestSuiteOperationInformation, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a test variable. + * + * @param {TestPlanInterfaces.TestVariableCreateUpdateParameters} testVariableCreateUpdateParameters - TestVariableCreateUpdateParameters + * @param {string} project - Project ID or project name + */ + createTestVariable(testVariableCreateUpdateParameters, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "2c61fac6-ac4e-45a5-8c38-1c2b8fd8ea6c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testVariableCreateUpdateParameters, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestVariable, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a test variable by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} testVariableId - ID of the test variable to delete. + */ + deleteTestVariable(project, testVariableId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + testVariableId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "2c61fac6-ac4e-45a5-8c38-1c2b8fd8ea6c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a test variable by its ID. + * + * @param {string} project - Project ID or project name + * @param {number} testVariableId - ID of the test variable to get. + */ + getTestVariableById(project, testVariableId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + testVariableId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "2c61fac6-ac4e-45a5-8c38-1c2b8fd8ea6c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestVariable, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of test variables. + * + * @param {string} project - Project ID or project name + * @param {string} continuationToken - If the list of variables returned is not complete, a continuation token to query next batch of variables is included in the response header as "x-ms-continuationtoken". Omit this parameter to get the first batch of test variables. + */ + getTestVariables(project, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "2c61fac6-ac4e-45a5-8c38-1c2b8fd8ea6c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestVariable, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a test variable by its ID. + * + * @param {TestPlanInterfaces.TestVariableCreateUpdateParameters} testVariableCreateUpdateParameters - TestVariableCreateUpdateParameters + * @param {string} project - Project ID or project name + * @param {number} testVariableId - ID of the test variable to update. + */ + updateTestVariable(testVariableCreateUpdateParameters, project, testVariableId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + testVariableId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testplan", "2c61fac6-ac4e-45a5-8c38-1c2b8fd8ea6c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, testVariableCreateUpdateParameters, options); + let ret = this.formatResponse(res.result, TestPlanInterfaces.TypeInfo.TestVariable, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.TestPlanApi = TestPlanApi; + } +}); + +// ../node_modules/azure-devops-node-api/TestResultsApi.js +var require_TestResultsApi = __commonJS({ + "../node_modules/azure-devops-node-api/TestResultsApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TestResultsApi = void 0; + var basem = require_ClientApiBases(); + var Contracts = require_TestInterfaces(); + var TestResultsApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-testResults-api", options); + } + /** + * @param {Contracts.TestAttachmentRequestModel} attachmentRequestModel + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + * @param {number} iterationId + * @param {string} actionPath + */ + createTestIterationResultAttachment(attachmentRequestModel, project, runId, testCaseResultId, iterationId, actionPath) { + return __awaiter2(this, void 0, void 0, function* () { + if (iterationId == null) { + throw new TypeError("iterationId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + let queryValues = { + iterationId, + actionPath + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "2a632e97-e014-4275-978f-8e5c4906d4b3", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, attachmentRequestModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.TestAttachmentRequestModel} attachmentRequestModel + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + */ + createTestResultAttachment(attachmentRequestModel, project, runId, testCaseResultId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "2a632e97-e014-4275-978f-8e5c4906d4b3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, attachmentRequestModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.TestAttachmentRequestModel} attachmentRequestModel + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + * @param {number} testSubResultId + */ + createTestSubResultAttachment(attachmentRequestModel, project, runId, testCaseResultId, testSubResultId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testSubResultId == null) { + throw new TypeError("testSubResultId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + let queryValues = { + testSubResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "2a632e97-e014-4275-978f-8e5c4906d4b3", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, attachmentRequestModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + * @param {number} attachmentId + */ + deleteTestResultAttachment(project, runId, testCaseResultId, attachmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId, + attachmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "2a632e97-e014-4275-978f-8e5c4906d4b3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a test iteration attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + * @param {number} attachmentId + * @param {number} iterationId + */ + getTestIterationAttachmentContent(project, runId, testCaseResultId, attachmentId, iterationId) { + return __awaiter2(this, void 0, void 0, function* () { + if (iterationId == null) { + throw new TypeError("iterationId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId, + attachmentId + }; + let queryValues = { + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "2a632e97-e014-4275-978f-8e5c4906d4b3", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a test iteration attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + * @param {number} attachmentId + * @param {number} iterationId + */ + getTestIterationAttachmentZip(project, runId, testCaseResultId, attachmentId, iterationId) { + return __awaiter2(this, void 0, void 0, function* () { + if (iterationId == null) { + throw new TypeError("iterationId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId, + attachmentId + }; + let queryValues = { + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "2a632e97-e014-4275-978f-8e5c4906d4b3", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a test result attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + * @param {number} attachmentId + */ + getTestResultAttachmentContent(project, runId, testCaseResultId, attachmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId, + attachmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "2a632e97-e014-4275-978f-8e5c4906d4b3", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + */ + getTestResultAttachments(project, runId, testCaseResultId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "2a632e97-e014-4275-978f-8e5c4906d4b3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestAttachment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a test result attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + * @param {number} attachmentId + */ + getTestResultAttachmentZip(project, runId, testCaseResultId, attachmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId, + attachmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "2a632e97-e014-4275-978f-8e5c4906d4b3", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a test sub result attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + * @param {number} attachmentId + * @param {number} testSubResultId + */ + getTestSubResultAttachmentContent(project, runId, testCaseResultId, attachmentId, testSubResultId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testSubResultId == null) { + throw new TypeError("testSubResultId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId, + attachmentId + }; + let queryValues = { + testSubResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "2a632e97-e014-4275-978f-8e5c4906d4b3", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns attachment references for test sub result. + * + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + * @param {number} testSubResultId + */ + getTestSubResultAttachments(project, runId, testCaseResultId, testSubResultId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testSubResultId == null) { + throw new TypeError("testSubResultId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + let queryValues = { + testSubResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "2a632e97-e014-4275-978f-8e5c4906d4b3", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestAttachment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a test sub result attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + * @param {number} attachmentId + * @param {number} testSubResultId + */ + getTestSubResultAttachmentZip(project, runId, testCaseResultId, attachmentId, testSubResultId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testSubResultId == null) { + throw new TypeError("testSubResultId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId, + attachmentId + }; + let queryValues = { + testSubResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "2a632e97-e014-4275-978f-8e5c4906d4b3", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.TestAttachmentRequestModel} attachmentRequestModel + * @param {string} project - Project ID or project name + * @param {number} runId + */ + createTestRunAttachment(attachmentRequestModel, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "b5731898-8206-477a-a51d-3fdf116fc6bf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, attachmentRequestModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} attachmentId + */ + deleteTestRunAttachment(project, runId, attachmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + attachmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "b5731898-8206-477a-a51d-3fdf116fc6bf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a test run attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} attachmentId + */ + getTestRunAttachmentContent(project, runId, attachmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + attachmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "b5731898-8206-477a-a51d-3fdf116fc6bf", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + */ + getTestRunAttachments(project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "b5731898-8206-477a-a51d-3fdf116fc6bf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestAttachment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a test run attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} attachmentId + */ + getTestRunAttachmentZip(project, runId, attachmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + attachmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "b5731898-8206-477a-a51d-3fdf116fc6bf", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + */ + getBugsLinkedToTestResult(project, runId, testCaseResultId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "d8dbf98f-eb34-4f8d-8365-47972af34f29", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} buildId + */ + fetchSourceCodeCoverageReport(project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "a459e10b-d703-4193-b3c1-60f2287918b3", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.SourceViewBuildCoverage, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {number} flags + */ + getBuildCodeCoverage(project, buildId, flags) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + if (flags == null) { + throw new TypeError("flags can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + flags + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "9b3e1ece-c6ab-4fbb-8167-8a32a0c92216", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.BuildCoverage, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * http://(tfsserver):8080/tfs/DefaultCollection/_apis/test/CodeCoverage?buildId=10&deltaBuildId=9 Request: build id and delta build id (optional) + * + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {number} deltaBuildId + */ + getCodeCoverageSummary(project, buildId, deltaBuildId) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + deltaBuildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "9b3e1ece-c6ab-4fbb-8167-8a32a0c92216", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.CodeCoverageSummary, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * http://(tfsserver):8080/tfs/DefaultCollection/_apis/test/CodeCoverage?buildId=10 Request: Json of code coverage summary + * + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {Contracts.CodeCoverageData} coverageData + */ + updateCodeCoverageSummary(project, buildId, coverageData) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "9b3e1ece-c6ab-4fbb-8167-8a32a0c92216", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, coverageData, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} flags + */ + getTestRunCodeCoverage(project, runId, flags) { + return __awaiter2(this, void 0, void 0, function* () { + if (flags == null) { + throw new TypeError("flags can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + flags + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "5641efbc-6f9b-401a-baeb-d3da22489e5e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.CustomTestFieldDefinition[]} newFields + * @param {string} project - Project ID or project name + */ + addCustomFields(newFields, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "b67d46d8-b70e-4dcc-a98c-7f74b52ba82f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, newFields, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.CustomTestFieldDefinition, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {Contracts.CustomTestFieldScope} scopeFilter + */ + queryCustomFields(project, scopeFilter) { + return __awaiter2(this, void 0, void 0, function* () { + if (scopeFilter == null) { + throw new TypeError("scopeFilter can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + scopeFilter + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "b67d46d8-b70e-4dcc-a98c-7f74b52ba82f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.CustomTestFieldDefinition, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get file coverage for the specified file + * + * @param {Contracts.FileCoverageRequest} fileCoverageRequest - File details with pull request iteration context + * @param {string} project - Project ID or project name + */ + getFileLevelCodeCoverage(fileCoverageRequest, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "4a6d0c46-51ca-45aa-9163-249cee3289b7", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} buildDefinitionId + * @param {Date} minBuildCreatedDate + */ + getFlakyTestResultsByBuildDefinitionId(project, buildDefinitionId, minBuildCreatedDate) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildDefinitionId == null) { + throw new TypeError("buildDefinitionId can not be null or undefined"); + } + if (minBuildCreatedDate == null) { + throw new TypeError("minBuildCreatedDate can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildDefinitionId, + minBuildCreatedDate + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "8ed3cf63-7153-4722-a107-c49dae996143", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestCaseResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + */ + getFlakyTestResultsByTestRun(project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "31cc4b31-416f-45cd-9b45-39534279e10c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestCaseResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.ResultsFilter} filter + * @param {string} project - Project ID or project name + */ + queryTestResultHistory(filter2, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "bdf7a97b-0395-4da8-9d5d-f957619327d1", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, filter2, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestResultHistory, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get test run message logs + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the run to get. + */ + getTestRunMessageLogs(project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "e9ab0c6a-1984-418b-87c0-ee4202318ba3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestMessageLogDetails, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get summary of test results. + * + * @param {string} project - Project ID or project name + * @param {number} pipelineId - Pipeline Id. This is same as build Id. + * @param {string} stageName - Name of the stage. Maximum supported length for name is 256 character. + * @param {string} phaseName - Name of the phase. Maximum supported length for name is 256 character. + * @param {string} jobName - Matrixing in YAML generates copies of a job with different inputs in matrix. JobName is the name of those input. Maximum supported length for name is 256 character. + * @param {Contracts.Metrics[]} metricNames + * @param {boolean} groupByNode - Group summary for each node of the pipleine heirarchy + */ + getTestPipelineMetrics(project, pipelineId, stageName, phaseName, jobName, metricNames, groupByNode) { + return __awaiter2(this, void 0, void 0, function* () { + if (pipelineId == null) { + throw new TypeError("pipelineId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + pipelineId, + stageName, + phaseName, + jobName, + metricNames: metricNames && metricNames.join(","), + groupByNode + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "65f35817-86a1-4131-b38b-3ec2d4744e53", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.PipelineTestMetrics, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {string} publishContext + * @param {string} groupBy + * @param {string} filter + * @param {string} orderby + * @param {boolean} shouldIncludeResults + * @param {boolean} queryRunSummaryForInProgress + */ + getTestResultDetailsForBuild(project, buildId, publishContext, groupBy, filter2, orderby, shouldIncludeResults, queryRunSummaryForInProgress) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + publishContext, + groupBy, + "$filter": filter2, + "$orderby": orderby, + shouldIncludeResults, + queryRunSummaryForInProgress + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "a518c749-4524-45b2-a7ef-1ac009b312cd", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestResultsDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {number} releaseEnvId + * @param {string} publishContext + * @param {string} groupBy + * @param {string} filter + * @param {string} orderby + * @param {boolean} shouldIncludeResults + * @param {boolean} queryRunSummaryForInProgress + */ + getTestResultDetailsForRelease(project, releaseId, releaseEnvId, publishContext, groupBy, filter2, orderby, shouldIncludeResults, queryRunSummaryForInProgress) { + return __awaiter2(this, void 0, void 0, function* () { + if (releaseId == null) { + throw new TypeError("releaseId can not be null or undefined"); + } + if (releaseEnvId == null) { + throw new TypeError("releaseEnvId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + releaseId, + releaseEnvId, + publishContext, + groupBy, + "$filter": filter2, + "$orderby": orderby, + shouldIncludeResults, + queryRunSummaryForInProgress + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "19a8183a-69fb-47d7-bfbf-1b6b0d921294", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestResultsDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.TestResultDocument} document + * @param {string} project - Project ID or project name + * @param {number} runId + */ + publishTestResultDocument(document, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "74838649-b038-42f1-a0e7-6deb3973bf14", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, document, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {string} publishContext + * @param {string[]} fields + * @param {string} continuationToken + */ + getResultGroupsByBuild(project, buildId, publishContext, fields, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + if (publishContext == null) { + throw new TypeError("publishContext can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + publishContext, + fields: fields && fields.join(","), + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "e49244d1-c49f-49ad-a717-3bbaefe6a201", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {string} publishContext + * @param {number} releaseEnvId + * @param {string[]} fields + * @param {string} continuationToken + */ + getResultGroupsByRelease(project, releaseId, publishContext, releaseEnvId, fields, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (releaseId == null) { + throw new TypeError("releaseId can not be null or undefined"); + } + if (publishContext == null) { + throw new TypeError("publishContext can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + releaseId, + publishContext, + releaseEnvId, + fields: fields && fields.join(","), + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "3c2b6bb0-0620-434a-a5c3-26aa0fcfda15", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get list of test Result meta data details for corresponding testcasereferenceId + * + * @param {string[]} testCaseReferenceIds - TestCaseReference Ids of the test Result to be queried, comma separated list of valid ids (limit no. of ids 200). + * @param {string} project - Project ID or project name + * @param {Contracts.ResultMetaDataDetails} detailsToInclude - Details to include with test results metadata. Default is None. Other values are FlakyIdentifiers. + */ + queryTestResultsMetaData(testCaseReferenceIds, project, detailsToInclude) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + detailsToInclude + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "testresults", "b72ff4c0-4341-4213-ba27-f517cf341c95", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testCaseReferenceIds, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update properties of test result meta data + * + * @param {Contracts.TestResultMetaDataUpdateInput} testResultMetaDataUpdateInput - TestResultMetaData update input TestResultMetaDataUpdateInput + * @param {string} project - Project ID or project name + * @param {number} testCaseReferenceId - TestCaseReference Id of Test Result to be updated. + */ + updateTestResultsMetaData(testResultMetaDataUpdateInput, project, testCaseReferenceId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + testCaseReferenceId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "testresults", "b72ff4c0-4341-4213-ba27-f517cf341c95", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, testResultMetaDataUpdateInput, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.TestResultsQuery} query + * @param {string} project - Project ID or project name + */ + getTestResultsByQuery(query, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "14033a2c-af25-4af1-9e39-8ef6900482e3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, query, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestResultsQuery, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.QueryModel} queryModel + * @param {string} project - Project ID or project name + * @param {boolean} includeResultDetails + * @param {boolean} includeIterationDetails + * @param {number} skip + * @param {number} top + */ + getTestResultsByQueryWiql(queryModel, project, includeResultDetails, includeIterationDetails, skip, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + includeResultDetails, + includeIterationDetails, + "$skip": skip, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "5ea78be3-2f5a-4110-8034-c27f24c62db1", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, queryModel, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestCaseResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.TestCaseResult[]} results + * @param {string} project - Project ID or project name + * @param {number} runId + */ + addTestResultsToTestRun(results, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "02afa165-e79a-4d70-8f0c-2af0f35b4e07", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, results, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestCaseResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testResultId + * @param {Contracts.ResultDetails} detailsToInclude + */ + getTestResultById(project, runId, testResultId, detailsToInclude) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testResultId + }; + let queryValues = { + detailsToInclude + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "02afa165-e79a-4d70-8f0c-2af0f35b4e07", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestCaseResult, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {Contracts.ResultDetails} detailsToInclude + * @param {number} skip + * @param {number} top + * @param {Contracts.TestOutcome[]} outcomes + * @param {boolean} newTestsOnly + */ + getTestResults(project, runId, detailsToInclude, skip, top, outcomes, newTestsOnly) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + detailsToInclude, + "$skip": skip, + "$top": top, + outcomes: outcomes && outcomes.join(","), + "$newTestsOnly": newTestsOnly + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "02afa165-e79a-4d70-8f0c-2af0f35b4e07", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestCaseResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.TestCaseResult[]} results + * @param {string} project - Project ID or project name + * @param {number} runId + */ + updateTestResults(results, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "02afa165-e79a-4d70-8f0c-2af0f35b4e07", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, results, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestCaseResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {string} publishContext + * @param {Contracts.TestOutcome[]} outcomes + * @param {number} top + * @param {string} continuationToken + */ + getTestResultsByBuild(project, buildId, publishContext, outcomes, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + publishContext, + outcomes: outcomes && outcomes.join(","), + "$top": top, + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "f48cc885-dbc4-4efc-ab19-ae8c19d1e02a", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of results. + * + * @param {string} project - Project ID or project name + * @param {number} pipelineId - Pipeline Id. This is same as build Id. + * @param {string} stageName - Name of the stage. Maximum supported length for name is 256 character. + * @param {string} phaseName - Name of the phase. Maximum supported length for name is 256 character. + * @param {string} jobName - Matrixing in YAML generates copies of a job with different inputs in matrix. JobName is the name of those input. Maximum supported length for name is 256 character. + * @param {Contracts.TestOutcome[]} outcomes - List of outcome of results + * @param {number} top - Maximum number of results to return + * @param {String} continuationToken - Header to pass the continuationToken + */ + getTestResultsByPipeline(customHeaders, project, pipelineId, stageName, phaseName, jobName, outcomes, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (pipelineId == null) { + throw new TypeError("pipelineId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + pipelineId, + stageName, + phaseName, + jobName, + outcomes: outcomes && outcomes.join(","), + "$top": top + }; + customHeaders = customHeaders || {}; + customHeaders["x-ms-continuationtoken"] = "continuationToken"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "80169dc2-30c3-4c25-84b2-dd67d7ff1f52", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {number} releaseEnvid + * @param {string} publishContext + * @param {Contracts.TestOutcome[]} outcomes + * @param {number} top + * @param {string} continuationToken + */ + getTestResultsByRelease(project, releaseId, releaseEnvid, publishContext, outcomes, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (releaseId == null) { + throw new TypeError("releaseId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + releaseId, + releaseEnvid, + publishContext, + outcomes: outcomes && outcomes.join(","), + "$top": top, + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "3994b949-77e5-495d-8034-edf80d95b84e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all the available groups details and for these groups get failed and aborted results. + * + * @param {string} project - Project ID or project name + * @param {number} pipelineId - Pipeline Id. This is same as build Id. + * @param {string} stageName - Name of the stage. Maximum supported length for name is 256 character. + * @param {string} phaseName - Name of the phase. Maximum supported length for name is 256 character. + * @param {string} jobName - Matrixing in YAML generates copies of a job with different inputs in matrix. JobName is the name of those input. Maximum supported length for name is 256 character. + * @param {boolean} shouldIncludeFailedAndAbortedResults - If true, it will return Ids of failed and aborted results for each test group + * @param {boolean} queryGroupSummaryForInProgress - If true, it will calculate summary for InProgress runs as well. + */ + testResultsGroupDetails(project, pipelineId, stageName, phaseName, jobName, shouldIncludeFailedAndAbortedResults, queryGroupSummaryForInProgress) { + return __awaiter2(this, void 0, void 0, function* () { + if (pipelineId == null) { + throw new TypeError("pipelineId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + pipelineId, + stageName, + phaseName, + jobName, + shouldIncludeFailedAndAbortedResults, + queryGroupSummaryForInProgress + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "f903b850-06af-4b50-a344-d7bbfb19e93b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestResultsDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} buildId + * @param {string} publishContext + * @param {boolean} includeFailureDetails + * @param {Contracts.BuildReference} buildToCompare + */ + queryTestResultsReportForBuild(project, buildId, publishContext, includeFailureDetails, buildToCompare) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + publishContext, + includeFailureDetails, + buildToCompare + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "e009fa95-95a5-4ad4-9681-590043ce2423", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestResultSummary, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get summary of test results. + * + * @param {string} project - Project ID or project name + * @param {number} pipelineId - Pipeline Id. This is same as build Id. + * @param {string} stageName - Name of the stage. Maximum supported length for name is 256 character. + * @param {string} phaseName - Name of the phase. Maximum supported length for name is 256 character. + * @param {string} jobName - Matrixing in YAML generates copies of a job with different inputs in matrix. JobName is the name of those input. Maximum supported length for name is 256 character. + * @param {boolean} includeFailureDetails - If true returns failure insights + */ + queryTestResultsReportForPipeline(project, pipelineId, stageName, phaseName, jobName, includeFailureDetails) { + return __awaiter2(this, void 0, void 0, function* () { + if (pipelineId == null) { + throw new TypeError("pipelineId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + pipelineId, + stageName, + phaseName, + jobName, + includeFailureDetails + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "71f746a1-7d68-40fe-b705-9d821a73dff2", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestResultSummary, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} releaseId + * @param {number} releaseEnvId + * @param {string} publishContext + * @param {boolean} includeFailureDetails + * @param {Contracts.ReleaseReference} releaseToCompare + */ + queryTestResultsReportForRelease(project, releaseId, releaseEnvId, publishContext, includeFailureDetails, releaseToCompare) { + return __awaiter2(this, void 0, void 0, function* () { + if (releaseId == null) { + throw new TypeError("releaseId can not be null or undefined"); + } + if (releaseEnvId == null) { + throw new TypeError("releaseEnvId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + releaseId, + releaseEnvId, + publishContext, + includeFailureDetails, + releaseToCompare + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "f10f9577-2c04-45ab-8c99-b26567a7cd55", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestResultSummary, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.ReleaseReference[]} releases + * @param {string} project - Project ID or project name + */ + queryTestResultsSummaryForReleases(releases, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "f10f9577-2c04-45ab-8c99-b26567a7cd55", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, releases, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestResultSummary, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.TestResultsContext} resultsContext + * @param {string} project - Project ID or project name + * @param {number[]} workItemIds + */ + queryTestSummaryByRequirement(resultsContext, project, workItemIds) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + workItemIds: workItemIds && workItemIds.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "3b7fd26f-c335-4e55-afc1-a588f5e2af3c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, resultsContext, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestSummaryForWorkItem, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.TestResultTrendFilter} filter + * @param {string} project - Project ID or project name + */ + queryResultTrendForBuild(filter2, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "0886a7ae-315a-4dba-9122-bcce93301f3a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, filter2, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.AggregatedDataForResultTrend, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.TestResultTrendFilter} filter + * @param {string} project - Project ID or project name + */ + queryResultTrendForRelease(filter2, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "107f23c3-359a-460a-a70c-63ee739f9f9a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, filter2, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.AggregatedDataForResultTrend, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.RunCreateModel} testRun + * @param {string} project - Project ID or project name + */ + createTestRun(testRun, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "364538f9-8062-4ce0-b024-75a0fb463f0d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testRun, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestRun, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + */ + deleteTestRun(project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "364538f9-8062-4ce0-b024-75a0fb463f0d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {boolean} includeDetails + * @param {boolean} includeTags + */ + getTestRunById(project, runId, includeDetails, includeTags) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + includeDetails, + includeTags + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "364538f9-8062-4ce0-b024-75a0fb463f0d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestRun, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} buildUri + * @param {string} owner + * @param {string} tmiRunId + * @param {number} planId + * @param {boolean} includeRunDetails + * @param {boolean} automated + * @param {number} skip + * @param {number} top + */ + getTestRuns(project, buildUri, owner, tmiRunId, planId, includeRunDetails, automated, skip, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildUri, + owner, + tmiRunId, + planId, + includeRunDetails, + automated, + "$skip": skip, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "364538f9-8062-4ce0-b024-75a0fb463f0d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestRun, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Query Test Runs based on filters. Mandatory fields are minLastUpdatedDate and maxLastUpdatedDate. + * + * @param {string} project - Project ID or project name + * @param {Date} minLastUpdatedDate - Minimum Last Modified Date of run to be queried (Mandatory). + * @param {Date} maxLastUpdatedDate - Maximum Last Modified Date of run to be queried (Mandatory, difference between min and max date can be atmost 7 days). + * @param {Contracts.TestRunState} state - Current state of the Runs to be queried. + * @param {number[]} planIds - Plan Ids of the Runs to be queried, comma separated list of valid ids. + * @param {boolean} isAutomated - Automation type of the Runs to be queried. + * @param {Contracts.TestRunPublishContext} publishContext - PublishContext of the Runs to be queried. + * @param {number[]} buildIds - Build Ids of the Runs to be queried, comma separated list of valid ids. + * @param {number[]} buildDefIds - Build Definition Ids of the Runs to be queried, comma separated list of valid ids. + * @param {string} branchName - Source Branch name of the Runs to be queried. + * @param {number[]} releaseIds - Release Ids of the Runs to be queried, comma separated list of valid ids. + * @param {number[]} releaseDefIds - Release Definition Ids of the Runs to be queried, comma separated list of valid ids. + * @param {number[]} releaseEnvIds - Release Environment Ids of the Runs to be queried, comma separated list of valid ids. + * @param {number[]} releaseEnvDefIds - Release Environment Definition Ids of the Runs to be queried, comma separated list of valid ids. + * @param {string} runTitle - Run Title of the Runs to be queried. + * @param {number} top - Number of runs to be queried. Limit is 100 + * @param {string} continuationToken - continuationToken received from previous batch or null for first batch. It is not supposed to be created (or altered, if received from last batch) by user. + */ + queryTestRuns(project, minLastUpdatedDate, maxLastUpdatedDate, state, planIds, isAutomated, publishContext, buildIds, buildDefIds, branchName, releaseIds, releaseDefIds, releaseEnvIds, releaseEnvDefIds, runTitle, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (minLastUpdatedDate == null) { + throw new TypeError("minLastUpdatedDate can not be null or undefined"); + } + if (maxLastUpdatedDate == null) { + throw new TypeError("maxLastUpdatedDate can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + minLastUpdatedDate, + maxLastUpdatedDate, + state, + planIds: planIds && planIds.join(","), + isAutomated, + publishContext, + buildIds: buildIds && buildIds.join(","), + buildDefIds: buildDefIds && buildDefIds.join(","), + branchName, + releaseIds: releaseIds && releaseIds.join(","), + releaseDefIds: releaseDefIds && releaseDefIds.join(","), + releaseEnvIds: releaseEnvIds && releaseEnvIds.join(","), + releaseEnvDefIds: releaseEnvDefIds && releaseEnvDefIds.join(","), + runTitle, + "$top": top, + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "364538f9-8062-4ce0-b024-75a0fb463f0d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestRun, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.RunUpdateModel} runUpdateModel + * @param {string} project - Project ID or project name + * @param {number} runId + */ + updateTestRun(runUpdateModel, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "364538f9-8062-4ce0-b024-75a0fb463f0d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, runUpdateModel, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestRun, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get test run summary, used when we want to get summary of a run by outcome. Test run should be in completed state. + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the run to get. + */ + getTestRunSummaryByOutcome(project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "5c6a250c-53b7-4851-990c-42a7a00c8b39", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestRunStatistic, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get TestResultsSettings data + * + * @param {string} project - Project ID or project name + * @param {Contracts.TestResultsSettingsType} settingsType + */ + getTestResultsSettings(project, settingsType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + settingsType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testresults", "7319952e-e5a9-4e19-a006-84f3be8b7c68", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestResultsSettings, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update project settings of test results + * + * @param {Contracts.TestResultsUpdateSettings} testResultsUpdateSettings + * @param {string} project - Project ID or project name + */ + updatePipelinesTestSettings(testResultsUpdateSettings, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "testresults", "7319952e-e5a9-4e19-a006-84f3be8b7c68", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, testResultsUpdateSettings, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestResultsSettings, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the list of results whose failure matches with the provided one. + * + * @param {string} project - Project ID or project name + * @param {number} runId - id of test run + * @param {number} testResultId - id of test result inside a test run + * @param {number} testSubResultId - id of subresult inside a test result + * @param {number} top - Maximum number of results to return + * @param {String} continuationToken - Header to pass the continuationToken + */ + getSimilarTestResults(customHeaders, project, runId, testResultId, testSubResultId, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (testSubResultId == null) { + throw new TypeError("testSubResultId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testResultId + }; + let queryValues = { + testSubResultId, + "$top": top + }; + customHeaders = customHeaders || {}; + customHeaders["x-ms-continuationtoken"] = "continuationToken"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "67d0a074-b255-4902-a639-e3e6de7a3de6", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestCaseResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get test run statistics , used when we want to get summary of a run by outcome. + * + * @param {string} project - Project ID or project name + * @param {number} runId - ID of the run to get. + */ + getTestRunStatistics(project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "82b986e8-ca9e-4a89-b39e-f65c69bc104a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestRunStatistic, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + *

Gets the coverage status for the last successful build of a definition, optionally scoped to a specific branch

+ * + * @param {string} project - Project ID or project name + * @param {string} definition - The ID or name of the definition. + * @param {string} branchName - The branch name. + * @param {string} label - The String to replace the default text on the left side of the badge. + */ + getCoverageStatusBadge(project, definition, branchName, label) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + definition + }; + let queryValues = { + branchName, + label + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "73b7c9d8-defb-4b60-b3d6-2162d60d6b13", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all the tags in a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - Build ID + */ + getTestTagsForBuild(project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "52ee2057-4b54-41a6-a18c-ed4375a00f8d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all the tags in a release. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Release ID + * @param {number} releaseEnvId - Release environment ID + */ + getTestTagsForRelease(project, releaseId, releaseEnvId) { + return __awaiter2(this, void 0, void 0, function* () { + if (releaseId == null) { + throw new TypeError("releaseId can not be null or undefined"); + } + if (releaseEnvId == null) { + throw new TypeError("releaseEnvId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + releaseId, + releaseEnvId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "52ee2057-4b54-41a6-a18c-ed4375a00f8d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update tags of a run, Tags can be Added and Deleted + * + * @param {Contracts.TestTagsUpdateModel} testTagsUpdateModel - TestTagsUpdateModel + * @param {string} project - Project ID or project name + * @param {number} runId - RunId of the run + */ + updateTestRunTags(testTagsUpdateModel, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "a5e2f411-2b43-45f3-989c-05b71339f5b8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, testTagsUpdateModel, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all the tags in a build. + * + * @param {string} project - Project ID or project name + * @param {number} buildId - Build ID + */ + getTestTagSummaryForBuild(project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "655a8f6b-fec7-4b46-b672-68b44141b498", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all the tags in a release. + * + * @param {string} project - Project ID or project name + * @param {number} releaseId - Release ID + * @param {number} releaseEnvId - Release environment ID + */ + getTestTagSummaryForRelease(project, releaseId, releaseEnvId) { + return __awaiter2(this, void 0, void 0, function* () { + if (releaseId == null) { + throw new TypeError("releaseId can not be null or undefined"); + } + if (releaseEnvId == null) { + throw new TypeError("releaseEnvId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + releaseId, + releaseEnvId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "655a8f6b-fec7-4b46-b672-68b44141b498", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates an attachment in the LogStore for the specified buildId. + * + * @param {Contracts.TestAttachmentRequestModel} attachmentRequestModel - Contains attachment info like stream, filename, comment, attachmentType + * @param {string} project - Project ID or project name + * @param {number} buildId - BuildId + */ + createBuildAttachmentInLogStore(attachmentRequestModel, project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "6f747e16-18c2-435a-b4fb-fa05d6845fee", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, attachmentRequestModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates an attachment in the LogStore for the specified runId. + * + * @param {Contracts.TestAttachmentRequestModel} attachmentRequestModel - Contains attachment info like stream, filename, comment, attachmentType + * @param {string} project - Project ID or project name + * @param {number} runId - Test RunId + */ + createTestRunLogStoreAttachment(attachmentRequestModel, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "1026d5de-4b0b-46ae-a31f-7c59b6af51ef", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, attachmentRequestModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes the attachment with the specified filename for the specified runId from the LogStore. + * + * @param {string} project - Project ID or project name + * @param {number} runId - Test RunId + * @param {string} filename - Attachment FileName + */ + deleteTestRunLogStoreAttachment(project, runId, filename) { + return __awaiter2(this, void 0, void 0, function* () { + if (filename == null) { + throw new TypeError("filename can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + filename + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "1026d5de-4b0b-46ae-a31f-7c59b6af51ef", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns the attachment with the specified filename for the specified runId from the LogStore. + * + * @param {string} project - Project ID or project name + * @param {number} runId - Test RunId + * @param {string} filename - Attachment FileName + */ + getTestRunLogStoreAttachmentContent(project, runId, filename) { + return __awaiter2(this, void 0, void 0, function* () { + if (filename == null) { + throw new TypeError("filename can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + filename + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "1026d5de-4b0b-46ae-a31f-7c59b6af51ef", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of attachments for the specified runId from the LogStore. + * + * @param {string} project - Project ID or project name + * @param {number} runId - Test RunId + */ + getTestRunLogStoreAttachments(project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "1026d5de-4b0b-46ae-a31f-7c59b6af51ef", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestLogStoreAttachment, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns the attachment with the specified filename for the specified runId from the LogStore. + * + * @param {string} project - Project ID or project name + * @param {number} runId - Test RunId + * @param {string} filename - Attachment FileName + */ + getTestRunLogStoreAttachmentZip(project, runId, filename) { + return __awaiter2(this, void 0, void 0, function* () { + if (filename == null) { + throw new TypeError("filename can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + filename + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "1026d5de-4b0b-46ae-a31f-7c59b6af51ef", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a new test failure type + * + * @param {Contracts.TestResultFailureTypeRequestModel} testResultFailureType + * @param {string} project - Project ID or project name + */ + createFailureType(testResultFailureType, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "c4ac0486-830c-4a2a-9ef9-e8a1791a70fd", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testResultFailureType, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes a test failure type with specified failureTypeId + * + * @param {string} project - Project ID or project name + * @param {number} failureTypeId + */ + deleteFailureType(project, failureTypeId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + failureTypeId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "c4ac0486-830c-4a2a-9ef9-e8a1791a70fd", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns the list of test failure types. + * + * @param {string} project - Project ID or project name + */ + getFailureTypes(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "c4ac0486-830c-4a2a-9ef9-e8a1791a70fd", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get history of a test method using TestHistoryQuery + * + * @param {Contracts.TestHistoryQuery} filter - TestHistoryQuery to get history + * @param {string} project - Project ID or project name + */ + queryTestHistory(filter2, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "2a41bd6a-8118-4403-b74e-5ba7492aed9d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, filter2, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestHistoryQuery, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get list of build attachments reference + * + * @param {string} project - Project ID or project name + * @param {number} buildId - Id of the build to get + * @param {Contracts.TestLogType} type - type of the attachment to get + * @param {string} directoryPath - directory path for which attachments are needed + * @param {string} fileNamePrefix - file name prefix to filter the list of attachment + * @param {boolean} fetchMetaData - Default is false, set if metadata is needed + * @param {number} top - Number of test attachments reference to return + * @param {String} continuationToken - Header to pass the continuationToken + */ + getTestLogsForBuild(customHeaders, project, buildId, type, directoryPath, fileNamePrefix, fetchMetaData, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + if (type == null) { + throw new TypeError("type can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + type, + directoryPath, + fileNamePrefix, + fetchMetaData, + top + }; + customHeaders = customHeaders || {}; + customHeaders["x-ms-continuationtoken"] = "continuationToken"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "dff8ce3a-e539-4817-a405-d968491a88f1", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestLog, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get list of test result attachments reference + * + * @param {string} project - Project ID or project name + * @param {number} runId - Id of the test run that contains the result + * @param {number} resultId - Id of the test result + * @param {Contracts.TestLogType} type - type of attachments to get + * @param {string} directoryPath - directory path of attachments to get + * @param {string} fileNamePrefix - file name prefix to filter the list of attachment + * @param {boolean} fetchMetaData - Default is false, set if metadata is needed + * @param {number} top - Numbe of attachments reference to return + * @param {String} continuationToken - Header to pass the continuationToken + */ + getTestResultLogs(customHeaders, project, runId, resultId, type, directoryPath, fileNamePrefix, fetchMetaData, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (type == null) { + throw new TypeError("type can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + resultId + }; + let queryValues = { + type, + directoryPath, + fileNamePrefix, + fetchMetaData, + top + }; + customHeaders = customHeaders || {}; + customHeaders["x-ms-continuationtoken"] = "continuationToken"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "714caaac-ae1e-4869-8323-9bc0f5120dbf", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestLog, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get list of test subresult attachments reference + * + * @param {string} project - Project ID or project name + * @param {number} runId - Id of the test run that contains the results + * @param {number} resultId - Id of the test result that contains subresult + * @param {number} subResultId - Id of the test subresult + * @param {Contracts.TestLogType} type - type of the attachments to get + * @param {string} directoryPath - directory path of the attachment to get + * @param {string} fileNamePrefix - file name prefix to filter the list of attachments + * @param {boolean} fetchMetaData - Default is false, set if metadata is needed + * @param {number} top - Number of attachments reference to return + * @param {String} continuationToken - Header to pass the continuationToken + */ + getTestSubResultLogs(customHeaders, project, runId, resultId, subResultId, type, directoryPath, fileNamePrefix, fetchMetaData, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (subResultId == null) { + throw new TypeError("subResultId can not be null or undefined"); + } + if (type == null) { + throw new TypeError("type can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + resultId + }; + let queryValues = { + subResultId, + type, + directoryPath, + fileNamePrefix, + fetchMetaData, + top + }; + customHeaders = customHeaders || {}; + customHeaders["x-ms-continuationtoken"] = "continuationToken"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "714caaac-ae1e-4869-8323-9bc0f5120dbf", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestLog, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get list of test run attachments reference + * + * @param {string} project - Project ID or project name + * @param {number} runId - Id of the test run + * @param {Contracts.TestLogType} type - type of the attachments to get + * @param {string} directoryPath - directory path for which attachments are needed + * @param {string} fileNamePrefix - file name prefix to filter the list of attachment + * @param {boolean} fetchMetaData - Default is false, set if metadata is needed + * @param {number} top - Number of attachments reference to return + * @param {String} continuationToken - Header to pass the continuationToken + */ + getTestRunLogs(customHeaders, project, runId, type, directoryPath, fileNamePrefix, fetchMetaData, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + if (type == null) { + throw new TypeError("type can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + type, + directoryPath, + fileNamePrefix, + fetchMetaData, + top + }; + customHeaders = customHeaders || {}; + customHeaders["x-ms-continuationtoken"] = "continuationToken"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "5b47b946-e875-4c9a-acdc-2a20996caebe", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestLog, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get SAS Uri of a build attachment + * + * @param {string} project - Project ID or project name + * @param {number} build - Id of the build to get + * @param {Contracts.TestLogType} type - type of the file + * @param {string} filePath - filePath for which sas uri is needed + */ + getTestLogStoreEndpointDetailsForBuildLog(project, build, type, filePath) { + return __awaiter2(this, void 0, void 0, function* () { + if (build == null) { + throw new TypeError("build can not be null or undefined"); + } + if (type == null) { + throw new TypeError("type can not be null or undefined"); + } + if (filePath == null) { + throw new TypeError("filePath can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + build, + type, + filePath + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "39b09be7-f0c9-4a83-a513-9ae31b45c56f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestLogStoreEndpointDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create and Get sas uri of the build container + * + * @param {string} project - Project ID or project name + * @param {number} buildId - Id of the build to get + * @param {Contracts.TestLogStoreOperationType} testLogStoreOperationType - Type of operation to perform using sas uri + */ + testLogStoreEndpointDetailsForBuild(project, buildId, testLogStoreOperationType) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + if (testLogStoreOperationType == null) { + throw new TypeError("testLogStoreOperationType can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId, + testLogStoreOperationType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "39b09be7-f0c9-4a83-a513-9ae31b45c56f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestLogStoreEndpointDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get SAS Uri of a test results attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId - Id of the test run that contains result + * @param {number} resultId - Id of the test result whose files need to be downloaded + * @param {Contracts.TestLogType} type - type of the file + * @param {string} filePath - filePath for which sas uri is needed + */ + getTestLogStoreEndpointDetailsForResultLog(project, runId, resultId, type, filePath) { + return __awaiter2(this, void 0, void 0, function* () { + if (type == null) { + throw new TypeError("type can not be null or undefined"); + } + if (filePath == null) { + throw new TypeError("filePath can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + resultId + }; + let queryValues = { + type, + filePath + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "da630b37-1236-45b5-945e-1d7bdb673850", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestLogStoreEndpointDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get SAS Uri of a test subresults attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId - Id of the test run that contains result + * @param {number} resultId - Id of the test result that contains subresult + * @param {number} subResultId - Id of the test subresult whose file sas uri is needed + * @param {Contracts.TestLogType} type - type of the file + * @param {string} filePath - filePath for which sas uri is needed + */ + getTestLogStoreEndpointDetailsForSubResultLog(project, runId, resultId, subResultId, type, filePath) { + return __awaiter2(this, void 0, void 0, function* () { + if (subResultId == null) { + throw new TypeError("subResultId can not be null or undefined"); + } + if (type == null) { + throw new TypeError("type can not be null or undefined"); + } + if (filePath == null) { + throw new TypeError("filePath can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + resultId + }; + let queryValues = { + subResultId, + type, + filePath + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "da630b37-1236-45b5-945e-1d7bdb673850", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestLogStoreEndpointDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create empty file for a result and Get Sas uri for the file + * + * @param {string} project - Project ID or project name + * @param {number} runId - Id of the test run that contains the result + * @param {number} resultId - Id of the test results that contains sub result + * @param {number} subResultId - Id of the test sub result whose file sas uri is needed + * @param {string} filePath - file path inside the sub result for which sas uri is needed + * @param {Contracts.TestLogType} type - Type of the file for download + */ + testLogStoreEndpointDetailsForResult(project, runId, resultId, subResultId, filePath, type) { + return __awaiter2(this, void 0, void 0, function* () { + if (subResultId == null) { + throw new TypeError("subResultId can not be null or undefined"); + } + if (filePath == null) { + throw new TypeError("filePath can not be null or undefined"); + } + if (type == null) { + throw new TypeError("type can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + resultId + }; + let queryValues = { + subResultId, + filePath, + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "da630b37-1236-45b5-945e-1d7bdb673850", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestLogStoreEndpointDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get SAS Uri of a test run attachment + * + * @param {string} project - Project ID or project name + * @param {number} runId - Id of the test run whose file has to be downloaded + * @param {Contracts.TestLogType} type - type of the file + * @param {string} filePath - filePath for which sas uri is needed + */ + getTestLogStoreEndpointDetailsForRunLog(project, runId, type, filePath) { + return __awaiter2(this, void 0, void 0, function* () { + if (type == null) { + throw new TypeError("type can not be null or undefined"); + } + if (filePath == null) { + throw new TypeError("filePath can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + type, + filePath + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "67eb3f92-6c97-4fd9-8b63-6cbdc7e526ea", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestLogStoreEndpointDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create empty file for a run and Get Sas uri for the file + * + * @param {string} project - Project ID or project name + * @param {number} runId - Id of the run to get endpoint details + * @param {Contracts.TestLogStoreOperationType} testLogStoreOperationType - Type of operation to perform using sas uri + * @param {string} filePath - file path to create an empty file + * @param {Contracts.TestLogType} type - Default is GeneralAttachment, type of empty file to be created + */ + testLogStoreEndpointDetailsForRun(project, runId, testLogStoreOperationType, filePath, type) { + return __awaiter2(this, void 0, void 0, function* () { + if (testLogStoreOperationType == null) { + throw new TypeError("testLogStoreOperationType can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + testLogStoreOperationType, + filePath, + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "67eb3f92-6c97-4fd9-8b63-6cbdc7e526ea", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestLogStoreEndpointDetails, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieves Test runs associated to a session + * + * @param {string} project - Project ID or project name + * @param {number} sessionId - Id of TestResults session to obtain Test Runs for. + */ + getTestRunsBySessionId(project, sessionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + sessionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "6efc2c12-d4bf-4e86-ae37-b502e57a84c7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates TestResultsSession object in TCM data store + * + * @param {Contracts.TestResultsSession} session - Received session object. + * @param {string} project - Project ID or project name + */ + createTestSession(session, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "531e61ce-580d-4962-8591-0b2942b6bf78", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, session, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieves TestResultsSession metadata object in TCM data store + * + * @param {string} project - Project ID or project name + * @param {number} buildId + */ + getTestSession(project, buildId) { + return __awaiter2(this, void 0, void 0, function* () { + if (buildId == null) { + throw new TypeError("buildId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + buildId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "531e61ce-580d-4962-8591-0b2942b6bf78", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestResultsSession, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieves TestResultsSession Layout object in TCM data store + * + * @param {string} project - Project ID or project name + * @param {string} sessionId + */ + getTestSessionLayout(project, sessionId) { + return __awaiter2(this, void 0, void 0, function* () { + if (sessionId == null) { + throw new TypeError("sessionId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + sessionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "531e61ce-580d-4962-8591-0b2942b6bf78", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates Environment object in TCM data store + * + * @param {Contracts.TestSessionEnvironment[]} environments - Received Environment object. + * @param {string} project - Project ID or project name + */ + createEnvironment(environments, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "f9c2e9e4-9c9a-4c1d-9a7d-2b4c8a6f0d5f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, environments, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates Notification object in TCM data store for a given session + * + * @param {Contracts.TestSessionNotification[]} notifications - Notification(s) to add for the specified sessionId + * @param {string} project - Project ID or project name + * @param {number} sessionId - ID of Session to add Notification + */ + createNotification(notifications, project, sessionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + sessionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "ebff1c56-2188-4082-9d0e-1838a396f0c8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, notifications, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieves TestResultsSession Notification objects in TCM data store + * + * @param {string} project - Project ID or project name + * @param {number} sessionId - Id of TestResults session to obtain Notifications for. + */ + getSessionNotifications(project, sessionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + sessionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "ebff1c56-2188-4082-9d0e-1838a396f0c8", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add Test Results to test run session + * + * @param {Contracts.TestCaseResult[]} results + * @param {string} project - Project ID or project name + * @param {number} runId - RunId of test run + */ + addTestResultsToTestRunSession(results, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "ee6d95bf-7506-4c47-8100-9fed82cdc2f7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, results, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestCaseResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {Contracts.ResultDetails} detailsToInclude + * @param {number} skip + * @param {number} top + * @param {Contracts.TestOutcome[]} outcomes + * @param {boolean} newTestsOnly + */ + getTestSessionResults(project, runId, detailsToInclude, skip, top, outcomes, newTestsOnly) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + let queryValues = { + detailsToInclude, + "$skip": skip, + "$top": top, + outcomes: outcomes && outcomes.join(","), + "$newTestsOnly": newTestsOnly + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "ee6d95bf-7506-4c47-8100-9fed82cdc2f7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.TestCaseResult, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates TestResultsMRX objects in TCM data store for existing test results + * + * @param {Contracts.TestCaseResult[]} results - Results object with only test results MRX properties and existing testResultId + * @param {string} project - Project ID or project name + * @param {number} runId - RunId of test run + */ + updateTestResultsToTestRunSession(results, project, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "ee6d95bf-7506-4c47-8100-9fed82cdc2f7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, results, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.TestSettings} testSettings + * @param {string} project - Project ID or project name + */ + createTestSettings(testSettings, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "930bad47-f826-4099-9597-f44d0a9c735c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, testSettings, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} testSettingsId + */ + deleteTestSettings(project, testSettingsId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testSettingsId == null) { + throw new TypeError("testSettingsId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + testSettingsId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "930bad47-f826-4099-9597-f44d0a9c735c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} testSettingsId + */ + getTestSettingsById(project, testSettingsId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testSettingsId == null) { + throw new TypeError("testSettingsId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + testSettingsId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "testresults", "930bad47-f826-4099-9597-f44d0a9c735c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {Contracts.WorkItemToTestLinks} workItemToTestLinks + * @param {string} project - Project ID or project name + */ + addWorkItemToTestLinks(workItemToTestLinks, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "4e3abe63-ca46-4fe0-98b2-363f7ec7aa5f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, workItemToTestLinks, options); + let ret = this.formatResponse(res.result, Contracts.TypeInfo.WorkItemToTestLinks, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} testName + * @param {number} workItemId + */ + deleteTestMethodToWorkItemLink(project, testName, workItemId) { + return __awaiter2(this, void 0, void 0, function* () { + if (testName == null) { + throw new TypeError("testName can not be null or undefined"); + } + if (workItemId == null) { + throw new TypeError("workItemId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + testName, + workItemId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "cbd50bd7-f7ed-4e35-b127-4408ae6bfa2c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} testName + */ + queryTestMethodLinkedWorkItems(project, testName) { + return __awaiter2(this, void 0, void 0, function* () { + if (testName == null) { + throw new TypeError("testName can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + testName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "cbd50bd7-f7ed-4e35-b127-4408ae6bfa2c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} runId + * @param {number} testCaseResultId + */ + getTestResultWorkItemsById(project, runId, testCaseResultId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + runId, + testCaseResultId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "3d032fd6-e7a0-468b-b105-75d206f99aad", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Query Test Result WorkItems based on filter + * + * @param {string} project - Project ID or project name + * @param {string} workItemCategory - can take values Microsoft.BugCategory or all(for getting all workitems) + * @param {string} automatedTestName + * @param {number} testCaseId + * @param {Date} maxCompleteDate + * @param {number} days + * @param {number} workItemCount + */ + queryTestResultWorkItems(project, workItemCategory, automatedTestName, testCaseId, maxCompleteDate, days, workItemCount) { + return __awaiter2(this, void 0, void 0, function* () { + if (workItemCategory == null) { + throw new TypeError("workItemCategory can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + workItemCategory, + automatedTestName, + testCaseId, + maxCompleteDate, + days, + "$workItemCount": workItemCount + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "testresults", "f7401a26-331b-44fe-a470-f7ed35138e4a", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.TestResultsApi = TestResultsApi; + TestResultsApi.RESOURCE_AREA_ID = "c83eaf52-edf3-4034-ae11-17d38f25404c"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/TfvcInterfaces.js +var require_TfvcInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/TfvcInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.VersionControlRecursionType = exports2.VersionControlChangeType = exports2.TfvcVersionType = exports2.TfvcVersionOption = exports2.ItemContentType = void 0; + var TfsCoreInterfaces = require_CoreInterfaces(); + var ItemContentType; + (function(ItemContentType2) { + ItemContentType2[ItemContentType2["RawText"] = 0] = "RawText"; + ItemContentType2[ItemContentType2["Base64Encoded"] = 1] = "Base64Encoded"; + })(ItemContentType = exports2.ItemContentType || (exports2.ItemContentType = {})); + var TfvcVersionOption; + (function(TfvcVersionOption2) { + TfvcVersionOption2[TfvcVersionOption2["None"] = 0] = "None"; + TfvcVersionOption2[TfvcVersionOption2["Previous"] = 1] = "Previous"; + TfvcVersionOption2[TfvcVersionOption2["UseRename"] = 2] = "UseRename"; + })(TfvcVersionOption = exports2.TfvcVersionOption || (exports2.TfvcVersionOption = {})); + var TfvcVersionType; + (function(TfvcVersionType2) { + TfvcVersionType2[TfvcVersionType2["None"] = 0] = "None"; + TfvcVersionType2[TfvcVersionType2["Changeset"] = 1] = "Changeset"; + TfvcVersionType2[TfvcVersionType2["Shelveset"] = 2] = "Shelveset"; + TfvcVersionType2[TfvcVersionType2["Change"] = 3] = "Change"; + TfvcVersionType2[TfvcVersionType2["Date"] = 4] = "Date"; + TfvcVersionType2[TfvcVersionType2["Latest"] = 5] = "Latest"; + TfvcVersionType2[TfvcVersionType2["Tip"] = 6] = "Tip"; + TfvcVersionType2[TfvcVersionType2["MergeSource"] = 7] = "MergeSource"; + })(TfvcVersionType = exports2.TfvcVersionType || (exports2.TfvcVersionType = {})); + var VersionControlChangeType; + (function(VersionControlChangeType2) { + VersionControlChangeType2[VersionControlChangeType2["None"] = 0] = "None"; + VersionControlChangeType2[VersionControlChangeType2["Add"] = 1] = "Add"; + VersionControlChangeType2[VersionControlChangeType2["Edit"] = 2] = "Edit"; + VersionControlChangeType2[VersionControlChangeType2["Encoding"] = 4] = "Encoding"; + VersionControlChangeType2[VersionControlChangeType2["Rename"] = 8] = "Rename"; + VersionControlChangeType2[VersionControlChangeType2["Delete"] = 16] = "Delete"; + VersionControlChangeType2[VersionControlChangeType2["Undelete"] = 32] = "Undelete"; + VersionControlChangeType2[VersionControlChangeType2["Branch"] = 64] = "Branch"; + VersionControlChangeType2[VersionControlChangeType2["Merge"] = 128] = "Merge"; + VersionControlChangeType2[VersionControlChangeType2["Lock"] = 256] = "Lock"; + VersionControlChangeType2[VersionControlChangeType2["Rollback"] = 512] = "Rollback"; + VersionControlChangeType2[VersionControlChangeType2["SourceRename"] = 1024] = "SourceRename"; + VersionControlChangeType2[VersionControlChangeType2["TargetRename"] = 2048] = "TargetRename"; + VersionControlChangeType2[VersionControlChangeType2["Property"] = 4096] = "Property"; + VersionControlChangeType2[VersionControlChangeType2["All"] = 8191] = "All"; + })(VersionControlChangeType = exports2.VersionControlChangeType || (exports2.VersionControlChangeType = {})); + var VersionControlRecursionType; + (function(VersionControlRecursionType2) { + VersionControlRecursionType2[VersionControlRecursionType2["None"] = 0] = "None"; + VersionControlRecursionType2[VersionControlRecursionType2["OneLevel"] = 1] = "OneLevel"; + VersionControlRecursionType2[VersionControlRecursionType2["OneLevelPlusNestedEmptyFolders"] = 4] = "OneLevelPlusNestedEmptyFolders"; + VersionControlRecursionType2[VersionControlRecursionType2["Full"] = 120] = "Full"; + })(VersionControlRecursionType = exports2.VersionControlRecursionType || (exports2.VersionControlRecursionType = {})); + exports2.TypeInfo = { + Change: {}, + GitRepository: {}, + GitRepositoryRef: {}, + ItemContent: {}, + ItemContentType: { + enumValues: { + "rawText": 0, + "base64Encoded": 1 + } + }, + TfvcBranch: {}, + TfvcBranchRef: {}, + TfvcChange: {}, + TfvcChangeset: {}, + TfvcChangesetRef: {}, + TfvcItem: {}, + TfvcItemDescriptor: {}, + TfvcItemRequestData: {}, + TfvcLabel: {}, + TfvcLabelRef: {}, + TfvcShelveset: {}, + TfvcShelvesetRef: {}, + TfvcVersionDescriptor: {}, + TfvcVersionOption: { + enumValues: { + "none": 0, + "previous": 1, + "useRename": 2 + } + }, + TfvcVersionType: { + enumValues: { + "none": 0, + "changeset": 1, + "shelveset": 2, + "change": 3, + "date": 4, + "latest": 5, + "tip": 6, + "mergeSource": 7 + } + }, + VersionControlChangeType: { + enumValues: { + "none": 0, + "add": 1, + "edit": 2, + "encoding": 4, + "rename": 8, + "delete": 16, + "undelete": 32, + "branch": 64, + "merge": 128, + "lock": 256, + "rollback": 512, + "sourceRename": 1024, + "targetRename": 2048, + "property": 4096, + "all": 8191 + } + }, + VersionControlProjectInfo: {}, + VersionControlRecursionType: { + enumValues: { + "none": 0, + "oneLevel": 1, + "oneLevelPlusNestedEmptyFolders": 4, + "full": 120 + } + } + }; + exports2.TypeInfo.Change.fields = { + changeType: { + enumType: exports2.TypeInfo.VersionControlChangeType + }, + newContent: { + typeInfo: exports2.TypeInfo.ItemContent + } + }; + exports2.TypeInfo.GitRepository.fields = { + parentRepository: { + typeInfo: exports2.TypeInfo.GitRepositoryRef + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.GitRepositoryRef.fields = { + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + exports2.TypeInfo.ItemContent.fields = { + contentType: { + enumType: exports2.TypeInfo.ItemContentType + } + }; + exports2.TypeInfo.TfvcBranch.fields = { + children: { + isArray: true, + typeInfo: exports2.TypeInfo.TfvcBranch + }, + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcBranchRef.fields = { + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcChange.fields = { + changeType: { + enumType: exports2.TypeInfo.VersionControlChangeType + }, + newContent: { + typeInfo: exports2.TypeInfo.ItemContent + } + }; + exports2.TypeInfo.TfvcChangeset.fields = { + changes: { + isArray: true, + typeInfo: exports2.TypeInfo.TfvcChange + }, + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcChangesetRef.fields = { + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcItem.fields = { + changeDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcItemDescriptor.fields = { + recursionLevel: { + enumType: exports2.TypeInfo.VersionControlRecursionType + }, + versionOption: { + enumType: exports2.TypeInfo.TfvcVersionOption + }, + versionType: { + enumType: exports2.TypeInfo.TfvcVersionType + } + }; + exports2.TypeInfo.TfvcItemRequestData.fields = { + itemDescriptors: { + isArray: true, + typeInfo: exports2.TypeInfo.TfvcItemDescriptor + } + }; + exports2.TypeInfo.TfvcLabel.fields = { + items: { + isArray: true, + typeInfo: exports2.TypeInfo.TfvcItem + }, + modifiedDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcLabelRef.fields = { + modifiedDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcShelveset.fields = { + changes: { + isArray: true, + typeInfo: exports2.TypeInfo.TfvcChange + }, + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcShelvesetRef.fields = { + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.TfvcVersionDescriptor.fields = { + versionOption: { + enumType: exports2.TypeInfo.TfvcVersionOption + }, + versionType: { + enumType: exports2.TypeInfo.TfvcVersionType + } + }; + exports2.TypeInfo.VersionControlProjectInfo.fields = { + defaultSourceControlType: { + enumType: TfsCoreInterfaces.TypeInfo.SourceControlTypes + }, + project: { + typeInfo: TfsCoreInterfaces.TypeInfo.TeamProjectReference + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/TfvcApi.js +var require_TfvcApi = __commonJS({ + "../node_modules/azure-devops-node-api/TfvcApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TfvcApi = void 0; + var basem = require_ClientApiBases(); + var TfvcInterfaces = require_TfvcInterfaces(); + var TfvcApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Tfvc-api", options); + } + /** + * Get a single branch hierarchy at the given path with parents or children as specified. + * + * @param {string} path - Full path to the branch. Default: $/ Examples: $/, $/MyProject, $/MyProject/SomeFolder. + * @param {string} project - Project ID or project name + * @param {boolean} includeParent - Return the parent branch, if there is one. Default: False + * @param {boolean} includeChildren - Return child branches, if there are any. Default: False + */ + getBranch(path2, project, includeParent, includeChildren) { + return __awaiter2(this, void 0, void 0, function* () { + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + path: path2, + includeParent, + includeChildren + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "bc1f417e-239d-42e7-85e1-76e80cb2d6eb", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcBranch, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a collection of branch roots -- first-level children, branches with no parents. + * + * @param {string} project - Project ID or project name + * @param {boolean} includeParent - Return the parent branch, if there is one. Default: False + * @param {boolean} includeChildren - Return the child branches for each root branch. Default: False + * @param {boolean} includeDeleted - Return deleted branches. Default: False + * @param {boolean} includeLinks - Return links. Default: False + */ + getBranches(project, includeParent, includeChildren, includeDeleted, includeLinks) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + includeParent, + includeChildren, + includeDeleted, + includeLinks + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "bc1f417e-239d-42e7-85e1-76e80cb2d6eb", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcBranch, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get branch hierarchies below the specified scopePath + * + * @param {string} scopePath - Full path to the branch. Default: $/ Examples: $/, $/MyProject, $/MyProject/SomeFolder. + * @param {string} project - Project ID or project name + * @param {boolean} includeDeleted - Return deleted branches. Default: False + * @param {boolean} includeLinks - Return links. Default: False + */ + getBranchRefs(scopePath, project, includeDeleted, includeLinks) { + return __awaiter2(this, void 0, void 0, function* () { + if (scopePath == null) { + throw new TypeError("scopePath can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + scopePath, + includeDeleted, + includeLinks + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "bc1f417e-239d-42e7-85e1-76e80cb2d6eb", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcBranchRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve Tfvc changes for a given changeset. + * + * @param {number} id - ID of the changeset. Default: null + * @param {number} skip - Number of results to skip. Default: null + * @param {number} top - The maximum number of results to return. Default: null + */ + getChangesetChanges(id, skip, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + let queryValues = { + "$skip": skip, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "f32b86f2-15b9-4fe6-81b1-6f8938617ee5", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcChange, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a new changeset. + * + * @param {TfvcInterfaces.TfvcChangeset} changeset + * @param {string} project - Project ID or project name + */ + createChangeset(changeset, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "tfvc", "0bc8f0a4-6bfb-42a9-ba84-139da7b99c49", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, changeset, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcChangesetRef, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve a Tfvc Changeset + * + * @param {number} id - Changeset Id to retrieve. + * @param {string} project - Project ID or project name + * @param {number} maxChangeCount - Number of changes to return (maximum 100 changes) Default: 0 + * @param {boolean} includeDetails - Include policy details and check-in notes in the response. Default: false + * @param {boolean} includeWorkItems - Include workitems. Default: false + * @param {number} maxCommentLength - Include details about associated work items in the response. Default: null + * @param {boolean} includeSourceRename - Include renames. Default: false + * @param {number} skip - Number of results to skip. Default: null + * @param {number} top - The maximum number of results to return. Default: null + * @param {string} orderby - Results are sorted by ID in descending order by default. Use id asc to sort by ID in ascending order. + * @param {TfvcInterfaces.TfvcChangesetSearchCriteria} searchCriteria - Following criteria available (.itemPath, .version, .versionType, .versionOption, .author, .fromId, .toId, .fromDate, .toDate) Default: null + */ + getChangeset(id, project, maxChangeCount, includeDetails, includeWorkItems, maxCommentLength, includeSourceRename, skip, top, orderby, searchCriteria) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + let queryValues = { + maxChangeCount, + includeDetails, + includeWorkItems, + maxCommentLength, + includeSourceRename, + "$skip": skip, + "$top": top, + "$orderby": orderby, + searchCriteria + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "tfvc", "0bc8f0a4-6bfb-42a9-ba84-139da7b99c49", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcChangeset, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieve Tfvc Changesets + * + * @param {string} project - Project ID or project name + * @param {number} maxCommentLength - Include details about associated work items in the response. Default: null + * @param {number} skip - Number of results to skip. Default: null + * @param {number} top - The maximum number of results to return. Default: null + * @param {string} orderby - Results are sorted by ID in descending order by default. Use id asc to sort by ID in ascending order. + * @param {TfvcInterfaces.TfvcChangesetSearchCriteria} searchCriteria - Following criteria available (.itemPath, .version, .versionType, .versionOption, .author, .fromId, .toId, .fromDate, .toDate) Default: null + */ + getChangesets(project, maxCommentLength, skip, top, orderby, searchCriteria) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + maxCommentLength, + "$skip": skip, + "$top": top, + "$orderby": orderby, + searchCriteria + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "tfvc", "0bc8f0a4-6bfb-42a9-ba84-139da7b99c49", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcChangesetRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns changesets for a given list of changeset Ids. + * + * @param {TfvcInterfaces.TfvcChangesetsRequestData} changesetsRequestData - List of changeset IDs. + */ + getBatchedChangesets(changesetsRequestData) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "b7e7c173-803c-4fea-9ec8-31ee35c5502a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, changesetsRequestData, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcChangesetRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieves the work items associated with a particular changeset. + * + * @param {number} id - ID of the changeset. + */ + getChangesetWorkItems(id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "64ae0bea-1d71-47c9-a9e5-fe73f5ea0ff4", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path. + * + * @param {TfvcInterfaces.TfvcItemRequestData} itemRequestData + * @param {string} project - Project ID or project name + */ + getItemsBatch(itemRequestData, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "fe6f827b-5f64-480f-b8af-1eca3b80e833", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, itemRequestData, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcItem, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Post for retrieving a set of items given a list of paths or a long path. Allows for specifying the recursionLevel and version descriptors for each path. + * + * @param {TfvcInterfaces.TfvcItemRequestData} itemRequestData + * @param {string} project - Project ID or project name + */ + getItemsBatchZip(itemRequestData, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "fe6f827b-5f64-480f-b8af-1eca3b80e833", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. + * + * @param {string} path - Version control path of an individual item to return. + * @param {string} project - Project ID or project name + * @param {string} fileName - file name of item returned. + * @param {boolean} download - If true, create a downloadable attachment. + * @param {string} scopePath - Version control path of a folder to return multiple items. + * @param {TfvcInterfaces.VersionControlRecursionType} recursionLevel - None (just the item), or OneLevel (contents of a folder). + * @param {TfvcInterfaces.TfvcVersionDescriptor} versionDescriptor - Version descriptor. Default is null. + * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false. + */ + getItem(path2, project, fileName, download, scopePath, recursionLevel, versionDescriptor, includeContent) { + return __awaiter2(this, void 0, void 0, function* () { + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + path: path2, + fileName, + download, + scopePath, + recursionLevel, + versionDescriptor, + includeContent + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "ba9fc436-9a38-4578-89d6-e4f3241f5040", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcItem, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. + * + * @param {string} path - Version control path of an individual item to return. + * @param {string} project - Project ID or project name + * @param {string} fileName - file name of item returned. + * @param {boolean} download - If true, create a downloadable attachment. + * @param {string} scopePath - Version control path of a folder to return multiple items. + * @param {TfvcInterfaces.VersionControlRecursionType} recursionLevel - None (just the item), or OneLevel (contents of a folder). + * @param {TfvcInterfaces.TfvcVersionDescriptor} versionDescriptor - Version descriptor. Default is null. + * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false. + */ + getItemContent(path2, project, fileName, download, scopePath, recursionLevel, versionDescriptor, includeContent) { + return __awaiter2(this, void 0, void 0, function* () { + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + path: path2, + fileName, + download, + scopePath, + recursionLevel, + versionDescriptor, + includeContent + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "ba9fc436-9a38-4578-89d6-e4f3241f5040", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of Tfvc items + * + * @param {string} project - Project ID or project name + * @param {string} scopePath - Version control path of a folder to return multiple items. + * @param {TfvcInterfaces.VersionControlRecursionType} recursionLevel - None (just the item), or OneLevel (contents of a folder). + * @param {boolean} includeLinks - True to include links. + * @param {TfvcInterfaces.TfvcVersionDescriptor} versionDescriptor + */ + getItems(project, scopePath, recursionLevel, includeLinks, versionDescriptor) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + scopePath, + recursionLevel, + includeLinks, + versionDescriptor + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "ba9fc436-9a38-4578-89d6-e4f3241f5040", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcItem, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. + * + * @param {string} path - Version control path of an individual item to return. + * @param {string} project - Project ID or project name + * @param {string} fileName - file name of item returned. + * @param {boolean} download - If true, create a downloadable attachment. + * @param {string} scopePath - Version control path of a folder to return multiple items. + * @param {TfvcInterfaces.VersionControlRecursionType} recursionLevel - None (just the item), or OneLevel (contents of a folder). + * @param {TfvcInterfaces.TfvcVersionDescriptor} versionDescriptor - Version descriptor. Default is null. + * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false. + */ + getItemText(path2, project, fileName, download, scopePath, recursionLevel, versionDescriptor, includeContent) { + return __awaiter2(this, void 0, void 0, function* () { + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + path: path2, + fileName, + download, + scopePath, + recursionLevel, + versionDescriptor, + includeContent + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "ba9fc436-9a38-4578-89d6-e4f3241f5040", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get Item Metadata and/or Content for a single item. The download parameter is to indicate whether the content should be available as a download or just sent as a stream in the response. Doesn't apply to zipped content which is always returned as a download. + * + * @param {string} path - Version control path of an individual item to return. + * @param {string} project - Project ID or project name + * @param {string} fileName - file name of item returned. + * @param {boolean} download - If true, create a downloadable attachment. + * @param {string} scopePath - Version control path of a folder to return multiple items. + * @param {TfvcInterfaces.VersionControlRecursionType} recursionLevel - None (just the item), or OneLevel (contents of a folder). + * @param {TfvcInterfaces.TfvcVersionDescriptor} versionDescriptor - Version descriptor. Default is null. + * @param {boolean} includeContent - Set to true to include item content when requesting json. Default is false. + */ + getItemZip(path2, project, fileName, download, scopePath, recursionLevel, versionDescriptor, includeContent) { + return __awaiter2(this, void 0, void 0, function* () { + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + path: path2, + fileName, + download, + scopePath, + recursionLevel, + versionDescriptor, + includeContent + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "ba9fc436-9a38-4578-89d6-e4f3241f5040", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get items under a label. + * + * @param {string} labelId - Unique identifier of label + * @param {number} top - Max number of items to return + * @param {number} skip - Number of items to skip + */ + getLabelItems(labelId, top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + labelId + }; + let queryValues = { + "$top": top, + "$skip": skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "06166e34-de17-4b60-8cd1-23182a346fda", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcItem, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a single deep label. + * + * @param {string} labelId - Unique identifier of label + * @param {TfvcInterfaces.TfvcLabelRequestData} requestData - maxItemCount + * @param {string} project - Project ID or project name + */ + getLabel(labelId, requestData, project) { + return __awaiter2(this, void 0, void 0, function* () { + if (requestData == null) { + throw new TypeError("requestData can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + labelId + }; + let queryValues = { + requestData + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "a5d9bd7f-b661-4d0e-b9be-d9c16affae54", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcLabel, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a collection of shallow label references. + * + * @param {TfvcInterfaces.TfvcLabelRequestData} requestData - labelScope, name, owner, and itemLabelFilter + * @param {string} project - Project ID or project name + * @param {number} top - Max number of labels to return, defaults to 100 when undefined + * @param {number} skip - Number of labels to skip + */ + getLabels(requestData, project, top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + if (requestData == null) { + throw new TypeError("requestData can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + requestData, + "$top": top, + "$skip": skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "a5d9bd7f-b661-4d0e-b9be-d9c16affae54", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcLabelRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get changes included in a shelveset. + * + * @param {string} shelvesetId - Shelveset's unique ID + * @param {number} top - Max number of changes to return + * @param {number} skip - Number of changes to skip + */ + getShelvesetChanges(shelvesetId, top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + if (shelvesetId == null) { + throw new TypeError("shelvesetId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + shelvesetId, + "$top": top, + "$skip": skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "dbaf075b-0445-4c34-9e5b-82292f856522", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcChange, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a single deep shelveset. + * + * @param {string} shelvesetId - Shelveset's unique ID + * @param {TfvcInterfaces.TfvcShelvesetRequestData} requestData - includeDetails, includeWorkItems, maxChangeCount, and maxCommentLength + */ + getShelveset(shelvesetId, requestData) { + return __awaiter2(this, void 0, void 0, function* () { + if (shelvesetId == null) { + throw new TypeError("shelvesetId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + shelvesetId, + requestData + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "e36d44fb-e907-4b0a-b194-f83f1ed32ad3", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcShelveset, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Return a collection of shallow shelveset references. + * + * @param {TfvcInterfaces.TfvcShelvesetRequestData} requestData - name, owner, and maxCommentLength + * @param {number} top - Max number of shelvesets to return + * @param {number} skip - Number of shelvesets to skip + */ + getShelvesets(requestData, top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + requestData, + "$top": top, + "$skip": skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "e36d44fb-e907-4b0a-b194-f83f1ed32ad3", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, TfvcInterfaces.TypeInfo.TfvcShelvesetRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get work items associated with a shelveset. + * + * @param {string} shelvesetId - Shelveset's unique ID + */ + getShelvesetWorkItems(shelvesetId) { + return __awaiter2(this, void 0, void 0, function* () { + if (shelvesetId == null) { + throw new TypeError("shelvesetId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + shelvesetId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "a7a0c1c1-373e-425a-b031-a519474d743d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Provides File Count and Uncompressed Bytes for a Collection/Project at a particular scope for TFVC. + * + * @param {string} project - Project ID or project name + * @param {string} scopePath - '$/' for collection, '$/project' for specific project + */ + getTfvcStatistics(project, scopePath) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + scopePath + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "tfvc", "e15c74c0-3605-40e0-aed4-4cc61e549ed8", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.TfvcApi = TfvcApi; + TfvcApi.RESOURCE_AREA_ID = "8aa40520-446d-40e6-89f6-9c9f9ce44c48"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/CommentsInterfaces.js +var require_CommentsInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/CommentsInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.CommentState = exports2.CommentSortOrder = exports2.CommentReactionType = exports2.CommentMentionType = exports2.CommentFormat = exports2.CommentExpandOptions = void 0; + var CommentExpandOptions; + (function(CommentExpandOptions2) { + CommentExpandOptions2[CommentExpandOptions2["None"] = 0] = "None"; + CommentExpandOptions2[CommentExpandOptions2["Reactions"] = 1] = "Reactions"; + CommentExpandOptions2[CommentExpandOptions2["RenderedText"] = 8] = "RenderedText"; + CommentExpandOptions2[CommentExpandOptions2["RenderedTextOnly"] = 16] = "RenderedTextOnly"; + CommentExpandOptions2[CommentExpandOptions2["Children"] = 32] = "Children"; + CommentExpandOptions2[CommentExpandOptions2["All"] = -17] = "All"; + })(CommentExpandOptions = exports2.CommentExpandOptions || (exports2.CommentExpandOptions = {})); + var CommentFormat; + (function(CommentFormat2) { + CommentFormat2[CommentFormat2["Markdown"] = 0] = "Markdown"; + CommentFormat2[CommentFormat2["Html"] = 1] = "Html"; + })(CommentFormat = exports2.CommentFormat || (exports2.CommentFormat = {})); + var CommentMentionType; + (function(CommentMentionType2) { + CommentMentionType2[CommentMentionType2["Person"] = 0] = "Person"; + CommentMentionType2[CommentMentionType2["WorkItem"] = 1] = "WorkItem"; + CommentMentionType2[CommentMentionType2["PullRequest"] = 2] = "PullRequest"; + })(CommentMentionType = exports2.CommentMentionType || (exports2.CommentMentionType = {})); + var CommentReactionType; + (function(CommentReactionType2) { + CommentReactionType2[CommentReactionType2["Like"] = 0] = "Like"; + CommentReactionType2[CommentReactionType2["Dislike"] = 1] = "Dislike"; + CommentReactionType2[CommentReactionType2["Heart"] = 2] = "Heart"; + CommentReactionType2[CommentReactionType2["Hooray"] = 3] = "Hooray"; + CommentReactionType2[CommentReactionType2["Smile"] = 4] = "Smile"; + CommentReactionType2[CommentReactionType2["Confused"] = 5] = "Confused"; + })(CommentReactionType = exports2.CommentReactionType || (exports2.CommentReactionType = {})); + var CommentSortOrder; + (function(CommentSortOrder2) { + CommentSortOrder2[CommentSortOrder2["Asc"] = 1] = "Asc"; + CommentSortOrder2[CommentSortOrder2["Desc"] = 2] = "Desc"; + })(CommentSortOrder = exports2.CommentSortOrder || (exports2.CommentSortOrder = {})); + var CommentState; + (function(CommentState2) { + CommentState2[CommentState2["Active"] = 0] = "Active"; + CommentState2[CommentState2["Resolved"] = 1] = "Resolved"; + CommentState2[CommentState2["Closed"] = 2] = "Closed"; + })(CommentState = exports2.CommentState || (exports2.CommentState = {})); + exports2.TypeInfo = { + Comment: {}, + CommentAttachment: {}, + CommentExpandOptions: { + enumValues: { + "none": 0, + "reactions": 1, + "renderedText": 8, + "renderedTextOnly": 16, + "children": 32, + "all": -17 + } + }, + CommentFormat: { + enumValues: { + "markdown": 0, + "html": 1 + } + }, + CommentList: {}, + CommentMention: {}, + CommentMentionType: { + enumValues: { + "person": 0, + "workItem": 1, + "pullRequest": 2 + } + }, + CommentReaction: {}, + CommentReactionType: { + enumValues: { + "like": 0, + "dislike": 1, + "heart": 2, + "hooray": 3, + "smile": 4, + "confused": 5 + } + }, + CommentSortOrder: { + enumValues: { + "asc": 1, + "desc": 2 + } + }, + CommentState: { + enumValues: { + "active": 0, + "resolved": 1, + "closed": 2 + } + }, + CommentUpdateParameters: {}, + CommentVersion: {} + }; + exports2.TypeInfo.Comment.fields = { + createdDate: { + isDate: true + }, + mentions: { + isArray: true, + typeInfo: exports2.TypeInfo.CommentMention + }, + modifiedDate: { + isDate: true + }, + reactions: { + isArray: true, + typeInfo: exports2.TypeInfo.CommentReaction + }, + replies: { + typeInfo: exports2.TypeInfo.CommentList + }, + state: { + enumType: exports2.TypeInfo.CommentState + } + }; + exports2.TypeInfo.CommentAttachment.fields = { + createdDate: { + isDate: true + } + }; + exports2.TypeInfo.CommentList.fields = { + comments: { + isArray: true, + typeInfo: exports2.TypeInfo.Comment + } + }; + exports2.TypeInfo.CommentMention.fields = { + type: { + enumType: exports2.TypeInfo.CommentMentionType + } + }; + exports2.TypeInfo.CommentReaction.fields = { + type: { + enumType: exports2.TypeInfo.CommentReactionType + } + }; + exports2.TypeInfo.CommentUpdateParameters.fields = { + state: { + enumType: exports2.TypeInfo.CommentState + } + }; + exports2.TypeInfo.CommentVersion.fields = { + createdDate: { + isDate: true + }, + modifiedDate: { + isDate: true + }, + state: { + enumType: exports2.TypeInfo.CommentState + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/WikiInterfaces.js +var require_WikiInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/WikiInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.WikiType = void 0; + var GitInterfaces = require_GitInterfaces(); + var WikiType; + (function(WikiType2) { + WikiType2[WikiType2["ProjectWiki"] = 0] = "ProjectWiki"; + WikiType2[WikiType2["CodeWiki"] = 1] = "CodeWiki"; + })(WikiType = exports2.WikiType || (exports2.WikiType = {})); + exports2.TypeInfo = { + Wiki: {}, + WikiCreateBaseParameters: {}, + WikiCreateParametersV2: {}, + WikiPageDetail: {}, + WikiPageStat: {}, + WikiPageViewStats: {}, + WikiType: { + enumValues: { + "projectWiki": 0, + "codeWiki": 1 + } + }, + WikiUpdateParameters: {}, + WikiV2: {} + }; + exports2.TypeInfo.Wiki.fields = { + repository: { + typeInfo: GitInterfaces.TypeInfo.GitRepository + } + }; + exports2.TypeInfo.WikiCreateBaseParameters.fields = { + type: { + enumType: exports2.TypeInfo.WikiType + } + }; + exports2.TypeInfo.WikiCreateParametersV2.fields = { + type: { + enumType: exports2.TypeInfo.WikiType + }, + version: { + typeInfo: GitInterfaces.TypeInfo.GitVersionDescriptor + } + }; + exports2.TypeInfo.WikiPageDetail.fields = { + viewStats: { + isArray: true, + typeInfo: exports2.TypeInfo.WikiPageStat + } + }; + exports2.TypeInfo.WikiPageStat.fields = { + day: { + isDate: true + } + }; + exports2.TypeInfo.WikiPageViewStats.fields = { + lastViewedTime: { + isDate: true + } + }; + exports2.TypeInfo.WikiUpdateParameters.fields = { + versions: { + isArray: true, + typeInfo: GitInterfaces.TypeInfo.GitVersionDescriptor + } + }; + exports2.TypeInfo.WikiV2.fields = { + type: { + enumType: exports2.TypeInfo.WikiType + }, + versions: { + isArray: true, + typeInfo: GitInterfaces.TypeInfo.GitVersionDescriptor + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/WikiApi.js +var require_WikiApi = __commonJS({ + "../node_modules/azure-devops-node-api/WikiApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WikiApi = void 0; + var basem = require_ClientApiBases(); + var Comments_Contracts = require_CommentsInterfaces(); + var WikiInterfaces = require_WikiInterfaces(); + var WikiApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Wiki-api", options); + } + /** + * Uploads an attachment on a comment on a wiki page. + * + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {number} pageId - Wiki page ID. + */ + createCommentAttachment(customHeaders, contentStream, project, wikiIdentifier, pageId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + pageId + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "5100d976-363d-42e7-a19d-4171ecb44782", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("POST", url, contentStream, options); + let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.CommentAttachment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Downloads an attachment on a comment on a wiki page. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {number} pageId - Wiki page ID. + * @param {string} attachmentId - Attachment ID. + */ + getAttachmentContent(project, wikiIdentifier, pageId, attachmentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + pageId, + attachmentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "5100d976-363d-42e7-a19d-4171ecb44782", routeValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add a reaction on a wiki page comment. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name + * @param {number} pageId - Wiki page ID + * @param {number} commentId - ID of the associated comment + * @param {Comments_Contracts.CommentReactionType} type - Type of the reaction being added + */ + addCommentReaction(project, wikiIdentifier, pageId, commentId, type) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + pageId, + commentId, + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "7a5bc693-aab7-4d48-8f34-36f373022063", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.CommentReaction, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a reaction on a wiki page comment. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or name + * @param {number} pageId - Wiki page ID + * @param {number} commentId - ID of the associated comment + * @param {Comments_Contracts.CommentReactionType} type - Type of the reaction being deleted + */ + deleteCommentReaction(project, wikiIdentifier, pageId, commentId, type) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + pageId, + commentId, + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "7a5bc693-aab7-4d48-8f34-36f373022063", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.CommentReaction, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a list of users who have reacted for the given wiki comment with a given reaction type. Supports paging, with a default page size of 100 users at a time. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {number} pageId - Wiki page ID. + * @param {number} commentId - ID of the associated comment + * @param {Comments_Contracts.CommentReactionType} type - Type of the reaction for which the engaged users are being requested + * @param {number} top - Number of enagaged users to be returned in a given page. Optional, defaults to 100 + * @param {number} skip - Number of engaged users to be skipped to page the next set of engaged users, defaults to 0 + */ + getEngagedUsers(project, wikiIdentifier, pageId, commentId, type, top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + pageId, + commentId, + type + }; + let queryValues = { + "$top": top, + "$skip": skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "598a5268-41a7-4162-b7dc-344131e4d1fa", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add a comment on a wiki page. + * + * @param {Comments_Contracts.CommentCreateParameters} request - Comment create request. + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {number} pageId - Wiki page ID. + */ + addComment(request, project, wikiIdentifier, pageId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + pageId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "9b394e93-7db5-46cb-9c26-09a36aa5c895", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, request, options); + let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.Comment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a comment on a wiki page. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or name. + * @param {number} pageId - Wiki page ID. + * @param {number} id - Comment ID. + */ + deleteComment(project, wikiIdentifier, pageId, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + pageId, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "9b394e93-7db5-46cb-9c26-09a36aa5c895", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a comment associated with the Wiki Page. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {number} pageId - Wiki page ID. + * @param {number} id - ID of the comment to return. + * @param {boolean} excludeDeleted - Specify if the deleted comment should be skipped. + * @param {Comments_Contracts.CommentExpandOptions} expand - Specifies the additional data retrieval options for comments. + */ + getComment(project, wikiIdentifier, pageId, id, excludeDeleted, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + pageId, + id + }; + let queryValues = { + excludeDeleted, + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "9b394e93-7db5-46cb-9c26-09a36aa5c895", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.Comment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a pageable list of comments. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {number} pageId - Wiki page ID. + * @param {number} top - Max number of comments to return. + * @param {string} continuationToken - Used to query for the next page of comments. + * @param {boolean} excludeDeleted - Specify if the deleted comments should be skipped. + * @param {Comments_Contracts.CommentExpandOptions} expand - Specifies the additional data retrieval options for comments. + * @param {Comments_Contracts.CommentSortOrder} order - Order in which the comments should be returned. + * @param {number} parentId - CommentId of the parent comment. + */ + listComments(project, wikiIdentifier, pageId, top, continuationToken, excludeDeleted, expand, order, parentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + pageId + }; + let queryValues = { + "$top": top, + continuationToken, + excludeDeleted, + "$expand": expand, + order, + parentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "9b394e93-7db5-46cb-9c26-09a36aa5c895", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.CommentList, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a comment on a wiki page. + * + * @param {Comments_Contracts.CommentUpdateParameters} comment - Comment update request. + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {number} pageId - Wiki page ID. + * @param {number} id - Comment ID. + */ + updateComment(comment, project, wikiIdentifier, pageId, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + pageId, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "9b394e93-7db5-46cb-9c26-09a36aa5c895", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, comment, options); + let ret = this.formatResponse(res.result, Comments_Contracts.TypeInfo.Comment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets metadata or content of the wiki page for the provided path. Content negotiation is done based on the `Accept` header sent in the request. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {string} path - Wiki page path. + * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - Recursion level for subpages retrieval. Defaults to `None` (Optional). + * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - GitVersionDescriptor for the page. Defaults to the default branch (Optional). + * @param {boolean} includeContent - True to include the content of the page in the response for Json content type. Defaults to false (Optional) + */ + getPageText(project, wikiIdentifier, path2, recursionLevel, versionDescriptor, includeContent) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier + }; + let queryValues = { + path: path2, + recursionLevel, + versionDescriptor, + includeContent + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets metadata or content of the wiki page for the provided path. Content negotiation is done based on the `Accept` header sent in the request. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {string} path - Wiki page path. + * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - Recursion level for subpages retrieval. Defaults to `None` (Optional). + * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - GitVersionDescriptor for the page. Defaults to the default branch (Optional). + * @param {boolean} includeContent - True to include the content of the page in the response for Json content type. Defaults to false (Optional) + */ + getPageZip(project, wikiIdentifier, path2, recursionLevel, versionDescriptor, includeContent) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier + }; + let queryValues = { + path: path2, + recursionLevel, + versionDescriptor, + includeContent + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "25d3fbc7-fe3d-46cb-b5a5-0b6f79caf27b", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets metadata or content of the wiki page for the provided page id. Content negotiation is done based on the `Accept` header sent in the request. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name.. + * @param {number} id - Wiki page ID. + * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - Recursion level for subpages retrieval. Defaults to `None` (Optional). + * @param {boolean} includeContent - True to include the content of the page in the response for Json content type. Defaults to false (Optional) + */ + getPageByIdText(project, wikiIdentifier, id, recursionLevel, includeContent) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + id + }; + let queryValues = { + recursionLevel, + includeContent + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "ceddcf75-1068-452d-8b13-2d4d76e1f970", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("text/plain", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets metadata or content of the wiki page for the provided page id. Content negotiation is done based on the `Accept` header sent in the request. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name.. + * @param {number} id - Wiki page ID. + * @param {GitInterfaces.VersionControlRecursionType} recursionLevel - Recursion level for subpages retrieval. Defaults to `None` (Optional). + * @param {boolean} includeContent - True to include the content of the page in the response for Json content type. Defaults to false (Optional) + */ + getPageByIdZip(project, wikiIdentifier, id, recursionLevel, includeContent) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + id + }; + let queryValues = { + recursionLevel, + includeContent + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "ceddcf75-1068-452d-8b13-2d4d76e1f970", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns pageable list of Wiki Pages + * + * @param {WikiInterfaces.WikiPagesBatchRequest} pagesBatchRequest - Wiki batch page request. + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {GitInterfaces.GitVersionDescriptor} versionDescriptor - GitVersionDescriptor for the page. (Optional in case of ProjectWiki). + */ + getPagesBatch(pagesBatchRequest, project, wikiIdentifier, versionDescriptor) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier + }; + let queryValues = { + versionDescriptor + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "71323c46-2592-4398-8771-ced73dd87207", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, pagesBatchRequest, options); + let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiPageDetail, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns page detail corresponding to Page ID. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {number} pageId - Wiki page ID. + * @param {number} pageViewsForDays - last N days from the current day for which page views is to be returned. It's inclusive of current day. + */ + getPageData(project, wikiIdentifier, pageId, pageViewsForDays) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier, + pageId + }; + let queryValues = { + pageViewsForDays + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "81c4e0fe-7663-4d62-ad46-6ab78459f274", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiPageDetail, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a new page view stats resource or updates an existing page view stats resource. + * + * @param {string} project - Project ID or project name + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {GitInterfaces.GitVersionDescriptor} wikiVersion - Wiki version. + * @param {string} path - Wiki page path. + * @param {string} oldPath - Old page path. This is optional and required to rename path in existing page view stats. + */ + createOrUpdatePageViewStats(project, wikiIdentifier, wikiVersion, path2, oldPath) { + return __awaiter2(this, void 0, void 0, function* () { + if (wikiVersion == null) { + throw new TypeError("wikiVersion can not be null or undefined"); + } + if (path2 == null) { + throw new TypeError("path can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier + }; + let queryValues = { + wikiVersion, + path: path2, + oldPath + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "wiki", "1087b746-5d15-41b9-bea6-14e325e7f880", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, null, options); + let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiPageViewStats, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates the wiki resource. + * + * @param {WikiInterfaces.WikiCreateParametersV2} wikiCreateParams - Parameters for the wiki creation. + * @param {string} project - Project ID or project name + */ + createWiki(wikiCreateParams, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "wiki", "288d122c-dbd4-451d-aa5f-7dbbba070728", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, wikiCreateParams, options); + let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiV2, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes the wiki corresponding to the wiki ID or wiki name provided. + * + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {string} project - Project ID or project name + */ + deleteWiki(wikiIdentifier, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "wiki", "288d122c-dbd4-451d-aa5f-7dbbba070728", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiV2, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets all wikis in a project or collection. + * + * @param {string} project - Project ID or project name + */ + getAllWikis(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "wiki", "288d122c-dbd4-451d-aa5f-7dbbba070728", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiV2, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the wiki corresponding to the wiki ID or wiki name provided. + * + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {string} project - Project ID or project name + */ + getWiki(wikiIdentifier, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "wiki", "288d122c-dbd4-451d-aa5f-7dbbba070728", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiV2, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates the wiki corresponding to the wiki ID or wiki name provided using the update parameters. + * + * @param {WikiInterfaces.WikiUpdateParameters} updateParameters - Update parameters. + * @param {string} wikiIdentifier - Wiki ID or wiki name. + * @param {string} project - Project ID or project name + */ + updateWiki(updateParameters, wikiIdentifier, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + wikiIdentifier + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "wiki", "288d122c-dbd4-451d-aa5f-7dbbba070728", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, updateParameters, options); + let ret = this.formatResponse(res.result, WikiInterfaces.TypeInfo.WikiV2, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.WikiApi = WikiApi; + WikiApi.RESOURCE_AREA_ID = "bf7d82a0-8aa5-4613-94ef-6172a5ea01f3"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/common/System.js +var require_System = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/common/System.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.DayOfWeek = void 0; + var DayOfWeek; + (function(DayOfWeek2) { + DayOfWeek2[DayOfWeek2["Sunday"] = 0] = "Sunday"; + DayOfWeek2[DayOfWeek2["Monday"] = 1] = "Monday"; + DayOfWeek2[DayOfWeek2["Tuesday"] = 2] = "Tuesday"; + DayOfWeek2[DayOfWeek2["Wednesday"] = 3] = "Wednesday"; + DayOfWeek2[DayOfWeek2["Thursday"] = 4] = "Thursday"; + DayOfWeek2[DayOfWeek2["Friday"] = 5] = "Friday"; + DayOfWeek2[DayOfWeek2["Saturday"] = 6] = "Saturday"; + })(DayOfWeek = exports2.DayOfWeek || (exports2.DayOfWeek = {})); + exports2.TypeInfo = { + DayOfWeek: { + enumValues: { + "sunday": 0, + "monday": 1, + "tuesday": 2, + "wednesday": 3, + "thursday": 4, + "friday": 5, + "saturday": 6 + } + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/WorkInterfaces.js +var require_WorkInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/WorkInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.TimelineTeamStatusCode = exports2.TimelineIterationStatusCode = exports2.TimelineCriteriaStatusCode = exports2.TimeFrame = exports2.PlanUserPermissions = exports2.PlanType = exports2.IdentityDisplayFormat = exports2.FieldType = exports2.BugsBehavior = exports2.BoardColumnType = exports2.BoardBadgeColumnOptions = exports2.BacklogType = void 0; + var SystemInterfaces = require_System(); + var BacklogType; + (function(BacklogType2) { + BacklogType2[BacklogType2["Portfolio"] = 0] = "Portfolio"; + BacklogType2[BacklogType2["Requirement"] = 1] = "Requirement"; + BacklogType2[BacklogType2["Task"] = 2] = "Task"; + })(BacklogType = exports2.BacklogType || (exports2.BacklogType = {})); + var BoardBadgeColumnOptions; + (function(BoardBadgeColumnOptions2) { + BoardBadgeColumnOptions2[BoardBadgeColumnOptions2["InProgressColumns"] = 0] = "InProgressColumns"; + BoardBadgeColumnOptions2[BoardBadgeColumnOptions2["AllColumns"] = 1] = "AllColumns"; + BoardBadgeColumnOptions2[BoardBadgeColumnOptions2["CustomColumns"] = 2] = "CustomColumns"; + })(BoardBadgeColumnOptions = exports2.BoardBadgeColumnOptions || (exports2.BoardBadgeColumnOptions = {})); + var BoardColumnType; + (function(BoardColumnType2) { + BoardColumnType2[BoardColumnType2["Incoming"] = 0] = "Incoming"; + BoardColumnType2[BoardColumnType2["InProgress"] = 1] = "InProgress"; + BoardColumnType2[BoardColumnType2["Outgoing"] = 2] = "Outgoing"; + })(BoardColumnType = exports2.BoardColumnType || (exports2.BoardColumnType = {})); + var BugsBehavior; + (function(BugsBehavior2) { + BugsBehavior2[BugsBehavior2["Off"] = 0] = "Off"; + BugsBehavior2[BugsBehavior2["AsRequirements"] = 1] = "AsRequirements"; + BugsBehavior2[BugsBehavior2["AsTasks"] = 2] = "AsTasks"; + })(BugsBehavior = exports2.BugsBehavior || (exports2.BugsBehavior = {})); + var FieldType; + (function(FieldType2) { + FieldType2[FieldType2["String"] = 0] = "String"; + FieldType2[FieldType2["PlainText"] = 1] = "PlainText"; + FieldType2[FieldType2["Integer"] = 2] = "Integer"; + FieldType2[FieldType2["DateTime"] = 3] = "DateTime"; + FieldType2[FieldType2["TreePath"] = 4] = "TreePath"; + FieldType2[FieldType2["Boolean"] = 5] = "Boolean"; + FieldType2[FieldType2["Double"] = 6] = "Double"; + })(FieldType = exports2.FieldType || (exports2.FieldType = {})); + var IdentityDisplayFormat; + (function(IdentityDisplayFormat2) { + IdentityDisplayFormat2[IdentityDisplayFormat2["AvatarOnly"] = 0] = "AvatarOnly"; + IdentityDisplayFormat2[IdentityDisplayFormat2["FullName"] = 1] = "FullName"; + IdentityDisplayFormat2[IdentityDisplayFormat2["AvatarAndFullName"] = 2] = "AvatarAndFullName"; + })(IdentityDisplayFormat = exports2.IdentityDisplayFormat || (exports2.IdentityDisplayFormat = {})); + var PlanType; + (function(PlanType2) { + PlanType2[PlanType2["DeliveryTimelineView"] = 0] = "DeliveryTimelineView"; + })(PlanType = exports2.PlanType || (exports2.PlanType = {})); + var PlanUserPermissions; + (function(PlanUserPermissions2) { + PlanUserPermissions2[PlanUserPermissions2["None"] = 0] = "None"; + PlanUserPermissions2[PlanUserPermissions2["View"] = 1] = "View"; + PlanUserPermissions2[PlanUserPermissions2["Edit"] = 2] = "Edit"; + PlanUserPermissions2[PlanUserPermissions2["Delete"] = 4] = "Delete"; + PlanUserPermissions2[PlanUserPermissions2["Manage"] = 8] = "Manage"; + PlanUserPermissions2[PlanUserPermissions2["AllPermissions"] = 15] = "AllPermissions"; + })(PlanUserPermissions = exports2.PlanUserPermissions || (exports2.PlanUserPermissions = {})); + var TimeFrame; + (function(TimeFrame2) { + TimeFrame2[TimeFrame2["Past"] = 0] = "Past"; + TimeFrame2[TimeFrame2["Current"] = 1] = "Current"; + TimeFrame2[TimeFrame2["Future"] = 2] = "Future"; + })(TimeFrame = exports2.TimeFrame || (exports2.TimeFrame = {})); + var TimelineCriteriaStatusCode; + (function(TimelineCriteriaStatusCode2) { + TimelineCriteriaStatusCode2[TimelineCriteriaStatusCode2["OK"] = 0] = "OK"; + TimelineCriteriaStatusCode2[TimelineCriteriaStatusCode2["InvalidFilterClause"] = 1] = "InvalidFilterClause"; + TimelineCriteriaStatusCode2[TimelineCriteriaStatusCode2["Unknown"] = 2] = "Unknown"; + })(TimelineCriteriaStatusCode = exports2.TimelineCriteriaStatusCode || (exports2.TimelineCriteriaStatusCode = {})); + var TimelineIterationStatusCode; + (function(TimelineIterationStatusCode2) { + TimelineIterationStatusCode2[TimelineIterationStatusCode2["OK"] = 0] = "OK"; + TimelineIterationStatusCode2[TimelineIterationStatusCode2["IsOverlapping"] = 1] = "IsOverlapping"; + })(TimelineIterationStatusCode = exports2.TimelineIterationStatusCode || (exports2.TimelineIterationStatusCode = {})); + var TimelineTeamStatusCode; + (function(TimelineTeamStatusCode2) { + TimelineTeamStatusCode2[TimelineTeamStatusCode2["OK"] = 0] = "OK"; + TimelineTeamStatusCode2[TimelineTeamStatusCode2["DoesntExistOrAccessDenied"] = 1] = "DoesntExistOrAccessDenied"; + TimelineTeamStatusCode2[TimelineTeamStatusCode2["MaxTeamsExceeded"] = 2] = "MaxTeamsExceeded"; + TimelineTeamStatusCode2[TimelineTeamStatusCode2["MaxTeamFieldsExceeded"] = 3] = "MaxTeamFieldsExceeded"; + TimelineTeamStatusCode2[TimelineTeamStatusCode2["BacklogInError"] = 4] = "BacklogInError"; + TimelineTeamStatusCode2[TimelineTeamStatusCode2["MissingTeamFieldValue"] = 5] = "MissingTeamFieldValue"; + TimelineTeamStatusCode2[TimelineTeamStatusCode2["NoIterationsExist"] = 6] = "NoIterationsExist"; + })(TimelineTeamStatusCode = exports2.TimelineTeamStatusCode || (exports2.TimelineTeamStatusCode = {})); + exports2.TypeInfo = { + BacklogConfiguration: {}, + BacklogLevelConfiguration: {}, + BacklogType: { + enumValues: { + "portfolio": 0, + "requirement": 1, + "task": 2 + } + }, + Board: {}, + BoardBadgeColumnOptions: { + enumValues: { + "inProgressColumns": 0, + "allColumns": 1, + "customColumns": 2 + } + }, + BoardColumn: {}, + BoardColumnType: { + enumValues: { + "incoming": 0, + "inProgress": 1, + "outgoing": 2 + } + }, + BugsBehavior: { + enumValues: { + "off": 0, + "asRequirements": 1, + "asTasks": 2 + } + }, + CapacityContractBase: {}, + CapacityPatch: {}, + CardFieldSettings: {}, + CardSettings: {}, + CreatePlan: {}, + DateRange: {}, + DeliveryViewData: {}, + DeliveryViewPropertyCollection: {}, + FieldInfo: {}, + FieldType: { + enumValues: { + "string": 0, + "plainText": 1, + "integer": 2, + "dateTime": 3, + "treePath": 4, + "boolean": 5, + "double": 6 + } + }, + IdentityDisplayFormat: { + enumValues: { + "avatarOnly": 0, + "fullName": 1, + "avatarAndFullName": 2 + } + }, + Marker: {}, + Plan: {}, + PlanMetadata: {}, + PlanType: { + enumValues: { + "deliveryTimelineView": 0 + } + }, + PlanUserPermissions: { + enumValues: { + "none": 0, + "view": 1, + "edit": 2, + "delete": 4, + "manage": 8, + "allPermissions": 15 + } + }, + TeamCapacity: {}, + TeamIterationAttributes: {}, + TeamMemberCapacity: {}, + TeamMemberCapacityIdentityRef: {}, + TeamSetting: {}, + TeamSettingsDaysOff: {}, + TeamSettingsDaysOffPatch: {}, + TeamSettingsIteration: {}, + TeamSettingsPatch: {}, + TimeFrame: { + enumValues: { + "past": 0, + "current": 1, + "future": 2 + } + }, + TimelineCriteriaStatus: {}, + TimelineCriteriaStatusCode: { + enumValues: { + "ok": 0, + "invalidFilterClause": 1, + "unknown": 2 + } + }, + TimelineIterationStatus: {}, + TimelineIterationStatusCode: { + enumValues: { + "ok": 0, + "isOverlapping": 1 + } + }, + TimelineTeamData: {}, + TimelineTeamIteration: {}, + TimelineTeamStatus: {}, + TimelineTeamStatusCode: { + enumValues: { + "ok": 0, + "doesntExistOrAccessDenied": 1, + "maxTeamsExceeded": 2, + "maxTeamFieldsExceeded": 3, + "backlogInError": 4, + "missingTeamFieldValue": 5, + "noIterationsExist": 6 + } + }, + UpdatePlan: {} + }; + exports2.TypeInfo.BacklogConfiguration.fields = { + bugsBehavior: { + enumType: exports2.TypeInfo.BugsBehavior + }, + portfolioBacklogs: { + isArray: true, + typeInfo: exports2.TypeInfo.BacklogLevelConfiguration + }, + requirementBacklog: { + typeInfo: exports2.TypeInfo.BacklogLevelConfiguration + }, + taskBacklog: { + typeInfo: exports2.TypeInfo.BacklogLevelConfiguration + } + }; + exports2.TypeInfo.BacklogLevelConfiguration.fields = { + type: { + enumType: exports2.TypeInfo.BacklogType + } + }; + exports2.TypeInfo.Board.fields = { + columns: { + isArray: true, + typeInfo: exports2.TypeInfo.BoardColumn + } + }; + exports2.TypeInfo.BoardColumn.fields = { + columnType: { + enumType: exports2.TypeInfo.BoardColumnType + } + }; + exports2.TypeInfo.CapacityContractBase.fields = { + daysOff: { + isArray: true, + typeInfo: exports2.TypeInfo.DateRange + } + }; + exports2.TypeInfo.CapacityPatch.fields = { + daysOff: { + isArray: true, + typeInfo: exports2.TypeInfo.DateRange + } + }; + exports2.TypeInfo.CardFieldSettings.fields = { + additionalFields: { + isArray: true, + typeInfo: exports2.TypeInfo.FieldInfo + }, + assignedToDisplayFormat: { + enumType: exports2.TypeInfo.IdentityDisplayFormat + }, + coreFields: { + isArray: true, + typeInfo: exports2.TypeInfo.FieldInfo + } + }; + exports2.TypeInfo.CardSettings.fields = { + fields: { + typeInfo: exports2.TypeInfo.CardFieldSettings + } + }; + exports2.TypeInfo.CreatePlan.fields = { + type: { + enumType: exports2.TypeInfo.PlanType + } + }; + exports2.TypeInfo.DateRange.fields = { + end: { + isDate: true + }, + start: { + isDate: true + } + }; + exports2.TypeInfo.DeliveryViewData.fields = { + criteriaStatus: { + typeInfo: exports2.TypeInfo.TimelineCriteriaStatus + }, + endDate: { + isDate: true + }, + startDate: { + isDate: true + }, + teams: { + isArray: true, + typeInfo: exports2.TypeInfo.TimelineTeamData + } + }; + exports2.TypeInfo.DeliveryViewPropertyCollection.fields = { + cardSettings: { + typeInfo: exports2.TypeInfo.CardSettings + }, + markers: { + isArray: true, + typeInfo: exports2.TypeInfo.Marker + } + }; + exports2.TypeInfo.FieldInfo.fields = { + fieldType: { + enumType: exports2.TypeInfo.FieldType + } + }; + exports2.TypeInfo.Marker.fields = { + date: { + isDate: true + } + }; + exports2.TypeInfo.Plan.fields = { + createdDate: { + isDate: true + }, + lastAccessed: { + isDate: true + }, + modifiedDate: { + isDate: true + }, + type: { + enumType: exports2.TypeInfo.PlanType + }, + userPermissions: { + enumType: exports2.TypeInfo.PlanUserPermissions + } + }; + exports2.TypeInfo.PlanMetadata.fields = { + modifiedDate: { + isDate: true + }, + userPermissions: { + enumType: exports2.TypeInfo.PlanUserPermissions + } + }; + exports2.TypeInfo.TeamCapacity.fields = { + teamMembers: { + isArray: true, + typeInfo: exports2.TypeInfo.TeamMemberCapacityIdentityRef + } + }; + exports2.TypeInfo.TeamIterationAttributes.fields = { + finishDate: { + isDate: true + }, + startDate: { + isDate: true + }, + timeFrame: { + enumType: exports2.TypeInfo.TimeFrame + } + }; + exports2.TypeInfo.TeamMemberCapacity.fields = { + daysOff: { + isArray: true, + typeInfo: exports2.TypeInfo.DateRange + } + }; + exports2.TypeInfo.TeamMemberCapacityIdentityRef.fields = { + daysOff: { + isArray: true, + typeInfo: exports2.TypeInfo.DateRange + } + }; + exports2.TypeInfo.TeamSetting.fields = { + backlogIteration: { + typeInfo: exports2.TypeInfo.TeamSettingsIteration + }, + bugsBehavior: { + enumType: exports2.TypeInfo.BugsBehavior + }, + defaultIteration: { + typeInfo: exports2.TypeInfo.TeamSettingsIteration + }, + workingDays: { + isArray: true, + enumType: SystemInterfaces.TypeInfo.DayOfWeek + } + }; + exports2.TypeInfo.TeamSettingsDaysOff.fields = { + daysOff: { + isArray: true, + typeInfo: exports2.TypeInfo.DateRange + } + }; + exports2.TypeInfo.TeamSettingsDaysOffPatch.fields = { + daysOff: { + isArray: true, + typeInfo: exports2.TypeInfo.DateRange + } + }; + exports2.TypeInfo.TeamSettingsIteration.fields = { + attributes: { + typeInfo: exports2.TypeInfo.TeamIterationAttributes + } + }; + exports2.TypeInfo.TeamSettingsPatch.fields = { + bugsBehavior: { + enumType: exports2.TypeInfo.BugsBehavior + }, + workingDays: { + isArray: true, + enumType: SystemInterfaces.TypeInfo.DayOfWeek + } + }; + exports2.TypeInfo.TimelineCriteriaStatus.fields = { + type: { + enumType: exports2.TypeInfo.TimelineCriteriaStatusCode + } + }; + exports2.TypeInfo.TimelineIterationStatus.fields = { + type: { + enumType: exports2.TypeInfo.TimelineIterationStatusCode + } + }; + exports2.TypeInfo.TimelineTeamData.fields = { + iterations: { + isArray: true, + typeInfo: exports2.TypeInfo.TimelineTeamIteration + }, + status: { + typeInfo: exports2.TypeInfo.TimelineTeamStatus + } + }; + exports2.TypeInfo.TimelineTeamIteration.fields = { + finishDate: { + isDate: true + }, + startDate: { + isDate: true + }, + status: { + typeInfo: exports2.TypeInfo.TimelineIterationStatus + } + }; + exports2.TypeInfo.TimelineTeamStatus.fields = { + type: { + enumType: exports2.TypeInfo.TimelineTeamStatusCode + } + }; + exports2.TypeInfo.UpdatePlan.fields = { + type: { + enumType: exports2.TypeInfo.PlanType + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/WorkApi.js +var require_WorkApi = __commonJS({ + "../node_modules/azure-devops-node-api/WorkApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WorkApi = void 0; + var basem = require_ClientApiBases(); + var WorkInterfaces = require_WorkInterfaces(); + var WorkApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Work-api", options); + } + /** + * Creates/updates an automation rules settings + * + * @param {WorkInterfaces.TeamAutomationRulesSettingsRequestModel} ruleRequestModel - Required parameters to create/update an automation rules settings + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + updateAutomationRule(ruleRequestModel, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "2882c15d-0cb3-43b5-8fb7-db62e09a79db", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, ruleRequestModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets backlog configuration for a team + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + getBacklogConfigurations(teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "7799f497-3cb5-4f16-ad4f-5cd06012db64", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.BacklogConfiguration, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of work items within a backlog level + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} backlogId + */ + getBacklogLevelWorkItems(teamContext, backlogId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + backlogId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "7c468d96-ab1d-4294-a360-92f07e9ccd98", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a backlog level + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} id - The id of the backlog level + */ + getBacklog(teamContext, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "a93726f9-7867-4e38-b4f2-0bfafc2f6a94", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.BacklogLevelConfiguration, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * List all backlog levels + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + getBacklogs(teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "a93726f9-7867-4e38-b4f2-0bfafc2f6a94", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.BacklogLevelConfiguration, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a badge that displays the status of columns on the board. + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} id - The id of the board. + * @param {WorkInterfaces.BoardBadgeColumnOptions} columnOptions - Determines what columns to show. + * @param {string[]} columns - If columnOptions is set to custom, specify the list of column names. + */ + getBoardBadge(teamContext, id, columnOptions, columns) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + id + }; + let queryValues = { + columnOptions, + columns: columns && columns.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0120b002-ab6c-4ca0-98cf-a8d7492f865c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a badge that displays the status of columns on the board. + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} id - The id of the board. + * @param {WorkInterfaces.BoardBadgeColumnOptions} columnOptions - Determines what columns to show. + * @param {string[]} columns - If columnOptions is set to custom, specify the list of column names. + */ + getBoardBadgeData(teamContext, id, columnOptions, columns) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + id + }; + let queryValues = { + columnOptions, + columns: columns && columns.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0120b002-ab6c-4ca0-98cf-a8d7492f865c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get available board columns in a project + * + * @param {string} project - Project ID or project name + */ + getColumnSuggestedValues(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "eb7ec5a3-1ba3-4fd1-b834-49a5a387e57d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns the list of parent field filter model for the given list of workitem ids + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} childBacklogContextCategoryRefName + * @param {number[]} workitemIds + */ + getBoardMappingParentItems(teamContext, childBacklogContextCategoryRefName, workitemIds) { + return __awaiter2(this, void 0, void 0, function* () { + if (childBacklogContextCategoryRefName == null) { + throw new TypeError("childBacklogContextCategoryRefName can not be null or undefined"); + } + if (workitemIds == null) { + throw new TypeError("workitemIds can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + let queryValues = { + childBacklogContextCategoryRefName, + workitemIds: workitemIds && workitemIds.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "186abea3-5c35-432f-9e28-7a15b4312a0e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get available board rows in a project + * + * @param {string} project - Project ID or project name + */ + getRowSuggestedValues(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "bb494cc6-a0f5-4c6c-8dca-ea6912e79eb9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get board + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} id - identifier for board, either board's backlog level name (Eg:"Stories") or Id + */ + getBoard(teamContext, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "23ad19fc-3b8e-4877-8462-b3f92bc06b40", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.Board, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get boards + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + getBoards(teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "23ad19fc-3b8e-4877-8462-b3f92bc06b40", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update board options + * + * @param {{ [key: string] : string; }} options - options to updated + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} id - identifier for board, either category plural name (Eg:"Stories") or guid + */ + setBoardOptions(options, teamContext, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "23ad19fc-3b8e-4877-8462-b3f92bc06b40", routeValues); + let url = verData.requestUrl; + let options2 = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, options2, options2); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get board user settings for a board id + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board - Board ID or Name + */ + getBoardUserSettings(teamContext, board) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "b30d9f58-1891-4b0a-b168-c46408f919b0", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update board user settings for the board id + * + * @param {{ [key: string] : string; }} boardUserSettings + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board + */ + updateBoardUserSettings(boardUserSettings, teamContext, board) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "b30d9f58-1891-4b0a-b168-c46408f919b0", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, boardUserSettings, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a team's capacity including total capacity and days off + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} iterationId - ID of the iteration + */ + getCapacitiesWithIdentityRefAndTotals(teamContext, iterationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "work", "74412d15-8c1a-4352-a48d-ef1ed5587d57", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamCapacity, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a team member's capacity + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} iterationId - ID of the iteration + * @param {string} teamMemberId - ID of the team member + */ + getCapacityWithIdentityRef(teamContext, iterationId, teamMemberId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + iterationId, + teamMemberId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "work", "74412d15-8c1a-4352-a48d-ef1ed5587d57", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamMemberCapacityIdentityRef, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Replace a team's capacity + * + * @param {WorkInterfaces.TeamMemberCapacityIdentityRef[]} capacities - Team capacity to replace + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} iterationId - ID of the iteration + */ + replaceCapacitiesWithIdentityRef(capacities, teamContext, iterationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "work", "74412d15-8c1a-4352-a48d-ef1ed5587d57", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, capacities, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamMemberCapacityIdentityRef, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a team member's capacity + * + * @param {WorkInterfaces.CapacityPatch} patch - Updated capacity + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} iterationId - ID of the iteration + * @param {string} teamMemberId - ID of the team member + */ + updateCapacityWithIdentityRef(patch, teamContext, iterationId, teamMemberId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + iterationId, + teamMemberId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.3", "work", "74412d15-8c1a-4352-a48d-ef1ed5587d57", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, patch, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamMemberCapacityIdentityRef, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get board card Rule settings for the board id or board by name + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board + */ + getBoardCardRuleSettings(teamContext, board) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "b044a3d9-02ea-49c7-91a1-b730949cc896", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update board card Rule settings for the board id or board by name + * + * @param {WorkInterfaces.BoardCardRuleSettings} boardCardRuleSettings + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board + */ + updateBoardCardRuleSettings(boardCardRuleSettings, teamContext, board) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "b044a3d9-02ea-49c7-91a1-b730949cc896", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, boardCardRuleSettings, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update taskboard card Rule settings + * + * @param {WorkInterfaces.BoardCardRuleSettings} boardCardRuleSettings + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + updateTaskboardCardRuleSettings(boardCardRuleSettings, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "3f84a8d1-1aab-423e-a94b-6dcbdcca511f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, boardCardRuleSettings, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get board card settings for the board id or board by name + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board + */ + getBoardCardSettings(teamContext, board) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "07c3b467-bc60-4f05-8e34-599ce288fafc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update board card settings for the board id or board by name + * + * @param {WorkInterfaces.BoardCardSettings} boardCardSettingsToSave + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board + */ + updateBoardCardSettings(boardCardSettingsToSave, teamContext, board) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "07c3b467-bc60-4f05-8e34-599ce288fafc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, boardCardSettingsToSave, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update taskboard card settings + * + * @param {WorkInterfaces.BoardCardSettings} boardCardSettingsToSave + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + updateTaskboardCardSettings(boardCardSettingsToSave, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "work", "0d63745f-31f3-4cf3-9056-2a064e567637", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, boardCardSettingsToSave, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a board chart + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board - Identifier for board, either board's backlog level name (Eg:"Stories") or Id + * @param {string} name - The chart name + */ + getBoardChart(teamContext, board, name) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board, + name + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "45fe888c-239e-49fd-958c-df1a1ab21d97", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get board charts + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board - Identifier for board, either board's backlog level name (Eg:"Stories") or Id + */ + getBoardCharts(teamContext, board) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "45fe888c-239e-49fd-958c-df1a1ab21d97", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a board chart + * + * @param {WorkInterfaces.BoardChart} chart + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board - Identifier for board, either board's backlog level name (Eg:"Stories") or Id + * @param {string} name - The chart name + */ + updateBoardChart(chart, teamContext, board, name) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board, + name + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "45fe888c-239e-49fd-958c-df1a1ab21d97", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, chart, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get columns on a board + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board - Name or ID of the specific board + */ + getBoardColumns(teamContext, board) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c555d7ff-84e1-47df-9923-a3fe0cd8751b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.BoardColumn, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update columns on a board + * + * @param {WorkInterfaces.BoardColumn[]} boardColumns - List of board columns to update + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board - Name or ID of the specific board + */ + updateBoardColumns(boardColumns, teamContext, board) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c555d7ff-84e1-47df-9923-a3fe0cd8751b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, boardColumns, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.BoardColumn, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get Delivery View Data + * + * @param {string} project - Project ID or project name + * @param {string} id - Identifier for delivery view + * @param {number} revision - Revision of the plan for which you want data. If the current plan is a different revision you will get an ViewRevisionMismatchException exception. If you do not supply a revision you will get data for the latest revision. + * @param {Date} startDate - The start date of timeline + * @param {Date} endDate - The end date of timeline + */ + getDeliveryTimelineData(project, id, revision, startDate, endDate) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + let queryValues = { + revision, + startDate, + endDate + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "bdd0834e-101f-49f0-a6ae-509f384a12b4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.DeliveryViewData, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get an iteration's capacity for all teams in iteration + * + * @param {string} project - Project ID or project name + * @param {string} iterationId - ID of the iteration + */ + getTotalIterationCapacities(project, iterationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "1e385ce0-396b-4273-8171-d64562c18d37", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a team's iteration by iterationId + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} id - ID of the iteration + */ + deleteTeamIteration(teamContext, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c9175577-28a1-4b06-9197-8636af9f64ad", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get team's iteration by iterationId + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} id - ID of the iteration + */ + getTeamIteration(teamContext, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c9175577-28a1-4b06-9197-8636af9f64ad", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSettingsIteration, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a team's iterations using timeframe filter + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} timeframe - A filter for which iterations are returned based on relative time. Only Current is supported currently. + */ + getTeamIterations(teamContext, timeframe) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + let queryValues = { + "$timeframe": timeframe + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c9175577-28a1-4b06-9197-8636af9f64ad", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSettingsIteration, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add an iteration to the team + * + * @param {WorkInterfaces.TeamSettingsIteration} iteration - Iteration to add + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + postTeamIteration(iteration, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c9175577-28a1-4b06-9197-8636af9f64ad", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, iteration, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSettingsIteration, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add a new plan for the team + * + * @param {WorkInterfaces.CreatePlan} postedPlan - Plan definition + * @param {string} project - Project ID or project name + */ + createPlan(postedPlan, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0b42cb47-cd73-4810-ac90-19c9ba147453", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, postedPlan, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.Plan, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete the specified plan + * + * @param {string} project - Project ID or project name + * @param {string} id - Identifier of the plan + */ + deletePlan(project, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0b42cb47-cd73-4810-ac90-19c9ba147453", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the information for the specified plan + * + * @param {string} project - Project ID or project name + * @param {string} id - Identifier of the plan + */ + getPlan(project, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0b42cb47-cd73-4810-ac90-19c9ba147453", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.Plan, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the information for all the plans configured for the given team + * + * @param {string} project - Project ID or project name + */ + getPlans(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0b42cb47-cd73-4810-ac90-19c9ba147453", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.Plan, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update the information for the specified plan + * + * @param {WorkInterfaces.UpdatePlan} updatedPlan - Plan definition to be updated + * @param {string} project - Project ID or project name + * @param {string} id - Identifier of the plan + */ + updatePlan(updatedPlan, project, id) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0b42cb47-cd73-4810-ac90-19c9ba147453", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, updatedPlan, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.Plan, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get process configuration + * + * @param {string} project - Project ID or project name + */ + getProcessConfiguration(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "f901ba42-86d2-4b0c-89c1-3f86d06daa84", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get rows on a board + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board - Name or ID of the specific board + */ + getBoardRows(teamContext, board) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0863355d-aefd-4d63-8669-984c9b7b0e78", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update rows on a board + * + * @param {WorkInterfaces.BoardRow[]} boardRows - List of board rows to update + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} board - Name or ID of the specific board + */ + updateBoardRows(boardRows, teamContext, board) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + board + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "0863355d-aefd-4d63-8669-984c9b7b0e78", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, boardRows, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + getColumns(teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c6815dbe-8e7e-4ffe-9a79-e83ee712aa92", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {WorkInterfaces.UpdateTaskboardColumn[]} updateColumns + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + updateColumns(updateColumns, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c6815dbe-8e7e-4ffe-9a79-e83ee712aa92", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, updateColumns, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} iterationId + */ + getWorkItemColumns(teamContext, iterationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "1be23c36-8872-4abc-b57d-402cd6c669d9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {WorkInterfaces.UpdateTaskboardWorkItemColumn} updateColumn + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} iterationId + * @param {number} workItemId + */ + updateWorkItemColumn(updateColumn, teamContext, iterationId, workItemId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + iterationId, + workItemId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "1be23c36-8872-4abc-b57d-402cd6c669d9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, updateColumn, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get team's days off for an iteration + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} iterationId - ID of the iteration + */ + getTeamDaysOff(teamContext, iterationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "2d4faa2e-9150-4cbf-a47a-932b1b4a0773", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSettingsDaysOff, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Set a team's days off for an iteration + * + * @param {WorkInterfaces.TeamSettingsDaysOffPatch} daysOffPatch - Team's days off patch containing a list of start and end dates + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} iterationId - ID of the iteration + */ + updateTeamDaysOff(daysOffPatch, teamContext, iterationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "2d4faa2e-9150-4cbf-a47a-932b1b4a0773", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, daysOffPatch, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSettingsDaysOff, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a collection of team field values + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + getTeamFieldValues(teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "07ced576-58ed-49e6-9c1e-5cb53ab8bf2a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update team field values + * + * @param {WorkInterfaces.TeamFieldValuesPatch} patch + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + updateTeamFieldValues(patch, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "07ced576-58ed-49e6-9c1e-5cb53ab8bf2a", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, patch, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a team's settings + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + getTeamSettings(teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c3c1012b-bea7-49d7-b45e-1664e566f84c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSetting, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a team's settings + * + * @param {WorkInterfaces.TeamSettingsPatch} teamSettingsPatch - TeamSettings changes + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + updateTeamSettings(teamSettingsPatch, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "c3c1012b-bea7-49d7-b45e-1664e566f84c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, teamSettingsPatch, options); + let ret = this.formatResponse(res.result, WorkInterfaces.TypeInfo.TeamSetting, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get work items for iteration + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} iterationId - ID of the iteration + */ + getIterationWorkItems(teamContext, iterationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "5b3ef1a6-d3ab-44cd-bafd-c7f45db850fa", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Reorder Product Backlog/Boards Work Items + * + * @param {WorkInterfaces.ReorderOperation} operation + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + reorderBacklogWorkItems(operation, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "1c22b714-e7e4-41b9-85e0-56ee13ef55ed", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, operation, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Reorder Sprint Backlog/Taskboard Work Items + * + * @param {WorkInterfaces.ReorderOperation} operation + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} iterationId - The id of the iteration + */ + reorderIterationWorkItems(operation, teamContext, iterationId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + iterationId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "work", "47755db2-d7eb-405a-8c25-675401525fc9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, operation, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.WorkApi = WorkApi; + WorkApi.RESOURCE_AREA_ID = "1d4f49f9-02b9-4e26-b826-2cdb6195f2a9"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/PipelinesInterfaces.js +var require_PipelinesInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/PipelinesInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.RunState = exports2.RunResult = exports2.RepositoryType = exports2.GetLogExpandOptions = exports2.GetArtifactExpandOptions = exports2.ConfigurationType = void 0; + var VSSInterfaces = require_VSSInterfaces(); + var ConfigurationType; + (function(ConfigurationType2) { + ConfigurationType2[ConfigurationType2["Unknown"] = 0] = "Unknown"; + ConfigurationType2[ConfigurationType2["Yaml"] = 1] = "Yaml"; + ConfigurationType2[ConfigurationType2["DesignerJson"] = 2] = "DesignerJson"; + ConfigurationType2[ConfigurationType2["JustInTime"] = 3] = "JustInTime"; + ConfigurationType2[ConfigurationType2["DesignerHyphenJson"] = 2] = "DesignerHyphenJson"; + })(ConfigurationType = exports2.ConfigurationType || (exports2.ConfigurationType = {})); + var GetArtifactExpandOptions; + (function(GetArtifactExpandOptions2) { + GetArtifactExpandOptions2[GetArtifactExpandOptions2["None"] = 0] = "None"; + GetArtifactExpandOptions2[GetArtifactExpandOptions2["SignedContent"] = 1] = "SignedContent"; + })(GetArtifactExpandOptions = exports2.GetArtifactExpandOptions || (exports2.GetArtifactExpandOptions = {})); + var GetLogExpandOptions; + (function(GetLogExpandOptions2) { + GetLogExpandOptions2[GetLogExpandOptions2["None"] = 0] = "None"; + GetLogExpandOptions2[GetLogExpandOptions2["SignedContent"] = 1] = "SignedContent"; + })(GetLogExpandOptions = exports2.GetLogExpandOptions || (exports2.GetLogExpandOptions = {})); + var RepositoryType; + (function(RepositoryType2) { + RepositoryType2[RepositoryType2["Unknown"] = 0] = "Unknown"; + RepositoryType2[RepositoryType2["GitHub"] = 1] = "GitHub"; + RepositoryType2[RepositoryType2["AzureReposGit"] = 2] = "AzureReposGit"; + RepositoryType2[RepositoryType2["GitHubEnterprise"] = 3] = "GitHubEnterprise"; + RepositoryType2[RepositoryType2["AzureReposGitHyphenated"] = 2] = "AzureReposGitHyphenated"; + })(RepositoryType = exports2.RepositoryType || (exports2.RepositoryType = {})); + var RunResult; + (function(RunResult2) { + RunResult2[RunResult2["Unknown"] = 0] = "Unknown"; + RunResult2[RunResult2["Succeeded"] = 1] = "Succeeded"; + RunResult2[RunResult2["Failed"] = 2] = "Failed"; + RunResult2[RunResult2["Canceled"] = 4] = "Canceled"; + })(RunResult = exports2.RunResult || (exports2.RunResult = {})); + var RunState; + (function(RunState2) { + RunState2[RunState2["Unknown"] = 0] = "Unknown"; + RunState2[RunState2["InProgress"] = 1] = "InProgress"; + RunState2[RunState2["Canceling"] = 2] = "Canceling"; + RunState2[RunState2["Completed"] = 4] = "Completed"; + })(RunState = exports2.RunState || (exports2.RunState = {})); + exports2.TypeInfo = { + Artifact: {}, + ConfigurationType: { + enumValues: { + "unknown": 0, + "yaml": 1, + "designerJson": 2, + "justInTime": 3, + "designerHyphenJson": 2 + } + }, + CreatePipelineConfigurationParameters: {}, + CreatePipelineParameters: {}, + GetArtifactExpandOptions: { + enumValues: { + "none": 0, + "signedContent": 1 + } + }, + GetLogExpandOptions: { + enumValues: { + "none": 0, + "signedContent": 1 + } + }, + Log: {}, + LogCollection: {}, + Pipeline: {}, + PipelineConfiguration: {}, + Repository: {}, + RepositoryResource: {}, + RepositoryType: { + enumValues: { + "unknown": 0, + "gitHub": 1, + "azureReposGit": 2, + "gitHubEnterprise": 3, + "azureReposGitHyphenated": 2 + } + }, + Run: {}, + RunResources: {}, + RunResult: { + enumValues: { + "unknown": 0, + "succeeded": 1, + "failed": 2, + "canceled": 4 + } + }, + RunState: { + enumValues: { + "unknown": 0, + "inProgress": 1, + "canceling": 2, + "completed": 4 + } + }, + SignalRConnection: {} + }; + exports2.TypeInfo.Artifact.fields = { + signedContent: { + typeInfo: VSSInterfaces.TypeInfo.SignedUrl + } + }; + exports2.TypeInfo.CreatePipelineConfigurationParameters.fields = { + type: { + enumType: exports2.TypeInfo.ConfigurationType + } + }; + exports2.TypeInfo.CreatePipelineParameters.fields = { + configuration: { + typeInfo: exports2.TypeInfo.CreatePipelineConfigurationParameters + } + }; + exports2.TypeInfo.Log.fields = { + createdOn: { + isDate: true + }, + lastChangedOn: { + isDate: true + }, + signedContent: { + typeInfo: VSSInterfaces.TypeInfo.SignedUrl + } + }; + exports2.TypeInfo.LogCollection.fields = { + logs: { + isArray: true, + typeInfo: exports2.TypeInfo.Log + }, + signedContent: { + typeInfo: VSSInterfaces.TypeInfo.SignedUrl + } + }; + exports2.TypeInfo.Pipeline.fields = { + configuration: { + typeInfo: exports2.TypeInfo.PipelineConfiguration + } + }; + exports2.TypeInfo.PipelineConfiguration.fields = { + type: { + enumType: exports2.TypeInfo.ConfigurationType + } + }; + exports2.TypeInfo.Repository.fields = { + type: { + enumType: exports2.TypeInfo.RepositoryType + } + }; + exports2.TypeInfo.RepositoryResource.fields = { + repository: { + typeInfo: exports2.TypeInfo.Repository + } + }; + exports2.TypeInfo.Run.fields = { + createdDate: { + isDate: true + }, + finishedDate: { + isDate: true + }, + resources: { + typeInfo: exports2.TypeInfo.RunResources + }, + result: { + enumType: exports2.TypeInfo.RunResult + }, + state: { + enumType: exports2.TypeInfo.RunState + } + }; + exports2.TypeInfo.RunResources.fields = { + repositories: { + isDictionary: true, + dictionaryValueTypeInfo: exports2.TypeInfo.RepositoryResource + } + }; + exports2.TypeInfo.SignalRConnection.fields = { + signedContent: { + typeInfo: VSSInterfaces.TypeInfo.SignedUrl + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/PipelinesApi.js +var require_PipelinesApi = __commonJS({ + "../node_modules/azure-devops-node-api/PipelinesApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.PipelinesApi = void 0; + var basem = require_ClientApiBases(); + var PipelinesInterfaces = require_PipelinesInterfaces(); + var PipelinesApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Pipelines-api", options); + } + /** + * Get a specific artifact from a pipeline run + * + * @param {string} project - Project ID or project name + * @param {number} pipelineId - ID of the pipeline. + * @param {number} runId - ID of the run of that pipeline. + * @param {string} artifactName - Name of the artifact. + * @param {PipelinesInterfaces.GetArtifactExpandOptions} expand - Expand options. Default is None. + */ + getArtifact(project, pipelineId, runId, artifactName, expand) { + return __awaiter2(this, void 0, void 0, function* () { + if (artifactName == null) { + throw new TypeError("artifactName can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + pipelineId, + runId + }; + let queryValues = { + artifactName, + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "85023071-bd5e-4438-89b0-2a5bf362a19d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Artifact, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a specific log from a pipeline run + * + * @param {string} project - Project ID or project name + * @param {number} pipelineId - ID of the pipeline. + * @param {number} runId - ID of the run of that pipeline. + * @param {number} logId - ID of the log. + * @param {PipelinesInterfaces.GetLogExpandOptions} expand - Expand options. Default is None. + */ + getLog(project, pipelineId, runId, logId, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + pipelineId, + runId, + logId + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "fb1b6d27-3957-43d5-a14b-a2d70403e545", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Log, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of logs from a pipeline run. + * + * @param {string} project - Project ID or project name + * @param {number} pipelineId - ID of the pipeline. + * @param {number} runId - ID of the run of that pipeline. + * @param {PipelinesInterfaces.GetLogExpandOptions} expand - Expand options. Default is None. + */ + listLogs(project, pipelineId, runId, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + pipelineId, + runId + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "fb1b6d27-3957-43d5-a14b-a2d70403e545", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.LogCollection, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a pipeline. + * + * @param {PipelinesInterfaces.CreatePipelineParameters} inputParameters - Input parameters. + * @param {string} project - Project ID or project name + */ + createPipeline(inputParameters, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "28e1305e-2afe-47bf-abaf-cbb0e6a91988", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, inputParameters, options); + let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Pipeline, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a pipeline, optionally at the specified version + * + * @param {string} project - Project ID or project name + * @param {number} pipelineId - The pipeline ID + * @param {number} pipelineVersion - The pipeline version + */ + getPipeline(project, pipelineId, pipelineVersion) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + pipelineId + }; + let queryValues = { + pipelineVersion + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "28e1305e-2afe-47bf-abaf-cbb0e6a91988", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Pipeline, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of pipelines. + * + * @param {string} project - Project ID or project name + * @param {string} orderBy - A sort expression. Defaults to "name asc" + * @param {number} top - The maximum number of pipelines to return + * @param {string} continuationToken - A continuation token from a previous request, to retrieve the next page of results + */ + listPipelines(project, orderBy, top, continuationToken) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + orderBy, + "$top": top, + continuationToken + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "28e1305e-2afe-47bf-abaf-cbb0e6a91988", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Pipeline, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Queues a dry run of the pipeline and returns an object containing the final yaml. + * + * @param {PipelinesInterfaces.RunPipelineParameters} runParameters - Optional additional parameters for this run. + * @param {string} project - Project ID or project name + * @param {number} pipelineId - The pipeline ID. + * @param {number} pipelineVersion - The pipeline version. + */ + preview(runParameters, project, pipelineId, pipelineVersion) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + pipelineId + }; + let queryValues = { + pipelineVersion + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "53df2d18-29ea-46a9-bee0-933540f80abf", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, runParameters, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a run for a particular pipeline. + * + * @param {string} project - Project ID or project name + * @param {number} pipelineId - The pipeline id + * @param {number} runId - The run id + */ + getRun(project, pipelineId, runId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + pipelineId, + runId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "7859261e-d2e9-4a68-b820-a5d84cc5bb3d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Run, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets top 10000 runs for a particular pipeline. + * + * @param {string} project - Project ID or project name + * @param {number} pipelineId - The pipeline id + */ + listRuns(project, pipelineId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + pipelineId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "7859261e-d2e9-4a68-b820-a5d84cc5bb3d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Run, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Runs a pipeline. + * + * @param {PipelinesInterfaces.RunPipelineParameters} runParameters - Optional additional parameters for this run. + * @param {string} project - Project ID or project name + * @param {number} pipelineId - The pipeline ID. + * @param {number} pipelineVersion - The pipeline version. + */ + runPipeline(runParameters, project, pipelineId, pipelineVersion) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + pipelineId + }; + let queryValues = { + pipelineVersion + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "7859261e-d2e9-4a68-b820-a5d84cc5bb3d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, runParameters, options); + let ret = this.formatResponse(res.result, PipelinesInterfaces.TypeInfo.Run, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.PipelinesApi = PipelinesApi; + } +}); + +// ../node_modules/azure-devops-node-api/CIXApi.js +var require_CIXApi = __commonJS({ + "../node_modules/azure-devops-node-api/CIXApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.CixApi = void 0; + var basem = require_ClientApiBases(); + var CixApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-Pipelines-api", options); + } + /** + * Gets a list of existing configuration files for the given repository. + * + * @param {string} project - Project ID or project name + * @param {string} repositoryType - The type of the repository such as GitHub, TfsGit (i.e. Azure Repos), Bitbucket, etc. + * @param {string} repositoryId - The vendor-specific identifier or the name of the repository, e.g. Microsoft/vscode (GitHub) or e9d82045-ddba-4e01-a63d-2ab9f040af62 (Azure Repos) + * @param {string} branch - The repository branch where to look for the configuration file. + * @param {string} serviceConnectionId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TfsGit (i.e. Azure Repos). + */ + getConfigurations(project, repositoryType, repositoryId, branch, serviceConnectionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + repositoryType, + repositoryId, + branch, + serviceConnectionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "8fc87684-9ebc-4c37-ab92-f4ac4a58cb3a", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a new Pipeline connection between the provider installation and the specified project. Returns the PipelineConnection object created. + * + * @param {CIXInterfaces.CreatePipelineConnectionInputs} createConnectionInputs + * @param {string} project + */ + createProjectConnection(createConnectionInputs, project) { + return __awaiter2(this, void 0, void 0, function* () { + if (project == null) { + throw new TypeError("project can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "00df4879-9216-45d5-b38d-4a487b626b2c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, createConnectionInputs, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of build frameworks that best match the given repository based on its contents. + * + * @param {string} project - Project ID or project name + * @param {string} repositoryType - The type of the repository such as GitHub, TfsGit (i.e. Azure Repos), Bitbucket, etc. + * @param {string} repositoryId - The vendor-specific identifier or the name of the repository, e.g. Microsoft/vscode (GitHub) or e9d82045-ddba-4e01-a63d-2ab9f040af62 (Azure Repos) + * @param {string} branch - The repository branch to detect build frameworks for. + * @param {CIXInterfaces.BuildFrameworkDetectionType} detectionType + * @param {string} serviceConnectionId - If specified, the ID of the service endpoint to query. Can only be omitted for providers that do not use service endpoints, e.g. TfsGit (i.e. Azure Repos). + */ + getDetectedBuildFrameworks(project, repositoryType, repositoryId, branch, detectionType, serviceConnectionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + repositoryType, + repositoryId, + branch, + detectionType, + serviceConnectionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "29a30bab-9efb-4652-bf1b-9269baca0980", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {{ [key: string] : CIXInterfaces.ResourceCreationParameter; }} creationParameters + * @param {string} project - Project ID or project name + */ + createResources(creationParameters, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "pipelines", "43201899-7690-4870-9c79-ab69605f21ed", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, creationParameters, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.CixApi = CixApi; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/WorkItemTrackingInterfaces.js +var require_WorkItemTrackingInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/WorkItemTrackingInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.WorkItemTypeFieldsExpandLevel = exports2.WorkItemRecentActivityType = exports2.WorkItemExpand = exports2.WorkItemErrorPolicy = exports2.TreeStructureGroup = exports2.TreeNodeStructureType = exports2.TemplateType = exports2.ReportingRevisionsExpand = exports2.QueryType = exports2.QueryResultType = exports2.QueryRecursionOption = exports2.QueryOption = exports2.QueryExpand = exports2.QueryErrorPolicy = exports2.ProvisioningActionType = exports2.LogicalOperation = exports2.LinkQueryMode = exports2.GetFieldsExpand = exports2.FieldUsage = exports2.FieldType = exports2.CommentSortOrder = exports2.CommentReactionType = exports2.CommentFormat = exports2.CommentExpandOptions = exports2.ClassificationNodesErrorPolicy = void 0; + var ClassificationNodesErrorPolicy; + (function(ClassificationNodesErrorPolicy2) { + ClassificationNodesErrorPolicy2[ClassificationNodesErrorPolicy2["Fail"] = 1] = "Fail"; + ClassificationNodesErrorPolicy2[ClassificationNodesErrorPolicy2["Omit"] = 2] = "Omit"; + })(ClassificationNodesErrorPolicy = exports2.ClassificationNodesErrorPolicy || (exports2.ClassificationNodesErrorPolicy = {})); + var CommentExpandOptions; + (function(CommentExpandOptions2) { + CommentExpandOptions2[CommentExpandOptions2["None"] = 0] = "None"; + CommentExpandOptions2[CommentExpandOptions2["Reactions"] = 1] = "Reactions"; + CommentExpandOptions2[CommentExpandOptions2["RenderedText"] = 8] = "RenderedText"; + CommentExpandOptions2[CommentExpandOptions2["RenderedTextOnly"] = 16] = "RenderedTextOnly"; + CommentExpandOptions2[CommentExpandOptions2["All"] = -17] = "All"; + })(CommentExpandOptions = exports2.CommentExpandOptions || (exports2.CommentExpandOptions = {})); + var CommentFormat; + (function(CommentFormat2) { + CommentFormat2[CommentFormat2["Markdown"] = 0] = "Markdown"; + CommentFormat2[CommentFormat2["Html"] = 1] = "Html"; + })(CommentFormat = exports2.CommentFormat || (exports2.CommentFormat = {})); + var CommentReactionType; + (function(CommentReactionType2) { + CommentReactionType2[CommentReactionType2["Like"] = 0] = "Like"; + CommentReactionType2[CommentReactionType2["Dislike"] = 1] = "Dislike"; + CommentReactionType2[CommentReactionType2["Heart"] = 2] = "Heart"; + CommentReactionType2[CommentReactionType2["Hooray"] = 3] = "Hooray"; + CommentReactionType2[CommentReactionType2["Smile"] = 4] = "Smile"; + CommentReactionType2[CommentReactionType2["Confused"] = 5] = "Confused"; + })(CommentReactionType = exports2.CommentReactionType || (exports2.CommentReactionType = {})); + var CommentSortOrder; + (function(CommentSortOrder2) { + CommentSortOrder2[CommentSortOrder2["Asc"] = 1] = "Asc"; + CommentSortOrder2[CommentSortOrder2["Desc"] = 2] = "Desc"; + })(CommentSortOrder = exports2.CommentSortOrder || (exports2.CommentSortOrder = {})); + var FieldType; + (function(FieldType2) { + FieldType2[FieldType2["String"] = 0] = "String"; + FieldType2[FieldType2["Integer"] = 1] = "Integer"; + FieldType2[FieldType2["DateTime"] = 2] = "DateTime"; + FieldType2[FieldType2["PlainText"] = 3] = "PlainText"; + FieldType2[FieldType2["Html"] = 4] = "Html"; + FieldType2[FieldType2["TreePath"] = 5] = "TreePath"; + FieldType2[FieldType2["History"] = 6] = "History"; + FieldType2[FieldType2["Double"] = 7] = "Double"; + FieldType2[FieldType2["Guid"] = 8] = "Guid"; + FieldType2[FieldType2["Boolean"] = 9] = "Boolean"; + FieldType2[FieldType2["Identity"] = 10] = "Identity"; + FieldType2[FieldType2["PicklistString"] = 11] = "PicklistString"; + FieldType2[FieldType2["PicklistInteger"] = 12] = "PicklistInteger"; + FieldType2[FieldType2["PicklistDouble"] = 13] = "PicklistDouble"; + })(FieldType = exports2.FieldType || (exports2.FieldType = {})); + var FieldUsage; + (function(FieldUsage2) { + FieldUsage2[FieldUsage2["None"] = 0] = "None"; + FieldUsage2[FieldUsage2["WorkItem"] = 1] = "WorkItem"; + FieldUsage2[FieldUsage2["WorkItemLink"] = 2] = "WorkItemLink"; + FieldUsage2[FieldUsage2["Tree"] = 3] = "Tree"; + FieldUsage2[FieldUsage2["WorkItemTypeExtension"] = 4] = "WorkItemTypeExtension"; + })(FieldUsage = exports2.FieldUsage || (exports2.FieldUsage = {})); + var GetFieldsExpand; + (function(GetFieldsExpand2) { + GetFieldsExpand2[GetFieldsExpand2["None"] = 0] = "None"; + GetFieldsExpand2[GetFieldsExpand2["ExtensionFields"] = 1] = "ExtensionFields"; + GetFieldsExpand2[GetFieldsExpand2["IncludeDeleted"] = 2] = "IncludeDeleted"; + })(GetFieldsExpand = exports2.GetFieldsExpand || (exports2.GetFieldsExpand = {})); + var LinkQueryMode; + (function(LinkQueryMode2) { + LinkQueryMode2[LinkQueryMode2["WorkItems"] = 0] = "WorkItems"; + LinkQueryMode2[LinkQueryMode2["LinksOneHopMustContain"] = 1] = "LinksOneHopMustContain"; + LinkQueryMode2[LinkQueryMode2["LinksOneHopMayContain"] = 2] = "LinksOneHopMayContain"; + LinkQueryMode2[LinkQueryMode2["LinksOneHopDoesNotContain"] = 3] = "LinksOneHopDoesNotContain"; + LinkQueryMode2[LinkQueryMode2["LinksRecursiveMustContain"] = 4] = "LinksRecursiveMustContain"; + LinkQueryMode2[LinkQueryMode2["LinksRecursiveMayContain"] = 5] = "LinksRecursiveMayContain"; + LinkQueryMode2[LinkQueryMode2["LinksRecursiveDoesNotContain"] = 6] = "LinksRecursiveDoesNotContain"; + })(LinkQueryMode = exports2.LinkQueryMode || (exports2.LinkQueryMode = {})); + var LogicalOperation; + (function(LogicalOperation2) { + LogicalOperation2[LogicalOperation2["NONE"] = 0] = "NONE"; + LogicalOperation2[LogicalOperation2["AND"] = 1] = "AND"; + LogicalOperation2[LogicalOperation2["OR"] = 2] = "OR"; + })(LogicalOperation = exports2.LogicalOperation || (exports2.LogicalOperation = {})); + var ProvisioningActionType; + (function(ProvisioningActionType2) { + ProvisioningActionType2[ProvisioningActionType2["Import"] = 0] = "Import"; + ProvisioningActionType2[ProvisioningActionType2["Validate"] = 1] = "Validate"; + })(ProvisioningActionType = exports2.ProvisioningActionType || (exports2.ProvisioningActionType = {})); + var QueryErrorPolicy; + (function(QueryErrorPolicy2) { + QueryErrorPolicy2[QueryErrorPolicy2["Fail"] = 1] = "Fail"; + QueryErrorPolicy2[QueryErrorPolicy2["Omit"] = 2] = "Omit"; + })(QueryErrorPolicy = exports2.QueryErrorPolicy || (exports2.QueryErrorPolicy = {})); + var QueryExpand; + (function(QueryExpand2) { + QueryExpand2[QueryExpand2["None"] = 0] = "None"; + QueryExpand2[QueryExpand2["Wiql"] = 1] = "Wiql"; + QueryExpand2[QueryExpand2["Clauses"] = 2] = "Clauses"; + QueryExpand2[QueryExpand2["All"] = 3] = "All"; + QueryExpand2[QueryExpand2["Minimal"] = 4] = "Minimal"; + })(QueryExpand = exports2.QueryExpand || (exports2.QueryExpand = {})); + var QueryOption; + (function(QueryOption2) { + QueryOption2[QueryOption2["Doing"] = 1] = "Doing"; + QueryOption2[QueryOption2["Done"] = 2] = "Done"; + QueryOption2[QueryOption2["Followed"] = 3] = "Followed"; + })(QueryOption = exports2.QueryOption || (exports2.QueryOption = {})); + var QueryRecursionOption; + (function(QueryRecursionOption2) { + QueryRecursionOption2[QueryRecursionOption2["ParentFirst"] = 0] = "ParentFirst"; + QueryRecursionOption2[QueryRecursionOption2["ChildFirst"] = 1] = "ChildFirst"; + })(QueryRecursionOption = exports2.QueryRecursionOption || (exports2.QueryRecursionOption = {})); + var QueryResultType; + (function(QueryResultType2) { + QueryResultType2[QueryResultType2["WorkItem"] = 1] = "WorkItem"; + QueryResultType2[QueryResultType2["WorkItemLink"] = 2] = "WorkItemLink"; + })(QueryResultType = exports2.QueryResultType || (exports2.QueryResultType = {})); + var QueryType; + (function(QueryType2) { + QueryType2[QueryType2["Flat"] = 1] = "Flat"; + QueryType2[QueryType2["Tree"] = 2] = "Tree"; + QueryType2[QueryType2["OneHop"] = 3] = "OneHop"; + })(QueryType = exports2.QueryType || (exports2.QueryType = {})); + var ReportingRevisionsExpand; + (function(ReportingRevisionsExpand2) { + ReportingRevisionsExpand2[ReportingRevisionsExpand2["None"] = 0] = "None"; + ReportingRevisionsExpand2[ReportingRevisionsExpand2["Fields"] = 1] = "Fields"; + })(ReportingRevisionsExpand = exports2.ReportingRevisionsExpand || (exports2.ReportingRevisionsExpand = {})); + var TemplateType; + (function(TemplateType2) { + TemplateType2[TemplateType2["WorkItemType"] = 0] = "WorkItemType"; + TemplateType2[TemplateType2["GlobalWorkflow"] = 1] = "GlobalWorkflow"; + })(TemplateType = exports2.TemplateType || (exports2.TemplateType = {})); + var TreeNodeStructureType; + (function(TreeNodeStructureType2) { + TreeNodeStructureType2[TreeNodeStructureType2["Area"] = 0] = "Area"; + TreeNodeStructureType2[TreeNodeStructureType2["Iteration"] = 1] = "Iteration"; + })(TreeNodeStructureType = exports2.TreeNodeStructureType || (exports2.TreeNodeStructureType = {})); + var TreeStructureGroup; + (function(TreeStructureGroup2) { + TreeStructureGroup2[TreeStructureGroup2["Areas"] = 0] = "Areas"; + TreeStructureGroup2[TreeStructureGroup2["Iterations"] = 1] = "Iterations"; + })(TreeStructureGroup = exports2.TreeStructureGroup || (exports2.TreeStructureGroup = {})); + var WorkItemErrorPolicy; + (function(WorkItemErrorPolicy2) { + WorkItemErrorPolicy2[WorkItemErrorPolicy2["Fail"] = 1] = "Fail"; + WorkItemErrorPolicy2[WorkItemErrorPolicy2["Omit"] = 2] = "Omit"; + })(WorkItemErrorPolicy = exports2.WorkItemErrorPolicy || (exports2.WorkItemErrorPolicy = {})); + var WorkItemExpand; + (function(WorkItemExpand2) { + WorkItemExpand2[WorkItemExpand2["None"] = 0] = "None"; + WorkItemExpand2[WorkItemExpand2["Relations"] = 1] = "Relations"; + WorkItemExpand2[WorkItemExpand2["Fields"] = 2] = "Fields"; + WorkItemExpand2[WorkItemExpand2["Links"] = 3] = "Links"; + WorkItemExpand2[WorkItemExpand2["All"] = 4] = "All"; + })(WorkItemExpand = exports2.WorkItemExpand || (exports2.WorkItemExpand = {})); + var WorkItemRecentActivityType; + (function(WorkItemRecentActivityType2) { + WorkItemRecentActivityType2[WorkItemRecentActivityType2["Visited"] = 0] = "Visited"; + WorkItemRecentActivityType2[WorkItemRecentActivityType2["Edited"] = 1] = "Edited"; + WorkItemRecentActivityType2[WorkItemRecentActivityType2["Deleted"] = 2] = "Deleted"; + WorkItemRecentActivityType2[WorkItemRecentActivityType2["Restored"] = 3] = "Restored"; + })(WorkItemRecentActivityType = exports2.WorkItemRecentActivityType || (exports2.WorkItemRecentActivityType = {})); + var WorkItemTypeFieldsExpandLevel; + (function(WorkItemTypeFieldsExpandLevel2) { + WorkItemTypeFieldsExpandLevel2[WorkItemTypeFieldsExpandLevel2["None"] = 0] = "None"; + WorkItemTypeFieldsExpandLevel2[WorkItemTypeFieldsExpandLevel2["AllowedValues"] = 1] = "AllowedValues"; + WorkItemTypeFieldsExpandLevel2[WorkItemTypeFieldsExpandLevel2["DependentFields"] = 2] = "DependentFields"; + WorkItemTypeFieldsExpandLevel2[WorkItemTypeFieldsExpandLevel2["All"] = 3] = "All"; + })(WorkItemTypeFieldsExpandLevel = exports2.WorkItemTypeFieldsExpandLevel || (exports2.WorkItemTypeFieldsExpandLevel = {})); + exports2.TypeInfo = { + AccountMyWorkResult: {}, + AccountRecentActivityWorkItemModel: {}, + AccountRecentActivityWorkItemModel2: {}, + AccountRecentActivityWorkItemModelBase: {}, + AccountRecentMentionWorkItemModel: {}, + AccountWorkWorkItemModel: {}, + ClassificationNodesErrorPolicy: { + enumValues: { + "fail": 1, + "omit": 2 + } + }, + Comment: {}, + CommentExpandOptions: { + enumValues: { + "none": 0, + "reactions": 1, + "renderedText": 8, + "renderedTextOnly": 16, + "all": -17 + } + }, + CommentFormat: { + enumValues: { + "markdown": 0, + "html": 1 + } + }, + CommentList: {}, + CommentReaction: {}, + CommentReactionType: { + enumValues: { + "like": 0, + "dislike": 1, + "heart": 2, + "hooray": 3, + "smile": 4, + "confused": 5 + } + }, + CommentSortOrder: { + enumValues: { + "asc": 1, + "desc": 2 + } + }, + CommentVersion: {}, + ExternalDeployment: {}, + FieldType: { + enumValues: { + "string": 0, + "integer": 1, + "dateTime": 2, + "plainText": 3, + "html": 4, + "treePath": 5, + "history": 6, + "double": 7, + "guid": 8, + "boolean": 9, + "identity": 10, + "picklistString": 11, + "picklistInteger": 12, + "picklistDouble": 13 + } + }, + FieldUsage: { + enumValues: { + "none": 0, + "workItem": 1, + "workItemLink": 2, + "tree": 3, + "workItemTypeExtension": 4 + } + }, + GetFieldsExpand: { + enumValues: { + "none": 0, + "extensionFields": 1, + "includeDeleted": 2 + } + }, + LinkQueryMode: { + enumValues: { + "workItems": 0, + "linksOneHopMustContain": 1, + "linksOneHopMayContain": 2, + "linksOneHopDoesNotContain": 3, + "linksRecursiveMustContain": 4, + "linksRecursiveMayContain": 5, + "linksRecursiveDoesNotContain": 6 + } + }, + LogicalOperation: { + enumValues: { + "none": 0, + "and": 1, + "or": 2 + } + }, + ProvisioningActionType: { + enumValues: { + "import": 0, + "validate": 1 + } + }, + QueryBatchGetRequest: {}, + QueryErrorPolicy: { + enumValues: { + "fail": 1, + "omit": 2 + } + }, + QueryExpand: { + enumValues: { + "none": 0, + "wiql": 1, + "clauses": 2, + "all": 3, + "minimal": 4 + } + }, + QueryHierarchyItem: {}, + QueryHierarchyItemsResult: {}, + QueryOption: { + enumValues: { + "doing": 1, + "done": 2, + "followed": 3 + } + }, + QueryRecursionOption: { + enumValues: { + "parentFirst": 0, + "childFirst": 1 + } + }, + QueryResultType: { + enumValues: { + "workItem": 1, + "workItemLink": 2 + } + }, + QueryType: { + enumValues: { + "flat": 1, + "tree": 2, + "oneHop": 3 + } + }, + ReportingRevisionsExpand: { + enumValues: { + "none": 0, + "fields": 1 + } + }, + TemplateType: { + enumValues: { + "workItemType": 0, + "globalWorkflow": 1 + } + }, + TreeNodeStructureType: { + enumValues: { + "area": 0, + "iteration": 1 + } + }, + TreeStructureGroup: { + enumValues: { + "areas": 0, + "iterations": 1 + } + }, + WorkItemBatchGetRequest: {}, + WorkItemClassificationNode: {}, + WorkItemComment: {}, + WorkItemComments: {}, + WorkItemErrorPolicy: { + enumValues: { + "fail": 1, + "omit": 2 + } + }, + WorkItemExpand: { + enumValues: { + "none": 0, + "relations": 1, + "fields": 2, + "links": 3, + "all": 4 + } + }, + WorkItemField: {}, + WorkItemField2: {}, + WorkItemHistory: {}, + WorkItemQueryClause: {}, + WorkItemQueryResult: {}, + WorkItemRecentActivityType: { + enumValues: { + "visited": 0, + "edited": 1, + "deleted": 2, + "restored": 3 + } + }, + WorkItemTagDefinition: {}, + WorkItemTypeFieldsExpandLevel: { + enumValues: { + "none": 0, + "allowedValues": 1, + "dependentFields": 2, + "all": 3 + } + }, + WorkItemTypeTemplateUpdateModel: {}, + WorkItemUpdate: {} + }; + exports2.TypeInfo.AccountMyWorkResult.fields = { + workItemDetails: { + isArray: true, + typeInfo: exports2.TypeInfo.AccountWorkWorkItemModel + } + }; + exports2.TypeInfo.AccountRecentActivityWorkItemModel.fields = { + activityDate: { + isDate: true + }, + activityType: { + enumType: exports2.TypeInfo.WorkItemRecentActivityType + }, + changedDate: { + isDate: true + } + }; + exports2.TypeInfo.AccountRecentActivityWorkItemModel2.fields = { + activityDate: { + isDate: true + }, + activityType: { + enumType: exports2.TypeInfo.WorkItemRecentActivityType + }, + changedDate: { + isDate: true + } + }; + exports2.TypeInfo.AccountRecentActivityWorkItemModelBase.fields = { + activityDate: { + isDate: true + }, + activityType: { + enumType: exports2.TypeInfo.WorkItemRecentActivityType + }, + changedDate: { + isDate: true + } + }; + exports2.TypeInfo.AccountRecentMentionWorkItemModel.fields = { + mentionedDateField: { + isDate: true + } + }; + exports2.TypeInfo.AccountWorkWorkItemModel.fields = { + changedDate: { + isDate: true + } + }; + exports2.TypeInfo.Comment.fields = { + createdDate: { + isDate: true + }, + createdOnBehalfDate: { + isDate: true + }, + format: { + enumType: exports2.TypeInfo.CommentFormat + }, + modifiedDate: { + isDate: true + }, + reactions: { + isArray: true, + typeInfo: exports2.TypeInfo.CommentReaction + } + }; + exports2.TypeInfo.CommentList.fields = { + comments: { + isArray: true, + typeInfo: exports2.TypeInfo.Comment + } + }; + exports2.TypeInfo.CommentReaction.fields = { + type: { + enumType: exports2.TypeInfo.CommentReactionType + } + }; + exports2.TypeInfo.CommentVersion.fields = { + createdDate: { + isDate: true + }, + createdOnBehalfDate: { + isDate: true + }, + modifiedDate: { + isDate: true + } + }; + exports2.TypeInfo.ExternalDeployment.fields = { + statusDate: { + isDate: true + } + }; + exports2.TypeInfo.QueryBatchGetRequest.fields = { + $expand: { + enumType: exports2.TypeInfo.QueryExpand + }, + errorPolicy: { + enumType: exports2.TypeInfo.QueryErrorPolicy + } + }; + exports2.TypeInfo.QueryHierarchyItem.fields = { + children: { + isArray: true, + typeInfo: exports2.TypeInfo.QueryHierarchyItem + }, + clauses: { + typeInfo: exports2.TypeInfo.WorkItemQueryClause + }, + createdDate: { + isDate: true + }, + filterOptions: { + enumType: exports2.TypeInfo.LinkQueryMode + }, + lastExecutedDate: { + isDate: true + }, + lastModifiedDate: { + isDate: true + }, + linkClauses: { + typeInfo: exports2.TypeInfo.WorkItemQueryClause + }, + queryRecursionOption: { + enumType: exports2.TypeInfo.QueryRecursionOption + }, + queryType: { + enumType: exports2.TypeInfo.QueryType + }, + sourceClauses: { + typeInfo: exports2.TypeInfo.WorkItemQueryClause + }, + targetClauses: { + typeInfo: exports2.TypeInfo.WorkItemQueryClause + } + }; + exports2.TypeInfo.QueryHierarchyItemsResult.fields = { + value: { + isArray: true, + typeInfo: exports2.TypeInfo.QueryHierarchyItem + } + }; + exports2.TypeInfo.WorkItemBatchGetRequest.fields = { + $expand: { + enumType: exports2.TypeInfo.WorkItemExpand + }, + asOf: { + isDate: true + }, + errorPolicy: { + enumType: exports2.TypeInfo.WorkItemErrorPolicy + } + }; + exports2.TypeInfo.WorkItemClassificationNode.fields = { + children: { + isArray: true, + typeInfo: exports2.TypeInfo.WorkItemClassificationNode + }, + structureType: { + enumType: exports2.TypeInfo.TreeNodeStructureType + } + }; + exports2.TypeInfo.WorkItemComment.fields = { + format: { + enumType: exports2.TypeInfo.CommentFormat + }, + revisedDate: { + isDate: true + } + }; + exports2.TypeInfo.WorkItemComments.fields = { + comments: { + isArray: true, + typeInfo: exports2.TypeInfo.WorkItemComment + } + }; + exports2.TypeInfo.WorkItemField.fields = { + type: { + enumType: exports2.TypeInfo.FieldType + }, + usage: { + enumType: exports2.TypeInfo.FieldUsage + } + }; + exports2.TypeInfo.WorkItemField2.fields = { + type: { + enumType: exports2.TypeInfo.FieldType + }, + usage: { + enumType: exports2.TypeInfo.FieldUsage + } + }; + exports2.TypeInfo.WorkItemHistory.fields = { + revisedDate: { + isDate: true + } + }; + exports2.TypeInfo.WorkItemQueryClause.fields = { + clauses: { + isArray: true, + typeInfo: exports2.TypeInfo.WorkItemQueryClause + }, + logicalOperator: { + enumType: exports2.TypeInfo.LogicalOperation + } + }; + exports2.TypeInfo.WorkItemQueryResult.fields = { + asOf: { + isDate: true + }, + queryResultType: { + enumType: exports2.TypeInfo.QueryResultType + }, + queryType: { + enumType: exports2.TypeInfo.QueryType + } + }; + exports2.TypeInfo.WorkItemTagDefinition.fields = { + lastUpdated: { + isDate: true + } + }; + exports2.TypeInfo.WorkItemTypeTemplateUpdateModel.fields = { + actionType: { + enumType: exports2.TypeInfo.ProvisioningActionType + }, + templateType: { + enumType: exports2.TypeInfo.TemplateType + } + }; + exports2.TypeInfo.WorkItemUpdate.fields = { + revisedDate: { + isDate: true + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/WorkItemTrackingApi.js +var require_WorkItemTrackingApi = __commonJS({ + "../node_modules/azure-devops-node-api/WorkItemTrackingApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WorkItemTrackingApi = void 0; + var basem = require_ClientApiBases(); + var WorkItemTrackingInterfaces = require_WorkItemTrackingInterfaces(); + var WorkItemTrackingApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-WorkItemTracking-api", options); + } + /** + * INTERNAL ONLY: USED BY ACCOUNT MY WORK PAGE. This returns Doing, Done, Follows and activity work items details. + * + * @param {WorkItemTrackingInterfaces.QueryOption} queryOption + */ + getAccountMyWorkData(queryOption) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + "$queryOption": queryOption + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "def3d688-ddf5-4096-9024-69beea15cdbd", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.AccountMyWorkResult, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets recent work item activities + * + */ + getRecentActivityData() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "1bc988f4-c15f-4072-ad35-497c87e3a909", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.AccountRecentActivityWorkItemModel2, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * INTERNAL ONLY: USED BY ACCOUNT MY WORK PAGE. + * + */ + getRecentMentions() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "d60eeb6e-e18c-4478-9e94-a0094e28f41c", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.AccountRecentMentionWorkItemModel, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get the list of work item tracking outbound artifact link types. + * + */ + getWorkArtifactLinkTypes() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "1a31de40-e318-41cd-a6c6-881077df52e3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Queries work items linked to a given list of artifact URI. + * + * @param {WorkItemTrackingInterfaces.ArtifactUriQuery} artifactUriQuery - Defines a list of artifact URI for querying work items. + * @param {string} project - Project ID or project name + */ + queryWorkItemsForArtifactUris(artifactUriQuery, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "a9a9aa7a-8c09-44d3-ad1b-46e855c1e3d3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, artifactUriQuery, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Uploads an attachment. + * + * @param {NodeJS.ReadableStream} contentStream - Content to upload + * @param {string} fileName - The name of the file + * @param {string} uploadType - Attachment upload type: Simple or Chunked + * @param {string} project - Project ID or project name + * @param {string} areaPath - Target project Area Path + */ + createAttachment(customHeaders, contentStream, fileName, uploadType, project, areaPath) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + fileName, + uploadType, + areaPath + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/octet-stream"; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "e07b5fa4-1499-494d-a496-64b860fd64ff", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.uploadStream("POST", url, contentStream, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Downloads an attachment. + * + * @param {string} id - Attachment ID + * @param {string} fileName - Name of the file + * @param {string} project - Project ID or project name + * @param {boolean} download - If set to true always download attachment + */ + getAttachmentContent(id, fileName, project, download) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + let queryValues = { + fileName, + download + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "e07b5fa4-1499-494d-a496-64b860fd64ff", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/octet-stream", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Downloads an attachment. + * + * @param {string} id - Attachment ID + * @param {string} fileName - Name of the file + * @param {string} project - Project ID or project name + * @param {boolean} download - If set to true always download attachment + */ + getAttachmentZip(id, fileName, project, download) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + let queryValues = { + fileName, + download + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "e07b5fa4-1499-494d-a496-64b860fd64ff", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("application/zip", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets root classification nodes or list of classification nodes for a given list of nodes ids, for a given project. In case ids parameter is supplied you will get list of classification nodes for those ids. Otherwise you will get root classification nodes for this project. + * + * @param {string} project - Project ID or project name + * @param {number[]} ids - Comma separated integer classification nodes ids. It's not required, if you want root nodes. + * @param {number} depth - Depth of children to fetch. + * @param {WorkItemTrackingInterfaces.ClassificationNodesErrorPolicy} errorPolicy - Flag to handle errors in getting some nodes. Possible options are Fail and Omit. + */ + getClassificationNodes(project, ids, depth, errorPolicy) { + return __awaiter2(this, void 0, void 0, function* () { + if (ids == null) { + throw new TypeError("ids can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + ids: ids && ids.join(","), + "$depth": depth, + errorPolicy + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a70579d1-f53a-48ee-a5be-7be8659023b9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets root classification nodes under the project. + * + * @param {string} project - Project ID or project name + * @param {number} depth - Depth of children to fetch. + */ + getRootNodes(project, depth) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + "$depth": depth + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a70579d1-f53a-48ee-a5be-7be8659023b9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create new or update an existing classification node. + * + * @param {WorkItemTrackingInterfaces.WorkItemClassificationNode} postedNode - Node to create or update. + * @param {string} project - Project ID or project name + * @param {WorkItemTrackingInterfaces.TreeStructureGroup} structureGroup - Structure group of the classification node, area or iteration. + * @param {string} path - Path of the classification node. + */ + createOrUpdateClassificationNode(postedNode, project, structureGroup, path2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + structureGroup, + path: path2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "5a172953-1b41-49d3-840a-33f79c3ce89f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, postedNode, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete an existing classification node. + * + * @param {string} project - Project ID or project name + * @param {WorkItemTrackingInterfaces.TreeStructureGroup} structureGroup - Structure group of the classification node, area or iteration. + * @param {string} path - Path of the classification node. + * @param {number} reclassifyId - Id of the target classification node for reclassification. + */ + deleteClassificationNode(project, structureGroup, path2, reclassifyId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + structureGroup, + path: path2 + }; + let queryValues = { + "$reclassifyId": reclassifyId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "5a172953-1b41-49d3-840a-33f79c3ce89f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the classification node for a given node path. + * + * @param {string} project - Project ID or project name + * @param {WorkItemTrackingInterfaces.TreeStructureGroup} structureGroup - Structure group of the classification node, area or iteration. + * @param {string} path - Path of the classification node. + * @param {number} depth - Depth of children to fetch. + */ + getClassificationNode(project, structureGroup, path2, depth) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + structureGroup, + path: path2 + }; + let queryValues = { + "$depth": depth + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "5a172953-1b41-49d3-840a-33f79c3ce89f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update an existing classification node. + * + * @param {WorkItemTrackingInterfaces.WorkItemClassificationNode} postedNode - Node to create or update. + * @param {string} project - Project ID or project name + * @param {WorkItemTrackingInterfaces.TreeStructureGroup} structureGroup - Structure group of the classification node, area or iteration. + * @param {string} path - Path of the classification node. + */ + updateClassificationNode(postedNode, project, structureGroup, path2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + structureGroup, + path: path2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "5a172953-1b41-49d3-840a-33f79c3ce89f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, postedNode, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemClassificationNode, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get users who reacted on the comment. + * + * @param {string} project - Project ID or project name + * @param {number} workItemId - WorkItem ID. + * @param {number} commentId - Comment ID. + * @param {WorkItemTrackingInterfaces.CommentReactionType} reactionType - Type of the reaction. + * @param {number} top + * @param {number} skip + */ + getEngagedUsers(project, workItemId, commentId, reactionType, top, skip) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + workItemId, + commentId, + reactionType + }; + let queryValues = { + "$top": top, + "$skip": skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "e33ca5e0-2349-4285-af3d-d72d86781c35", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add a comment on a work item. + * + * @param {WorkItemTrackingInterfaces.CommentCreate} request - Comment create request. + * @param {string} project - Project ID or project name + * @param {number} workItemId - Id of a work item. + */ + addComment(request, project, workItemId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + workItemId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, request, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.Comment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a comment on a work item. + * + * @param {string} project - Project ID or project name + * @param {number} workItemId - Id of a work item. + * @param {number} commentId + */ + deleteComment(project, workItemId, commentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + workItemId, + commentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a work item comment. + * + * @param {string} project - Project ID or project name + * @param {number} workItemId - Id of a work item to get the comment. + * @param {number} commentId - Id of the comment to return. + * @param {boolean} includeDeleted - Specify if the deleted comment should be retrieved. + * @param {WorkItemTrackingInterfaces.CommentExpandOptions} expand - Specifies the additional data retrieval options for work item comments. + */ + getComment(project, workItemId, commentId, includeDeleted, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + workItemId, + commentId + }; + let queryValues = { + includeDeleted, + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.Comment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of work item comments, pageable. + * + * @param {string} project - Project ID or project name + * @param {number} workItemId - Id of a work item to get comments for. + * @param {number} top - Max number of comments to return. + * @param {string} continuationToken - Used to query for the next page of comments. + * @param {boolean} includeDeleted - Specify if the deleted comments should be retrieved. + * @param {WorkItemTrackingInterfaces.CommentExpandOptions} expand - Specifies the additional data retrieval options for work item comments. + * @param {WorkItemTrackingInterfaces.CommentSortOrder} order - Order in which the comments should be returned. + */ + getComments(project, workItemId, top, continuationToken, includeDeleted, expand, order) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + workItemId + }; + let queryValues = { + "$top": top, + continuationToken, + includeDeleted, + "$expand": expand, + order + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentList, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of work item comments by ids. + * + * @param {string} project - Project ID or project name + * @param {number} workItemId - Id of a work item to get comments for. + * @param {number[]} ids - Comma-separated list of comment ids to return. + * @param {boolean} includeDeleted - Specify if the deleted comments should be retrieved. + * @param {WorkItemTrackingInterfaces.CommentExpandOptions} expand - Specifies the additional data retrieval options for work item comments. + */ + getCommentsBatch(project, workItemId, ids, includeDeleted, expand) { + return __awaiter2(this, void 0, void 0, function* () { + if (ids == null) { + throw new TypeError("ids can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + workItemId + }; + let queryValues = { + ids: ids && ids.join(","), + includeDeleted, + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentList, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a comment on a work item. + * + * @param {WorkItemTrackingInterfaces.CommentUpdate} request - Comment update request. + * @param {string} project - Project ID or project name + * @param {number} workItemId - Id of a work item. + * @param {number} commentId + */ + updateComment(request, project, workItemId, commentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + workItemId, + commentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "608aac0a-32e1-4493-a863-b9cf4566d257", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, request, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.Comment, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a new reaction to a comment. + * + * @param {string} project - Project ID or project name + * @param {number} workItemId - WorkItem ID + * @param {number} commentId - Comment ID + * @param {WorkItemTrackingInterfaces.CommentReactionType} reactionType - Type of the reaction + */ + createCommentReaction(project, workItemId, commentId, reactionType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + workItemId, + commentId, + reactionType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "f6cb3f27-1028-4851-af96-887e570dc21f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, null, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentReaction, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes an existing reaction on a comment. + * + * @param {string} project - Project ID or project name + * @param {number} workItemId - WorkItem ID + * @param {number} commentId - Comment ID + * @param {WorkItemTrackingInterfaces.CommentReactionType} reactionType - Type of the reaction + */ + deleteCommentReaction(project, workItemId, commentId, reactionType) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + workItemId, + commentId, + reactionType + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "f6cb3f27-1028-4851-af96-887e570dc21f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentReaction, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets reactions of a comment. + * + * @param {string} project - Project ID or project name + * @param {number} workItemId - WorkItem ID + * @param {number} commentId - Comment ID + */ + getCommentReactions(project, workItemId, commentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + workItemId, + commentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "f6cb3f27-1028-4851-af96-887e570dc21f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentReaction, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} workItemId + * @param {number} commentId + * @param {number} version + */ + getCommentVersion(project, workItemId, commentId, version2) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + workItemId, + commentId, + version: version2 + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "49e03b34-3be0-42e3-8a5d-e8dfb88ac954", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentVersion, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {number} workItemId + * @param {number} commentId + */ + getCommentVersions(project, workItemId, commentId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + workItemId, + commentId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "49e03b34-3be0-42e3-8a5d-e8dfb88ac954", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.CommentVersion, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Create a new field. + * + * @param {WorkItemTrackingInterfaces.WorkItemField} workItemField - New field definition + * @param {string} project - Project ID or project name + */ + createField(workItemField, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, workItemField, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemField, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes the field. To undelete a filed, see "Update Field" API. + * + * @param {string} fieldNameOrRefName - Field simple name or reference name + * @param {string} project - Project ID or project name + */ + deleteField(fieldNameOrRefName, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + fieldNameOrRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets information on a specific field. + * + * @param {string} fieldNameOrRefName - Field simple name or reference name + * @param {string} project - Project ID or project name + */ + getField(fieldNameOrRefName, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + fieldNameOrRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemField, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns information for all fields. The project ID/name parameter is optional. + * + * @param {string} project - Project ID or project name + * @param {WorkItemTrackingInterfaces.GetFieldsExpand} expand - Use ExtensionFields to include extension fields, otherwise exclude them. Unless the feature flag for this parameter is enabled, extension fields are always included. + */ + getFields(project, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemField, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a field. + * + * @param {WorkItemTrackingInterfaces.UpdateWorkItemField} payload - Payload contains desired value of the field's properties + * @param {string} fieldNameOrRefName - Name/reference name of the field to be updated + * @param {string} project - Project ID or project name + */ + updateField(payload, fieldNameOrRefName, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + fieldNameOrRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b51fd764-e5c2-4b9b-aaf7-3395cf4bdd94", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, payload, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemField, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Migrates a project to a different process within the same OOB type. For example, you can only migrate a project from agile/custom-agile to agile/custom-agile. + * + * @param {WorkItemTrackingInterfaces.ProcessIdModel} newProcess + * @param {string} project - Project ID or project name + */ + migrateProjectsProcess(newProcess, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "19801631-d4e5-47e9-8166-0330de0ff1e6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, newProcess, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a query, or moves a query. + * + * @param {WorkItemTrackingInterfaces.QueryHierarchyItem} postedQuery - The query to create. + * @param {string} project - Project ID or project name + * @param {string} query - The parent id or path under which the query is to be created. + * @param {boolean} validateWiqlOnly - If you only want to validate your WIQL query without actually creating one, set it to true. Default is false. + */ + createQuery(postedQuery, project, query, validateWiqlOnly) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + query + }; + let queryValues = { + validateWiqlOnly + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, postedQuery, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItem, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Delete a query or a folder. This deletes any permission change on the deleted query or folder and any of its descendants if it is a folder. It is important to note that the deleted permission changes cannot be recovered upon undeleting the query or folder. + * + * @param {string} project - Project ID or project name + * @param {string} query - ID or path of the query or folder to delete. + */ + deleteQuery(project, query) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + query + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the root queries and their children + * + * @param {string} project - Project ID or project name + * @param {WorkItemTrackingInterfaces.QueryExpand} expand - Include the query string (wiql), clauses, query result columns, and sort options in the results. + * @param {number} depth - In the folder of queries, return child queries and folders to this depth. + * @param {boolean} includeDeleted - Include deleted queries and folders + */ + getQueries(project, expand, depth, includeDeleted) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + "$expand": expand, + "$depth": depth, + "$includeDeleted": includeDeleted + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItem, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Retrieves an individual query and its children + * + * @param {string} project - Project ID or project name + * @param {string} query - ID or path of the query. + * @param {WorkItemTrackingInterfaces.QueryExpand} expand - Include the query string (wiql), clauses, query result columns, and sort options in the results. + * @param {number} depth - In the folder of queries, return child queries and folders to this depth. + * @param {boolean} includeDeleted - Include deleted queries and folders + * @param {boolean} useIsoDateFormat - DateTime query clauses will be formatted using a ISO 8601 compliant format + */ + getQuery(project, query, expand, depth, includeDeleted, useIsoDateFormat) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + query + }; + let queryValues = { + "$expand": expand, + "$depth": depth, + "$includeDeleted": includeDeleted, + "$useIsoDateFormat": useIsoDateFormat + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItem, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Searches all queries the user has access to in the current project + * + * @param {string} project - Project ID or project name + * @param {string} filter - The text to filter the queries with. + * @param {number} top - The number of queries to return (Default is 50 and maximum is 200). + * @param {WorkItemTrackingInterfaces.QueryExpand} expand + * @param {boolean} includeDeleted - Include deleted queries and folders + */ + searchQueries(project, filter2, top, expand, includeDeleted) { + return __awaiter2(this, void 0, void 0, function* () { + if (filter2 == null) { + throw new TypeError("filter can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + "$filter": filter2, + "$top": top, + "$expand": expand, + "$includeDeleted": includeDeleted + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItemsResult, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Update a query or a folder. This allows you to update, rename and move queries and folders. + * + * @param {WorkItemTrackingInterfaces.QueryHierarchyItem} queryUpdate - The query to update. + * @param {string} project - Project ID or project name + * @param {string} query - The ID or path for the query to update. + * @param {boolean} undeleteDescendants - Undelete the children of this folder. It is important to note that this will not bring back the permission changes that were previously applied to the descendants. + */ + updateQuery(queryUpdate, project, query, undeleteDescendants) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + query + }; + let queryValues = { + "$undeleteDescendants": undeleteDescendants + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a67d190c-c41f-424b-814d-0e906f659301", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, queryUpdate, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItem, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a list of queries by ids (Maximum 1000) + * + * @param {WorkItemTrackingInterfaces.QueryBatchGetRequest} queryGetRequest + * @param {string} project - Project ID or project name + */ + getQueriesBatch(queryGetRequest, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "549816f9-09b0-4e75-9e81-01fbfcd07426", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, queryGetRequest, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.QueryHierarchyItem, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Destroys the specified work item permanently from the Recycle Bin. This action can not be undone. + * + * @param {number} id - ID of the work item to be destroyed permanently + * @param {string} project - Project ID or project name + */ + destroyWorkItem(id, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b70d8d39-926c-465e-b927-b1bf0e5ca0e0", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a deleted work item from Recycle Bin. + * + * @param {number} id - ID of the work item to be returned + * @param {string} project - Project ID or project name + */ + getDeletedWorkItem(id, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b70d8d39-926c-465e-b927-b1bf0e5ca0e0", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the work items from the recycle bin, whose IDs have been specified in the parameters + * + * @param {number[]} ids - Comma separated list of IDs of the deleted work items to be returned + * @param {string} project - Project ID or project name + */ + getDeletedWorkItems(ids, project) { + return __awaiter2(this, void 0, void 0, function* () { + if (ids == null) { + throw new TypeError("ids can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + ids: ids && ids.join(",") + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b70d8d39-926c-465e-b927-b1bf0e5ca0e0", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets a list of the IDs and the URLs of the deleted the work items in the Recycle Bin. + * + * @param {string} project - Project ID or project name + */ + getDeletedWorkItemShallowReferences(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b70d8d39-926c-465e-b927-b1bf0e5ca0e0", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Restores the deleted work item from Recycle Bin. + * + * @param {WorkItemTrackingInterfaces.WorkItemDeleteUpdate} payload - Paylod with instructions to update the IsDeleted flag to false + * @param {number} id - ID of the work item to be restored + * @param {string} project - Project ID or project name + */ + restoreWorkItem(payload, id, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "b70d8d39-926c-465e-b927-b1bf0e5ca0e0", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, payload, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a fully hydrated work item for the requested revision + * + * @param {number} id + * @param {number} revisionNumber + * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand + * @param {string} project - Project ID or project name + */ + getRevision(id, revisionNumber, expand, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id, + revisionNumber + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "a00c85a5-80fa-4565-99c3-bcd2181434bb", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns the list of fully hydrated work item revisions, paged. + * + * @param {number} id + * @param {number} top + * @param {number} skip + * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand + * @param {string} project - Project ID or project name + */ + getRevisions(id, top, skip, expand, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + let queryValues = { + "$top": top, + "$skip": skip, + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "a00c85a5-80fa-4565-99c3-bcd2181434bb", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * RESTful method to send mail for selected/queried work items. + * + * @param {WorkItemTrackingInterfaces.SendMailBody} body + * @param {string} project - Project ID or project name + */ + sendMail(body, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "12438500-2f84-4fa7-9f1a-c31871b4959d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, body, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} tagIdOrName + */ + deleteTag(project, tagIdOrName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + tagIdOrName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "bc15bc60-e7a8-43cb-ab01-2106be3983a1", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} tagIdOrName + */ + getTag(project, tagIdOrName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + tagIdOrName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "bc15bc60-e7a8-43cb-ab01-2106be3983a1", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + */ + getTags(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "bc15bc60-e7a8-43cb-ab01-2106be3983a1", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {WorkItemTrackingInterfaces.WorkItemTagDefinition} tagData + * @param {string} project - Project ID or project name + * @param {string} tagIdOrName + */ + updateTag(tagData, project, tagIdOrName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + tagIdOrName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "bc15bc60-e7a8-43cb-ab01-2106be3983a1", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, tagData, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a template + * + * @param {WorkItemTrackingInterfaces.WorkItemTemplate} template - Template contents + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + */ + createTemplate(template2, teamContext) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "6a90345f-a676-4969-afce-8e163e1d5642", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, template2, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets template + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} workitemtypename - Optional, When specified returns templates for given Work item type. + */ + getTemplates(teamContext, workitemtypename) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + let queryValues = { + workitemtypename + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "6a90345f-a676-4969-afce-8e163e1d5642", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes the template with given id + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} templateId - Template id + */ + deleteTemplate(teamContext, templateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + templateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "fb10264a-8836-48a0-8033-1b0ccd2748d5", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the template with specified id + * + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} templateId - Template Id + */ + getTemplate(teamContext, templateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + templateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "fb10264a-8836-48a0-8033-1b0ccd2748d5", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Replace template contents + * + * @param {WorkItemTrackingInterfaces.WorkItemTemplate} templateContent - Template contents to replace with + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {string} templateId - Template id + */ + replaceTemplate(templateContent, teamContext, templateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + templateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "fb10264a-8836-48a0-8033-1b0ccd2748d5", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, templateContent, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a single update for a work item + * + * @param {number} id + * @param {number} updateNumber + * @param {string} project - Project ID or project name + */ + getUpdate(id, updateNumber, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id, + updateNumber + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "6570bf97-d02c-4a91-8d93-3abe9895b1a9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemUpdate, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a the deltas between work item revisions + * + * @param {number} id + * @param {number} top + * @param {number} skip + * @param {string} project - Project ID or project name + */ + getUpdates(id, top, skip, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + let queryValues = { + "$top": top, + "$skip": skip + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "6570bf97-d02c-4a91-8d93-3abe9895b1a9", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemUpdate, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the results of the query given its WIQL. + * + * @param {WorkItemTrackingInterfaces.Wiql} wiql - The query containing the WIQL. + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {boolean} timePrecision - Whether or not to use time precision. + * @param {number} top - The max number of results to return. + */ + queryByWiql(wiql, teamContext, timePrecision, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team + }; + let queryValues = { + timePrecision, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "1a9c53f7-f243-4447-b110-35ef023636e4", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, wiql, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemQueryResult, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the results of the query given the query ID. + * + * @param {string} id - The query ID. + * @param {TfsCoreInterfaces.TeamContext} teamContext - The team context for the operation + * @param {boolean} timePrecision - Whether or not to use time precision. + * @param {number} top - The max number of results to return. + */ + queryById(id, teamContext, timePrecision, top) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let project = null; + let team = null; + if (teamContext) { + project = teamContext.projectId || teamContext.project; + team = teamContext.teamId || teamContext.team; + } + let routeValues = { + project, + team, + id + }; + let queryValues = { + timePrecision, + "$top": top + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "a02355f5-5f8a-4671-8e32-369d23aac83d", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingInterfaces.TypeInfo.WorkItemQueryResult, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a work item icon given the friendly name and icon color. + * + * @param {string} icon - The name of the icon + * @param {string} color - The 6-digit hex color for the icon + * @param {number} v - The version of the icon (used only for cache invalidation) + */ + getWorkItemIconJson(icon, color, v) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + icon + }; + let queryValues = { + color, + v + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "4e1eb4a5-1970-4228-a682-ec48eb2dca30", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of all work item icons. + * + */ + getWorkItemIcons() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "4e1eb4a5-1970-4228-a682-ec48eb2dca30", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a work item icon given the friendly name and icon color. + * + * @param {string} icon - The name of the icon + * @param {string} color - The 6-digit hex color for the icon + * @param {number} v - The version of the icon (used only for cache invalidation) + */ + getWorkItemIconSvg(icon, color, v) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + icon + }; + let queryValues = { + color, + v + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "4e1eb4a5-1970-4228-a682-ec48eb2dca30", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("image/svg+xml", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a work item icon given the friendly name and icon color. + * + * @param {string} icon - The name of the icon + * @param {string} color - The 6-digit hex color for the icon + * @param {number} v - The version of the icon (used only for cache invalidation) + */ + getWorkItemIconXaml(icon, color, v) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + icon + }; + let queryValues = { + color, + v + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "4e1eb4a5-1970-4228-a682-ec48eb2dca30", routeValues, queryValues); + let url = verData.requestUrl; + let apiVersion = verData.apiVersion; + let accept = this.createAcceptHeader("image/xaml+xml", apiVersion); + resolve((yield this.http.get(url, { "Accept": accept })).message); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a batch of work item links + * + * @param {string} project - Project ID or project name + * @param {string[]} linkTypes - A list of types to filter the results to specific link types. Omit this parameter to get work item links of all link types. + * @param {string[]} types - A list of types to filter the results to specific work item types. Omit this parameter to get work item links of all work item types. + * @param {string} continuationToken - Specifies the continuationToken to start the batch from. Omit this parameter to get the first batch of links. + * @param {Date} startDateTime - Date/time to use as a starting point for link changes. Only link changes that occurred after that date/time will be returned. Cannot be used in conjunction with 'watermark' parameter. + */ + getReportingLinksByLinkType(project, linkTypes, types, continuationToken, startDateTime) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + linkTypes: linkTypes && linkTypes.join(","), + types: types && types.join(","), + continuationToken, + startDateTime + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "b5b5b6d0-0308-40a1-b3f4-b9bb3c66878f", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the work item relation type definition. + * + * @param {string} relation - The relation name + */ + getRelationType(relation) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + relation + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "f5d33bc9-5b49-4a3c-a9bd-f3cd46dd2165", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the work item relation types. + * + */ + getRelationTypes() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "f5d33bc9-5b49-4a3c-a9bd-f3cd46dd2165", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a batch of work item revisions with the option of including deleted items + * + * @param {string} project - Project ID or project name + * @param {string[]} fields - A list of fields to return in work item revisions. Omit this parameter to get all reportable fields. + * @param {string[]} types - A list of types to filter the results to specific work item types. Omit this parameter to get work item revisions of all work item types. + * @param {string} continuationToken - Specifies the watermark to start the batch from. Omit this parameter to get the first batch of revisions. + * @param {Date} startDateTime - Date/time to use as a starting point for revisions, all revisions will occur after this date/time. Cannot be used in conjunction with 'watermark' parameter. + * @param {boolean} includeIdentityRef - Return an identity reference instead of a string value for identity fields. + * @param {boolean} includeDeleted - Specify if the deleted item should be returned. + * @param {boolean} includeTagRef - Specify if the tag objects should be returned for System.Tags field. + * @param {boolean} includeLatestOnly - Return only the latest revisions of work items, skipping all historical revisions + * @param {WorkItemTrackingInterfaces.ReportingRevisionsExpand} expand - Return all the fields in work item revisions, including long text fields which are not returned by default + * @param {boolean} includeDiscussionChangesOnly - Return only the those revisions of work items, where only history field was changed + * @param {number} maxPageSize - The maximum number of results to return in this batch + */ + readReportingRevisionsGet(project, fields, types, continuationToken, startDateTime, includeIdentityRef, includeDeleted, includeTagRef, includeLatestOnly, expand, includeDiscussionChangesOnly, maxPageSize) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + fields: fields && fields.join(","), + types: types && types.join(","), + continuationToken, + startDateTime, + includeIdentityRef, + includeDeleted, + includeTagRef, + includeLatestOnly, + "$expand": expand, + includeDiscussionChangesOnly, + "$maxPageSize": maxPageSize + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "f828fe59-dd87-495d-a17c-7a8d6211ca6c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a batch of work item revisions. This request may be used if your list of fields is large enough that it may run the URL over the length limit. + * + * @param {WorkItemTrackingInterfaces.ReportingWorkItemRevisionsFilter} filter - An object that contains request settings: field filter, type filter, identity format + * @param {string} project - Project ID or project name + * @param {string} continuationToken - Specifies the watermark to start the batch from. Omit this parameter to get the first batch of revisions. + * @param {Date} startDateTime - Date/time to use as a starting point for revisions, all revisions will occur after this date/time. Cannot be used in conjunction with 'watermark' parameter. + * @param {WorkItemTrackingInterfaces.ReportingRevisionsExpand} expand + */ + readReportingRevisionsPost(filter2, project, continuationToken, startDateTime, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + continuationToken, + startDateTime, + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "f828fe59-dd87-495d-a17c-7a8d6211ca6c", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, filter2, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * @param {string} project - Project ID or project name + * @param {string} continuationToken + * @param {number} maxPageSize + */ + readReportingDiscussions(project, continuationToken, maxPageSize) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + continuationToken, + "$maxPageSize": maxPageSize + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "4a644469-90c5-4fcc-9a9f-be0827d369ec", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a single work item. + * + * @param {VSSInterfaces.JsonPatchDocument} document - The JSON Patch document representing the work item + * @param {string} project - Project ID or project name + * @param {string} type - The work item type of the work item to create + * @param {boolean} validateOnly - Indicate if you only want to validate the changes without saving the work item + * @param {boolean} bypassRules - Do not enforce the work item type rules on this update + * @param {boolean} suppressNotifications - Do not fire any notifications for this change + * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand - The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + */ + createWorkItem(customHeaders, document, project, type, validateOnly, bypassRules, suppressNotifications, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + type + }; + let queryValues = { + validateOnly, + bypassRules, + suppressNotifications, + "$expand": expand + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/json-patch+json"; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "62d3d110-0047-428c-ad3c-4fe872c91c74", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.create(url, document, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a single work item from a template. + * + * @param {string} project - Project ID or project name + * @param {string} type - The work item type name + * @param {string} fields - Comma-separated list of requested fields + * @param {Date} asOf - AsOf UTC date time string + * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand - The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + */ + getWorkItemTemplate(project, type, fields, asOf, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + type + }; + let queryValues = { + fields, + asOf, + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "62d3d110-0047-428c-ad3c-4fe872c91c74", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes the specified work item and sends it to the Recycle Bin, so that it can be restored back, if required. Optionally, if the destroy parameter has been set to true, it destroys the work item permanently. WARNING: If the destroy parameter is set to true, work items deleted by this command will NOT go to recycle-bin and there is no way to restore/recover them after deletion. It is recommended NOT to use this parameter. If you do, please use this parameter with extreme caution. + * + * @param {number} id - ID of the work item to be deleted + * @param {string} project - Project ID or project name + * @param {boolean} destroy - Optional parameter, if set to true, the work item is deleted permanently. Please note: the destroy action is PERMANENT and cannot be undone. + */ + deleteWorkItem(id, project, destroy) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + let queryValues = { + destroy + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "72c7ddf8-2cdc-4f60-90cd-ab71c14a399b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a single work item. + * + * @param {number} id - The work item id + * @param {string[]} fields - Comma-separated list of requested fields + * @param {Date} asOf - AsOf UTC date time string + * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand - The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + * @param {string} project - Project ID or project name + */ + getWorkItem(id, fields, asOf, expand, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + let queryValues = { + fields: fields && fields.join(","), + asOf, + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "72c7ddf8-2cdc-4f60-90cd-ab71c14a399b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of work items (Maximum 200) + * + * @param {number[]} ids - The comma-separated list of requested work item ids. (Maximum 200 ids allowed). + * @param {string[]} fields - Comma-separated list of requested fields + * @param {Date} asOf - AsOf UTC date time string + * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand - The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + * @param {WorkItemTrackingInterfaces.WorkItemErrorPolicy} errorPolicy - The flag to control error policy in a bulk get work items request. Possible options are {Fail, Omit}. + * @param {string} project - Project ID or project name + */ + getWorkItems(ids, fields, asOf, expand, errorPolicy, project) { + return __awaiter2(this, void 0, void 0, function* () { + if (ids == null) { + throw new TypeError("ids can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + let queryValues = { + ids: ids && ids.join(","), + fields: fields && fields.join(","), + asOf, + "$expand": expand, + errorPolicy + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "72c7ddf8-2cdc-4f60-90cd-ab71c14a399b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a single work item. + * + * @param {VSSInterfaces.JsonPatchDocument} document - The JSON Patch document representing the update + * @param {number} id - The id of the work item to update + * @param {string} project - Project ID or project name + * @param {boolean} validateOnly - Indicate if you only want to validate the changes without saving the work item + * @param {boolean} bypassRules - Do not enforce the work item type rules on this update + * @param {boolean} suppressNotifications - Do not fire any notifications for this change + * @param {WorkItemTrackingInterfaces.WorkItemExpand} expand - The expand parameters for work item attributes. Possible options are { None, Relations, Fields, Links, All }. + */ + updateWorkItem(customHeaders, document, id, project, validateOnly, bypassRules, suppressNotifications, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + id + }; + let queryValues = { + validateOnly, + bypassRules, + suppressNotifications, + "$expand": expand + }; + customHeaders = customHeaders || {}; + customHeaders["Content-Type"] = "application/json-patch+json"; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "72c7ddf8-2cdc-4f60-90cd-ab71c14a399b", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + options.additionalHeaders = customHeaders; + let res; + res = yield this.rest.update(url, document, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets work items for a list of work item ids (Maximum 200) + * + * @param {WorkItemTrackingInterfaces.WorkItemBatchGetRequest} workItemGetRequest + * @param {string} project - Project ID or project name + */ + getWorkItemsBatch(workItemGetRequest, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "908509b6-4248-4475-a1cd-829139ba419f", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, workItemGetRequest, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * INTERNAL ONLY: It will be used for My account work experience. Get the work item type state color for multiple projects + * + * @param {string[]} projectNames + */ + getWorkItemStateColors(projectNames) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "0b83df8a-3496-4ddb-ba44-63634f4cda61", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, projectNames, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns the next state on the given work item IDs. + * + * @param {number[]} ids - list of work item ids + * @param {string} action - possible actions. Currently only supports checkin + */ + getWorkItemNextStatesOnCheckinAction(ids, action) { + return __awaiter2(this, void 0, void 0, function* () { + if (ids == null) { + throw new TypeError("ids can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + ids: ids && ids.join(","), + action + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "afae844b-e2f6-44c2-8053-17b3bb936a40", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get all work item type categories. + * + * @param {string} project - Project ID or project name + */ + getWorkItemTypeCategories(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "9b9f5734-36c8-415e-ba67-f83b45c31408", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get specific work item type category by name. + * + * @param {string} project - Project ID or project name + * @param {string} category - The category name + */ + getWorkItemTypeCategory(project, category) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + category + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "9b9f5734-36c8-415e-ba67-f83b45c31408", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * INTERNAL ONLY: It will be used for My account work experience. Get the wit type color for multiple projects + * + * @param {string[]} projectNames + */ + getWorkItemTypeColors(projectNames) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "958fde80-115e-43fb-bd65-749c48057faf", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, projectNames, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * INTERNAL ONLY: It is used for color and icon providers. Get the wit type color for multiple projects + * + * @param {string[]} projectNames + */ + getWorkItemTypeColorAndIcons(projectNames) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "f0f8dc62-3975-48ce-8051-f636b68b52e3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, projectNames, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a work item type definition. + * + * @param {string} project - Project ID or project name + * @param {string} type - Work item type name + */ + getWorkItemType(project, type) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "7c8d7a76-4a09-43e8-b5df-bd792f4ac6aa", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns the list of work item types + * + * @param {string} project - Project ID or project name + */ + getWorkItemTypes(project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.2", "wit", "7c8d7a76-4a09-43e8-b5df-bd792f4ac6aa", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a list of fields for a work item type with detailed references. + * + * @param {string} project - Project ID or project name + * @param {string} type - Work item type. + * @param {WorkItemTrackingInterfaces.WorkItemTypeFieldsExpandLevel} expand - Expand level for the API response. Properties: to include allowedvalues, default value, isRequired etc. as a part of response; None: to skip these properties. + */ + getWorkItemTypeFieldsWithReferences(project, type, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + type + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "bd293ce5-3d25-4192-8e67-e8092e879efb", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a field for a work item type with detailed references. + * + * @param {string} project - Project ID or project name + * @param {string} type - Work item type. + * @param {string} field + * @param {WorkItemTrackingInterfaces.WorkItemTypeFieldsExpandLevel} expand - Expand level for the API response. Properties: to include allowedvalues, default value, isRequired etc. as a part of response; None: to skip these properties. + */ + getWorkItemTypeFieldWithReferences(project, type, field, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + type, + field + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.3", "wit", "bd293ce5-3d25-4192-8e67-e8092e879efb", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns the state names and colors for a work item type. + * + * @param {string} project - Project ID or project name + * @param {string} type - The state name + */ + getWorkItemTypeStates(project, type) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + type + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "7c9d7a76-4a09-43e8-b5df-bd792f4ac6aa", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Export work item type + * + * @param {string} project - Project ID or project name + * @param {string} type + * @param {boolean} exportGlobalLists + */ + exportWorkItemTypeDefinition(project, type, exportGlobalLists) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project, + type + }; + let queryValues = { + exportGlobalLists + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "8637ac8b-5eb6-4f90-b3f7-4f2ff576a459", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Add/updates a work item type + * + * @param {WorkItemTrackingInterfaces.WorkItemTypeTemplateUpdateModel} updateModel + * @param {string} project - Project ID or project name + */ + updateWorkItemTypeDefinition(updateModel, project) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + project + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.1-preview.1", "wit", "8637ac8b-5eb6-4f90-b3f7-4f2ff576a459", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, updateModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.WorkItemTrackingApi = WorkItemTrackingApi; + WorkItemTrackingApi.RESOURCE_AREA_ID = "5264459e-e5e0-4bd8-b118-0985e68a4ec5"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/WorkItemTrackingProcessInterfaces.js +var require_WorkItemTrackingProcessInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/WorkItemTrackingProcessInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.WorkItemTypeClass = exports2.RuleConditionType = exports2.RuleActionType = exports2.ProcessWorkItemTypeFieldsExpandLevel = exports2.ProcessClass = exports2.PageType = exports2.GetWorkItemTypeExpand = exports2.GetProcessExpandLevel = exports2.GetBehaviorsExpand = exports2.FieldType = exports2.CustomizationType = void 0; + var CustomizationType; + (function(CustomizationType2) { + CustomizationType2[CustomizationType2["System"] = 1] = "System"; + CustomizationType2[CustomizationType2["Inherited"] = 2] = "Inherited"; + CustomizationType2[CustomizationType2["Custom"] = 3] = "Custom"; + })(CustomizationType = exports2.CustomizationType || (exports2.CustomizationType = {})); + var FieldType; + (function(FieldType2) { + FieldType2[FieldType2["String"] = 1] = "String"; + FieldType2[FieldType2["Integer"] = 2] = "Integer"; + FieldType2[FieldType2["DateTime"] = 3] = "DateTime"; + FieldType2[FieldType2["PlainText"] = 5] = "PlainText"; + FieldType2[FieldType2["Html"] = 7] = "Html"; + FieldType2[FieldType2["TreePath"] = 8] = "TreePath"; + FieldType2[FieldType2["History"] = 9] = "History"; + FieldType2[FieldType2["Double"] = 10] = "Double"; + FieldType2[FieldType2["Guid"] = 11] = "Guid"; + FieldType2[FieldType2["Boolean"] = 12] = "Boolean"; + FieldType2[FieldType2["Identity"] = 13] = "Identity"; + FieldType2[FieldType2["PicklistInteger"] = 14] = "PicklistInteger"; + FieldType2[FieldType2["PicklistString"] = 15] = "PicklistString"; + FieldType2[FieldType2["PicklistDouble"] = 16] = "PicklistDouble"; + })(FieldType = exports2.FieldType || (exports2.FieldType = {})); + var GetBehaviorsExpand; + (function(GetBehaviorsExpand2) { + GetBehaviorsExpand2[GetBehaviorsExpand2["None"] = 0] = "None"; + GetBehaviorsExpand2[GetBehaviorsExpand2["Fields"] = 1] = "Fields"; + GetBehaviorsExpand2[GetBehaviorsExpand2["CombinedFields"] = 2] = "CombinedFields"; + })(GetBehaviorsExpand = exports2.GetBehaviorsExpand || (exports2.GetBehaviorsExpand = {})); + var GetProcessExpandLevel; + (function(GetProcessExpandLevel2) { + GetProcessExpandLevel2[GetProcessExpandLevel2["None"] = 0] = "None"; + GetProcessExpandLevel2[GetProcessExpandLevel2["Projects"] = 1] = "Projects"; + })(GetProcessExpandLevel = exports2.GetProcessExpandLevel || (exports2.GetProcessExpandLevel = {})); + var GetWorkItemTypeExpand; + (function(GetWorkItemTypeExpand2) { + GetWorkItemTypeExpand2[GetWorkItemTypeExpand2["None"] = 0] = "None"; + GetWorkItemTypeExpand2[GetWorkItemTypeExpand2["States"] = 1] = "States"; + GetWorkItemTypeExpand2[GetWorkItemTypeExpand2["Behaviors"] = 2] = "Behaviors"; + GetWorkItemTypeExpand2[GetWorkItemTypeExpand2["Layout"] = 4] = "Layout"; + })(GetWorkItemTypeExpand = exports2.GetWorkItemTypeExpand || (exports2.GetWorkItemTypeExpand = {})); + var PageType; + (function(PageType2) { + PageType2[PageType2["Custom"] = 1] = "Custom"; + PageType2[PageType2["History"] = 2] = "History"; + PageType2[PageType2["Links"] = 3] = "Links"; + PageType2[PageType2["Attachments"] = 4] = "Attachments"; + })(PageType = exports2.PageType || (exports2.PageType = {})); + var ProcessClass; + (function(ProcessClass2) { + ProcessClass2[ProcessClass2["System"] = 0] = "System"; + ProcessClass2[ProcessClass2["Derived"] = 1] = "Derived"; + ProcessClass2[ProcessClass2["Custom"] = 2] = "Custom"; + })(ProcessClass = exports2.ProcessClass || (exports2.ProcessClass = {})); + var ProcessWorkItemTypeFieldsExpandLevel; + (function(ProcessWorkItemTypeFieldsExpandLevel2) { + ProcessWorkItemTypeFieldsExpandLevel2[ProcessWorkItemTypeFieldsExpandLevel2["None"] = 0] = "None"; + ProcessWorkItemTypeFieldsExpandLevel2[ProcessWorkItemTypeFieldsExpandLevel2["AllowedValues"] = 1] = "AllowedValues"; + ProcessWorkItemTypeFieldsExpandLevel2[ProcessWorkItemTypeFieldsExpandLevel2["All"] = 2] = "All"; + })(ProcessWorkItemTypeFieldsExpandLevel = exports2.ProcessWorkItemTypeFieldsExpandLevel || (exports2.ProcessWorkItemTypeFieldsExpandLevel = {})); + var RuleActionType; + (function(RuleActionType2) { + RuleActionType2[RuleActionType2["MakeRequired"] = 1] = "MakeRequired"; + RuleActionType2[RuleActionType2["MakeReadOnly"] = 2] = "MakeReadOnly"; + RuleActionType2[RuleActionType2["SetDefaultValue"] = 3] = "SetDefaultValue"; + RuleActionType2[RuleActionType2["SetDefaultFromClock"] = 4] = "SetDefaultFromClock"; + RuleActionType2[RuleActionType2["SetDefaultFromCurrentUser"] = 5] = "SetDefaultFromCurrentUser"; + RuleActionType2[RuleActionType2["SetDefaultFromField"] = 6] = "SetDefaultFromField"; + RuleActionType2[RuleActionType2["CopyValue"] = 7] = "CopyValue"; + RuleActionType2[RuleActionType2["CopyFromClock"] = 8] = "CopyFromClock"; + RuleActionType2[RuleActionType2["CopyFromCurrentUser"] = 9] = "CopyFromCurrentUser"; + RuleActionType2[RuleActionType2["CopyFromField"] = 10] = "CopyFromField"; + RuleActionType2[RuleActionType2["SetValueToEmpty"] = 11] = "SetValueToEmpty"; + RuleActionType2[RuleActionType2["CopyFromServerClock"] = 12] = "CopyFromServerClock"; + RuleActionType2[RuleActionType2["CopyFromServerCurrentUser"] = 13] = "CopyFromServerCurrentUser"; + RuleActionType2[RuleActionType2["HideTargetField"] = 14] = "HideTargetField"; + RuleActionType2[RuleActionType2["DisallowValue"] = 15] = "DisallowValue"; + })(RuleActionType = exports2.RuleActionType || (exports2.RuleActionType = {})); + var RuleConditionType; + (function(RuleConditionType2) { + RuleConditionType2[RuleConditionType2["When"] = 1] = "When"; + RuleConditionType2[RuleConditionType2["WhenNot"] = 2] = "WhenNot"; + RuleConditionType2[RuleConditionType2["WhenChanged"] = 3] = "WhenChanged"; + RuleConditionType2[RuleConditionType2["WhenNotChanged"] = 4] = "WhenNotChanged"; + RuleConditionType2[RuleConditionType2["WhenWas"] = 5] = "WhenWas"; + RuleConditionType2[RuleConditionType2["WhenStateChangedTo"] = 6] = "WhenStateChangedTo"; + RuleConditionType2[RuleConditionType2["WhenStateChangedFromAndTo"] = 7] = "WhenStateChangedFromAndTo"; + RuleConditionType2[RuleConditionType2["WhenWorkItemIsCreated"] = 8] = "WhenWorkItemIsCreated"; + RuleConditionType2[RuleConditionType2["WhenValueIsDefined"] = 9] = "WhenValueIsDefined"; + RuleConditionType2[RuleConditionType2["WhenValueIsNotDefined"] = 10] = "WhenValueIsNotDefined"; + RuleConditionType2[RuleConditionType2["WhenCurrentUserIsMemberOfGroup"] = 11] = "WhenCurrentUserIsMemberOfGroup"; + RuleConditionType2[RuleConditionType2["WhenCurrentUserIsNotMemberOfGroup"] = 12] = "WhenCurrentUserIsNotMemberOfGroup"; + })(RuleConditionType = exports2.RuleConditionType || (exports2.RuleConditionType = {})); + var WorkItemTypeClass; + (function(WorkItemTypeClass2) { + WorkItemTypeClass2[WorkItemTypeClass2["System"] = 0] = "System"; + WorkItemTypeClass2[WorkItemTypeClass2["Derived"] = 1] = "Derived"; + WorkItemTypeClass2[WorkItemTypeClass2["Custom"] = 2] = "Custom"; + })(WorkItemTypeClass = exports2.WorkItemTypeClass || (exports2.WorkItemTypeClass = {})); + exports2.TypeInfo = { + CreateProcessRuleRequest: {}, + CustomizationType: { + enumValues: { + "system": 1, + "inherited": 2, + "custom": 3 + } + }, + FieldModel: {}, + FieldType: { + enumValues: { + "string": 1, + "integer": 2, + "dateTime": 3, + "plainText": 5, + "html": 7, + "treePath": 8, + "history": 9, + "double": 10, + "guid": 11, + "boolean": 12, + "identity": 13, + "picklistInteger": 14, + "picklistString": 15, + "picklistDouble": 16 + } + }, + FormLayout: {}, + GetBehaviorsExpand: { + enumValues: { + "none": 0, + "fields": 1, + "combinedFields": 2 + } + }, + GetProcessExpandLevel: { + enumValues: { + "none": 0, + "projects": 1 + } + }, + GetWorkItemTypeExpand: { + enumValues: { + "none": 0, + "states": 1, + "behaviors": 2, + "layout": 4 + } + }, + Page: {}, + PageType: { + enumValues: { + "custom": 1, + "history": 2, + "links": 3, + "attachments": 4 + } + }, + ProcessBehavior: {}, + ProcessClass: { + enumValues: { + "system": 0, + "derived": 1, + "custom": 2 + } + }, + ProcessInfo: {}, + ProcessModel: {}, + ProcessProperties: {}, + ProcessRule: {}, + ProcessWorkItemType: {}, + ProcessWorkItemTypeField: {}, + ProcessWorkItemTypeFieldsExpandLevel: { + enumValues: { + "none": 0, + "allowedValues": 1, + "all": 2 + } + }, + RuleAction: {}, + RuleActionType: { + enumValues: { + "makeRequired": 1, + "makeReadOnly": 2, + "setDefaultValue": 3, + "setDefaultFromClock": 4, + "setDefaultFromCurrentUser": 5, + "setDefaultFromField": 6, + "copyValue": 7, + "copyFromClock": 8, + "copyFromCurrentUser": 9, + "copyFromField": 10, + "setValueToEmpty": 11, + "copyFromServerClock": 12, + "copyFromServerCurrentUser": 13, + "hideTargetField": 14, + "disallowValue": 15 + } + }, + RuleCondition: {}, + RuleConditionType: { + enumValues: { + "when": 1, + "whenNot": 2, + "whenChanged": 3, + "whenNotChanged": 4, + "whenWas": 5, + "whenStateChangedTo": 6, + "whenStateChangedFromAndTo": 7, + "whenWorkItemIsCreated": 8, + "whenValueIsDefined": 9, + "whenValueIsNotDefined": 10, + "whenCurrentUserIsMemberOfGroup": 11, + "whenCurrentUserIsNotMemberOfGroup": 12 + } + }, + UpdateProcessRuleRequest: {}, + WorkItemStateResultModel: {}, + WorkItemTypeClass: { + enumValues: { + "system": 0, + "derived": 1, + "custom": 2 + } + }, + WorkItemTypeModel: {} + }; + exports2.TypeInfo.CreateProcessRuleRequest.fields = { + actions: { + isArray: true, + typeInfo: exports2.TypeInfo.RuleAction + }, + conditions: { + isArray: true, + typeInfo: exports2.TypeInfo.RuleCondition + } + }; + exports2.TypeInfo.FieldModel.fields = { + type: { + enumType: exports2.TypeInfo.FieldType + } + }; + exports2.TypeInfo.FormLayout.fields = { + pages: { + isArray: true, + typeInfo: exports2.TypeInfo.Page + } + }; + exports2.TypeInfo.Page.fields = { + pageType: { + enumType: exports2.TypeInfo.PageType + } + }; + exports2.TypeInfo.ProcessBehavior.fields = { + customization: { + enumType: exports2.TypeInfo.CustomizationType + } + }; + exports2.TypeInfo.ProcessInfo.fields = { + customizationType: { + enumType: exports2.TypeInfo.CustomizationType + } + }; + exports2.TypeInfo.ProcessModel.fields = { + properties: { + typeInfo: exports2.TypeInfo.ProcessProperties + } + }; + exports2.TypeInfo.ProcessProperties.fields = { + class: { + enumType: exports2.TypeInfo.ProcessClass + } + }; + exports2.TypeInfo.ProcessRule.fields = { + actions: { + isArray: true, + typeInfo: exports2.TypeInfo.RuleAction + }, + conditions: { + isArray: true, + typeInfo: exports2.TypeInfo.RuleCondition + }, + customizationType: { + enumType: exports2.TypeInfo.CustomizationType + } + }; + exports2.TypeInfo.ProcessWorkItemType.fields = { + customization: { + enumType: exports2.TypeInfo.CustomizationType + }, + layout: { + typeInfo: exports2.TypeInfo.FormLayout + }, + states: { + isArray: true, + typeInfo: exports2.TypeInfo.WorkItemStateResultModel + } + }; + exports2.TypeInfo.ProcessWorkItemTypeField.fields = { + customization: { + enumType: exports2.TypeInfo.CustomizationType + }, + type: { + enumType: exports2.TypeInfo.FieldType + } + }; + exports2.TypeInfo.RuleAction.fields = { + actionType: { + enumType: exports2.TypeInfo.RuleActionType + } + }; + exports2.TypeInfo.RuleCondition.fields = { + conditionType: { + enumType: exports2.TypeInfo.RuleConditionType + } + }; + exports2.TypeInfo.UpdateProcessRuleRequest.fields = { + actions: { + isArray: true, + typeInfo: exports2.TypeInfo.RuleAction + }, + conditions: { + isArray: true, + typeInfo: exports2.TypeInfo.RuleCondition + } + }; + exports2.TypeInfo.WorkItemStateResultModel.fields = { + customizationType: { + enumType: exports2.TypeInfo.CustomizationType + } + }; + exports2.TypeInfo.WorkItemTypeModel.fields = { + class: { + enumType: exports2.TypeInfo.WorkItemTypeClass + }, + layout: { + typeInfo: exports2.TypeInfo.FormLayout + }, + states: { + isArray: true, + typeInfo: exports2.TypeInfo.WorkItemStateResultModel + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/WorkItemTrackingProcessApi.js +var require_WorkItemTrackingProcessApi = __commonJS({ + "../node_modules/azure-devops-node-api/WorkItemTrackingProcessApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WorkItemTrackingProcessApi = void 0; + var basem = require_ClientApiBases(); + var WorkItemTrackingProcessInterfaces = require_WorkItemTrackingProcessInterfaces(); + var WorkItemTrackingProcessApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-WorkItemTracking-api", options); + } + /** + * Creates a single behavior in the given process. + * + * @param {WorkItemTrackingProcessInterfaces.ProcessBehaviorCreateRequest} behavior + * @param {string} processId - The ID of the process + */ + createProcessBehavior(behavior, processId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "d1800200-f184-4e75-a5f2-ad0b04b4373e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, behavior, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessBehavior, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a behavior in the process. + * + * @param {string} processId - The ID of the process + * @param {string} behaviorRefName - The reference name of the behavior + */ + deleteProcessBehavior(processId, behaviorRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + behaviorRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "d1800200-f184-4e75-a5f2-ad0b04b4373e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a behavior of the process. + * + * @param {string} processId - The ID of the process + * @param {string} behaviorRefName - The reference name of the behavior + * @param {WorkItemTrackingProcessInterfaces.GetBehaviorsExpand} expand + */ + getProcessBehavior(processId, behaviorRefName, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + behaviorRefName + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "d1800200-f184-4e75-a5f2-ad0b04b4373e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessBehavior, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of all behaviors in the process. + * + * @param {string} processId - The ID of the process + * @param {WorkItemTrackingProcessInterfaces.GetBehaviorsExpand} expand + */ + getProcessBehaviors(processId, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "d1800200-f184-4e75-a5f2-ad0b04b4373e", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessBehavior, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Replaces a behavior in the process. + * + * @param {WorkItemTrackingProcessInterfaces.ProcessBehaviorUpdateRequest} behaviorData + * @param {string} processId - The ID of the process + * @param {string} behaviorRefName - The reference name of the behavior + */ + updateProcessBehavior(behaviorData, processId, behaviorRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + behaviorRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "d1800200-f184-4e75-a5f2-ad0b04b4373e", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, behaviorData, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessBehavior, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a control in a group. + * + * @param {WorkItemTrackingProcessInterfaces.Control} control - The control. + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} groupId - The ID of the group to add the control to. + */ + createControlInGroup(control, processId, witRefName, groupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + groupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1f59b363-a2d0-4b7e-9bc6-eb9f5f3f0e58", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, control, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Moves a control to a specified group. + * + * @param {WorkItemTrackingProcessInterfaces.Control} control - The control. + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} groupId - The ID of the group to move the control to. + * @param {string} controlId - The ID of the control. + * @param {string} removeFromGroupId - The group ID to remove the control from. + */ + moveControlToGroup(control, processId, witRefName, groupId, controlId, removeFromGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + groupId, + controlId + }; + let queryValues = { + removeFromGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1f59b363-a2d0-4b7e-9bc6-eb9f5f3f0e58", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, control, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a control from the work item form. + * + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} groupId - The ID of the group. + * @param {string} controlId - The ID of the control to remove. + */ + removeControlFromGroup(processId, witRefName, groupId, controlId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + groupId, + controlId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1f59b363-a2d0-4b7e-9bc6-eb9f5f3f0e58", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a control on the work item form. + * + * @param {WorkItemTrackingProcessInterfaces.Control} control - The updated control. + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} groupId - The ID of the group. + * @param {string} controlId - The ID of the control. + */ + updateControl(control, processId, witRefName, groupId, controlId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + groupId, + controlId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1f59b363-a2d0-4b7e-9bc6-eb9f5f3f0e58", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, control, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a field to a work item type. + * + * @param {WorkItemTrackingProcessInterfaces.AddProcessWorkItemTypeFieldRequest} field + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + */ + addFieldToWorkItemType(field, processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "bc0ad8dc-e3f3-46b0-b06c-5bf861793196", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, field, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemTypeField, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of all fields in a work item type. + * + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + */ + getAllWorkItemTypeFields(processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "bc0ad8dc-e3f3-46b0-b06c-5bf861793196", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemTypeField, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a field in a work item type. + * + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} fieldRefName - The reference name of the field. + * @param {WorkItemTrackingProcessInterfaces.ProcessWorkItemTypeFieldsExpandLevel} expand + */ + getWorkItemTypeField(processId, witRefName, fieldRefName, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + fieldRefName + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "bc0ad8dc-e3f3-46b0-b06c-5bf861793196", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemTypeField, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a field from a work item type. Does not permanently delete the field. + * + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} fieldRefName - The reference name of the field. + */ + removeWorkItemTypeField(processId, witRefName, fieldRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + fieldRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "bc0ad8dc-e3f3-46b0-b06c-5bf861793196", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a field in a work item type. + * + * @param {WorkItemTrackingProcessInterfaces.UpdateProcessWorkItemTypeFieldRequest} field + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} fieldRefName - The reference name of the field. + */ + updateWorkItemTypeField(field, processId, witRefName, fieldRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + fieldRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "bc0ad8dc-e3f3-46b0-b06c-5bf861793196", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, field, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemTypeField, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a group to the work item form. + * + * @param {WorkItemTrackingProcessInterfaces.Group} group - The group. + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} pageId - The ID of the page to add the group to. + * @param {string} sectionId - The ID of the section to add the group to. + */ + addGroup(group2, processId, witRefName, pageId, sectionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + pageId, + sectionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "766e44e1-36a8-41d7-9050-c343ff02f7a5", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, group2, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Moves a group to a different page and section. + * + * @param {WorkItemTrackingProcessInterfaces.Group} group - The updated group. + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} pageId - The ID of the page the group is in. + * @param {string} sectionId - The ID of the section the group is i.n + * @param {string} groupId - The ID of the group. + * @param {string} removeFromPageId - ID of the page to remove the group from. + * @param {string} removeFromSectionId - ID of the section to remove the group from. + */ + moveGroupToPage(group2, processId, witRefName, pageId, sectionId, groupId, removeFromPageId, removeFromSectionId) { + return __awaiter2(this, void 0, void 0, function* () { + if (removeFromPageId == null) { + throw new TypeError("removeFromPageId can not be null or undefined"); + } + if (removeFromSectionId == null) { + throw new TypeError("removeFromSectionId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + pageId, + sectionId, + groupId + }; + let queryValues = { + removeFromPageId, + removeFromSectionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "766e44e1-36a8-41d7-9050-c343ff02f7a5", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, group2, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Moves a group to a different section. + * + * @param {WorkItemTrackingProcessInterfaces.Group} group - The updated group. + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} pageId - The ID of the page the group is in. + * @param {string} sectionId - The ID of the section the group is in. + * @param {string} groupId - The ID of the group. + * @param {string} removeFromSectionId - ID of the section to remove the group from. + */ + moveGroupToSection(group2, processId, witRefName, pageId, sectionId, groupId, removeFromSectionId) { + return __awaiter2(this, void 0, void 0, function* () { + if (removeFromSectionId == null) { + throw new TypeError("removeFromSectionId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + pageId, + sectionId, + groupId + }; + let queryValues = { + removeFromSectionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "766e44e1-36a8-41d7-9050-c343ff02f7a5", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, group2, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a group from the work item form. + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} pageId - The ID of the page the group is in + * @param {string} sectionId - The ID of the section to the group is in + * @param {string} groupId - The ID of the group + */ + removeGroup(processId, witRefName, pageId, sectionId, groupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + pageId, + sectionId, + groupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "766e44e1-36a8-41d7-9050-c343ff02f7a5", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a group in the work item form. + * + * @param {WorkItemTrackingProcessInterfaces.Group} group - The updated group. + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} pageId - The ID of the page the group is in. + * @param {string} sectionId - The ID of the section the group is in. + * @param {string} groupId - The ID of the group. + */ + updateGroup(group2, processId, witRefName, pageId, sectionId, groupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + pageId, + sectionId, + groupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "766e44e1-36a8-41d7-9050-c343ff02f7a5", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, group2, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the form layout. + * + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + */ + getFormLayout(processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "fa8646eb-43cd-4b71-9564-40106fd63e40", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.FormLayout, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a picklist. + * + * @param {WorkItemTrackingProcessInterfaces.PickList} picklist - Picklist + */ + createList(picklist) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "01e15468-e27c-4e20-a974-bd957dcccebc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, picklist, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a picklist. + * + * @param {string} listId - The ID of the list + */ + deleteList(listId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + listId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "01e15468-e27c-4e20-a974-bd957dcccebc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a picklist. + * + * @param {string} listId - The ID of the list + */ + getList(listId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + listId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "01e15468-e27c-4e20-a974-bd957dcccebc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns meta data of the picklist. + * + */ + getListsMetadata() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "01e15468-e27c-4e20-a974-bd957dcccebc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a list. + * + * @param {WorkItemTrackingProcessInterfaces.PickList} picklist + * @param {string} listId - The ID of the list + */ + updateList(picklist, listId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + listId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "01e15468-e27c-4e20-a974-bd957dcccebc", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, picklist, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a page to the work item form. + * + * @param {WorkItemTrackingProcessInterfaces.Page} page - The page. + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + */ + addPage(page, processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1cc7b29f-6697-4d9d-b0a1-2650d3e1d584", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, page, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.Page, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a page from the work item form + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} pageId - The ID of the page + */ + removePage(processId, witRefName, pageId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + pageId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1cc7b29f-6697-4d9d-b0a1-2650d3e1d584", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a page on the work item form + * + * @param {WorkItemTrackingProcessInterfaces.Page} page - The page + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + updatePage(page, processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "1cc7b29f-6697-4d9d-b0a1-2650d3e1d584", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, page, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.Page, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a process. + * + * @param {WorkItemTrackingProcessInterfaces.CreateProcessModel} createRequest - CreateProcessModel. + */ + createNewProcess(createRequest) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "02cc6a73-5cfb-427d-8c8e-b49fb086e8af", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, createRequest, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessInfo, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a process of a specific ID. + * + * @param {string} processTypeId + */ + deleteProcessById(processTypeId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processTypeId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "02cc6a73-5cfb-427d-8c8e-b49fb086e8af", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Edit a process of a specific ID. + * + * @param {WorkItemTrackingProcessInterfaces.UpdateProcessModel} updateRequest + * @param {string} processTypeId + */ + editProcess(updateRequest, processTypeId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processTypeId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "02cc6a73-5cfb-427d-8c8e-b49fb086e8af", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, updateRequest, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessInfo, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get list of all processes including system and inherited. + * + * @param {WorkItemTrackingProcessInterfaces.GetProcessExpandLevel} expand + */ + getListOfProcesses(expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "02cc6a73-5cfb-427d-8c8e-b49fb086e8af", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessInfo, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Get a single process of a specified ID. + * + * @param {string} processTypeId + * @param {WorkItemTrackingProcessInterfaces.GetProcessExpandLevel} expand + */ + getProcessByItsId(processTypeId, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processTypeId + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "02cc6a73-5cfb-427d-8c8e-b49fb086e8af", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessInfo, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a rule to work item type in the process. + * + * @param {WorkItemTrackingProcessInterfaces.CreateProcessRuleRequest} processRuleCreate + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + addProcessWorkItemTypeRule(processRuleCreate, processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "76fe3432-d825-479d-a5f6-983bbb78b4f3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, processRuleCreate, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessRule, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a rule from the work item type in the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} ruleId - The ID of the rule + */ + deleteProcessWorkItemTypeRule(processId, witRefName, ruleId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + ruleId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "76fe3432-d825-479d-a5f6-983bbb78b4f3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a single rule in the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} ruleId - The ID of the rule + */ + getProcessWorkItemTypeRule(processId, witRefName, ruleId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + ruleId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "76fe3432-d825-479d-a5f6-983bbb78b4f3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessRule, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of all rules in the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + getProcessWorkItemTypeRules(processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "76fe3432-d825-479d-a5f6-983bbb78b4f3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessRule, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a rule in the work item type of the process. + * + * @param {WorkItemTrackingProcessInterfaces.UpdateProcessRuleRequest} processRule + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} ruleId - The ID of the rule + */ + updateProcessWorkItemTypeRule(processRule, processId, witRefName, ruleId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + ruleId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "76fe3432-d825-479d-a5f6-983bbb78b4f3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, processRule, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessRule, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a state definition in the work item type of the process. + * + * @param {WorkItemTrackingProcessInterfaces.WorkItemStateInputModel} stateModel + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + createStateDefinition(stateModel, processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "31015d57-2dff-4a46-adb3-2fb4ee3dcec9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, stateModel, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.WorkItemStateResultModel, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a state definition in the work item type of the process. + * + * @param {string} processId - ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} stateId - ID of the state + */ + deleteStateDefinition(processId, witRefName, stateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + stateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "31015d57-2dff-4a46-adb3-2fb4ee3dcec9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a single state definition in a work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} stateId - The ID of the state + */ + getStateDefinition(processId, witRefName, stateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + stateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "31015d57-2dff-4a46-adb3-2fb4ee3dcec9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.WorkItemStateResultModel, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of all state definitions in a work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + getStateDefinitions(processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "31015d57-2dff-4a46-adb3-2fb4ee3dcec9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.WorkItemStateResultModel, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Hides a state definition in the work item type of the process.Only states with customizationType:System can be hidden. + * + * @param {WorkItemTrackingProcessInterfaces.HideStateModel} hideStateModel + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} stateId - The ID of the state + */ + hideStateDefinition(hideStateModel, processId, witRefName, stateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + stateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "31015d57-2dff-4a46-adb3-2fb4ee3dcec9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, hideStateModel, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.WorkItemStateResultModel, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a given state definition in the work item type of the process. + * + * @param {WorkItemTrackingProcessInterfaces.WorkItemStateInputModel} stateModel + * @param {string} processId - ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} stateId - ID of the state + */ + updateStateDefinition(stateModel, processId, witRefName, stateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + stateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "31015d57-2dff-4a46-adb3-2fb4ee3dcec9", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, stateModel, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.WorkItemStateResultModel, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Deletes a system control modification on the work item form. + * + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} controlId - The ID of the control. + */ + deleteSystemControl(processId, witRefName, controlId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + controlId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "ff9a3d2c-32b7-4c6c-991c-d5a251fb9098", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets edited system controls for a work item type in a process. To get all system controls (base + edited) use layout API(s) + * + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + */ + getSystemControls(processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "ff9a3d2c-32b7-4c6c-991c-d5a251fb9098", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates/adds a system control on the work item form. + * + * @param {WorkItemTrackingProcessInterfaces.Control} control + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + * @param {string} controlId - The ID of the control. + */ + updateSystemControl(control, processId, witRefName, controlId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + controlId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "ff9a3d2c-32b7-4c6c-991c-d5a251fb9098", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, control, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a work item type in the process. + * + * @param {WorkItemTrackingProcessInterfaces.CreateProcessWorkItemTypeRequest} workItemType + * @param {string} processId - The ID of the process on which to create work item type. + */ + createProcessWorkItemType(workItemType, processId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "e2e9d1a6-432d-4062-8870-bfcb8c324ad7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, workItemType, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemType, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a work item type in the process. + * + * @param {string} processId - The ID of the process. + * @param {string} witRefName - The reference name of the work item type. + */ + deleteProcessWorkItemType(processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "e2e9d1a6-432d-4062-8870-bfcb8c324ad7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a single work item type in a process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {WorkItemTrackingProcessInterfaces.GetWorkItemTypeExpand} expand - Flag to determine what properties of work item type to return + */ + getProcessWorkItemType(processId, witRefName, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "e2e9d1a6-432d-4062-8870-bfcb8c324ad7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemType, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of all work item types in a process. + * + * @param {string} processId - The ID of the process + * @param {WorkItemTrackingProcessInterfaces.GetWorkItemTypeExpand} expand - Flag to determine what properties of work item type to return + */ + getProcessWorkItemTypes(processId, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "e2e9d1a6-432d-4062-8870-bfcb8c324ad7", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemType, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a work item type of the process. + * + * @param {WorkItemTrackingProcessInterfaces.UpdateProcessWorkItemTypeRequest} workItemTypeUpdate + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + updateProcessWorkItemType(workItemTypeUpdate, processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.2", "processes", "e2e9d1a6-432d-4062-8870-bfcb8c324ad7", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, workItemTypeUpdate, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessInterfaces.TypeInfo.ProcessWorkItemType, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a behavior to the work item type of the process. + * + * @param {WorkItemTrackingProcessInterfaces.WorkItemTypeBehavior} behavior + * @param {string} processId - The ID of the process + * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior + */ + addBehaviorToWorkItemType(behavior, processId, witRefNameForBehaviors) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForBehaviors + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "6d765a2e-4e1b-4b11-be93-f953be676024", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, behavior, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a behavior for the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior + * @param {string} behaviorRefName - The reference name of the behavior + */ + getBehaviorForWorkItemType(processId, witRefNameForBehaviors, behaviorRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForBehaviors, + behaviorRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "6d765a2e-4e1b-4b11-be93-f953be676024", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of all behaviors for the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior + */ + getBehaviorsForWorkItemType(processId, witRefNameForBehaviors) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForBehaviors + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "6d765a2e-4e1b-4b11-be93-f953be676024", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a behavior for the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior + * @param {string} behaviorRefName - The reference name of the behavior + */ + removeBehaviorFromWorkItemType(processId, witRefNameForBehaviors, behaviorRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForBehaviors, + behaviorRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "6d765a2e-4e1b-4b11-be93-f953be676024", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a behavior for the work item type of the process. + * + * @param {WorkItemTrackingProcessInterfaces.WorkItemTypeBehavior} behavior + * @param {string} processId - The ID of the process + * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior + */ + updateBehaviorToWorkItemType(behavior, processId, witRefNameForBehaviors) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForBehaviors + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processes", "6d765a2e-4e1b-4b11-be93-f953be676024", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, behavior, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.WorkItemTrackingProcessApi = WorkItemTrackingProcessApi; + WorkItemTrackingProcessApi.RESOURCE_AREA_ID = "5264459e-e5e0-4bd8-b118-0985e68a4ec5"; + } +}); + +// ../node_modules/azure-devops-node-api/interfaces/WorkItemTrackingProcessDefinitionsInterfaces.js +var require_WorkItemTrackingProcessDefinitionsInterfaces = __commonJS({ + "../node_modules/azure-devops-node-api/interfaces/WorkItemTrackingProcessDefinitionsInterfaces.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypeInfo = exports2.WorkItemTypeClass = exports2.PageType = exports2.GetWorkItemTypeExpand = exports2.FieldType = void 0; + var FieldType; + (function(FieldType2) { + FieldType2[FieldType2["String"] = 1] = "String"; + FieldType2[FieldType2["Integer"] = 2] = "Integer"; + FieldType2[FieldType2["DateTime"] = 3] = "DateTime"; + FieldType2[FieldType2["PlainText"] = 5] = "PlainText"; + FieldType2[FieldType2["Html"] = 7] = "Html"; + FieldType2[FieldType2["TreePath"] = 8] = "TreePath"; + FieldType2[FieldType2["History"] = 9] = "History"; + FieldType2[FieldType2["Double"] = 10] = "Double"; + FieldType2[FieldType2["Guid"] = 11] = "Guid"; + FieldType2[FieldType2["Boolean"] = 12] = "Boolean"; + FieldType2[FieldType2["Identity"] = 13] = "Identity"; + FieldType2[FieldType2["PicklistInteger"] = 14] = "PicklistInteger"; + FieldType2[FieldType2["PicklistString"] = 15] = "PicklistString"; + FieldType2[FieldType2["PicklistDouble"] = 16] = "PicklistDouble"; + })(FieldType = exports2.FieldType || (exports2.FieldType = {})); + var GetWorkItemTypeExpand; + (function(GetWorkItemTypeExpand2) { + GetWorkItemTypeExpand2[GetWorkItemTypeExpand2["None"] = 0] = "None"; + GetWorkItemTypeExpand2[GetWorkItemTypeExpand2["States"] = 1] = "States"; + GetWorkItemTypeExpand2[GetWorkItemTypeExpand2["Behaviors"] = 2] = "Behaviors"; + GetWorkItemTypeExpand2[GetWorkItemTypeExpand2["Layout"] = 4] = "Layout"; + })(GetWorkItemTypeExpand = exports2.GetWorkItemTypeExpand || (exports2.GetWorkItemTypeExpand = {})); + var PageType; + (function(PageType2) { + PageType2[PageType2["Custom"] = 1] = "Custom"; + PageType2[PageType2["History"] = 2] = "History"; + PageType2[PageType2["Links"] = 3] = "Links"; + PageType2[PageType2["Attachments"] = 4] = "Attachments"; + })(PageType = exports2.PageType || (exports2.PageType = {})); + var WorkItemTypeClass; + (function(WorkItemTypeClass2) { + WorkItemTypeClass2[WorkItemTypeClass2["System"] = 0] = "System"; + WorkItemTypeClass2[WorkItemTypeClass2["Derived"] = 1] = "Derived"; + WorkItemTypeClass2[WorkItemTypeClass2["Custom"] = 2] = "Custom"; + })(WorkItemTypeClass = exports2.WorkItemTypeClass || (exports2.WorkItemTypeClass = {})); + exports2.TypeInfo = { + FieldModel: {}, + FieldType: { + enumValues: { + "string": 1, + "integer": 2, + "dateTime": 3, + "plainText": 5, + "html": 7, + "treePath": 8, + "history": 9, + "double": 10, + "guid": 11, + "boolean": 12, + "identity": 13, + "picklistInteger": 14, + "picklistString": 15, + "picklistDouble": 16 + } + }, + FormLayout: {}, + GetWorkItemTypeExpand: { + enumValues: { + "none": 0, + "states": 1, + "behaviors": 2, + "layout": 4 + } + }, + Page: {}, + PageType: { + enumValues: { + "custom": 1, + "history": 2, + "links": 3, + "attachments": 4 + } + }, + WorkItemTypeClass: { + enumValues: { + "system": 0, + "derived": 1, + "custom": 2 + } + }, + WorkItemTypeFieldModel: {}, + WorkItemTypeFieldModel2: {}, + WorkItemTypeModel: {} + }; + exports2.TypeInfo.FieldModel.fields = { + type: { + enumType: exports2.TypeInfo.FieldType + } + }; + exports2.TypeInfo.FormLayout.fields = { + pages: { + isArray: true, + typeInfo: exports2.TypeInfo.Page + } + }; + exports2.TypeInfo.Page.fields = { + pageType: { + enumType: exports2.TypeInfo.PageType + } + }; + exports2.TypeInfo.WorkItemTypeFieldModel.fields = { + type: { + enumType: exports2.TypeInfo.FieldType + } + }; + exports2.TypeInfo.WorkItemTypeFieldModel2.fields = { + type: { + enumType: exports2.TypeInfo.FieldType + } + }; + exports2.TypeInfo.WorkItemTypeModel.fields = { + class: { + enumType: exports2.TypeInfo.WorkItemTypeClass + }, + layout: { + typeInfo: exports2.TypeInfo.FormLayout + } + }; + } +}); + +// ../node_modules/azure-devops-node-api/WorkItemTrackingProcessDefinitionsApi.js +var require_WorkItemTrackingProcessDefinitionsApi = __commonJS({ + "../node_modules/azure-devops-node-api/WorkItemTrackingProcessDefinitionsApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WorkItemTrackingProcessDefinitionsApi = void 0; + var basem = require_ClientApiBases(); + var WorkItemTrackingProcessDefinitionsInterfaces = require_WorkItemTrackingProcessDefinitionsInterfaces(); + var WorkItemTrackingProcessDefinitionsApi = class extends basem.ClientApiBase { + constructor(baseUrl, handlers, options) { + super(baseUrl, handlers, "node-WorkItemTracking-api", options); + } + /** + * Creates a single behavior in the given process. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.BehaviorCreateModel} behavior + * @param {string} processId - The ID of the process + */ + createBehavior(behavior, processId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "47a651f4-fb70-43bf-b96b-7c0ba947142b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, behavior, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a behavior in the process. + * + * @param {string} processId - The ID of the process + * @param {string} behaviorId - The ID of the behavior + */ + deleteBehavior(processId, behaviorId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + behaviorId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "47a651f4-fb70-43bf-b96b-7c0ba947142b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a single behavior in the process. + * + * @param {string} processId - The ID of the process + * @param {string} behaviorId - The ID of the behavior + */ + getBehavior(processId, behaviorId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + behaviorId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "47a651f4-fb70-43bf-b96b-7c0ba947142b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of all behaviors in the process. + * + * @param {string} processId - The ID of the process + */ + getBehaviors(processId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "47a651f4-fb70-43bf-b96b-7c0ba947142b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Replaces a behavior in the process. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.BehaviorReplaceModel} behaviorData + * @param {string} processId - The ID of the process + * @param {string} behaviorId - The ID of the behavior + */ + replaceBehavior(behaviorData, processId, behaviorId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + behaviorId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "47a651f4-fb70-43bf-b96b-7c0ba947142b", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, behaviorData, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a control in a group + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.Control} control - The control + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} groupId - The ID of the group to add the control to + */ + addControlToGroup(control, processId, witRefName, groupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + groupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "e2e3166a-627a-4e9b-85b2-d6a097bbd731", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, control, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a control on the work item form + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.Control} control - The updated control + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} groupId - The ID of the group + * @param {string} controlId - The ID of the control + */ + editControl(control, processId, witRefName, groupId, controlId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + groupId, + controlId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "e2e3166a-627a-4e9b-85b2-d6a097bbd731", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, control, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a control from the work item form + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} groupId - The ID of the group + * @param {string} controlId - The ID of the control to remove + */ + removeControlFromGroup(processId, witRefName, groupId, controlId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + groupId, + controlId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "e2e3166a-627a-4e9b-85b2-d6a097bbd731", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Moves a control to a new group + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.Control} control - The control + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} groupId - The ID of the group to move the control to + * @param {string} controlId - The id of the control + * @param {string} removeFromGroupId - The group to remove the control from + */ + setControlInGroup(control, processId, witRefName, groupId, controlId, removeFromGroupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + groupId, + controlId + }; + let queryValues = { + removeFromGroupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "e2e3166a-627a-4e9b-85b2-d6a097bbd731", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, control, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a single field in the process. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.FieldModel} field + * @param {string} processId - The ID of the process + */ + createField(field, processId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "f36c66c7-911d-4163-8938-d3c5d0d7f5aa", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, field, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.FieldModel, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a given field in the process. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.FieldUpdate} field + * @param {string} processId - The ID of the process + */ + updateField(field, processId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "f36c66c7-911d-4163-8938-d3c5d0d7f5aa", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, field, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.FieldModel, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a group to the work item form + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.Group} group - The group + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} pageId - The ID of the page to add the group to + * @param {string} sectionId - The ID of the section to add the group to + */ + addGroup(group2, processId, witRefName, pageId, sectionId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + pageId, + sectionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "2617828b-e850-4375-a92a-04855704d4c3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, group2, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a group in the work item form + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.Group} group - The updated group + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} pageId - The ID of the page the group is in + * @param {string} sectionId - The ID of the section the group is in + * @param {string} groupId - The ID of the group + */ + editGroup(group2, processId, witRefName, pageId, sectionId, groupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + pageId, + sectionId, + groupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "2617828b-e850-4375-a92a-04855704d4c3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, group2, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a group from the work item form + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} pageId - The ID of the page the group is in + * @param {string} sectionId - The ID of the section to the group is in + * @param {string} groupId - The ID of the group + */ + removeGroup(processId, witRefName, pageId, sectionId, groupId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + pageId, + sectionId, + groupId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "2617828b-e850-4375-a92a-04855704d4c3", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Moves a group to a different page and section + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.Group} group - The updated group + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} pageId - The ID of the page the group is in + * @param {string} sectionId - The ID of the section the group is in + * @param {string} groupId - The ID of the group + * @param {string} removeFromPageId - ID of the page to remove the group from + * @param {string} removeFromSectionId - ID of the section to remove the group from + */ + setGroupInPage(group2, processId, witRefName, pageId, sectionId, groupId, removeFromPageId, removeFromSectionId) { + return __awaiter2(this, void 0, void 0, function* () { + if (removeFromPageId == null) { + throw new TypeError("removeFromPageId can not be null or undefined"); + } + if (removeFromSectionId == null) { + throw new TypeError("removeFromSectionId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + pageId, + sectionId, + groupId + }; + let queryValues = { + removeFromPageId, + removeFromSectionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "2617828b-e850-4375-a92a-04855704d4c3", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, group2, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Moves a group to a different section + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.Group} group - The updated group + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} pageId - The ID of the page the group is in + * @param {string} sectionId - The ID of the section the group is in + * @param {string} groupId - The ID of the group + * @param {string} removeFromSectionId - ID of the section to remove the group from + */ + setGroupInSection(group2, processId, witRefName, pageId, sectionId, groupId, removeFromSectionId) { + return __awaiter2(this, void 0, void 0, function* () { + if (removeFromSectionId == null) { + throw new TypeError("removeFromSectionId can not be null or undefined"); + } + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + pageId, + sectionId, + groupId + }; + let queryValues = { + removeFromSectionId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "2617828b-e850-4375-a92a-04855704d4c3", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, group2, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Gets the form layout + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + getFormLayout(processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "3eacc80a-ddca-4404-857a-6331aac99063", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.FormLayout, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns meta data of the picklist. + * + */ + getListsMetadata() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "b45cc931-98e3-44a1-b1cd-2e8e9c6dc1c6", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a picklist. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.PickListModel} picklist + */ + createList(picklist) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = {}; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "0b6179e2-23ce-46b2-b094-2ffa5ee70286", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, picklist, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a picklist. + * + * @param {string} listId - The ID of the list + */ + deleteList(listId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + listId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "0b6179e2-23ce-46b2-b094-2ffa5ee70286", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a picklist. + * + * @param {string} listId - The ID of the list + */ + getList(listId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + listId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "0b6179e2-23ce-46b2-b094-2ffa5ee70286", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a list. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.PickListModel} picklist + * @param {string} listId - The ID of the list + */ + updateList(picklist, listId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + listId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "0b6179e2-23ce-46b2-b094-2ffa5ee70286", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, picklist, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a page to the work item form + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.Page} page - The page + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + addPage(page, processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1b4ac126-59b2-4f37-b4df-0a48ba807edb", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, page, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.Page, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a page on the work item form + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.Page} page - The page + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + editPage(page, processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1b4ac126-59b2-4f37-b4df-0a48ba807edb", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, page, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.Page, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a page from the work item form + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} pageId - The ID of the page + */ + removePage(processId, witRefName, pageId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + pageId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1b4ac126-59b2-4f37-b4df-0a48ba807edb", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a state definition in the work item type of the process. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemStateInputModel} stateModel + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + createStateDefinition(stateModel, processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "4303625d-08f4-4461-b14b-32c65bba5599", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, stateModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a state definition in the work item type of the process. + * + * @param {string} processId - ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} stateId - ID of the state + */ + deleteStateDefinition(processId, witRefName, stateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + stateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "4303625d-08f4-4461-b14b-32c65bba5599", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a state definition in the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} stateId - The ID of the state + */ + getStateDefinition(processId, witRefName, stateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + stateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "4303625d-08f4-4461-b14b-32c65bba5599", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of all state definitions in the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + getStateDefinitions(processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "4303625d-08f4-4461-b14b-32c65bba5599", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Hides a state definition in the work item type of the process. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.HideStateModel} hideStateModel + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} stateId - The ID of the state + */ + hideStateDefinition(hideStateModel, processId, witRefName, stateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + stateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "4303625d-08f4-4461-b14b-32c65bba5599", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.replace(url, hideStateModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a given state definition in the work item type of the process. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemStateInputModel} stateModel + * @param {string} processId - ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {string} stateId - ID of the state + */ + updateStateDefinition(stateModel, processId, witRefName, stateId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName, + stateId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "4303625d-08f4-4461-b14b-32c65bba5599", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, stateModel, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a behavior to the work item type of the process. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemTypeBehavior} behavior + * @param {string} processId - The ID of the process + * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior + */ + addBehaviorToWorkItemType(behavior, processId, witRefNameForBehaviors) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForBehaviors + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "921dfb88-ef57-4c69-94e5-dd7da2d7031d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, behavior, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a behavior for the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior + * @param {string} behaviorRefName - The reference name of the behavior + */ + getBehaviorForWorkItemType(processId, witRefNameForBehaviors, behaviorRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForBehaviors, + behaviorRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "921dfb88-ef57-4c69-94e5-dd7da2d7031d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of all behaviors for the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior + */ + getBehaviorsForWorkItemType(processId, witRefNameForBehaviors) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForBehaviors + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "921dfb88-ef57-4c69-94e5-dd7da2d7031d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, null, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a behavior for the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior + * @param {string} behaviorRefName - The reference name of the behavior + */ + removeBehaviorFromWorkItemType(processId, witRefNameForBehaviors, behaviorRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForBehaviors, + behaviorRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "921dfb88-ef57-4c69-94e5-dd7da2d7031d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates default work item type for the behavior of the process. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemTypeBehavior} behavior + * @param {string} processId - The ID of the process + * @param {string} witRefNameForBehaviors - Work item type reference name for the behavior + */ + updateBehaviorToWorkItemType(behavior, processId, witRefNameForBehaviors) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForBehaviors + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "921dfb88-ef57-4c69-94e5-dd7da2d7031d", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, behavior, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Creates a work item type in the process. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemTypeModel} workItemType + * @param {string} processId - The ID of the process + */ + createWorkItemType(workItemType, processId) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1ce0acad-4638-49c3-969c-04aa65ba6bea", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, workItemType, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeModel, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a work item type in the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + deleteWorkItemType(processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1ce0acad-4638-49c3-969c-04aa65ba6bea", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + * @param {WorkItemTrackingProcessDefinitionsInterfaces.GetWorkItemTypeExpand} expand + */ + getWorkItemType(processId, witRefName, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1ce0acad-4638-49c3-969c-04aa65ba6bea", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeModel, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of all work item types in the process. + * + * @param {string} processId - The ID of the process + * @param {WorkItemTrackingProcessDefinitionsInterfaces.GetWorkItemTypeExpand} expand + */ + getWorkItemTypes(processId, expand) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId + }; + let queryValues = { + "$expand": expand + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1ce0acad-4638-49c3-969c-04aa65ba6bea", routeValues, queryValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeModel, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a work item type of the process. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemTypeUpdateModel} workItemTypeUpdate + * @param {string} processId - The ID of the process + * @param {string} witRefName - The reference name of the work item type + */ + updateWorkItemType(workItemTypeUpdate, processId, witRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "1ce0acad-4638-49c3-969c-04aa65ba6bea", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, workItemTypeUpdate, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeModel, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Adds a field to the work item type in the process. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemTypeFieldModel2} field + * @param {string} processId - The ID of the process + * @param {string} witRefNameForFields - Work item type reference name for the field + */ + addFieldToWorkItemType(field, processId, witRefNameForFields) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForFields + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "976713b4-a62e-499e-94dc-eeb869ea9126", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.create(url, field, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeFieldModel2, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a single field in the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefNameForFields - Work item type reference name for fields + * @param {string} fieldRefName - The reference name of the field + */ + getWorkItemTypeField(processId, witRefNameForFields, fieldRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForFields, + fieldRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "976713b4-a62e-499e-94dc-eeb869ea9126", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeFieldModel2, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Returns a list of all fields in the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefNameForFields - Work item type reference name for fields + */ + getWorkItemTypeFields(processId, witRefNameForFields) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForFields + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "976713b4-a62e-499e-94dc-eeb869ea9126", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.get(url, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeFieldModel2, true); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Removes a field in the work item type of the process. + * + * @param {string} processId - The ID of the process + * @param {string} witRefNameForFields - Work item type reference name for fields + * @param {string} fieldRefName - The reference name of the field + */ + removeFieldFromWorkItemType(processId, witRefNameForFields, fieldRefName) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForFields, + fieldRefName + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "976713b4-a62e-499e-94dc-eeb869ea9126", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.del(url, options); + let ret = this.formatResponse(res.result, null, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Updates a single field in the scope of the given process and work item type. + * + * @param {WorkItemTrackingProcessDefinitionsInterfaces.WorkItemTypeFieldModel2} field - The model with which to update the field + * @param {string} processId - The ID of the process + * @param {string} witRefNameForFields - Work item type reference name for fields + */ + updateWorkItemTypeField(field, processId, witRefNameForFields) { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + let routeValues = { + processId, + witRefNameForFields + }; + try { + let verData = yield this.vsoClient.getVersioningData("7.2-preview.1", "processDefinitions", "976713b4-a62e-499e-94dc-eeb869ea9126", routeValues); + let url = verData.requestUrl; + let options = this.createRequestOptions("application/json", verData.apiVersion); + let res; + res = yield this.rest.update(url, field, options); + let ret = this.formatResponse(res.result, WorkItemTrackingProcessDefinitionsInterfaces.TypeInfo.WorkItemTypeFieldModel2, false); + resolve(ret); + } catch (err) { + reject2(err); + } + })); + }); + } + }; + exports2.WorkItemTrackingProcessDefinitionsApi = WorkItemTrackingProcessDefinitionsApi; + WorkItemTrackingProcessDefinitionsApi.RESOURCE_AREA_ID = "5264459e-e5e0-4bd8-b118-0985e68a4ec5"; + } +}); + +// ../node_modules/azure-devops-node-api/node_modules/typed-rest-client/handlers/basiccreds.js +var require_basiccreds = __commonJS({ + "../node_modules/azure-devops-node-api/node_modules/typed-rest-client/handlers/basiccreds.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BasicCredentialHandler = void 0; + var BasicCredentialHandler = class { + constructor(username, password, allowCrossOriginAuthentication) { + this.username = username; + this.password = password; + this.allowCrossOriginAuthentication = allowCrossOriginAuthentication; + } + // currently implements pre-authorization + // TODO: support preAuth = false where it hooks on 401 + prepareRequest(options) { + if (!this.origin) { + this.origin = options.host; + } + if (this.origin === options.host || this.allowCrossOriginAuthentication) { + options.headers["Authorization"] = `Basic ${Buffer.from(`${this.username}:${this.password}`).toString("base64")}`; + } + options.headers["X-TFS-FedAuthRedirect"] = "Suppress"; + } + // This handler cannot handle 401 + canHandleAuthentication(response) { + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return null; + } + }; + exports2.BasicCredentialHandler = BasicCredentialHandler; + } +}); + +// ../node_modules/azure-devops-node-api/node_modules/typed-rest-client/handlers/bearertoken.js +var require_bearertoken = __commonJS({ + "../node_modules/azure-devops-node-api/node_modules/typed-rest-client/handlers/bearertoken.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BearerCredentialHandler = void 0; + var BearerCredentialHandler = class { + constructor(token, allowCrossOriginAuthentication) { + this.token = token; + this.allowCrossOriginAuthentication = allowCrossOriginAuthentication; + } + // currently implements pre-authorization + // TODO: support preAuth = false where it hooks on 401 + prepareRequest(options) { + if (!this.origin) { + this.origin = options.host; + } + if (this.origin === options.host || this.allowCrossOriginAuthentication) { + options.headers["Authorization"] = `Bearer ${this.token}`; + } + options.headers["X-TFS-FedAuthRedirect"] = "Suppress"; + } + // This handler cannot handle 401 + canHandleAuthentication(response) { + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return null; + } + }; + exports2.BearerCredentialHandler = BearerCredentialHandler; + } +}); + +// ../node_modules/underscore/modules/_setup.js +var VERSION2, root, ArrayProto, ObjProto, SymbolProto, push, slice, toString, hasOwnProperty, supportsArrayBuffer, supportsDataView, nativeIsArray, nativeKeys, nativeCreate, nativeIsView, _isNaN, _isFinite, hasEnumBug, nonEnumerableProps, MAX_ARRAY_INDEX; +var init_setup = __esm({ + "../node_modules/underscore/modules/_setup.js"() { + VERSION2 = "1.13.6"; + root = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || Function("return this")() || {}; + ArrayProto = Array.prototype; + ObjProto = Object.prototype; + SymbolProto = typeof Symbol !== "undefined" ? Symbol.prototype : null; + push = ArrayProto.push; + slice = ArrayProto.slice; + toString = ObjProto.toString; + hasOwnProperty = ObjProto.hasOwnProperty; + supportsArrayBuffer = typeof ArrayBuffer !== "undefined"; + supportsDataView = typeof DataView !== "undefined"; + nativeIsArray = Array.isArray; + nativeKeys = Object.keys; + nativeCreate = Object.create; + nativeIsView = supportsArrayBuffer && ArrayBuffer.isView; + _isNaN = isNaN; + _isFinite = isFinite; + hasEnumBug = !{ toString: null }.propertyIsEnumerable("toString"); + nonEnumerableProps = [ + "valueOf", + "isPrototypeOf", + "toString", + "propertyIsEnumerable", + "hasOwnProperty", + "toLocaleString" + ]; + MAX_ARRAY_INDEX = Math.pow(2, 53) - 1; + } +}); + +// ../node_modules/underscore/modules/restArguments.js +function restArguments(func, startIndex) { + startIndex = startIndex == null ? func.length - 1 : +startIndex; + return function() { + var length = Math.max(arguments.length - startIndex, 0), rest2 = Array(length), index = 0; + for (; index < length; index++) { + rest2[index] = arguments[index + startIndex]; + } + switch (startIndex) { + case 0: + return func.call(this, rest2); + case 1: + return func.call(this, arguments[0], rest2); + case 2: + return func.call(this, arguments[0], arguments[1], rest2); + } + var args = Array(startIndex + 1); + for (index = 0; index < startIndex; index++) { + args[index] = arguments[index]; + } + args[startIndex] = rest2; + return func.apply(this, args); + }; +} +var init_restArguments = __esm({ + "../node_modules/underscore/modules/restArguments.js"() { + } +}); + +// ../node_modules/underscore/modules/isObject.js +function isObject(obj) { + var type = typeof obj; + return type === "function" || type === "object" && !!obj; +} +var init_isObject = __esm({ + "../node_modules/underscore/modules/isObject.js"() { + } +}); + +// ../node_modules/underscore/modules/isNull.js +function isNull(obj) { + return obj === null; +} +var init_isNull = __esm({ + "../node_modules/underscore/modules/isNull.js"() { + } +}); + +// ../node_modules/underscore/modules/isUndefined.js +function isUndefined(obj) { + return obj === void 0; +} +var init_isUndefined = __esm({ + "../node_modules/underscore/modules/isUndefined.js"() { + } +}); + +// ../node_modules/underscore/modules/isBoolean.js +function isBoolean(obj) { + return obj === true || obj === false || toString.call(obj) === "[object Boolean]"; +} +var init_isBoolean = __esm({ + "../node_modules/underscore/modules/isBoolean.js"() { + init_setup(); + } +}); + +// ../node_modules/underscore/modules/isElement.js +function isElement(obj) { + return !!(obj && obj.nodeType === 1); +} +var init_isElement = __esm({ + "../node_modules/underscore/modules/isElement.js"() { + } +}); + +// ../node_modules/underscore/modules/_tagTester.js +function tagTester(name) { + var tag = "[object " + name + "]"; + return function(obj) { + return toString.call(obj) === tag; + }; +} +var init_tagTester = __esm({ + "../node_modules/underscore/modules/_tagTester.js"() { + init_setup(); + } +}); + +// ../node_modules/underscore/modules/isString.js +var isString_default; +var init_isString = __esm({ + "../node_modules/underscore/modules/isString.js"() { + init_tagTester(); + isString_default = tagTester("String"); + } +}); + +// ../node_modules/underscore/modules/isNumber.js +var isNumber_default; +var init_isNumber = __esm({ + "../node_modules/underscore/modules/isNumber.js"() { + init_tagTester(); + isNumber_default = tagTester("Number"); + } +}); + +// ../node_modules/underscore/modules/isDate.js +var isDate_default; +var init_isDate = __esm({ + "../node_modules/underscore/modules/isDate.js"() { + init_tagTester(); + isDate_default = tagTester("Date"); + } +}); + +// ../node_modules/underscore/modules/isRegExp.js +var isRegExp_default; +var init_isRegExp = __esm({ + "../node_modules/underscore/modules/isRegExp.js"() { + init_tagTester(); + isRegExp_default = tagTester("RegExp"); + } +}); + +// ../node_modules/underscore/modules/isError.js +var isError_default; +var init_isError = __esm({ + "../node_modules/underscore/modules/isError.js"() { + init_tagTester(); + isError_default = tagTester("Error"); + } +}); + +// ../node_modules/underscore/modules/isSymbol.js +var isSymbol_default; +var init_isSymbol = __esm({ + "../node_modules/underscore/modules/isSymbol.js"() { + init_tagTester(); + isSymbol_default = tagTester("Symbol"); + } +}); + +// ../node_modules/underscore/modules/isArrayBuffer.js +var isArrayBuffer_default; +var init_isArrayBuffer = __esm({ + "../node_modules/underscore/modules/isArrayBuffer.js"() { + init_tagTester(); + isArrayBuffer_default = tagTester("ArrayBuffer"); + } +}); + +// ../node_modules/underscore/modules/isFunction.js +var isFunction, nodelist, isFunction_default; +var init_isFunction = __esm({ + "../node_modules/underscore/modules/isFunction.js"() { + init_tagTester(); + init_setup(); + isFunction = tagTester("Function"); + nodelist = root.document && root.document.childNodes; + if (typeof /./ != "function" && typeof Int8Array != "object" && typeof nodelist != "function") { + isFunction = function(obj) { + return typeof obj == "function" || false; + }; + } + isFunction_default = isFunction; + } +}); + +// ../node_modules/underscore/modules/_hasObjectTag.js +var hasObjectTag_default; +var init_hasObjectTag = __esm({ + "../node_modules/underscore/modules/_hasObjectTag.js"() { + init_tagTester(); + hasObjectTag_default = tagTester("Object"); + } +}); + +// ../node_modules/underscore/modules/_stringTagBug.js +var hasStringTagBug, isIE11; +var init_stringTagBug = __esm({ + "../node_modules/underscore/modules/_stringTagBug.js"() { + init_setup(); + init_hasObjectTag(); + hasStringTagBug = supportsDataView && hasObjectTag_default(new DataView(new ArrayBuffer(8))); + isIE11 = typeof Map !== "undefined" && hasObjectTag_default(/* @__PURE__ */ new Map()); + } +}); + +// ../node_modules/underscore/modules/isDataView.js +function ie10IsDataView(obj) { + return obj != null && isFunction_default(obj.getInt8) && isArrayBuffer_default(obj.buffer); +} +var isDataView, isDataView_default; +var init_isDataView = __esm({ + "../node_modules/underscore/modules/isDataView.js"() { + init_tagTester(); + init_isFunction(); + init_isArrayBuffer(); + init_stringTagBug(); + isDataView = tagTester("DataView"); + isDataView_default = hasStringTagBug ? ie10IsDataView : isDataView; + } +}); + +// ../node_modules/underscore/modules/isArray.js +var isArray_default; +var init_isArray = __esm({ + "../node_modules/underscore/modules/isArray.js"() { + init_setup(); + init_tagTester(); + isArray_default = nativeIsArray || tagTester("Array"); + } +}); + +// ../node_modules/underscore/modules/_has.js +function has(obj, key) { + return obj != null && hasOwnProperty.call(obj, key); +} +var init_has = __esm({ + "../node_modules/underscore/modules/_has.js"() { + init_setup(); + } +}); + +// ../node_modules/underscore/modules/isArguments.js +var isArguments, isArguments_default; +var init_isArguments = __esm({ + "../node_modules/underscore/modules/isArguments.js"() { + init_tagTester(); + init_has(); + isArguments = tagTester("Arguments"); + (function() { + if (!isArguments(arguments)) { + isArguments = function(obj) { + return has(obj, "callee"); + }; + } + })(); + isArguments_default = isArguments; + } +}); + +// ../node_modules/underscore/modules/isFinite.js +function isFinite2(obj) { + return !isSymbol_default(obj) && _isFinite(obj) && !isNaN(parseFloat(obj)); +} +var init_isFinite = __esm({ + "../node_modules/underscore/modules/isFinite.js"() { + init_setup(); + init_isSymbol(); + } +}); + +// ../node_modules/underscore/modules/isNaN.js +function isNaN2(obj) { + return isNumber_default(obj) && _isNaN(obj); +} +var init_isNaN = __esm({ + "../node_modules/underscore/modules/isNaN.js"() { + init_setup(); + init_isNumber(); + } +}); + +// ../node_modules/underscore/modules/constant.js +function constant(value) { + return function() { + return value; + }; +} +var init_constant = __esm({ + "../node_modules/underscore/modules/constant.js"() { + } +}); + +// ../node_modules/underscore/modules/_createSizePropertyCheck.js +function createSizePropertyCheck(getSizeProperty) { + return function(collection) { + var sizeProperty = getSizeProperty(collection); + return typeof sizeProperty == "number" && sizeProperty >= 0 && sizeProperty <= MAX_ARRAY_INDEX; + }; +} +var init_createSizePropertyCheck = __esm({ + "../node_modules/underscore/modules/_createSizePropertyCheck.js"() { + init_setup(); + } +}); + +// ../node_modules/underscore/modules/_shallowProperty.js +function shallowProperty(key) { + return function(obj) { + return obj == null ? void 0 : obj[key]; + }; +} +var init_shallowProperty = __esm({ + "../node_modules/underscore/modules/_shallowProperty.js"() { + } +}); + +// ../node_modules/underscore/modules/_getByteLength.js +var getByteLength_default; +var init_getByteLength = __esm({ + "../node_modules/underscore/modules/_getByteLength.js"() { + init_shallowProperty(); + getByteLength_default = shallowProperty("byteLength"); + } +}); + +// ../node_modules/underscore/modules/_isBufferLike.js +var isBufferLike_default; +var init_isBufferLike = __esm({ + "../node_modules/underscore/modules/_isBufferLike.js"() { + init_createSizePropertyCheck(); + init_getByteLength(); + isBufferLike_default = createSizePropertyCheck(getByteLength_default); + } +}); + +// ../node_modules/underscore/modules/isTypedArray.js +function isTypedArray(obj) { + return nativeIsView ? nativeIsView(obj) && !isDataView_default(obj) : isBufferLike_default(obj) && typedArrayPattern.test(toString.call(obj)); +} +var typedArrayPattern, isTypedArray_default; +var init_isTypedArray = __esm({ + "../node_modules/underscore/modules/isTypedArray.js"() { + init_setup(); + init_isDataView(); + init_constant(); + init_isBufferLike(); + typedArrayPattern = /\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/; + isTypedArray_default = supportsArrayBuffer ? isTypedArray : constant(false); + } +}); + +// ../node_modules/underscore/modules/_getLength.js +var getLength_default; +var init_getLength = __esm({ + "../node_modules/underscore/modules/_getLength.js"() { + init_shallowProperty(); + getLength_default = shallowProperty("length"); + } +}); + +// ../node_modules/underscore/modules/_collectNonEnumProps.js +function emulatedSet(keys2) { + var hash = {}; + for (var l = keys2.length, i = 0; i < l; ++i) hash[keys2[i]] = true; + return { + contains: function(key) { + return hash[key] === true; + }, + push: function(key) { + hash[key] = true; + return keys2.push(key); + } + }; +} +function collectNonEnumProps(obj, keys2) { + keys2 = emulatedSet(keys2); + var nonEnumIdx = nonEnumerableProps.length; + var constructor = obj.constructor; + var proto = isFunction_default(constructor) && constructor.prototype || ObjProto; + var prop = "constructor"; + if (has(obj, prop) && !keys2.contains(prop)) keys2.push(prop); + while (nonEnumIdx--) { + prop = nonEnumerableProps[nonEnumIdx]; + if (prop in obj && obj[prop] !== proto[prop] && !keys2.contains(prop)) { + keys2.push(prop); + } + } +} +var init_collectNonEnumProps = __esm({ + "../node_modules/underscore/modules/_collectNonEnumProps.js"() { + init_setup(); + init_isFunction(); + init_has(); + } +}); + +// ../node_modules/underscore/modules/keys.js +function keys(obj) { + if (!isObject(obj)) return []; + if (nativeKeys) return nativeKeys(obj); + var keys2 = []; + for (var key in obj) if (has(obj, key)) keys2.push(key); + if (hasEnumBug) collectNonEnumProps(obj, keys2); + return keys2; +} +var init_keys = __esm({ + "../node_modules/underscore/modules/keys.js"() { + init_isObject(); + init_setup(); + init_has(); + init_collectNonEnumProps(); + } +}); + +// ../node_modules/underscore/modules/isEmpty.js +function isEmpty(obj) { + if (obj == null) return true; + var length = getLength_default(obj); + if (typeof length == "number" && (isArray_default(obj) || isString_default(obj) || isArguments_default(obj))) return length === 0; + return getLength_default(keys(obj)) === 0; +} +var init_isEmpty = __esm({ + "../node_modules/underscore/modules/isEmpty.js"() { + init_getLength(); + init_isArray(); + init_isString(); + init_isArguments(); + init_keys(); + } +}); + +// ../node_modules/underscore/modules/isMatch.js +function isMatch(object2, attrs) { + var _keys = keys(attrs), length = _keys.length; + if (object2 == null) return !length; + var obj = Object(object2); + for (var i = 0; i < length; i++) { + var key = _keys[i]; + if (attrs[key] !== obj[key] || !(key in obj)) return false; + } + return true; +} +var init_isMatch = __esm({ + "../node_modules/underscore/modules/isMatch.js"() { + init_keys(); + } +}); + +// ../node_modules/underscore/modules/underscore.js +function _(obj) { + if (obj instanceof _) return obj; + if (!(this instanceof _)) return new _(obj); + this._wrapped = obj; +} +var init_underscore = __esm({ + "../node_modules/underscore/modules/underscore.js"() { + init_setup(); + _.VERSION = VERSION2; + _.prototype.value = function() { + return this._wrapped; + }; + _.prototype.valueOf = _.prototype.toJSON = _.prototype.value; + _.prototype.toString = function() { + return String(this._wrapped); + }; + } +}); + +// ../node_modules/underscore/modules/_toBufferView.js +function toBufferView(bufferSource) { + return new Uint8Array( + bufferSource.buffer || bufferSource, + bufferSource.byteOffset || 0, + getByteLength_default(bufferSource) + ); +} +var init_toBufferView = __esm({ + "../node_modules/underscore/modules/_toBufferView.js"() { + init_getByteLength(); + } +}); + +// ../node_modules/underscore/modules/isEqual.js +function eq(a, b, aStack, bStack) { + if (a === b) return a !== 0 || 1 / a === 1 / b; + if (a == null || b == null) return false; + if (a !== a) return b !== b; + var type = typeof a; + if (type !== "function" && type !== "object" && typeof b != "object") return false; + return deepEq(a, b, aStack, bStack); +} +function deepEq(a, b, aStack, bStack) { + if (a instanceof _) a = a._wrapped; + if (b instanceof _) b = b._wrapped; + var className = toString.call(a); + if (className !== toString.call(b)) return false; + if (hasStringTagBug && className == "[object Object]" && isDataView_default(a)) { + if (!isDataView_default(b)) return false; + className = tagDataView; + } + switch (className) { + // These types are compared by value. + case "[object RegExp]": + // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') + case "[object String]": + return "" + a === "" + b; + case "[object Number]": + if (+a !== +a) return +b !== +b; + return +a === 0 ? 1 / +a === 1 / b : +a === +b; + case "[object Date]": + case "[object Boolean]": + return +a === +b; + case "[object Symbol]": + return SymbolProto.valueOf.call(a) === SymbolProto.valueOf.call(b); + case "[object ArrayBuffer]": + case tagDataView: + return deepEq(toBufferView(a), toBufferView(b), aStack, bStack); + } + var areArrays = className === "[object Array]"; + if (!areArrays && isTypedArray_default(a)) { + var byteLength = getByteLength_default(a); + if (byteLength !== getByteLength_default(b)) return false; + if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true; + areArrays = true; + } + if (!areArrays) { + if (typeof a != "object" || typeof b != "object") return false; + var aCtor = a.constructor, bCtor = b.constructor; + if (aCtor !== bCtor && !(isFunction_default(aCtor) && aCtor instanceof aCtor && isFunction_default(bCtor) && bCtor instanceof bCtor) && ("constructor" in a && "constructor" in b)) { + return false; + } + } + aStack = aStack || []; + bStack = bStack || []; + var length = aStack.length; + while (length--) { + if (aStack[length] === a) return bStack[length] === b; + } + aStack.push(a); + bStack.push(b); + if (areArrays) { + length = a.length; + if (length !== b.length) return false; + while (length--) { + if (!eq(a[length], b[length], aStack, bStack)) return false; + } + } else { + var _keys = keys(a), key; + length = _keys.length; + if (keys(b).length !== length) return false; + while (length--) { + key = _keys[length]; + if (!(has(b, key) && eq(a[key], b[key], aStack, bStack))) return false; + } + } + aStack.pop(); + bStack.pop(); + return true; +} +function isEqual(a, b) { + return eq(a, b); +} +var tagDataView; +var init_isEqual = __esm({ + "../node_modules/underscore/modules/isEqual.js"() { + init_underscore(); + init_setup(); + init_getByteLength(); + init_isTypedArray(); + init_isFunction(); + init_stringTagBug(); + init_isDataView(); + init_keys(); + init_has(); + init_toBufferView(); + tagDataView = "[object DataView]"; + } +}); + +// ../node_modules/underscore/modules/allKeys.js +function allKeys(obj) { + if (!isObject(obj)) return []; + var keys2 = []; + for (var key in obj) keys2.push(key); + if (hasEnumBug) collectNonEnumProps(obj, keys2); + return keys2; +} +var init_allKeys = __esm({ + "../node_modules/underscore/modules/allKeys.js"() { + init_isObject(); + init_setup(); + init_collectNonEnumProps(); + } +}); + +// ../node_modules/underscore/modules/_methodFingerprint.js +function ie11fingerprint(methods) { + var length = getLength_default(methods); + return function(obj) { + if (obj == null) return false; + var keys2 = allKeys(obj); + if (getLength_default(keys2)) return false; + for (var i = 0; i < length; i++) { + if (!isFunction_default(obj[methods[i]])) return false; + } + return methods !== weakMapMethods || !isFunction_default(obj[forEachName]); + }; +} +var forEachName, hasName, commonInit, mapTail, mapMethods, weakMapMethods, setMethods; +var init_methodFingerprint = __esm({ + "../node_modules/underscore/modules/_methodFingerprint.js"() { + init_getLength(); + init_isFunction(); + init_allKeys(); + forEachName = "forEach"; + hasName = "has"; + commonInit = ["clear", "delete"]; + mapTail = ["get", hasName, "set"]; + mapMethods = commonInit.concat(forEachName, mapTail); + weakMapMethods = commonInit.concat(mapTail); + setMethods = ["add"].concat(commonInit, forEachName, hasName); + } +}); + +// ../node_modules/underscore/modules/isMap.js +var isMap_default; +var init_isMap = __esm({ + "../node_modules/underscore/modules/isMap.js"() { + init_tagTester(); + init_stringTagBug(); + init_methodFingerprint(); + isMap_default = isIE11 ? ie11fingerprint(mapMethods) : tagTester("Map"); + } +}); + +// ../node_modules/underscore/modules/isWeakMap.js +var isWeakMap_default; +var init_isWeakMap = __esm({ + "../node_modules/underscore/modules/isWeakMap.js"() { + init_tagTester(); + init_stringTagBug(); + init_methodFingerprint(); + isWeakMap_default = isIE11 ? ie11fingerprint(weakMapMethods) : tagTester("WeakMap"); + } +}); + +// ../node_modules/underscore/modules/isSet.js +var isSet_default; +var init_isSet = __esm({ + "../node_modules/underscore/modules/isSet.js"() { + init_tagTester(); + init_stringTagBug(); + init_methodFingerprint(); + isSet_default = isIE11 ? ie11fingerprint(setMethods) : tagTester("Set"); + } +}); + +// ../node_modules/underscore/modules/isWeakSet.js +var isWeakSet_default; +var init_isWeakSet = __esm({ + "../node_modules/underscore/modules/isWeakSet.js"() { + init_tagTester(); + isWeakSet_default = tagTester("WeakSet"); + } +}); + +// ../node_modules/underscore/modules/values.js +function values(obj) { + var _keys = keys(obj); + var length = _keys.length; + var values2 = Array(length); + for (var i = 0; i < length; i++) { + values2[i] = obj[_keys[i]]; + } + return values2; +} +var init_values = __esm({ + "../node_modules/underscore/modules/values.js"() { + init_keys(); + } +}); + +// ../node_modules/underscore/modules/pairs.js +function pairs(obj) { + var _keys = keys(obj); + var length = _keys.length; + var pairs2 = Array(length); + for (var i = 0; i < length; i++) { + pairs2[i] = [_keys[i], obj[_keys[i]]]; + } + return pairs2; +} +var init_pairs = __esm({ + "../node_modules/underscore/modules/pairs.js"() { + init_keys(); + } +}); + +// ../node_modules/underscore/modules/invert.js +function invert(obj) { + var result2 = {}; + var _keys = keys(obj); + for (var i = 0, length = _keys.length; i < length; i++) { + result2[obj[_keys[i]]] = _keys[i]; + } + return result2; +} +var init_invert = __esm({ + "../node_modules/underscore/modules/invert.js"() { + init_keys(); + } +}); + +// ../node_modules/underscore/modules/functions.js +function functions(obj) { + var names = []; + for (var key in obj) { + if (isFunction_default(obj[key])) names.push(key); + } + return names.sort(); +} +var init_functions = __esm({ + "../node_modules/underscore/modules/functions.js"() { + init_isFunction(); + } +}); + +// ../node_modules/underscore/modules/_createAssigner.js +function createAssigner(keysFunc, defaults) { + return function(obj) { + var length = arguments.length; + if (defaults) obj = Object(obj); + if (length < 2 || obj == null) return obj; + for (var index = 1; index < length; index++) { + var source = arguments[index], keys2 = keysFunc(source), l = keys2.length; + for (var i = 0; i < l; i++) { + var key = keys2[i]; + if (!defaults || obj[key] === void 0) obj[key] = source[key]; + } + } + return obj; + }; +} +var init_createAssigner = __esm({ + "../node_modules/underscore/modules/_createAssigner.js"() { + } +}); + +// ../node_modules/underscore/modules/extend.js +var extend_default; +var init_extend = __esm({ + "../node_modules/underscore/modules/extend.js"() { + init_createAssigner(); + init_allKeys(); + extend_default = createAssigner(allKeys); + } +}); + +// ../node_modules/underscore/modules/extendOwn.js +var extendOwn_default; +var init_extendOwn = __esm({ + "../node_modules/underscore/modules/extendOwn.js"() { + init_createAssigner(); + init_keys(); + extendOwn_default = createAssigner(keys); + } +}); + +// ../node_modules/underscore/modules/defaults.js +var defaults_default; +var init_defaults = __esm({ + "../node_modules/underscore/modules/defaults.js"() { + init_createAssigner(); + init_allKeys(); + defaults_default = createAssigner(allKeys, true); + } +}); + +// ../node_modules/underscore/modules/_baseCreate.js +function ctor() { + return function() { + }; +} +function baseCreate(prototype) { + if (!isObject(prototype)) return {}; + if (nativeCreate) return nativeCreate(prototype); + var Ctor = ctor(); + Ctor.prototype = prototype; + var result2 = new Ctor(); + Ctor.prototype = null; + return result2; +} +var init_baseCreate = __esm({ + "../node_modules/underscore/modules/_baseCreate.js"() { + init_isObject(); + init_setup(); + } +}); + +// ../node_modules/underscore/modules/create.js +function create(prototype, props) { + var result2 = baseCreate(prototype); + if (props) extendOwn_default(result2, props); + return result2; +} +var init_create = __esm({ + "../node_modules/underscore/modules/create.js"() { + init_baseCreate(); + init_extendOwn(); + } +}); + +// ../node_modules/underscore/modules/clone.js +function clone(obj) { + if (!isObject(obj)) return obj; + return isArray_default(obj) ? obj.slice() : extend_default({}, obj); +} +var init_clone = __esm({ + "../node_modules/underscore/modules/clone.js"() { + init_isObject(); + init_isArray(); + init_extend(); + } +}); + +// ../node_modules/underscore/modules/tap.js +function tap(obj, interceptor) { + interceptor(obj); + return obj; +} +var init_tap = __esm({ + "../node_modules/underscore/modules/tap.js"() { + } +}); + +// ../node_modules/underscore/modules/toPath.js +function toPath(path2) { + return isArray_default(path2) ? path2 : [path2]; +} +var init_toPath = __esm({ + "../node_modules/underscore/modules/toPath.js"() { + init_underscore(); + init_isArray(); + _.toPath = toPath; + } +}); + +// ../node_modules/underscore/modules/_toPath.js +function toPath2(path2) { + return _.toPath(path2); +} +var init_toPath2 = __esm({ + "../node_modules/underscore/modules/_toPath.js"() { + init_underscore(); + init_toPath(); + } +}); + +// ../node_modules/underscore/modules/_deepGet.js +function deepGet(obj, path2) { + var length = path2.length; + for (var i = 0; i < length; i++) { + if (obj == null) return void 0; + obj = obj[path2[i]]; + } + return length ? obj : void 0; +} +var init_deepGet = __esm({ + "../node_modules/underscore/modules/_deepGet.js"() { + } +}); + +// ../node_modules/underscore/modules/get.js +function get(object2, path2, defaultValue) { + var value = deepGet(object2, toPath2(path2)); + return isUndefined(value) ? defaultValue : value; +} +var init_get = __esm({ + "../node_modules/underscore/modules/get.js"() { + init_toPath2(); + init_deepGet(); + init_isUndefined(); + } +}); + +// ../node_modules/underscore/modules/has.js +function has2(obj, path2) { + path2 = toPath2(path2); + var length = path2.length; + for (var i = 0; i < length; i++) { + var key = path2[i]; + if (!has(obj, key)) return false; + obj = obj[key]; + } + return !!length; +} +var init_has2 = __esm({ + "../node_modules/underscore/modules/has.js"() { + init_has(); + init_toPath2(); + } +}); + +// ../node_modules/underscore/modules/identity.js +function identity(value) { + return value; +} +var init_identity = __esm({ + "../node_modules/underscore/modules/identity.js"() { + } +}); + +// ../node_modules/underscore/modules/matcher.js +function matcher(attrs) { + attrs = extendOwn_default({}, attrs); + return function(obj) { + return isMatch(obj, attrs); + }; +} +var init_matcher = __esm({ + "../node_modules/underscore/modules/matcher.js"() { + init_extendOwn(); + init_isMatch(); + } +}); + +// ../node_modules/underscore/modules/property.js +function property(path2) { + path2 = toPath2(path2); + return function(obj) { + return deepGet(obj, path2); + }; +} +var init_property = __esm({ + "../node_modules/underscore/modules/property.js"() { + init_deepGet(); + init_toPath2(); + } +}); + +// ../node_modules/underscore/modules/_optimizeCb.js +function optimizeCb(func, context, argCount) { + if (context === void 0) return func; + switch (argCount == null ? 3 : argCount) { + case 1: + return function(value) { + return func.call(context, value); + }; + // The 2-argument case is omitted because we’re not using it. + case 3: + return function(value, index, collection) { + return func.call(context, value, index, collection); + }; + case 4: + return function(accumulator, value, index, collection) { + return func.call(context, accumulator, value, index, collection); + }; + } + return function() { + return func.apply(context, arguments); + }; +} +var init_optimizeCb = __esm({ + "../node_modules/underscore/modules/_optimizeCb.js"() { + } +}); + +// ../node_modules/underscore/modules/_baseIteratee.js +function baseIteratee(value, context, argCount) { + if (value == null) return identity; + if (isFunction_default(value)) return optimizeCb(value, context, argCount); + if (isObject(value) && !isArray_default(value)) return matcher(value); + return property(value); +} +var init_baseIteratee = __esm({ + "../node_modules/underscore/modules/_baseIteratee.js"() { + init_identity(); + init_isFunction(); + init_isObject(); + init_isArray(); + init_matcher(); + init_property(); + init_optimizeCb(); + } +}); + +// ../node_modules/underscore/modules/iteratee.js +function iteratee(value, context) { + return baseIteratee(value, context, Infinity); +} +var init_iteratee = __esm({ + "../node_modules/underscore/modules/iteratee.js"() { + init_underscore(); + init_baseIteratee(); + _.iteratee = iteratee; + } +}); + +// ../node_modules/underscore/modules/_cb.js +function cb(value, context, argCount) { + if (_.iteratee !== iteratee) return _.iteratee(value, context); + return baseIteratee(value, context, argCount); +} +var init_cb = __esm({ + "../node_modules/underscore/modules/_cb.js"() { + init_underscore(); + init_baseIteratee(); + init_iteratee(); + } +}); + +// ../node_modules/underscore/modules/mapObject.js +function mapObject(obj, iteratee2, context) { + iteratee2 = cb(iteratee2, context); + var _keys = keys(obj), length = _keys.length, results = {}; + for (var index = 0; index < length; index++) { + var currentKey = _keys[index]; + results[currentKey] = iteratee2(obj[currentKey], currentKey, obj); + } + return results; +} +var init_mapObject = __esm({ + "../node_modules/underscore/modules/mapObject.js"() { + init_cb(); + init_keys(); + } +}); + +// ../node_modules/underscore/modules/noop.js +function noop() { +} +var init_noop = __esm({ + "../node_modules/underscore/modules/noop.js"() { + } +}); + +// ../node_modules/underscore/modules/propertyOf.js +function propertyOf(obj) { + if (obj == null) return noop; + return function(path2) { + return get(obj, path2); + }; +} +var init_propertyOf = __esm({ + "../node_modules/underscore/modules/propertyOf.js"() { + init_noop(); + init_get(); + } +}); + +// ../node_modules/underscore/modules/times.js +function times(n, iteratee2, context) { + var accum = Array(Math.max(0, n)); + iteratee2 = optimizeCb(iteratee2, context, 1); + for (var i = 0; i < n; i++) accum[i] = iteratee2(i); + return accum; +} +var init_times = __esm({ + "../node_modules/underscore/modules/times.js"() { + init_optimizeCb(); + } +}); + +// ../node_modules/underscore/modules/random.js +function random(min2, max2) { + if (max2 == null) { + max2 = min2; + min2 = 0; + } + return min2 + Math.floor(Math.random() * (max2 - min2 + 1)); +} +var init_random = __esm({ + "../node_modules/underscore/modules/random.js"() { + } +}); + +// ../node_modules/underscore/modules/now.js +var now_default; +var init_now = __esm({ + "../node_modules/underscore/modules/now.js"() { + now_default = Date.now || function() { + return (/* @__PURE__ */ new Date()).getTime(); + }; + } +}); + +// ../node_modules/underscore/modules/_createEscaper.js +function createEscaper(map2) { + var escaper = function(match) { + return map2[match]; + }; + var source = "(?:" + keys(map2).join("|") + ")"; + var testRegexp = RegExp(source); + var replaceRegexp = RegExp(source, "g"); + return function(string) { + string = string == null ? "" : "" + string; + return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; + }; +} +var init_createEscaper = __esm({ + "../node_modules/underscore/modules/_createEscaper.js"() { + init_keys(); + } +}); + +// ../node_modules/underscore/modules/_escapeMap.js +var escapeMap_default; +var init_escapeMap = __esm({ + "../node_modules/underscore/modules/_escapeMap.js"() { + escapeMap_default = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'", + "`": "`" + }; + } +}); + +// ../node_modules/underscore/modules/escape.js +var escape_default; +var init_escape = __esm({ + "../node_modules/underscore/modules/escape.js"() { + init_createEscaper(); + init_escapeMap(); + escape_default = createEscaper(escapeMap_default); + } +}); + +// ../node_modules/underscore/modules/_unescapeMap.js +var unescapeMap_default; +var init_unescapeMap = __esm({ + "../node_modules/underscore/modules/_unescapeMap.js"() { + init_invert(); + init_escapeMap(); + unescapeMap_default = invert(escapeMap_default); + } +}); + +// ../node_modules/underscore/modules/unescape.js +var unescape_default; +var init_unescape = __esm({ + "../node_modules/underscore/modules/unescape.js"() { + init_createEscaper(); + init_unescapeMap(); + unescape_default = createEscaper(unescapeMap_default); + } +}); + +// ../node_modules/underscore/modules/templateSettings.js +var templateSettings_default; +var init_templateSettings = __esm({ + "../node_modules/underscore/modules/templateSettings.js"() { + init_underscore(); + templateSettings_default = _.templateSettings = { + evaluate: /<%([\s\S]+?)%>/g, + interpolate: /<%=([\s\S]+?)%>/g, + escape: /<%-([\s\S]+?)%>/g + }; + } +}); + +// ../node_modules/underscore/modules/template.js +function escapeChar(match) { + return "\\" + escapes[match]; +} +function template(text, settings, oldSettings) { + if (!settings && oldSettings) settings = oldSettings; + settings = defaults_default({}, settings, _.templateSettings); + var matcher2 = RegExp([ + (settings.escape || noMatch).source, + (settings.interpolate || noMatch).source, + (settings.evaluate || noMatch).source + ].join("|") + "|$", "g"); + var index = 0; + var source = "__p+='"; + text.replace(matcher2, function(match, escape2, interpolate, evaluate, offset) { + source += text.slice(index, offset).replace(escapeRegExp, escapeChar); + index = offset + match.length; + if (escape2) { + source += "'+\n((__t=(" + escape2 + "))==null?'':_.escape(__t))+\n'"; + } else if (interpolate) { + source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; + } else if (evaluate) { + source += "';\n" + evaluate + "\n__p+='"; + } + return match; + }); + source += "';\n"; + var argument = settings.variable; + if (argument) { + if (!bareIdentifier.test(argument)) throw new Error( + "variable is not a bare identifier: " + argument + ); + } else { + source = "with(obj||{}){\n" + source + "}\n"; + argument = "obj"; + } + source = "var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n" + source + "return __p;\n"; + var render; + try { + render = new Function(argument, "_", source); + } catch (e) { + e.source = source; + throw e; + } + var template2 = function(data) { + return render.call(this, data, _); + }; + template2.source = "function(" + argument + "){\n" + source + "}"; + return template2; +} +var noMatch, escapes, escapeRegExp, bareIdentifier; +var init_template = __esm({ + "../node_modules/underscore/modules/template.js"() { + init_defaults(); + init_underscore(); + init_templateSettings(); + noMatch = /(.)^/; + escapes = { + "'": "'", + "\\": "\\", + "\r": "r", + "\n": "n", + "\u2028": "u2028", + "\u2029": "u2029" + }; + escapeRegExp = /\\|'|\r|\n|\u2028|\u2029/g; + bareIdentifier = /^\s*(\w|\$)+\s*$/; + } +}); + +// ../node_modules/underscore/modules/result.js +function result(obj, path2, fallback) { + path2 = toPath2(path2); + var length = path2.length; + if (!length) { + return isFunction_default(fallback) ? fallback.call(obj) : fallback; + } + for (var i = 0; i < length; i++) { + var prop = obj == null ? void 0 : obj[path2[i]]; + if (prop === void 0) { + prop = fallback; + i = length; + } + obj = isFunction_default(prop) ? prop.call(obj) : prop; + } + return obj; +} +var init_result = __esm({ + "../node_modules/underscore/modules/result.js"() { + init_isFunction(); + init_toPath2(); + } +}); + +// ../node_modules/underscore/modules/uniqueId.js +function uniqueId(prefix) { + var id = ++idCounter + ""; + return prefix ? prefix + id : id; +} +var idCounter; +var init_uniqueId = __esm({ + "../node_modules/underscore/modules/uniqueId.js"() { + idCounter = 0; + } +}); + +// ../node_modules/underscore/modules/chain.js +function chain(obj) { + var instance = _(obj); + instance._chain = true; + return instance; +} +var init_chain = __esm({ + "../node_modules/underscore/modules/chain.js"() { + init_underscore(); + } +}); + +// ../node_modules/underscore/modules/_executeBound.js +function executeBound(sourceFunc, boundFunc, context, callingContext, args) { + if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); + var self2 = baseCreate(sourceFunc.prototype); + var result2 = sourceFunc.apply(self2, args); + if (isObject(result2)) return result2; + return self2; +} +var init_executeBound = __esm({ + "../node_modules/underscore/modules/_executeBound.js"() { + init_baseCreate(); + init_isObject(); + } +}); + +// ../node_modules/underscore/modules/partial.js +var partial, partial_default; +var init_partial = __esm({ + "../node_modules/underscore/modules/partial.js"() { + init_restArguments(); + init_executeBound(); + init_underscore(); + partial = restArguments(function(func, boundArgs) { + var placeholder = partial.placeholder; + var bound = function() { + var position = 0, length = boundArgs.length; + var args = Array(length); + for (var i = 0; i < length; i++) { + args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i]; + } + while (position < arguments.length) args.push(arguments[position++]); + return executeBound(func, bound, this, this, args); + }; + return bound; + }); + partial.placeholder = _; + partial_default = partial; + } +}); + +// ../node_modules/underscore/modules/bind.js +var bind_default; +var init_bind = __esm({ + "../node_modules/underscore/modules/bind.js"() { + init_restArguments(); + init_isFunction(); + init_executeBound(); + bind_default = restArguments(function(func, context, args) { + if (!isFunction_default(func)) throw new TypeError("Bind must be called on a function"); + var bound = restArguments(function(callArgs) { + return executeBound(func, bound, context, this, args.concat(callArgs)); + }); + return bound; + }); + } +}); + +// ../node_modules/underscore/modules/_isArrayLike.js +var isArrayLike_default; +var init_isArrayLike = __esm({ + "../node_modules/underscore/modules/_isArrayLike.js"() { + init_createSizePropertyCheck(); + init_getLength(); + isArrayLike_default = createSizePropertyCheck(getLength_default); + } +}); + +// ../node_modules/underscore/modules/_flatten.js +function flatten(input, depth, strict, output) { + output = output || []; + if (!depth && depth !== 0) { + depth = Infinity; + } else if (depth <= 0) { + return output.concat(input); + } + var idx = output.length; + for (var i = 0, length = getLength_default(input); i < length; i++) { + var value = input[i]; + if (isArrayLike_default(value) && (isArray_default(value) || isArguments_default(value))) { + if (depth > 1) { + flatten(value, depth - 1, strict, output); + idx = output.length; + } else { + var j = 0, len = value.length; + while (j < len) output[idx++] = value[j++]; + } + } else if (!strict) { + output[idx++] = value; + } + } + return output; +} +var init_flatten = __esm({ + "../node_modules/underscore/modules/_flatten.js"() { + init_getLength(); + init_isArrayLike(); + init_isArray(); + init_isArguments(); + } +}); + +// ../node_modules/underscore/modules/bindAll.js +var bindAll_default; +var init_bindAll = __esm({ + "../node_modules/underscore/modules/bindAll.js"() { + init_restArguments(); + init_flatten(); + init_bind(); + bindAll_default = restArguments(function(obj, keys2) { + keys2 = flatten(keys2, false, false); + var index = keys2.length; + if (index < 1) throw new Error("bindAll must be passed function names"); + while (index--) { + var key = keys2[index]; + obj[key] = bind_default(obj[key], obj); + } + return obj; + }); + } +}); + +// ../node_modules/underscore/modules/memoize.js +function memoize(func, hasher) { + var memoize2 = function(key) { + var cache = memoize2.cache; + var address = "" + (hasher ? hasher.apply(this, arguments) : key); + if (!has(cache, address)) cache[address] = func.apply(this, arguments); + return cache[address]; + }; + memoize2.cache = {}; + return memoize2; +} +var init_memoize = __esm({ + "../node_modules/underscore/modules/memoize.js"() { + init_has(); + } +}); + +// ../node_modules/underscore/modules/delay.js +var delay_default; +var init_delay = __esm({ + "../node_modules/underscore/modules/delay.js"() { + init_restArguments(); + delay_default = restArguments(function(func, wait, args) { + return setTimeout(function() { + return func.apply(null, args); + }, wait); + }); + } +}); + +// ../node_modules/underscore/modules/defer.js +var defer_default; +var init_defer = __esm({ + "../node_modules/underscore/modules/defer.js"() { + init_partial(); + init_delay(); + init_underscore(); + defer_default = partial_default(delay_default, _, 1); + } +}); + +// ../node_modules/underscore/modules/throttle.js +function throttle(func, wait, options) { + var timeout, context, args, result2; + var previous = 0; + if (!options) options = {}; + var later = function() { + previous = options.leading === false ? 0 : now_default(); + timeout = null; + result2 = func.apply(context, args); + if (!timeout) context = args = null; + }; + var throttled = function() { + var _now = now_default(); + if (!previous && options.leading === false) previous = _now; + var remaining = wait - (_now - previous); + context = this; + args = arguments; + if (remaining <= 0 || remaining > wait) { + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + previous = _now; + result2 = func.apply(context, args); + if (!timeout) context = args = null; + } else if (!timeout && options.trailing !== false) { + timeout = setTimeout(later, remaining); + } + return result2; + }; + throttled.cancel = function() { + clearTimeout(timeout); + previous = 0; + timeout = context = args = null; + }; + return throttled; +} +var init_throttle = __esm({ + "../node_modules/underscore/modules/throttle.js"() { + init_now(); + } +}); + +// ../node_modules/underscore/modules/debounce.js +function debounce(func, wait, immediate) { + var timeout, previous, args, result2, context; + var later = function() { + var passed = now_default() - previous; + if (wait > passed) { + timeout = setTimeout(later, wait - passed); + } else { + timeout = null; + if (!immediate) result2 = func.apply(context, args); + if (!timeout) args = context = null; + } + }; + var debounced = restArguments(function(_args) { + context = this; + args = _args; + previous = now_default(); + if (!timeout) { + timeout = setTimeout(later, wait); + if (immediate) result2 = func.apply(context, args); + } + return result2; + }); + debounced.cancel = function() { + clearTimeout(timeout); + timeout = args = context = null; + }; + return debounced; +} +var init_debounce = __esm({ + "../node_modules/underscore/modules/debounce.js"() { + init_restArguments(); + init_now(); + } +}); + +// ../node_modules/underscore/modules/wrap.js +function wrap(func, wrapper) { + return partial_default(wrapper, func); +} +var init_wrap = __esm({ + "../node_modules/underscore/modules/wrap.js"() { + init_partial(); + } +}); + +// ../node_modules/underscore/modules/negate.js +function negate(predicate) { + return function() { + return !predicate.apply(this, arguments); + }; +} +var init_negate = __esm({ + "../node_modules/underscore/modules/negate.js"() { + } +}); + +// ../node_modules/underscore/modules/compose.js +function compose() { + var args = arguments; + var start = args.length - 1; + return function() { + var i = start; + var result2 = args[start].apply(this, arguments); + while (i--) result2 = args[i].call(this, result2); + return result2; + }; +} +var init_compose = __esm({ + "../node_modules/underscore/modules/compose.js"() { + } +}); + +// ../node_modules/underscore/modules/after.js +function after(times2, func) { + return function() { + if (--times2 < 1) { + return func.apply(this, arguments); + } + }; +} +var init_after = __esm({ + "../node_modules/underscore/modules/after.js"() { + } +}); + +// ../node_modules/underscore/modules/before.js +function before(times2, func) { + var memo; + return function() { + if (--times2 > 0) { + memo = func.apply(this, arguments); + } + if (times2 <= 1) func = null; + return memo; + }; +} +var init_before = __esm({ + "../node_modules/underscore/modules/before.js"() { + } +}); + +// ../node_modules/underscore/modules/once.js +var once_default; +var init_once = __esm({ + "../node_modules/underscore/modules/once.js"() { + init_partial(); + init_before(); + once_default = partial_default(before, 2); + } +}); + +// ../node_modules/underscore/modules/findKey.js +function findKey(obj, predicate, context) { + predicate = cb(predicate, context); + var _keys = keys(obj), key; + for (var i = 0, length = _keys.length; i < length; i++) { + key = _keys[i]; + if (predicate(obj[key], key, obj)) return key; + } +} +var init_findKey = __esm({ + "../node_modules/underscore/modules/findKey.js"() { + init_cb(); + init_keys(); + } +}); + +// ../node_modules/underscore/modules/_createPredicateIndexFinder.js +function createPredicateIndexFinder(dir) { + return function(array, predicate, context) { + predicate = cb(predicate, context); + var length = getLength_default(array); + var index = dir > 0 ? 0 : length - 1; + for (; index >= 0 && index < length; index += dir) { + if (predicate(array[index], index, array)) return index; + } + return -1; + }; +} +var init_createPredicateIndexFinder = __esm({ + "../node_modules/underscore/modules/_createPredicateIndexFinder.js"() { + init_cb(); + init_getLength(); + } +}); + +// ../node_modules/underscore/modules/findIndex.js +var findIndex_default; +var init_findIndex = __esm({ + "../node_modules/underscore/modules/findIndex.js"() { + init_createPredicateIndexFinder(); + findIndex_default = createPredicateIndexFinder(1); + } +}); + +// ../node_modules/underscore/modules/findLastIndex.js +var findLastIndex_default; +var init_findLastIndex = __esm({ + "../node_modules/underscore/modules/findLastIndex.js"() { + init_createPredicateIndexFinder(); + findLastIndex_default = createPredicateIndexFinder(-1); + } +}); + +// ../node_modules/underscore/modules/sortedIndex.js +function sortedIndex(array, obj, iteratee2, context) { + iteratee2 = cb(iteratee2, context, 1); + var value = iteratee2(obj); + var low = 0, high = getLength_default(array); + while (low < high) { + var mid = Math.floor((low + high) / 2); + if (iteratee2(array[mid]) < value) low = mid + 1; + else high = mid; + } + return low; +} +var init_sortedIndex = __esm({ + "../node_modules/underscore/modules/sortedIndex.js"() { + init_cb(); + init_getLength(); + } +}); + +// ../node_modules/underscore/modules/_createIndexFinder.js +function createIndexFinder(dir, predicateFind, sortedIndex2) { + return function(array, item, idx) { + var i = 0, length = getLength_default(array); + if (typeof idx == "number") { + if (dir > 0) { + i = idx >= 0 ? idx : Math.max(idx + length, i); + } else { + length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1; + } + } else if (sortedIndex2 && idx && length) { + idx = sortedIndex2(array, item); + return array[idx] === item ? idx : -1; + } + if (item !== item) { + idx = predicateFind(slice.call(array, i, length), isNaN2); + return idx >= 0 ? idx + i : -1; + } + for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) { + if (array[idx] === item) return idx; + } + return -1; + }; +} +var init_createIndexFinder = __esm({ + "../node_modules/underscore/modules/_createIndexFinder.js"() { + init_getLength(); + init_setup(); + init_isNaN(); + } +}); + +// ../node_modules/underscore/modules/indexOf.js +var indexOf_default; +var init_indexOf = __esm({ + "../node_modules/underscore/modules/indexOf.js"() { + init_sortedIndex(); + init_findIndex(); + init_createIndexFinder(); + indexOf_default = createIndexFinder(1, findIndex_default, sortedIndex); + } +}); + +// ../node_modules/underscore/modules/lastIndexOf.js +var lastIndexOf_default; +var init_lastIndexOf = __esm({ + "../node_modules/underscore/modules/lastIndexOf.js"() { + init_findLastIndex(); + init_createIndexFinder(); + lastIndexOf_default = createIndexFinder(-1, findLastIndex_default); + } +}); + +// ../node_modules/underscore/modules/find.js +function find(obj, predicate, context) { + var keyFinder = isArrayLike_default(obj) ? findIndex_default : findKey; + var key = keyFinder(obj, predicate, context); + if (key !== void 0 && key !== -1) return obj[key]; +} +var init_find = __esm({ + "../node_modules/underscore/modules/find.js"() { + init_isArrayLike(); + init_findIndex(); + init_findKey(); + } +}); + +// ../node_modules/underscore/modules/findWhere.js +function findWhere(obj, attrs) { + return find(obj, matcher(attrs)); +} +var init_findWhere = __esm({ + "../node_modules/underscore/modules/findWhere.js"() { + init_find(); + init_matcher(); + } +}); + +// ../node_modules/underscore/modules/each.js +function each(obj, iteratee2, context) { + iteratee2 = optimizeCb(iteratee2, context); + var i, length; + if (isArrayLike_default(obj)) { + for (i = 0, length = obj.length; i < length; i++) { + iteratee2(obj[i], i, obj); + } + } else { + var _keys = keys(obj); + for (i = 0, length = _keys.length; i < length; i++) { + iteratee2(obj[_keys[i]], _keys[i], obj); + } + } + return obj; +} +var init_each = __esm({ + "../node_modules/underscore/modules/each.js"() { + init_optimizeCb(); + init_isArrayLike(); + init_keys(); + } +}); + +// ../node_modules/underscore/modules/map.js +function map(obj, iteratee2, context) { + iteratee2 = cb(iteratee2, context); + var _keys = !isArrayLike_default(obj) && keys(obj), length = (_keys || obj).length, results = Array(length); + for (var index = 0; index < length; index++) { + var currentKey = _keys ? _keys[index] : index; + results[index] = iteratee2(obj[currentKey], currentKey, obj); + } + return results; +} +var init_map = __esm({ + "../node_modules/underscore/modules/map.js"() { + init_cb(); + init_isArrayLike(); + init_keys(); + } +}); + +// ../node_modules/underscore/modules/_createReduce.js +function createReduce(dir) { + var reducer = function(obj, iteratee2, memo, initial2) { + var _keys = !isArrayLike_default(obj) && keys(obj), length = (_keys || obj).length, index = dir > 0 ? 0 : length - 1; + if (!initial2) { + memo = obj[_keys ? _keys[index] : index]; + index += dir; + } + for (; index >= 0 && index < length; index += dir) { + var currentKey = _keys ? _keys[index] : index; + memo = iteratee2(memo, obj[currentKey], currentKey, obj); + } + return memo; + }; + return function(obj, iteratee2, memo, context) { + var initial2 = arguments.length >= 3; + return reducer(obj, optimizeCb(iteratee2, context, 4), memo, initial2); + }; +} +var init_createReduce = __esm({ + "../node_modules/underscore/modules/_createReduce.js"() { + init_isArrayLike(); + init_keys(); + init_optimizeCb(); + } +}); + +// ../node_modules/underscore/modules/reduce.js +var reduce_default; +var init_reduce = __esm({ + "../node_modules/underscore/modules/reduce.js"() { + init_createReduce(); + reduce_default = createReduce(1); + } +}); + +// ../node_modules/underscore/modules/reduceRight.js +var reduceRight_default; +var init_reduceRight = __esm({ + "../node_modules/underscore/modules/reduceRight.js"() { + init_createReduce(); + reduceRight_default = createReduce(-1); + } +}); + +// ../node_modules/underscore/modules/filter.js +function filter(obj, predicate, context) { + var results = []; + predicate = cb(predicate, context); + each(obj, function(value, index, list) { + if (predicate(value, index, list)) results.push(value); + }); + return results; +} +var init_filter = __esm({ + "../node_modules/underscore/modules/filter.js"() { + init_cb(); + init_each(); + } +}); + +// ../node_modules/underscore/modules/reject.js +function reject(obj, predicate, context) { + return filter(obj, negate(cb(predicate)), context); +} +var init_reject = __esm({ + "../node_modules/underscore/modules/reject.js"() { + init_filter(); + init_negate(); + init_cb(); + } +}); + +// ../node_modules/underscore/modules/every.js +function every(obj, predicate, context) { + predicate = cb(predicate, context); + var _keys = !isArrayLike_default(obj) && keys(obj), length = (_keys || obj).length; + for (var index = 0; index < length; index++) { + var currentKey = _keys ? _keys[index] : index; + if (!predicate(obj[currentKey], currentKey, obj)) return false; + } + return true; +} +var init_every = __esm({ + "../node_modules/underscore/modules/every.js"() { + init_cb(); + init_isArrayLike(); + init_keys(); + } +}); + +// ../node_modules/underscore/modules/some.js +function some(obj, predicate, context) { + predicate = cb(predicate, context); + var _keys = !isArrayLike_default(obj) && keys(obj), length = (_keys || obj).length; + for (var index = 0; index < length; index++) { + var currentKey = _keys ? _keys[index] : index; + if (predicate(obj[currentKey], currentKey, obj)) return true; + } + return false; +} +var init_some = __esm({ + "../node_modules/underscore/modules/some.js"() { + init_cb(); + init_isArrayLike(); + init_keys(); + } +}); + +// ../node_modules/underscore/modules/contains.js +function contains(obj, item, fromIndex, guard) { + if (!isArrayLike_default(obj)) obj = values(obj); + if (typeof fromIndex != "number" || guard) fromIndex = 0; + return indexOf_default(obj, item, fromIndex) >= 0; +} +var init_contains = __esm({ + "../node_modules/underscore/modules/contains.js"() { + init_isArrayLike(); + init_values(); + init_indexOf(); + } +}); + +// ../node_modules/underscore/modules/invoke.js +var invoke_default; +var init_invoke = __esm({ + "../node_modules/underscore/modules/invoke.js"() { + init_restArguments(); + init_isFunction(); + init_map(); + init_deepGet(); + init_toPath2(); + invoke_default = restArguments(function(obj, path2, args) { + var contextPath, func; + if (isFunction_default(path2)) { + func = path2; + } else { + path2 = toPath2(path2); + contextPath = path2.slice(0, -1); + path2 = path2[path2.length - 1]; + } + return map(obj, function(context) { + var method = func; + if (!method) { + if (contextPath && contextPath.length) { + context = deepGet(context, contextPath); + } + if (context == null) return void 0; + method = context[path2]; + } + return method == null ? method : method.apply(context, args); + }); + }); + } +}); + +// ../node_modules/underscore/modules/pluck.js +function pluck(obj, key) { + return map(obj, property(key)); +} +var init_pluck = __esm({ + "../node_modules/underscore/modules/pluck.js"() { + init_map(); + init_property(); + } +}); + +// ../node_modules/underscore/modules/where.js +function where(obj, attrs) { + return filter(obj, matcher(attrs)); +} +var init_where = __esm({ + "../node_modules/underscore/modules/where.js"() { + init_filter(); + init_matcher(); + } +}); + +// ../node_modules/underscore/modules/max.js +function max(obj, iteratee2, context) { + var result2 = -Infinity, lastComputed = -Infinity, value, computed; + if (iteratee2 == null || typeof iteratee2 == "number" && typeof obj[0] != "object" && obj != null) { + obj = isArrayLike_default(obj) ? obj : values(obj); + for (var i = 0, length = obj.length; i < length; i++) { + value = obj[i]; + if (value != null && value > result2) { + result2 = value; + } + } + } else { + iteratee2 = cb(iteratee2, context); + each(obj, function(v, index, list) { + computed = iteratee2(v, index, list); + if (computed > lastComputed || computed === -Infinity && result2 === -Infinity) { + result2 = v; + lastComputed = computed; + } + }); + } + return result2; +} +var init_max = __esm({ + "../node_modules/underscore/modules/max.js"() { + init_isArrayLike(); + init_values(); + init_cb(); + init_each(); + } +}); + +// ../node_modules/underscore/modules/min.js +function min(obj, iteratee2, context) { + var result2 = Infinity, lastComputed = Infinity, value, computed; + if (iteratee2 == null || typeof iteratee2 == "number" && typeof obj[0] != "object" && obj != null) { + obj = isArrayLike_default(obj) ? obj : values(obj); + for (var i = 0, length = obj.length; i < length; i++) { + value = obj[i]; + if (value != null && value < result2) { + result2 = value; + } + } + } else { + iteratee2 = cb(iteratee2, context); + each(obj, function(v, index, list) { + computed = iteratee2(v, index, list); + if (computed < lastComputed || computed === Infinity && result2 === Infinity) { + result2 = v; + lastComputed = computed; + } + }); + } + return result2; +} +var init_min = __esm({ + "../node_modules/underscore/modules/min.js"() { + init_isArrayLike(); + init_values(); + init_cb(); + init_each(); + } +}); + +// ../node_modules/underscore/modules/toArray.js +function toArray(obj) { + if (!obj) return []; + if (isArray_default(obj)) return slice.call(obj); + if (isString_default(obj)) { + return obj.match(reStrSymbol); + } + if (isArrayLike_default(obj)) return map(obj, identity); + return values(obj); +} +var reStrSymbol; +var init_toArray = __esm({ + "../node_modules/underscore/modules/toArray.js"() { + init_isArray(); + init_setup(); + init_isString(); + init_isArrayLike(); + init_map(); + init_identity(); + init_values(); + reStrSymbol = /[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g; + } +}); + +// ../node_modules/underscore/modules/sample.js +function sample(obj, n, guard) { + if (n == null || guard) { + if (!isArrayLike_default(obj)) obj = values(obj); + return obj[random(obj.length - 1)]; + } + var sample2 = toArray(obj); + var length = getLength_default(sample2); + n = Math.max(Math.min(n, length), 0); + var last2 = length - 1; + for (var index = 0; index < n; index++) { + var rand = random(index, last2); + var temp = sample2[index]; + sample2[index] = sample2[rand]; + sample2[rand] = temp; + } + return sample2.slice(0, n); +} +var init_sample = __esm({ + "../node_modules/underscore/modules/sample.js"() { + init_isArrayLike(); + init_values(); + init_getLength(); + init_random(); + init_toArray(); + } +}); + +// ../node_modules/underscore/modules/shuffle.js +function shuffle(obj) { + return sample(obj, Infinity); +} +var init_shuffle = __esm({ + "../node_modules/underscore/modules/shuffle.js"() { + init_sample(); + } +}); + +// ../node_modules/underscore/modules/sortBy.js +function sortBy(obj, iteratee2, context) { + var index = 0; + iteratee2 = cb(iteratee2, context); + return pluck(map(obj, function(value, key, list) { + return { + value, + index: index++, + criteria: iteratee2(value, key, list) + }; + }).sort(function(left, right) { + var a = left.criteria; + var b = right.criteria; + if (a !== b) { + if (a > b || a === void 0) return 1; + if (a < b || b === void 0) return -1; + } + return left.index - right.index; + }), "value"); +} +var init_sortBy = __esm({ + "../node_modules/underscore/modules/sortBy.js"() { + init_cb(); + init_pluck(); + init_map(); + } +}); + +// ../node_modules/underscore/modules/_group.js +function group(behavior, partition) { + return function(obj, iteratee2, context) { + var result2 = partition ? [[], []] : {}; + iteratee2 = cb(iteratee2, context); + each(obj, function(value, index) { + var key = iteratee2(value, index, obj); + behavior(result2, value, key); + }); + return result2; + }; +} +var init_group = __esm({ + "../node_modules/underscore/modules/_group.js"() { + init_cb(); + init_each(); + } +}); + +// ../node_modules/underscore/modules/groupBy.js +var groupBy_default; +var init_groupBy = __esm({ + "../node_modules/underscore/modules/groupBy.js"() { + init_group(); + init_has(); + groupBy_default = group(function(result2, value, key) { + if (has(result2, key)) result2[key].push(value); + else result2[key] = [value]; + }); + } +}); + +// ../node_modules/underscore/modules/indexBy.js +var indexBy_default; +var init_indexBy = __esm({ + "../node_modules/underscore/modules/indexBy.js"() { + init_group(); + indexBy_default = group(function(result2, value, key) { + result2[key] = value; + }); + } +}); + +// ../node_modules/underscore/modules/countBy.js +var countBy_default; +var init_countBy = __esm({ + "../node_modules/underscore/modules/countBy.js"() { + init_group(); + init_has(); + countBy_default = group(function(result2, value, key) { + if (has(result2, key)) result2[key]++; + else result2[key] = 1; + }); + } +}); + +// ../node_modules/underscore/modules/partition.js +var partition_default; +var init_partition = __esm({ + "../node_modules/underscore/modules/partition.js"() { + init_group(); + partition_default = group(function(result2, value, pass) { + result2[pass ? 0 : 1].push(value); + }, true); + } +}); + +// ../node_modules/underscore/modules/size.js +function size(obj) { + if (obj == null) return 0; + return isArrayLike_default(obj) ? obj.length : keys(obj).length; +} +var init_size = __esm({ + "../node_modules/underscore/modules/size.js"() { + init_isArrayLike(); + init_keys(); + } +}); + +// ../node_modules/underscore/modules/_keyInObj.js +function keyInObj(value, key, obj) { + return key in obj; +} +var init_keyInObj = __esm({ + "../node_modules/underscore/modules/_keyInObj.js"() { + } +}); + +// ../node_modules/underscore/modules/pick.js +var pick_default; +var init_pick = __esm({ + "../node_modules/underscore/modules/pick.js"() { + init_restArguments(); + init_isFunction(); + init_optimizeCb(); + init_allKeys(); + init_keyInObj(); + init_flatten(); + pick_default = restArguments(function(obj, keys2) { + var result2 = {}, iteratee2 = keys2[0]; + if (obj == null) return result2; + if (isFunction_default(iteratee2)) { + if (keys2.length > 1) iteratee2 = optimizeCb(iteratee2, keys2[1]); + keys2 = allKeys(obj); + } else { + iteratee2 = keyInObj; + keys2 = flatten(keys2, false, false); + obj = Object(obj); + } + for (var i = 0, length = keys2.length; i < length; i++) { + var key = keys2[i]; + var value = obj[key]; + if (iteratee2(value, key, obj)) result2[key] = value; + } + return result2; + }); + } +}); + +// ../node_modules/underscore/modules/omit.js +var omit_default; +var init_omit = __esm({ + "../node_modules/underscore/modules/omit.js"() { + init_restArguments(); + init_isFunction(); + init_negate(); + init_map(); + init_flatten(); + init_contains(); + init_pick(); + omit_default = restArguments(function(obj, keys2) { + var iteratee2 = keys2[0], context; + if (isFunction_default(iteratee2)) { + iteratee2 = negate(iteratee2); + if (keys2.length > 1) context = keys2[1]; + } else { + keys2 = map(flatten(keys2, false, false), String); + iteratee2 = function(value, key) { + return !contains(keys2, key); + }; + } + return pick_default(obj, iteratee2, context); + }); + } +}); + +// ../node_modules/underscore/modules/initial.js +function initial(array, n, guard) { + return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n))); +} +var init_initial = __esm({ + "../node_modules/underscore/modules/initial.js"() { + init_setup(); + } +}); + +// ../node_modules/underscore/modules/first.js +function first(array, n, guard) { + if (array == null || array.length < 1) return n == null || guard ? void 0 : []; + if (n == null || guard) return array[0]; + return initial(array, array.length - n); +} +var init_first = __esm({ + "../node_modules/underscore/modules/first.js"() { + init_initial(); + } +}); + +// ../node_modules/underscore/modules/rest.js +function rest(array, n, guard) { + return slice.call(array, n == null || guard ? 1 : n); +} +var init_rest = __esm({ + "../node_modules/underscore/modules/rest.js"() { + init_setup(); + } +}); + +// ../node_modules/underscore/modules/last.js +function last(array, n, guard) { + if (array == null || array.length < 1) return n == null || guard ? void 0 : []; + if (n == null || guard) return array[array.length - 1]; + return rest(array, Math.max(0, array.length - n)); +} +var init_last = __esm({ + "../node_modules/underscore/modules/last.js"() { + init_rest(); + } +}); + +// ../node_modules/underscore/modules/compact.js +function compact(array) { + return filter(array, Boolean); +} +var init_compact = __esm({ + "../node_modules/underscore/modules/compact.js"() { + init_filter(); + } +}); + +// ../node_modules/underscore/modules/flatten.js +function flatten2(array, depth) { + return flatten(array, depth, false); +} +var init_flatten2 = __esm({ + "../node_modules/underscore/modules/flatten.js"() { + init_flatten(); + } +}); + +// ../node_modules/underscore/modules/difference.js +var difference_default; +var init_difference = __esm({ + "../node_modules/underscore/modules/difference.js"() { + init_restArguments(); + init_flatten(); + init_filter(); + init_contains(); + difference_default = restArguments(function(array, rest2) { + rest2 = flatten(rest2, true, true); + return filter(array, function(value) { + return !contains(rest2, value); + }); + }); + } +}); + +// ../node_modules/underscore/modules/without.js +var without_default; +var init_without = __esm({ + "../node_modules/underscore/modules/without.js"() { + init_restArguments(); + init_difference(); + without_default = restArguments(function(array, otherArrays) { + return difference_default(array, otherArrays); + }); + } +}); + +// ../node_modules/underscore/modules/uniq.js +function uniq(array, isSorted, iteratee2, context) { + if (!isBoolean(isSorted)) { + context = iteratee2; + iteratee2 = isSorted; + isSorted = false; + } + if (iteratee2 != null) iteratee2 = cb(iteratee2, context); + var result2 = []; + var seen = []; + for (var i = 0, length = getLength_default(array); i < length; i++) { + var value = array[i], computed = iteratee2 ? iteratee2(value, i, array) : value; + if (isSorted && !iteratee2) { + if (!i || seen !== computed) result2.push(value); + seen = computed; + } else if (iteratee2) { + if (!contains(seen, computed)) { + seen.push(computed); + result2.push(value); + } + } else if (!contains(result2, value)) { + result2.push(value); + } + } + return result2; +} +var init_uniq = __esm({ + "../node_modules/underscore/modules/uniq.js"() { + init_isBoolean(); + init_cb(); + init_getLength(); + init_contains(); + } +}); + +// ../node_modules/underscore/modules/union.js +var union_default; +var init_union = __esm({ + "../node_modules/underscore/modules/union.js"() { + init_restArguments(); + init_uniq(); + init_flatten(); + union_default = restArguments(function(arrays) { + return uniq(flatten(arrays, true, true)); + }); + } +}); + +// ../node_modules/underscore/modules/intersection.js +function intersection(array) { + var result2 = []; + var argsLength = arguments.length; + for (var i = 0, length = getLength_default(array); i < length; i++) { + var item = array[i]; + if (contains(result2, item)) continue; + var j; + for (j = 1; j < argsLength; j++) { + if (!contains(arguments[j], item)) break; + } + if (j === argsLength) result2.push(item); + } + return result2; +} +var init_intersection = __esm({ + "../node_modules/underscore/modules/intersection.js"() { + init_getLength(); + init_contains(); + } +}); + +// ../node_modules/underscore/modules/unzip.js +function unzip(array) { + var length = array && max(array, getLength_default).length || 0; + var result2 = Array(length); + for (var index = 0; index < length; index++) { + result2[index] = pluck(array, index); + } + return result2; +} +var init_unzip = __esm({ + "../node_modules/underscore/modules/unzip.js"() { + init_max(); + init_getLength(); + init_pluck(); + } +}); + +// ../node_modules/underscore/modules/zip.js +var zip_default; +var init_zip = __esm({ + "../node_modules/underscore/modules/zip.js"() { + init_restArguments(); + init_unzip(); + zip_default = restArguments(unzip); + } +}); + +// ../node_modules/underscore/modules/object.js +function object(list, values2) { + var result2 = {}; + for (var i = 0, length = getLength_default(list); i < length; i++) { + if (values2) { + result2[list[i]] = values2[i]; + } else { + result2[list[i][0]] = list[i][1]; + } + } + return result2; +} +var init_object = __esm({ + "../node_modules/underscore/modules/object.js"() { + init_getLength(); + } +}); + +// ../node_modules/underscore/modules/range.js +function range(start, stop, step) { + if (stop == null) { + stop = start || 0; + start = 0; + } + if (!step) { + step = stop < start ? -1 : 1; + } + var length = Math.max(Math.ceil((stop - start) / step), 0); + var range2 = Array(length); + for (var idx = 0; idx < length; idx++, start += step) { + range2[idx] = start; + } + return range2; +} +var init_range = __esm({ + "../node_modules/underscore/modules/range.js"() { + } +}); + +// ../node_modules/underscore/modules/chunk.js +function chunk(array, count) { + if (count == null || count < 1) return []; + var result2 = []; + var i = 0, length = array.length; + while (i < length) { + result2.push(slice.call(array, i, i += count)); + } + return result2; +} +var init_chunk = __esm({ + "../node_modules/underscore/modules/chunk.js"() { + init_setup(); + } +}); + +// ../node_modules/underscore/modules/_chainResult.js +function chainResult(instance, obj) { + return instance._chain ? _(obj).chain() : obj; +} +var init_chainResult = __esm({ + "../node_modules/underscore/modules/_chainResult.js"() { + init_underscore(); + } +}); + +// ../node_modules/underscore/modules/mixin.js +function mixin(obj) { + each(functions(obj), function(name) { + var func = _[name] = obj[name]; + _.prototype[name] = function() { + var args = [this._wrapped]; + push.apply(args, arguments); + return chainResult(this, func.apply(_, args)); + }; + }); + return _; +} +var init_mixin = __esm({ + "../node_modules/underscore/modules/mixin.js"() { + init_underscore(); + init_each(); + init_functions(); + init_setup(); + init_chainResult(); + } +}); + +// ../node_modules/underscore/modules/underscore-array-methods.js +var underscore_array_methods_default; +var init_underscore_array_methods = __esm({ + "../node_modules/underscore/modules/underscore-array-methods.js"() { + init_underscore(); + init_each(); + init_setup(); + init_chainResult(); + each(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function(name) { + var method = ArrayProto[name]; + _.prototype[name] = function() { + var obj = this._wrapped; + if (obj != null) { + method.apply(obj, arguments); + if ((name === "shift" || name === "splice") && obj.length === 0) { + delete obj[0]; + } + } + return chainResult(this, obj); + }; + }); + each(["concat", "join", "slice"], function(name) { + var method = ArrayProto[name]; + _.prototype[name] = function() { + var obj = this._wrapped; + if (obj != null) obj = method.apply(obj, arguments); + return chainResult(this, obj); + }; + }); + underscore_array_methods_default = _; + } +}); + +// ../node_modules/underscore/modules/index.js +var modules_exports = {}; +__export(modules_exports, { + VERSION: () => VERSION2, + after: () => after, + all: () => every, + allKeys: () => allKeys, + any: () => some, + assign: () => extendOwn_default, + before: () => before, + bind: () => bind_default, + bindAll: () => bindAll_default, + chain: () => chain, + chunk: () => chunk, + clone: () => clone, + collect: () => map, + compact: () => compact, + compose: () => compose, + constant: () => constant, + contains: () => contains, + countBy: () => countBy_default, + create: () => create, + debounce: () => debounce, + default: () => underscore_array_methods_default, + defaults: () => defaults_default, + defer: () => defer_default, + delay: () => delay_default, + detect: () => find, + difference: () => difference_default, + drop: () => rest, + each: () => each, + escape: () => escape_default, + every: () => every, + extend: () => extend_default, + extendOwn: () => extendOwn_default, + filter: () => filter, + find: () => find, + findIndex: () => findIndex_default, + findKey: () => findKey, + findLastIndex: () => findLastIndex_default, + findWhere: () => findWhere, + first: () => first, + flatten: () => flatten2, + foldl: () => reduce_default, + foldr: () => reduceRight_default, + forEach: () => each, + functions: () => functions, + get: () => get, + groupBy: () => groupBy_default, + has: () => has2, + head: () => first, + identity: () => identity, + include: () => contains, + includes: () => contains, + indexBy: () => indexBy_default, + indexOf: () => indexOf_default, + initial: () => initial, + inject: () => reduce_default, + intersection: () => intersection, + invert: () => invert, + invoke: () => invoke_default, + isArguments: () => isArguments_default, + isArray: () => isArray_default, + isArrayBuffer: () => isArrayBuffer_default, + isBoolean: () => isBoolean, + isDataView: () => isDataView_default, + isDate: () => isDate_default, + isElement: () => isElement, + isEmpty: () => isEmpty, + isEqual: () => isEqual, + isError: () => isError_default, + isFinite: () => isFinite2, + isFunction: () => isFunction_default, + isMap: () => isMap_default, + isMatch: () => isMatch, + isNaN: () => isNaN2, + isNull: () => isNull, + isNumber: () => isNumber_default, + isObject: () => isObject, + isRegExp: () => isRegExp_default, + isSet: () => isSet_default, + isString: () => isString_default, + isSymbol: () => isSymbol_default, + isTypedArray: () => isTypedArray_default, + isUndefined: () => isUndefined, + isWeakMap: () => isWeakMap_default, + isWeakSet: () => isWeakSet_default, + iteratee: () => iteratee, + keys: () => keys, + last: () => last, + lastIndexOf: () => lastIndexOf_default, + map: () => map, + mapObject: () => mapObject, + matcher: () => matcher, + matches: () => matcher, + max: () => max, + memoize: () => memoize, + methods: () => functions, + min: () => min, + mixin: () => mixin, + negate: () => negate, + noop: () => noop, + now: () => now_default, + object: () => object, + omit: () => omit_default, + once: () => once_default, + pairs: () => pairs, + partial: () => partial_default, + partition: () => partition_default, + pick: () => pick_default, + pluck: () => pluck, + property: () => property, + propertyOf: () => propertyOf, + random: () => random, + range: () => range, + reduce: () => reduce_default, + reduceRight: () => reduceRight_default, + reject: () => reject, + rest: () => rest, + restArguments: () => restArguments, + result: () => result, + sample: () => sample, + select: () => filter, + shuffle: () => shuffle, + size: () => size, + some: () => some, + sortBy: () => sortBy, + sortedIndex: () => sortedIndex, + tail: () => rest, + take: () => first, + tap: () => tap, + template: () => template, + templateSettings: () => templateSettings_default, + throttle: () => throttle, + times: () => times, + toArray: () => toArray, + toPath: () => toPath, + transpose: () => unzip, + unescape: () => unescape_default, + union: () => union_default, + uniq: () => uniq, + unique: () => uniq, + uniqueId: () => uniqueId, + unzip: () => unzip, + values: () => values, + where: () => where, + without: () => without_default, + wrap: () => wrap, + zip: () => zip_default +}); +var init_modules = __esm({ + "../node_modules/underscore/modules/index.js"() { + init_setup(); + init_restArguments(); + init_isObject(); + init_isNull(); + init_isUndefined(); + init_isBoolean(); + init_isElement(); + init_isString(); + init_isNumber(); + init_isDate(); + init_isRegExp(); + init_isError(); + init_isSymbol(); + init_isArrayBuffer(); + init_isDataView(); + init_isArray(); + init_isFunction(); + init_isArguments(); + init_isFinite(); + init_isNaN(); + init_isTypedArray(); + init_isEmpty(); + init_isMatch(); + init_isEqual(); + init_isMap(); + init_isWeakMap(); + init_isSet(); + init_isWeakSet(); + init_keys(); + init_allKeys(); + init_values(); + init_pairs(); + init_invert(); + init_functions(); + init_extend(); + init_extendOwn(); + init_defaults(); + init_create(); + init_clone(); + init_tap(); + init_get(); + init_has2(); + init_mapObject(); + init_identity(); + init_constant(); + init_noop(); + init_toPath(); + init_property(); + init_propertyOf(); + init_matcher(); + init_times(); + init_random(); + init_now(); + init_escape(); + init_unescape(); + init_templateSettings(); + init_template(); + init_result(); + init_uniqueId(); + init_chain(); + init_iteratee(); + init_partial(); + init_bind(); + init_bindAll(); + init_memoize(); + init_delay(); + init_defer(); + init_throttle(); + init_debounce(); + init_wrap(); + init_negate(); + init_compose(); + init_after(); + init_before(); + init_once(); + init_findKey(); + init_findIndex(); + init_findLastIndex(); + init_sortedIndex(); + init_indexOf(); + init_lastIndexOf(); + init_find(); + init_findWhere(); + init_each(); + init_map(); + init_reduce(); + init_reduceRight(); + init_filter(); + init_reject(); + init_every(); + init_some(); + init_contains(); + init_invoke(); + init_pluck(); + init_where(); + init_max(); + init_min(); + init_shuffle(); + init_sample(); + init_sortBy(); + init_groupBy(); + init_indexBy(); + init_countBy(); + init_partition(); + init_toArray(); + init_size(); + init_pick(); + init_omit(); + init_first(); + init_initial(); + init_last(); + init_rest(); + init_compact(); + init_flatten2(); + init_without(); + init_uniq(); + init_union(); + init_intersection(); + init_difference(); + init_unzip(); + init_zip(); + init_object(); + init_range(); + init_chunk(); + init_mixin(); + init_underscore_array_methods(); + } +}); + +// ../node_modules/underscore/modules/index-default.js +var _2, index_default_default; +var init_index_default = __esm({ + "../node_modules/underscore/modules/index-default.js"() { + init_modules(); + init_modules(); + _2 = mixin(modules_exports); + _2._ = _2; + index_default_default = _2; + } +}); + +// ../node_modules/underscore/modules/index-all.js +var index_all_exports = {}; +__export(index_all_exports, { + VERSION: () => VERSION2, + after: () => after, + all: () => every, + allKeys: () => allKeys, + any: () => some, + assign: () => extendOwn_default, + before: () => before, + bind: () => bind_default, + bindAll: () => bindAll_default, + chain: () => chain, + chunk: () => chunk, + clone: () => clone, + collect: () => map, + compact: () => compact, + compose: () => compose, + constant: () => constant, + contains: () => contains, + countBy: () => countBy_default, + create: () => create, + debounce: () => debounce, + default: () => index_default_default, + defaults: () => defaults_default, + defer: () => defer_default, + delay: () => delay_default, + detect: () => find, + difference: () => difference_default, + drop: () => rest, + each: () => each, + escape: () => escape_default, + every: () => every, + extend: () => extend_default, + extendOwn: () => extendOwn_default, + filter: () => filter, + find: () => find, + findIndex: () => findIndex_default, + findKey: () => findKey, + findLastIndex: () => findLastIndex_default, + findWhere: () => findWhere, + first: () => first, + flatten: () => flatten2, + foldl: () => reduce_default, + foldr: () => reduceRight_default, + forEach: () => each, + functions: () => functions, + get: () => get, + groupBy: () => groupBy_default, + has: () => has2, + head: () => first, + identity: () => identity, + include: () => contains, + includes: () => contains, + indexBy: () => indexBy_default, + indexOf: () => indexOf_default, + initial: () => initial, + inject: () => reduce_default, + intersection: () => intersection, + invert: () => invert, + invoke: () => invoke_default, + isArguments: () => isArguments_default, + isArray: () => isArray_default, + isArrayBuffer: () => isArrayBuffer_default, + isBoolean: () => isBoolean, + isDataView: () => isDataView_default, + isDate: () => isDate_default, + isElement: () => isElement, + isEmpty: () => isEmpty, + isEqual: () => isEqual, + isError: () => isError_default, + isFinite: () => isFinite2, + isFunction: () => isFunction_default, + isMap: () => isMap_default, + isMatch: () => isMatch, + isNaN: () => isNaN2, + isNull: () => isNull, + isNumber: () => isNumber_default, + isObject: () => isObject, + isRegExp: () => isRegExp_default, + isSet: () => isSet_default, + isString: () => isString_default, + isSymbol: () => isSymbol_default, + isTypedArray: () => isTypedArray_default, + isUndefined: () => isUndefined, + isWeakMap: () => isWeakMap_default, + isWeakSet: () => isWeakSet_default, + iteratee: () => iteratee, + keys: () => keys, + last: () => last, + lastIndexOf: () => lastIndexOf_default, + map: () => map, + mapObject: () => mapObject, + matcher: () => matcher, + matches: () => matcher, + max: () => max, + memoize: () => memoize, + methods: () => functions, + min: () => min, + mixin: () => mixin, + negate: () => negate, + noop: () => noop, + now: () => now_default, + object: () => object, + omit: () => omit_default, + once: () => once_default, + pairs: () => pairs, + partial: () => partial_default, + partition: () => partition_default, + pick: () => pick_default, + pluck: () => pluck, + property: () => property, + propertyOf: () => propertyOf, + random: () => random, + range: () => range, + reduce: () => reduce_default, + reduceRight: () => reduceRight_default, + reject: () => reject, + rest: () => rest, + restArguments: () => restArguments, + result: () => result, + sample: () => sample, + select: () => filter, + shuffle: () => shuffle, + size: () => size, + some: () => some, + sortBy: () => sortBy, + sortedIndex: () => sortedIndex, + tail: () => rest, + take: () => first, + tap: () => tap, + template: () => template, + templateSettings: () => templateSettings_default, + throttle: () => throttle, + times: () => times, + toArray: () => toArray, + toPath: () => toPath, + transpose: () => unzip, + unescape: () => unescape_default, + union: () => union_default, + uniq: () => uniq, + unique: () => uniq, + uniqueId: () => uniqueId, + unzip: () => unzip, + values: () => values, + where: () => where, + without: () => without_default, + wrap: () => wrap, + zip: () => zip_default +}); +var init_index_all = __esm({ + "../node_modules/underscore/modules/index-all.js"() { + init_index_default(); + init_modules(); + } +}); + +// ../node_modules/azure-devops-node-api/node_modules/typed-rest-client/opensource/Node-SMB/lib/common.js +var require_common2 = __commonJS({ + "../node_modules/azure-devops-node-api/node_modules/typed-rest-client/opensource/Node-SMB/lib/common.js"(exports2, module2) { + var crypto = require("crypto"); + function zeroextend(str, len) { + while (str.length < len) + str = "0" + str; + return str; + } + function oddpar(buf) { + for (var j = 0; j < buf.length; j++) { + var par = 1; + for (var i = 1; i < 8; i++) { + par = (par + (buf[j] >> i & 1)) % 2; + } + buf[j] |= par & 1; + } + return buf; + } + function expandkey(key56) { + var key64 = Buffer.alloc(8); + key64[0] = key56[0] & 254; + key64[1] = key56[0] << 7 & 255 | key56[1] >> 1; + key64[2] = key56[1] << 6 & 255 | key56[2] >> 2; + key64[3] = key56[2] << 5 & 255 | key56[3] >> 3; + key64[4] = key56[3] << 4 & 255 | key56[4] >> 4; + key64[5] = key56[4] << 3 & 255 | key56[5] >> 5; + key64[6] = key56[5] << 2 & 255 | key56[6] >> 6; + key64[7] = key56[6] << 1 & 255; + return key64; + } + function bintohex(bin) { + var buf = Buffer.isBuffer(buf) ? buf : Buffer.from(bin, "binary"); + var str = buf.toString("hex").toUpperCase(); + return zeroextend(str, 32); + } + module2.exports.zeroextend = zeroextend; + module2.exports.oddpar = oddpar; + module2.exports.expandkey = expandkey; + module2.exports.bintohex = bintohex; + } +}); + +// ../node_modules/js-md4/src/md4.js +var require_md4 = __commonJS({ + "../node_modules/js-md4/src/md4.js"(exports2, module2) { + (function() { + "use strict"; + var root2 = typeof window === "object" ? window : {}; + var NODE_JS = !root2.JS_MD4_NO_NODE_JS && typeof process === "object" && process.versions && process.versions.node; + if (NODE_JS) { + root2 = global; + } + var COMMON_JS = !root2.JS_MD4_NO_COMMON_JS && typeof module2 === "object" && module2.exports; + var AMD = typeof define === "function" && define.amd; + var ARRAY_BUFFER = !root2.JS_MD4_NO_ARRAY_BUFFER && typeof ArrayBuffer !== "undefined"; + var HEX_CHARS = "0123456789abcdef".split(""); + var EXTRA = [128, 32768, 8388608, -2147483648]; + var SHIFT = [0, 8, 16, 24]; + var OUTPUT_TYPES = ["hex", "array", "digest", "buffer", "arrayBuffer"]; + var blocks = [], buffer8; + if (ARRAY_BUFFER) { + var buffer = new ArrayBuffer(68); + buffer8 = new Uint8Array(buffer); + blocks = new Uint32Array(buffer); + } + var createOutputMethod = function(outputType) { + return function(message) { + return new Md4(true).update(message)[outputType](); + }; + }; + var createMethod = function() { + var method = createOutputMethod("hex"); + if (NODE_JS) { + method = nodeWrap(method); + } + method.create = function() { + return new Md4(); + }; + method.update = function(message) { + return method.create().update(message); + }; + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createOutputMethod(type); + } + return method; + }; + var nodeWrap = function(method) { + var crypto = require("crypto"); + var Buffer2 = require("buffer").Buffer; + var nodeMethod = function(message) { + if (typeof message === "string") { + return crypto.createHash("md4").update(message, "utf8").digest("hex"); + } else if (ARRAY_BUFFER && message instanceof ArrayBuffer) { + message = new Uint8Array(message); + } else if (message.length === void 0) { + return method(message); + } + return crypto.createHash("md4").update(new Buffer2(message)).digest("hex"); + }; + return nodeMethod; + }; + function Md4(sharedMemory) { + if (sharedMemory) { + blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0; + this.blocks = blocks; + this.buffer8 = buffer8; + } else { + if (ARRAY_BUFFER) { + var buffer2 = new ArrayBuffer(68); + this.buffer8 = new Uint8Array(buffer2); + this.blocks = new Uint32Array(buffer2); + } else { + this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + } + } + this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = 0; + this.finalized = this.hashed = false; + this.first = true; + } + Md4.prototype.update = function(message) { + if (this.finalized) { + return; + } + var notString = typeof message !== "string"; + if (notString && ARRAY_BUFFER && message instanceof ArrayBuffer) { + message = new Uint8Array(message); + } + var code, index = 0, i, length = message.length || 0, blocks2 = this.blocks; + var buffer82 = this.buffer8; + while (index < length) { + if (this.hashed) { + this.hashed = false; + blocks2[0] = blocks2[16]; + blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0; + } + if (notString) { + if (ARRAY_BUFFER) { + for (i = this.start; index < length && i < 64; ++index) { + buffer82[i++] = message[index]; + } + } else { + for (i = this.start; index < length && i < 64; ++index) { + blocks2[i >> 2] |= message[index] << SHIFT[i++ & 3]; + } + } + } else { + if (ARRAY_BUFFER) { + for (i = this.start; index < length && i < 64; ++index) { + code = message.charCodeAt(index); + if (code < 128) { + buffer82[i++] = code; + } else if (code < 2048) { + buffer82[i++] = 192 | code >> 6; + buffer82[i++] = 128 | code & 63; + } else if (code < 55296 || code >= 57344) { + buffer82[i++] = 224 | code >> 12; + buffer82[i++] = 128 | code >> 6 & 63; + buffer82[i++] = 128 | code & 63; + } else { + code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023); + buffer82[i++] = 240 | code >> 18; + buffer82[i++] = 128 | code >> 12 & 63; + buffer82[i++] = 128 | code >> 6 & 63; + buffer82[i++] = 128 | code & 63; + } + } + } else { + for (i = this.start; index < length && i < 64; ++index) { + code = message.charCodeAt(index); + if (code < 128) { + blocks2[i >> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 2048) { + blocks2[i >> 2] |= (192 | code >> 6) << SHIFT[i++ & 3]; + blocks2[i >> 2] |= (128 | code & 63) << SHIFT[i++ & 3]; + } else if (code < 55296 || code >= 57344) { + blocks2[i >> 2] |= (224 | code >> 12) << SHIFT[i++ & 3]; + blocks2[i >> 2] |= (128 | code >> 6 & 63) << SHIFT[i++ & 3]; + blocks2[i >> 2] |= (128 | code & 63) << SHIFT[i++ & 3]; + } else { + code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023); + blocks2[i >> 2] |= (240 | code >> 18) << SHIFT[i++ & 3]; + blocks2[i >> 2] |= (128 | code >> 12 & 63) << SHIFT[i++ & 3]; + blocks2[i >> 2] |= (128 | code >> 6 & 63) << SHIFT[i++ & 3]; + blocks2[i >> 2] |= (128 | code & 63) << SHIFT[i++ & 3]; + } + } + } + } + this.lastByteIndex = i; + this.bytes += i - this.start; + if (i >= 64) { + this.start = i - 64; + this.hash(); + this.hashed = true; + } else { + this.start = i; + } + } + return this; + }; + Md4.prototype.finalize = function() { + if (this.finalized) { + return; + } + this.finalized = true; + var blocks2 = this.blocks, i = this.lastByteIndex; + blocks2[i >> 2] |= EXTRA[i & 3]; + if (i >= 56) { + if (!this.hashed) { + this.hash(); + } + blocks2[0] = blocks2[16]; + blocks2[16] = blocks2[1] = blocks2[2] = blocks2[3] = blocks2[4] = blocks2[5] = blocks2[6] = blocks2[7] = blocks2[8] = blocks2[9] = blocks2[10] = blocks2[11] = blocks2[12] = blocks2[13] = blocks2[14] = blocks2[15] = 0; + } + blocks2[14] = this.bytes << 3; + this.hash(); + }; + Md4.prototype.hash = function() { + var a, b, c, d, ab, bc, cd, da, blocks2 = this.blocks; + if (this.first) { + a = blocks2[0] - 1; + a = a << 3 | a >>> 29; + d = (a & 4023233417 | ~a & 2562383102) + blocks2[1] + 271733878; + d = d << 7 | d >>> 25; + c = (d & a | ~d & 4023233417) + blocks2[2] - 1732584194; + c = c << 11 | c >>> 21; + b = (c & d | ~c & a) + blocks2[3] - 271733879; + b = b << 19 | b >>> 13; + } else { + a = this.h0; + b = this.h1; + c = this.h2; + d = this.h3; + a += (b & c | ~b & d) + blocks2[0]; + a = a << 3 | a >>> 29; + d += (a & b | ~a & c) + blocks2[1]; + d = d << 7 | d >>> 25; + c += (d & a | ~d & b) + blocks2[2]; + c = c << 11 | c >>> 21; + b += (c & d | ~c & a) + blocks2[3]; + b = b << 19 | b >>> 13; + } + a += (b & c | ~b & d) + blocks2[4]; + a = a << 3 | a >>> 29; + d += (a & b | ~a & c) + blocks2[5]; + d = d << 7 | d >>> 25; + c += (d & a | ~d & b) + blocks2[6]; + c = c << 11 | c >>> 21; + b += (c & d | ~c & a) + blocks2[7]; + b = b << 19 | b >>> 13; + a += (b & c | ~b & d) + blocks2[8]; + a = a << 3 | a >>> 29; + d += (a & b | ~a & c) + blocks2[9]; + d = d << 7 | d >>> 25; + c += (d & a | ~d & b) + blocks2[10]; + c = c << 11 | c >>> 21; + b += (c & d | ~c & a) + blocks2[11]; + b = b << 19 | b >>> 13; + a += (b & c | ~b & d) + blocks2[12]; + a = a << 3 | a >>> 29; + d += (a & b | ~a & c) + blocks2[13]; + d = d << 7 | d >>> 25; + c += (d & a | ~d & b) + blocks2[14]; + c = c << 11 | c >>> 21; + b += (c & d | ~c & a) + blocks2[15]; + b = b << 19 | b >>> 13; + bc = b & c; + a += (bc | b & d | c & d) + blocks2[0] + 1518500249; + a = a << 3 | a >>> 29; + ab = a & b; + d += (ab | a & c | bc) + blocks2[4] + 1518500249; + d = d << 5 | d >>> 27; + da = d & a; + c += (da | d & b | ab) + blocks2[8] + 1518500249; + c = c << 9 | c >>> 23; + cd = c & d; + b += (cd | c & a | da) + blocks2[12] + 1518500249; + b = b << 13 | b >>> 19; + bc = b & c; + a += (bc | b & d | cd) + blocks2[1] + 1518500249; + a = a << 3 | a >>> 29; + ab = a & b; + d += (ab | a & c | bc) + blocks2[5] + 1518500249; + d = d << 5 | d >>> 27; + da = d & a; + c += (da | d & b | ab) + blocks2[9] + 1518500249; + c = c << 9 | c >>> 23; + cd = c & d; + b += (cd | c & a | da) + blocks2[13] + 1518500249; + b = b << 13 | b >>> 19; + bc = b & c; + a += (bc | b & d | cd) + blocks2[2] + 1518500249; + a = a << 3 | a >>> 29; + ab = a & b; + d += (ab | a & c | bc) + blocks2[6] + 1518500249; + d = d << 5 | d >>> 27; + da = d & a; + c += (da | d & b | ab) + blocks2[10] + 1518500249; + c = c << 9 | c >>> 23; + cd = c & d; + b += (cd | c & a | da) + blocks2[14] + 1518500249; + b = b << 13 | b >>> 19; + bc = b & c; + a += (bc | b & d | cd) + blocks2[3] + 1518500249; + a = a << 3 | a >>> 29; + ab = a & b; + d += (ab | a & c | bc) + blocks2[7] + 1518500249; + d = d << 5 | d >>> 27; + da = d & a; + c += (da | d & b | ab) + blocks2[11] + 1518500249; + c = c << 9 | c >>> 23; + b += (c & d | c & a | da) + blocks2[15] + 1518500249; + b = b << 13 | b >>> 19; + bc = b ^ c; + a += (bc ^ d) + blocks2[0] + 1859775393; + a = a << 3 | a >>> 29; + d += (bc ^ a) + blocks2[8] + 1859775393; + d = d << 9 | d >>> 23; + da = d ^ a; + c += (da ^ b) + blocks2[4] + 1859775393; + c = c << 11 | c >>> 21; + b += (da ^ c) + blocks2[12] + 1859775393; + b = b << 15 | b >>> 17; + bc = b ^ c; + a += (bc ^ d) + blocks2[2] + 1859775393; + a = a << 3 | a >>> 29; + d += (bc ^ a) + blocks2[10] + 1859775393; + d = d << 9 | d >>> 23; + da = d ^ a; + c += (da ^ b) + blocks2[6] + 1859775393; + c = c << 11 | c >>> 21; + b += (da ^ c) + blocks2[14] + 1859775393; + b = b << 15 | b >>> 17; + bc = b ^ c; + a += (bc ^ d) + blocks2[1] + 1859775393; + a = a << 3 | a >>> 29; + d += (bc ^ a) + blocks2[9] + 1859775393; + d = d << 9 | d >>> 23; + da = d ^ a; + c += (da ^ b) + blocks2[5] + 1859775393; + c = c << 11 | c >>> 21; + b += (da ^ c) + blocks2[13] + 1859775393; + b = b << 15 | b >>> 17; + bc = b ^ c; + a += (bc ^ d) + blocks2[3] + 1859775393; + a = a << 3 | a >>> 29; + d += (bc ^ a) + blocks2[11] + 1859775393; + d = d << 9 | d >>> 23; + da = d ^ a; + c += (da ^ b) + blocks2[7] + 1859775393; + c = c << 11 | c >>> 21; + b += (da ^ c) + blocks2[15] + 1859775393; + b = b << 15 | b >>> 17; + if (this.first) { + this.h0 = a + 1732584193 << 0; + this.h1 = b - 271733879 << 0; + this.h2 = c - 1732584194 << 0; + this.h3 = d + 271733878 << 0; + this.first = false; + } else { + this.h0 = this.h0 + a << 0; + this.h1 = this.h1 + b << 0; + this.h2 = this.h2 + c << 0; + this.h3 = this.h3 + d << 0; + } + }; + Md4.prototype.hex = function() { + this.finalize(); + var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3; + return HEX_CHARS[h0 >> 4 & 15] + HEX_CHARS[h0 & 15] + HEX_CHARS[h0 >> 12 & 15] + HEX_CHARS[h0 >> 8 & 15] + HEX_CHARS[h0 >> 20 & 15] + HEX_CHARS[h0 >> 16 & 15] + HEX_CHARS[h0 >> 28 & 15] + HEX_CHARS[h0 >> 24 & 15] + HEX_CHARS[h1 >> 4 & 15] + HEX_CHARS[h1 & 15] + HEX_CHARS[h1 >> 12 & 15] + HEX_CHARS[h1 >> 8 & 15] + HEX_CHARS[h1 >> 20 & 15] + HEX_CHARS[h1 >> 16 & 15] + HEX_CHARS[h1 >> 28 & 15] + HEX_CHARS[h1 >> 24 & 15] + HEX_CHARS[h2 >> 4 & 15] + HEX_CHARS[h2 & 15] + HEX_CHARS[h2 >> 12 & 15] + HEX_CHARS[h2 >> 8 & 15] + HEX_CHARS[h2 >> 20 & 15] + HEX_CHARS[h2 >> 16 & 15] + HEX_CHARS[h2 >> 28 & 15] + HEX_CHARS[h2 >> 24 & 15] + HEX_CHARS[h3 >> 4 & 15] + HEX_CHARS[h3 & 15] + HEX_CHARS[h3 >> 12 & 15] + HEX_CHARS[h3 >> 8 & 15] + HEX_CHARS[h3 >> 20 & 15] + HEX_CHARS[h3 >> 16 & 15] + HEX_CHARS[h3 >> 28 & 15] + HEX_CHARS[h3 >> 24 & 15]; + }; + Md4.prototype.toString = Md4.prototype.hex; + Md4.prototype.digest = function() { + this.finalize(); + var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3; + return [ + h0 & 255, + h0 >> 8 & 255, + h0 >> 16 & 255, + h0 >> 24 & 255, + h1 & 255, + h1 >> 8 & 255, + h1 >> 16 & 255, + h1 >> 24 & 255, + h2 & 255, + h2 >> 8 & 255, + h2 >> 16 & 255, + h2 >> 24 & 255, + h3 & 255, + h3 >> 8 & 255, + h3 >> 16 & 255, + h3 >> 24 & 255 + ]; + }; + Md4.prototype.array = Md4.prototype.digest; + Md4.prototype.arrayBuffer = function() { + this.finalize(); + var buffer2 = new ArrayBuffer(16); + var blocks2 = new Uint32Array(buffer2); + blocks2[0] = this.h0; + blocks2[1] = this.h1; + blocks2[2] = this.h2; + blocks2[3] = this.h3; + return buffer2; + }; + Md4.prototype.buffer = Md4.prototype.arrayBuffer; + var exports3 = createMethod(); + if (COMMON_JS) { + module2.exports = exports3; + } else { + root2.md4 = exports3; + if (AMD) { + define(function() { + return exports3; + }); + } + } + })(); + } +}); + +// ../node_modules/des.js/lib/des/utils.js +var require_utils3 = __commonJS({ + "../node_modules/des.js/lib/des/utils.js"(exports2) { + "use strict"; + exports2.readUInt32BE = function readUInt32BE(bytes, off) { + var res = bytes[0 + off] << 24 | bytes[1 + off] << 16 | bytes[2 + off] << 8 | bytes[3 + off]; + return res >>> 0; + }; + exports2.writeUInt32BE = function writeUInt32BE(bytes, value, off) { + bytes[0 + off] = value >>> 24; + bytes[1 + off] = value >>> 16 & 255; + bytes[2 + off] = value >>> 8 & 255; + bytes[3 + off] = value & 255; + }; + exports2.ip = function ip(inL, inR, out, off) { + var outL = 0; + var outR = 0; + for (var i = 6; i >= 0; i -= 2) { + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= inR >>> j + i & 1; + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= inL >>> j + i & 1; + } + } + for (var i = 6; i >= 0; i -= 2) { + for (var j = 1; j <= 25; j += 8) { + outR <<= 1; + outR |= inR >>> j + i & 1; + } + for (var j = 1; j <= 25; j += 8) { + outR <<= 1; + outR |= inL >>> j + i & 1; + } + } + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; + }; + exports2.rip = function rip(inL, inR, out, off) { + var outL = 0; + var outR = 0; + for (var i = 0; i < 4; i++) { + for (var j = 24; j >= 0; j -= 8) { + outL <<= 1; + outL |= inR >>> j + i & 1; + outL <<= 1; + outL |= inL >>> j + i & 1; + } + } + for (var i = 4; i < 8; i++) { + for (var j = 24; j >= 0; j -= 8) { + outR <<= 1; + outR |= inR >>> j + i & 1; + outR <<= 1; + outR |= inL >>> j + i & 1; + } + } + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; + }; + exports2.pc1 = function pc1(inL, inR, out, off) { + var outL = 0; + var outR = 0; + for (var i = 7; i >= 5; i--) { + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= inR >> j + i & 1; + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= inL >> j + i & 1; + } + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= inR >> j + i & 1; + } + for (var i = 1; i <= 3; i++) { + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= inR >> j + i & 1; + } + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= inL >> j + i & 1; + } + } + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= inL >> j + i & 1; + } + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; + }; + exports2.r28shl = function r28shl(num, shift) { + return num << shift & 268435455 | num >>> 28 - shift; + }; + var pc2table = [ + // inL => outL + 14, + 11, + 17, + 4, + 27, + 23, + 25, + 0, + 13, + 22, + 7, + 18, + 5, + 9, + 16, + 24, + 2, + 20, + 12, + 21, + 1, + 8, + 15, + 26, + // inR => outR + 15, + 4, + 25, + 19, + 9, + 1, + 26, + 16, + 5, + 11, + 23, + 8, + 12, + 7, + 17, + 0, + 22, + 3, + 10, + 14, + 6, + 20, + 27, + 24 + ]; + exports2.pc2 = function pc2(inL, inR, out, off) { + var outL = 0; + var outR = 0; + var len = pc2table.length >>> 1; + for (var i = 0; i < len; i++) { + outL <<= 1; + outL |= inL >>> pc2table[i] & 1; + } + for (var i = len; i < pc2table.length; i++) { + outR <<= 1; + outR |= inR >>> pc2table[i] & 1; + } + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; + }; + exports2.expand = function expand(r, out, off) { + var outL = 0; + var outR = 0; + outL = (r & 1) << 5 | r >>> 27; + for (var i = 23; i >= 15; i -= 4) { + outL <<= 6; + outL |= r >>> i & 63; + } + for (var i = 11; i >= 3; i -= 4) { + outR |= r >>> i & 63; + outR <<= 6; + } + outR |= (r & 31) << 1 | r >>> 31; + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; + }; + var sTable = [ + 14, + 0, + 4, + 15, + 13, + 7, + 1, + 4, + 2, + 14, + 15, + 2, + 11, + 13, + 8, + 1, + 3, + 10, + 10, + 6, + 6, + 12, + 12, + 11, + 5, + 9, + 9, + 5, + 0, + 3, + 7, + 8, + 4, + 15, + 1, + 12, + 14, + 8, + 8, + 2, + 13, + 4, + 6, + 9, + 2, + 1, + 11, + 7, + 15, + 5, + 12, + 11, + 9, + 3, + 7, + 14, + 3, + 10, + 10, + 0, + 5, + 6, + 0, + 13, + 15, + 3, + 1, + 13, + 8, + 4, + 14, + 7, + 6, + 15, + 11, + 2, + 3, + 8, + 4, + 14, + 9, + 12, + 7, + 0, + 2, + 1, + 13, + 10, + 12, + 6, + 0, + 9, + 5, + 11, + 10, + 5, + 0, + 13, + 14, + 8, + 7, + 10, + 11, + 1, + 10, + 3, + 4, + 15, + 13, + 4, + 1, + 2, + 5, + 11, + 8, + 6, + 12, + 7, + 6, + 12, + 9, + 0, + 3, + 5, + 2, + 14, + 15, + 9, + 10, + 13, + 0, + 7, + 9, + 0, + 14, + 9, + 6, + 3, + 3, + 4, + 15, + 6, + 5, + 10, + 1, + 2, + 13, + 8, + 12, + 5, + 7, + 14, + 11, + 12, + 4, + 11, + 2, + 15, + 8, + 1, + 13, + 1, + 6, + 10, + 4, + 13, + 9, + 0, + 8, + 6, + 15, + 9, + 3, + 8, + 0, + 7, + 11, + 4, + 1, + 15, + 2, + 14, + 12, + 3, + 5, + 11, + 10, + 5, + 14, + 2, + 7, + 12, + 7, + 13, + 13, + 8, + 14, + 11, + 3, + 5, + 0, + 6, + 6, + 15, + 9, + 0, + 10, + 3, + 1, + 4, + 2, + 7, + 8, + 2, + 5, + 12, + 11, + 1, + 12, + 10, + 4, + 14, + 15, + 9, + 10, + 3, + 6, + 15, + 9, + 0, + 0, + 6, + 12, + 10, + 11, + 1, + 7, + 13, + 13, + 8, + 15, + 9, + 1, + 4, + 3, + 5, + 14, + 11, + 5, + 12, + 2, + 7, + 8, + 2, + 4, + 14, + 2, + 14, + 12, + 11, + 4, + 2, + 1, + 12, + 7, + 4, + 10, + 7, + 11, + 13, + 6, + 1, + 8, + 5, + 5, + 0, + 3, + 15, + 15, + 10, + 13, + 3, + 0, + 9, + 14, + 8, + 9, + 6, + 4, + 11, + 2, + 8, + 1, + 12, + 11, + 7, + 10, + 1, + 13, + 14, + 7, + 2, + 8, + 13, + 15, + 6, + 9, + 15, + 12, + 0, + 5, + 9, + 6, + 10, + 3, + 4, + 0, + 5, + 14, + 3, + 12, + 10, + 1, + 15, + 10, + 4, + 15, + 2, + 9, + 7, + 2, + 12, + 6, + 9, + 8, + 5, + 0, + 6, + 13, + 1, + 3, + 13, + 4, + 14, + 14, + 0, + 7, + 11, + 5, + 3, + 11, + 8, + 9, + 4, + 14, + 3, + 15, + 2, + 5, + 12, + 2, + 9, + 8, + 5, + 12, + 15, + 3, + 10, + 7, + 11, + 0, + 14, + 4, + 1, + 10, + 7, + 1, + 6, + 13, + 0, + 11, + 8, + 6, + 13, + 4, + 13, + 11, + 0, + 2, + 11, + 14, + 7, + 15, + 4, + 0, + 9, + 8, + 1, + 13, + 10, + 3, + 14, + 12, + 3, + 9, + 5, + 7, + 12, + 5, + 2, + 10, + 15, + 6, + 8, + 1, + 6, + 1, + 6, + 4, + 11, + 11, + 13, + 13, + 8, + 12, + 1, + 3, + 4, + 7, + 10, + 14, + 7, + 10, + 9, + 15, + 5, + 6, + 0, + 8, + 15, + 0, + 14, + 5, + 2, + 9, + 3, + 2, + 12, + 13, + 1, + 2, + 15, + 8, + 13, + 4, + 8, + 6, + 10, + 15, + 3, + 11, + 7, + 1, + 4, + 10, + 12, + 9, + 5, + 3, + 6, + 14, + 11, + 5, + 0, + 0, + 14, + 12, + 9, + 7, + 2, + 7, + 2, + 11, + 1, + 4, + 14, + 1, + 7, + 9, + 4, + 12, + 10, + 14, + 8, + 2, + 13, + 0, + 15, + 6, + 12, + 10, + 9, + 13, + 0, + 15, + 3, + 3, + 5, + 5, + 6, + 8, + 11 + ]; + exports2.substitute = function substitute(inL, inR) { + var out = 0; + for (var i = 0; i < 4; i++) { + var b = inL >>> 18 - i * 6 & 63; + var sb = sTable[i * 64 + b]; + out <<= 4; + out |= sb; + } + for (var i = 0; i < 4; i++) { + var b = inR >>> 18 - i * 6 & 63; + var sb = sTable[4 * 64 + i * 64 + b]; + out <<= 4; + out |= sb; + } + return out >>> 0; + }; + var permuteTable = [ + 16, + 25, + 12, + 11, + 3, + 20, + 4, + 15, + 31, + 17, + 9, + 6, + 27, + 14, + 1, + 22, + 30, + 24, + 8, + 18, + 0, + 5, + 29, + 23, + 13, + 19, + 2, + 26, + 10, + 21, + 28, + 7 + ]; + exports2.permute = function permute(num) { + var out = 0; + for (var i = 0; i < permuteTable.length; i++) { + out <<= 1; + out |= num >>> permuteTable[i] & 1; + } + return out >>> 0; + }; + exports2.padSplit = function padSplit(num, size2, group2) { + var str = num.toString(2); + while (str.length < size2) + str = "0" + str; + var out = []; + for (var i = 0; i < size2; i += group2) + out.push(str.slice(i, i + group2)); + return out.join(" "); + }; + } +}); + +// ../node_modules/minimalistic-assert/index.js +var require_minimalistic_assert = __commonJS({ + "../node_modules/minimalistic-assert/index.js"(exports2, module2) { + module2.exports = assert; + function assert(val, msg) { + if (!val) + throw new Error(msg || "Assertion failed"); + } + assert.equal = function assertEqual(l, r, msg) { + if (l != r) + throw new Error(msg || "Assertion failed: " + l + " != " + r); + }; + } +}); + +// ../node_modules/des.js/lib/des/cipher.js +var require_cipher = __commonJS({ + "../node_modules/des.js/lib/des/cipher.js"(exports2, module2) { + "use strict"; + var assert = require_minimalistic_assert(); + function Cipher(options) { + this.options = options; + this.type = this.options.type; + this.blockSize = 8; + this._init(); + this.buffer = new Array(this.blockSize); + this.bufferOff = 0; + this.padding = options.padding !== false; + } + module2.exports = Cipher; + Cipher.prototype._init = function _init() { + }; + Cipher.prototype.update = function update(data) { + if (data.length === 0) + return []; + if (this.type === "decrypt") + return this._updateDecrypt(data); + else + return this._updateEncrypt(data); + }; + Cipher.prototype._buffer = function _buffer(data, off) { + var min2 = Math.min(this.buffer.length - this.bufferOff, data.length - off); + for (var i = 0; i < min2; i++) + this.buffer[this.bufferOff + i] = data[off + i]; + this.bufferOff += min2; + return min2; + }; + Cipher.prototype._flushBuffer = function _flushBuffer(out, off) { + this._update(this.buffer, 0, out, off); + this.bufferOff = 0; + return this.blockSize; + }; + Cipher.prototype._updateEncrypt = function _updateEncrypt(data) { + var inputOff = 0; + var outputOff = 0; + var count = (this.bufferOff + data.length) / this.blockSize | 0; + var out = new Array(count * this.blockSize); + if (this.bufferOff !== 0) { + inputOff += this._buffer(data, inputOff); + if (this.bufferOff === this.buffer.length) + outputOff += this._flushBuffer(out, outputOff); + } + var max2 = data.length - (data.length - inputOff) % this.blockSize; + for (; inputOff < max2; inputOff += this.blockSize) { + this._update(data, inputOff, out, outputOff); + outputOff += this.blockSize; + } + for (; inputOff < data.length; inputOff++, this.bufferOff++) + this.buffer[this.bufferOff] = data[inputOff]; + return out; + }; + Cipher.prototype._updateDecrypt = function _updateDecrypt(data) { + var inputOff = 0; + var outputOff = 0; + var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1; + var out = new Array(count * this.blockSize); + for (; count > 0; count--) { + inputOff += this._buffer(data, inputOff); + outputOff += this._flushBuffer(out, outputOff); + } + inputOff += this._buffer(data, inputOff); + return out; + }; + Cipher.prototype.final = function final(buffer) { + var first2; + if (buffer) + first2 = this.update(buffer); + var last2; + if (this.type === "encrypt") + last2 = this._finalEncrypt(); + else + last2 = this._finalDecrypt(); + if (first2) + return first2.concat(last2); + else + return last2; + }; + Cipher.prototype._pad = function _pad(buffer, off) { + if (off === 0) + return false; + while (off < buffer.length) + buffer[off++] = 0; + return true; + }; + Cipher.prototype._finalEncrypt = function _finalEncrypt() { + if (!this._pad(this.buffer, this.bufferOff)) + return []; + var out = new Array(this.blockSize); + this._update(this.buffer, 0, out, 0); + return out; + }; + Cipher.prototype._unpad = function _unpad(buffer) { + return buffer; + }; + Cipher.prototype._finalDecrypt = function _finalDecrypt() { + assert.equal(this.bufferOff, this.blockSize, "Not enough data to decrypt"); + var out = new Array(this.blockSize); + this._flushBuffer(out, 0); + return this._unpad(out); + }; + } +}); + +// ../node_modules/des.js/lib/des/des.js +var require_des = __commonJS({ + "../node_modules/des.js/lib/des/des.js"(exports2, module2) { + "use strict"; + var assert = require_minimalistic_assert(); + var inherits = require_inherits(); + var utils = require_utils3(); + var Cipher = require_cipher(); + function DESState() { + this.tmp = new Array(2); + this.keys = null; + } + function DES(options) { + Cipher.call(this, options); + var state = new DESState(); + this._desState = state; + this.deriveKeys(state, options.key); + } + inherits(DES, Cipher); + module2.exports = DES; + DES.create = function create2(options) { + return new DES(options); + }; + var shiftTable = [ + 1, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 1, + 2, + 2, + 2, + 2, + 2, + 2, + 1 + ]; + DES.prototype.deriveKeys = function deriveKeys(state, key) { + state.keys = new Array(16 * 2); + assert.equal(key.length, this.blockSize, "Invalid key length"); + var kL = utils.readUInt32BE(key, 0); + var kR = utils.readUInt32BE(key, 4); + utils.pc1(kL, kR, state.tmp, 0); + kL = state.tmp[0]; + kR = state.tmp[1]; + for (var i = 0; i < state.keys.length; i += 2) { + var shift = shiftTable[i >>> 1]; + kL = utils.r28shl(kL, shift); + kR = utils.r28shl(kR, shift); + utils.pc2(kL, kR, state.keys, i); + } + }; + DES.prototype._update = function _update(inp, inOff, out, outOff) { + var state = this._desState; + var l = utils.readUInt32BE(inp, inOff); + var r = utils.readUInt32BE(inp, inOff + 4); + utils.ip(l, r, state.tmp, 0); + l = state.tmp[0]; + r = state.tmp[1]; + if (this.type === "encrypt") + this._encrypt(state, l, r, state.tmp, 0); + else + this._decrypt(state, l, r, state.tmp, 0); + l = state.tmp[0]; + r = state.tmp[1]; + utils.writeUInt32BE(out, l, outOff); + utils.writeUInt32BE(out, r, outOff + 4); + }; + DES.prototype._pad = function _pad(buffer, off) { + if (this.padding === false) { + return false; + } + var value = buffer.length - off; + for (var i = off; i < buffer.length; i++) + buffer[i] = value; + return true; + }; + DES.prototype._unpad = function _unpad(buffer) { + if (this.padding === false) { + return buffer; + } + var pad = buffer[buffer.length - 1]; + for (var i = buffer.length - pad; i < buffer.length; i++) + assert.equal(buffer[i], pad); + return buffer.slice(0, buffer.length - pad); + }; + DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) { + var l = lStart; + var r = rStart; + for (var i = 0; i < state.keys.length; i += 2) { + var keyL = state.keys[i]; + var keyR = state.keys[i + 1]; + utils.expand(r, state.tmp, 0); + keyL ^= state.tmp[0]; + keyR ^= state.tmp[1]; + var s = utils.substitute(keyL, keyR); + var f = utils.permute(s); + var t = r; + r = (l ^ f) >>> 0; + l = t; + } + utils.rip(r, l, out, off); + }; + DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) { + var l = rStart; + var r = lStart; + for (var i = state.keys.length - 2; i >= 0; i -= 2) { + var keyL = state.keys[i]; + var keyR = state.keys[i + 1]; + utils.expand(l, state.tmp, 0); + keyL ^= state.tmp[0]; + keyR ^= state.tmp[1]; + var s = utils.substitute(keyL, keyR); + var f = utils.permute(s); + var t = l; + l = (r ^ f) >>> 0; + r = t; + } + utils.rip(l, r, out, off); + }; + } +}); + +// ../node_modules/des.js/lib/des/cbc.js +var require_cbc = __commonJS({ + "../node_modules/des.js/lib/des/cbc.js"(exports2) { + "use strict"; + var assert = require_minimalistic_assert(); + var inherits = require_inherits(); + var proto = {}; + function CBCState(iv) { + assert.equal(iv.length, 8, "Invalid IV length"); + this.iv = new Array(8); + for (var i = 0; i < this.iv.length; i++) + this.iv[i] = iv[i]; + } + function instantiate(Base) { + function CBC(options) { + Base.call(this, options); + this._cbcInit(); + } + inherits(CBC, Base); + var keys2 = Object.keys(proto); + for (var i = 0; i < keys2.length; i++) { + var key = keys2[i]; + CBC.prototype[key] = proto[key]; + } + CBC.create = function create2(options) { + return new CBC(options); + }; + return CBC; + } + exports2.instantiate = instantiate; + proto._cbcInit = function _cbcInit() { + var state = new CBCState(this.options.iv); + this._cbcState = state; + }; + proto._update = function _update(inp, inOff, out, outOff) { + var state = this._cbcState; + var superProto = this.constructor.super_.prototype; + var iv = state.iv; + if (this.type === "encrypt") { + for (var i = 0; i < this.blockSize; i++) + iv[i] ^= inp[inOff + i]; + superProto._update.call(this, iv, 0, out, outOff); + for (var i = 0; i < this.blockSize; i++) + iv[i] = out[outOff + i]; + } else { + superProto._update.call(this, inp, inOff, out, outOff); + for (var i = 0; i < this.blockSize; i++) + out[outOff + i] ^= iv[i]; + for (var i = 0; i < this.blockSize; i++) + iv[i] = inp[inOff + i]; + } + }; + } +}); + +// ../node_modules/des.js/lib/des/ede.js +var require_ede = __commonJS({ + "../node_modules/des.js/lib/des/ede.js"(exports2, module2) { + "use strict"; + var assert = require_minimalistic_assert(); + var inherits = require_inherits(); + var Cipher = require_cipher(); + var DES = require_des(); + function EDEState(type, key) { + assert.equal(key.length, 24, "Invalid key length"); + var k1 = key.slice(0, 8); + var k2 = key.slice(8, 16); + var k3 = key.slice(16, 24); + if (type === "encrypt") { + this.ciphers = [ + DES.create({ type: "encrypt", key: k1 }), + DES.create({ type: "decrypt", key: k2 }), + DES.create({ type: "encrypt", key: k3 }) + ]; + } else { + this.ciphers = [ + DES.create({ type: "decrypt", key: k3 }), + DES.create({ type: "encrypt", key: k2 }), + DES.create({ type: "decrypt", key: k1 }) + ]; + } + } + function EDE(options) { + Cipher.call(this, options); + var state = new EDEState(this.type, this.options.key); + this._edeState = state; + } + inherits(EDE, Cipher); + module2.exports = EDE; + EDE.create = function create2(options) { + return new EDE(options); + }; + EDE.prototype._update = function _update(inp, inOff, out, outOff) { + var state = this._edeState; + state.ciphers[0]._update(inp, inOff, out, outOff); + state.ciphers[1]._update(out, outOff, out, outOff); + state.ciphers[2]._update(out, outOff, out, outOff); + }; + EDE.prototype._pad = DES.prototype._pad; + EDE.prototype._unpad = DES.prototype._unpad; + } +}); + +// ../node_modules/des.js/lib/des.js +var require_des2 = __commonJS({ + "../node_modules/des.js/lib/des.js"(exports2) { + "use strict"; + exports2.utils = require_utils3(); + exports2.Cipher = require_cipher(); + exports2.DES = require_des(); + exports2.CBC = require_cbc(); + exports2.EDE = require_ede(); + } +}); + +// ../node_modules/azure-devops-node-api/node_modules/typed-rest-client/opensource/Node-SMB/lib/smbhash.js +var require_smbhash = __commonJS({ + "../node_modules/azure-devops-node-api/node_modules/typed-rest-client/opensource/Node-SMB/lib/smbhash.js"(exports2, module2) { + var $ = require_common2(); + var jsmd4 = require_md4(); + var desjs = require_des2(); + function lmhashbuf(inputstr) { + var x = inputstr.substring(0, 14).toUpperCase(); + var xl = Buffer.byteLength(x, "ascii"); + var y = Buffer.alloc(14); + y.write(x, 0, xl, "ascii"); + y.fill(0, xl); + var halves = [ + $.oddpar($.expandkey(y.slice(0, 7))), + $.oddpar($.expandkey(y.slice(7, 14))) + ]; + var buf = Buffer.alloc(16); + var pos = 0; + var cts = halves.forEach(function(z) { + var des = desjs.DES.create({ type: "encrypt", key: z }); + var magicKey = Buffer.from("KGS!@#$%", "ascii"); + var insertBuff = Buffer.from(des.update(magicKey)); + buf.fill(insertBuff, pos, pos + 8, "binary"); + pos += 8; + }); + return buf; + } + function nthashbuf(str) { + var ucs2 = Buffer.from(str, "ucs2"); + var md4 = jsmd4.create(); + md4.update(ucs2); + return Buffer.from(md4.digest("binary"), "binary"); + } + function lmhash(is) { + return $.bintohex(lmhashbuf(is)); + } + function nthash(is) { + return $.bintohex(nthashbuf(is)); + } + module2.exports.nthashbuf = nthashbuf; + module2.exports.lmhashbuf = lmhashbuf; + module2.exports.nthash = nthash; + module2.exports.lmhash = lmhash; + } +}); + +// ../node_modules/azure-devops-node-api/node_modules/typed-rest-client/opensource/Node-SMB/lib/ntlm.js +var require_ntlm = __commonJS({ + "../node_modules/azure-devops-node-api/node_modules/typed-rest-client/opensource/Node-SMB/lib/ntlm.js"(exports2) { + var crypto = require("crypto"); + var $ = require_common2(); + var lmhashbuf = require_smbhash().lmhashbuf; + var nthashbuf = require_smbhash().nthashbuf; + var desjs = require_des2(); + function encodeType1(hostname, ntdomain) { + hostname = hostname.toUpperCase(); + ntdomain = ntdomain.toUpperCase(); + var hostnamelen = Buffer.byteLength(hostname, "ascii"); + var ntdomainlen = Buffer.byteLength(ntdomain, "ascii"); + var pos = 0; + var buf = Buffer.alloc(32 + hostnamelen + ntdomainlen); + buf.write("NTLMSSP", pos, 7, "ascii"); + pos += 7; + buf.writeUInt8(0, pos); + pos++; + buf.writeUInt8(1, pos); + pos++; + buf.fill(0, pos, pos + 3); + pos += 3; + buf.writeUInt16LE(45571, pos); + pos += 2; + buf.fill(0, pos, pos + 2); + pos += 2; + buf.writeUInt16LE(ntdomainlen, pos); + pos += 2; + buf.writeUInt16LE(ntdomainlen, pos); + pos += 2; + var ntdomainoff = 32 + hostnamelen; + buf.writeUInt16LE(ntdomainoff, pos); + pos += 2; + buf.fill(0, pos, pos + 2); + pos += 2; + buf.writeUInt16LE(hostnamelen, pos); + pos += 2; + buf.writeUInt16LE(hostnamelen, pos); + pos += 2; + buf.writeUInt16LE(32, pos); + pos += 2; + buf.fill(0, pos, pos + 2); + pos += 2; + buf.write(hostname, 32, hostnamelen, "ascii"); + buf.write(ntdomain, ntdomainoff, ntdomainlen, "ascii"); + return buf; + } + function decodeType2(buf) { + var proto = buf.toString("ascii", 0, 7); + if (buf[7] !== 0 || proto !== "NTLMSSP") + throw new Error("magic was not NTLMSSP"); + var type = buf.readUInt8(8); + if (type !== 2) + throw new Error("message was not NTLMSSP type 0x02"); + var nonce = buf.slice(24, 32); + return nonce; + } + function encodeType3(username, hostname, ntdomain, nonce, password) { + hostname = hostname.toUpperCase(); + ntdomain = ntdomain.toUpperCase(); + var lmh = Buffer.alloc(21); + lmhashbuf(password).copy(lmh); + lmh.fill(0, 16); + var nth = Buffer.alloc(21); + nthashbuf(password).copy(nth); + nth.fill(0, 16); + var lmr = makeResponse(lmh, nonce); + var ntr = makeResponse(nth, nonce); + var usernamelen = Buffer.byteLength(username, "ucs2"); + var hostnamelen = Buffer.byteLength(hostname, "ucs2"); + var ntdomainlen = Buffer.byteLength(ntdomain, "ucs2"); + var lmrlen = 24; + var ntrlen = 24; + var ntdomainoff = 64; + var usernameoff = ntdomainoff + ntdomainlen; + var hostnameoff = usernameoff + usernamelen; + var lmroff = hostnameoff + hostnamelen; + var ntroff = lmroff + lmrlen; + var pos = 0; + var msg_len = 64 + ntdomainlen + usernamelen + hostnamelen + lmrlen + ntrlen; + var buf = Buffer.alloc(msg_len); + buf.write("NTLMSSP", pos, 7, "ascii"); + pos += 7; + buf.writeUInt8(0, pos); + pos++; + buf.writeUInt8(3, pos); + pos++; + buf.fill(0, pos, pos + 3); + pos += 3; + buf.writeUInt16LE(lmrlen, pos); + pos += 2; + buf.writeUInt16LE(lmrlen, pos); + pos += 2; + buf.writeUInt16LE(lmroff, pos); + pos += 2; + buf.fill(0, pos, pos + 2); + pos += 2; + buf.writeUInt16LE(ntrlen, pos); + pos += 2; + buf.writeUInt16LE(ntrlen, pos); + pos += 2; + buf.writeUInt16LE(ntroff, pos); + pos += 2; + buf.fill(0, pos, pos + 2); + pos += 2; + buf.writeUInt16LE(ntdomainlen, pos); + pos += 2; + buf.writeUInt16LE(ntdomainlen, pos); + pos += 2; + buf.writeUInt16LE(ntdomainoff, pos); + pos += 2; + buf.fill(0, pos, pos + 2); + pos += 2; + buf.writeUInt16LE(usernamelen, pos); + pos += 2; + buf.writeUInt16LE(usernamelen, pos); + pos += 2; + buf.writeUInt16LE(usernameoff, pos); + pos += 2; + buf.fill(0, pos, pos + 2); + pos += 2; + buf.writeUInt16LE(hostnamelen, pos); + pos += 2; + buf.writeUInt16LE(hostnamelen, pos); + pos += 2; + buf.writeUInt16LE(hostnameoff, pos); + pos += 2; + buf.fill(0, pos, pos + 6); + pos += 6; + buf.writeUInt16LE(msg_len, pos); + pos += 2; + buf.fill(0, pos, pos + 2); + pos += 2; + buf.writeUInt16LE(33281, pos); + pos += 2; + buf.fill(0, pos, pos + 2); + pos += 2; + buf.write(ntdomain, ntdomainoff, ntdomainlen, "ucs2"); + buf.write(username, usernameoff, usernamelen, "ucs2"); + buf.write(hostname, hostnameoff, hostnamelen, "ucs2"); + lmr.copy(buf, lmroff, 0, lmrlen); + ntr.copy(buf, ntroff, 0, ntrlen); + return buf; + } + function makeResponse(hash, nonce) { + var out = Buffer.alloc(24); + for (var i = 0; i < 3; i++) { + var keybuf = $.oddpar($.expandkey(hash.slice(i * 7, i * 7 + 7))); + var des = desjs.DES.create({ type: "encrypt", key: keybuf }); + var magicKey = Buffer.from(nonce.toString("binary")); + var insertBuff = Buffer.from(des.update(magicKey)); + out.fill(insertBuff, i * 8, i * 8 + 8, "binary"); + } + return out; + } + exports2.encodeType1 = encodeType1; + exports2.decodeType2 = decodeType2; + exports2.encodeType3 = encodeType3; + exports2.challengeHeader = function(hostname, domain) { + return "NTLM " + exports2.encodeType1(hostname, domain).toString("base64"); + }; + exports2.responseHeader = function(res, url, domain, username, password) { + var serverNonce = Buffer.from((res.headers["www-authenticate"].match(/^NTLM\s+(.+?)(,|\s+|$)/) || [])[1], "base64"); + var hostname = require("url").parse(url).hostname; + return "NTLM " + exports2.encodeType3(username, hostname, domain, exports2.decodeType2(serverNonce), password).toString("base64"); + }; + exports2.smbhash = require_smbhash(); + } +}); + +// ../node_modules/azure-devops-node-api/node_modules/typed-rest-client/handlers/ntlm.js +var require_ntlm2 = __commonJS({ + "../node_modules/azure-devops-node-api/node_modules/typed-rest-client/handlers/ntlm.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NtlmCredentialHandler = void 0; + var http = require("http"); + var https = require("https"); + var _3 = (init_index_all(), __toCommonJS(index_all_exports)); + var ntlm = require_ntlm(); + var NtlmCredentialHandler = class { + constructor(username, password, workstation, domain) { + this._ntlmOptions = {}; + this._ntlmOptions.username = username; + this._ntlmOptions.password = password; + this._ntlmOptions.domain = domain || ""; + this._ntlmOptions.workstation = workstation || ""; + } + prepareRequest(options) { + if (options.agent) { + delete options.agent; + } + } + canHandleAuthentication(response) { + if (response && response.message && response.message.statusCode === 401) { + const wwwAuthenticate = response.message.headers["www-authenticate"]; + return wwwAuthenticate && wwwAuthenticate.split(", ").indexOf("NTLM") >= 0; + } + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return new Promise((resolve, reject2) => { + const callbackForResult = function(err, res) { + if (err) { + reject2(err); + return; + } + res.readBody().then(() => { + resolve(res); + }); + }; + this.handleAuthenticationPrivate(httpClient, requestInfo, objs, callbackForResult); + }); + } + handleAuthenticationPrivate(httpClient, requestInfo, objs, finalCallback) { + requestInfo.options = _3.extend(requestInfo.options, { + username: this._ntlmOptions.username, + password: this._ntlmOptions.password, + domain: this._ntlmOptions.domain, + workstation: this._ntlmOptions.workstation + }); + requestInfo.options.agent = httpClient.isSsl ? new https.Agent({ keepAlive: true }) : new http.Agent({ keepAlive: true }); + let self2 = this; + this.sendType1Message(httpClient, requestInfo, objs, function(err, res) { + if (err) { + return finalCallback(err, null, null); + } + res.readBody().then(() => { + setImmediate(function() { + self2.sendType3Message(httpClient, requestInfo, objs, res, finalCallback); + }); + }); + }); + } + // The following method is an adaptation of code found at https://github.com/SamDecrock/node-http-ntlm/blob/master/httpntlm.js + sendType1Message(httpClient, requestInfo, objs, finalCallback) { + const type1HexBuffer = ntlm.encodeType1(this._ntlmOptions.workstation, this._ntlmOptions.domain); + const type1msg = `NTLM ${type1HexBuffer.toString("base64")}`; + const type1options = { + headers: { + "Connection": "keep-alive", + "Authorization": type1msg + }, + timeout: requestInfo.options.timeout || 0, + agent: requestInfo.httpModule + }; + const type1info = {}; + type1info.httpModule = requestInfo.httpModule; + type1info.parsedUrl = requestInfo.parsedUrl; + type1info.options = _3.extend(type1options, _3.omit(requestInfo.options, "headers")); + return httpClient.requestRawWithCallback(type1info, objs, finalCallback); + } + // The following method is an adaptation of code found at https://github.com/SamDecrock/node-http-ntlm/blob/master/httpntlm.js + sendType3Message(httpClient, requestInfo, objs, res, callback) { + if (!res.message.headers && !res.message.headers["www-authenticate"]) { + throw new Error("www-authenticate not found on response of second request"); + } + const serverNonceRegex = /^NTLM\s+(.+?)(,|\s+|$)/; + const serverNonce = Buffer.from((res.message.headers["www-authenticate"].match(serverNonceRegex) || [])[1], "base64"); + let type2msg; + try { + type2msg = ntlm.decodeType2(serverNonce); + } catch (error) { + throw new Error(`Decoding Server's Challenge to Obtain Type2Message failed with error: ${error.message}`); + } + const type3msg = ntlm.encodeType3(this._ntlmOptions.username, this._ntlmOptions.workstation, this._ntlmOptions.domain, type2msg, this._ntlmOptions.password).toString("base64"); + const type3options = { + headers: { + "Authorization": `NTLM ${type3msg}`, + "Connection": "Close" + }, + agent: requestInfo.httpModule + }; + const type3info = {}; + type3info.httpModule = requestInfo.httpModule; + type3info.parsedUrl = requestInfo.parsedUrl; + type3options.headers = _3.extend(type3options.headers, requestInfo.options.headers); + type3info.options = _3.extend(type3options, _3.omit(requestInfo.options, "headers")); + return httpClient.requestRawWithCallback(type3info, objs, callback); + } + }; + exports2.NtlmCredentialHandler = NtlmCredentialHandler; + } +}); + +// ../node_modules/azure-devops-node-api/node_modules/typed-rest-client/handlers/personalaccesstoken.js +var require_personalaccesstoken = __commonJS({ + "../node_modules/azure-devops-node-api/node_modules/typed-rest-client/handlers/personalaccesstoken.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.PersonalAccessTokenCredentialHandler = void 0; + var PersonalAccessTokenCredentialHandler = class { + constructor(token, allowCrossOriginAuthentication) { + this.token = token; + this.allowCrossOriginAuthentication = allowCrossOriginAuthentication; + } + // currently implements pre-authorization + // TODO: support preAuth = false where it hooks on 401 + prepareRequest(options) { + if (!this.origin) { + this.origin = options.host; + } + if (this.origin === options.host || this.allowCrossOriginAuthentication) { + options.headers["Authorization"] = `Basic ${Buffer.from(`PAT:${this.token}`).toString("base64")}`; + } + options.headers["X-TFS-FedAuthRedirect"] = "Suppress"; + } + // This handler cannot handle 401 + canHandleAuthentication(response) { + return false; + } + handleAuthentication(httpClient, requestInfo, objs) { + return null; + } + }; + exports2.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; + } +}); + +// ../node_modules/azure-devops-node-api/node_modules/typed-rest-client/Handlers.js +var require_Handlers = __commonJS({ + "../node_modules/azure-devops-node-api/node_modules/typed-rest-client/Handlers.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.PersonalAccessTokenCredentialHandler = exports2.NtlmCredentialHandler = exports2.BearerCredentialHandler = exports2.BasicCredentialHandler = void 0; + var basiccreds_1 = require_basiccreds(); + Object.defineProperty(exports2, "BasicCredentialHandler", { enumerable: true, get: function() { + return basiccreds_1.BasicCredentialHandler; + } }); + var bearertoken_1 = require_bearertoken(); + Object.defineProperty(exports2, "BearerCredentialHandler", { enumerable: true, get: function() { + return bearertoken_1.BearerCredentialHandler; + } }); + var ntlm_1 = require_ntlm2(); + Object.defineProperty(exports2, "NtlmCredentialHandler", { enumerable: true, get: function() { + return ntlm_1.NtlmCredentialHandler; + } }); + var personalaccesstoken_1 = require_personalaccesstoken(); + Object.defineProperty(exports2, "PersonalAccessTokenCredentialHandler", { enumerable: true, get: function() { + return personalaccesstoken_1.PersonalAccessTokenCredentialHandler; + } }); + } +}); + +// ../node_modules/azure-devops-node-api/handlers/basiccreds.js +var require_basiccreds2 = __commonJS({ + "../node_modules/azure-devops-node-api/handlers/basiccreds.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BasicCredentialHandler = void 0; + var resthandlers = require_Handlers(); + var BasicCredentialHandler = class extends resthandlers.BasicCredentialHandler { + constructor(username, password, allowCrossOriginAuthentication = true) { + super(username, password, allowCrossOriginAuthentication); + } + }; + exports2.BasicCredentialHandler = BasicCredentialHandler; + } +}); + +// ../node_modules/azure-devops-node-api/handlers/bearertoken.js +var require_bearertoken2 = __commonJS({ + "../node_modules/azure-devops-node-api/handlers/bearertoken.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BearerCredentialHandler = void 0; + var resthandlers = require_Handlers(); + var BearerCredentialHandler = class extends resthandlers.BearerCredentialHandler { + constructor(token, allowCrossOriginAuthentication = true) { + super(token, allowCrossOriginAuthentication); + } + }; + exports2.BearerCredentialHandler = BearerCredentialHandler; + } +}); + +// ../node_modules/azure-devops-node-api/handlers/ntlm.js +var require_ntlm3 = __commonJS({ + "../node_modules/azure-devops-node-api/handlers/ntlm.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NtlmCredentialHandler = void 0; + var resthandlers = require_Handlers(); + var NtlmCredentialHandler = class extends resthandlers.NtlmCredentialHandler { + constructor(username, password, workstation, domain) { + super(username, password, workstation, domain); + } + }; + exports2.NtlmCredentialHandler = NtlmCredentialHandler; + } +}); + +// ../node_modules/azure-devops-node-api/handlers/personalaccesstoken.js +var require_personalaccesstoken2 = __commonJS({ + "../node_modules/azure-devops-node-api/handlers/personalaccesstoken.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.PersonalAccessTokenCredentialHandler = void 0; + var resthandlers = require_Handlers(); + var PersonalAccessTokenCredentialHandler = class extends resthandlers.PersonalAccessTokenCredentialHandler { + constructor(token, allowCrossOriginAuthentication = true) { + super(token, allowCrossOriginAuthentication); + } + }; + exports2.PersonalAccessTokenCredentialHandler = PersonalAccessTokenCredentialHandler; + } +}); + +// ../node_modules/azure-devops-node-api/WebApi.js +var require_WebApi = __commonJS({ + "../node_modules/azure-devops-node-api/WebApi.js"(exports2) { + "use strict"; + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WebApi = exports2.getHandlerFromToken = exports2.getPersonalAccessTokenHandler = exports2.getBearerHandler = exports2.getNtlmHandler = exports2.getBasicHandler = void 0; + var alertm = require_AlertApi(); + var buildm = require_BuildApi(); + var corem = require_CoreApi(); + var dashboardm = require_DashboardApi(); + var extmgmtm = require_ExtensionManagementApi(); + var featuremgmtm = require_FeatureManagementApi(); + var filecontainerm = require_FileContainerApi(); + var gallerym = require_GalleryApi(); + var gitm = require_GitApi(); + var locationsm = require_LocationsApi(); + var managementm = require_ManagementApi(); + var notificationm = require_NotificationApi(); + var policym = require_PolicyApi(); + var profilem = require_ProfileApi(); + var projectm = require_ProjectAnalysisApi(); + var releasem = require_ReleaseApi(); + var securityrolesm = require_SecurityRolesApi(); + var taskagentm = require_TaskAgentApi(); + var taskm = require_TaskApi(); + var testm = require_TestApi(); + var testplanm = require_TestPlanApi(); + var testresultsm = require_TestResultsApi(); + var tfvcm = require_TfvcApi(); + var wikim = require_WikiApi(); + var workm = require_WorkApi(); + var pipelinesm = require_PipelinesApi(); + var cixm = require_CIXApi(); + var workitemtrackingm = require_WorkItemTrackingApi(); + var workitemtrackingprocessm = require_WorkItemTrackingProcessApi(); + var workitemtrackingprocessdefinitionm = require_WorkItemTrackingProcessDefinitionsApi(); + var basicm = require_basiccreds2(); + var bearm = require_bearertoken2(); + var ntlmm = require_ntlm3(); + var patm = require_personalaccesstoken2(); + var rm = require_RestClient(); + var vsom = require_VsoClient(); + var crypto = require("crypto"); + var fs3 = require("fs"); + var os = require("os"); + var url = require("url"); + var path2 = require("path"); + var isBrowser = typeof window !== "undefined"; + var personalAccessTokenRegex = new RegExp("^.{76}AZDO.{4}$"); + function getBasicHandler(username, password, allowCrossOriginAuthentication) { + return new basicm.BasicCredentialHandler(username, password, allowCrossOriginAuthentication); + } + exports2.getBasicHandler = getBasicHandler; + function getNtlmHandler(username, password, workstation, domain) { + return new ntlmm.NtlmCredentialHandler(username, password, workstation, domain); + } + exports2.getNtlmHandler = getNtlmHandler; + function getBearerHandler(token, allowCrossOriginAuthentication) { + return new bearm.BearerCredentialHandler(token, allowCrossOriginAuthentication); + } + exports2.getBearerHandler = getBearerHandler; + function getPersonalAccessTokenHandler(token, allowCrossOriginAuthentication) { + return new patm.PersonalAccessTokenCredentialHandler(token, allowCrossOriginAuthentication); + } + exports2.getPersonalAccessTokenHandler = getPersonalAccessTokenHandler; + function getHandlerFromToken(token, allowCrossOriginAuthentication) { + if (token.length === 52 || personalAccessTokenRegex.test(token)) { + return getPersonalAccessTokenHandler(token, allowCrossOriginAuthentication); + } else { + return getBearerHandler(token, allowCrossOriginAuthentication); + } + } + exports2.getHandlerFromToken = getHandlerFromToken; + var WebApi = class { + /* + * Factory to return client apis and handlers + * @param defaultUrl default server url to use when creating new apis from factory methods + * @param authHandler default authentication credentials to use when creating new apis from factory methods + */ + constructor(defaultUrl, authHandler, options, requestSettings) { + this.isNoProxyHost = function(_url) { + if (!process.env.no_proxy) { + return false; + } + const noProxyDomains = (process.env.no_proxy || "").split(",").map((v) => v.toLowerCase()); + const serverUrl = url.parse(_url).host.toLowerCase(); + return noProxyDomains.indexOf(serverUrl) !== -1; + }; + this.serverUrl = defaultUrl; + this.authHandler = authHandler; + this.options = options || {}; + if (!this.isNoProxyHost(this.serverUrl)) { + if (!this.options.proxy || !this.options.proxy.proxyUrl) { + if (global["_vsts_task_lib_proxy"]) { + let proxyFromEnv = { + proxyUrl: global["_vsts_task_lib_proxy_url"], + proxyUsername: global["_vsts_task_lib_proxy_username"], + proxyPassword: this._readTaskLibSecrets(global["_vsts_task_lib_proxy_password"]), + proxyBypassHosts: JSON.parse(global["_vsts_task_lib_proxy_bypass"] || "[]") + }; + this.options.proxy = proxyFromEnv; + } + } + } + if (!this.options.cert) { + if (global["_vsts_task_lib_cert"]) { + let certFromEnv = { + caFile: global["_vsts_task_lib_cert_ca"], + certFile: global["_vsts_task_lib_cert_clientcert"], + keyFile: global["_vsts_task_lib_cert_key"], + passphrase: this._readTaskLibSecrets(global["_vsts_task_lib_cert_passphrase"]) + }; + this.options.cert = certFromEnv; + } + } + if (!this.options.ignoreSslError) { + this.options.ignoreSslError = !!global["_vsts_task_lib_skip_cert_validation"]; + } + let userAgent; + const nodeApiName = "azure-devops-node-api"; + if (isBrowser) { + if (requestSettings) { + userAgent = `${requestSettings.productName}/${requestSettings.productVersion} (${nodeApiName}; ${window.navigator.userAgent})`; + } else { + userAgent = `${nodeApiName} (${window.navigator.userAgent})`; + } + } else { + let nodeApiVersion = "unknown"; + const packageJsonPath = path2.resolve(__dirname, "package.json"); + if (fs3.existsSync(packageJsonPath)) { + nodeApiVersion = JSON.parse(fs3.readFileSync(packageJsonPath, "utf8")).version; + } + const osName = os.platform(); + const osVersion = os.release(); + if (requestSettings) { + userAgent = `${requestSettings.productName}/${requestSettings.productVersion} (${nodeApiName} ${nodeApiVersion}; ${osName} ${osVersion})`; + } else { + userAgent = `${nodeApiName}/${nodeApiVersion} (${osName} ${osVersion})`; + } + } + this.rest = new rm.RestClient(userAgent, null, [this.authHandler], this.options); + this.vsoClient = new vsom.VsoClient(defaultUrl, this.rest); + } + /** + * Convenience factory to create with a bearer token. + * @param defaultServerUrl default server url to use when creating new apis from factory methods + * @param defaultAuthHandler default authentication credentials to use when creating new apis from factory methods + */ + static createWithBearerToken(defaultUrl, token, options) { + let bearerHandler = getBearerHandler(token); + return new this(defaultUrl, bearerHandler, options); + } + connect() { + return __awaiter2(this, void 0, void 0, function* () { + return new Promise((resolve, reject2) => __awaiter2(this, void 0, void 0, function* () { + try { + let res; + res = yield this.rest.get(this.vsoClient.resolveUrl("/_apis/connectionData")); + resolve(res.result); + } catch (err) { + reject2(err); + } + })); + }); + } + /** + * Each factory method can take a serverUrl and a list of handlers + * if these aren't provided, the default url and auth handler given to the constructor for this class will be used + */ + getAlertApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "0f2ca920-f269-4545-b1f4-5b4173aa784e"); + handlers = handlers || [this.authHandler]; + return new alertm.AlertApi(serverUrl, handlers, this.options); + }); + } + getBuildApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, buildm.BuildApi.RESOURCE_AREA_ID); + handlers = handlers || [this.authHandler]; + return new buildm.BuildApi(serverUrl, handlers, this.options); + }); + } + getCoreApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "79134c72-4a58-4b42-976c-04e7115f32bf"); + handlers = handlers || [this.authHandler]; + return new corem.CoreApi(serverUrl, handlers, this.options); + }); + } + getDashboardApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "31c84e0a-3ece-48fd-a29d-100849af99ba"); + handlers = handlers || [this.authHandler]; + return new dashboardm.DashboardApi(serverUrl, handlers, this.options); + }); + } + getExtensionManagementApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "6c2b0933-3600-42ae-bf8b-93d4f7e83594"); + handlers = handlers || [this.authHandler]; + return new extmgmtm.ExtensionManagementApi(serverUrl, handlers, this.options); + }); + } + getFeatureManagementApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, ""); + handlers = handlers || [this.authHandler]; + return new featuremgmtm.FeatureManagementApi(serverUrl, handlers, this.options); + }); + } + getFileContainerApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, ""); + handlers = handlers || [this.authHandler]; + return new filecontainerm.FileContainerApi(serverUrl, handlers, this.options); + }); + } + getGalleryApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, gallerym.GalleryApi.RESOURCE_AREA_ID); + handlers = handlers || [this.authHandler]; + return new gallerym.GalleryApi(serverUrl, handlers, this.options); + }); + } + getGitApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, gitm.GitApi.RESOURCE_AREA_ID); + handlers = handlers || [this.authHandler]; + return new gitm.GitApi(serverUrl, handlers, this.options); + }); + } + // TODO: Don't call resource area here? Will cause infinite loop? + getLocationsApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + let optionsClone = Object.assign({}, this.options); + optionsClone.allowRetries = true; + optionsClone.maxRetries = 5; + serverUrl = (yield serverUrl) || this.serverUrl; + handlers = handlers || [this.authHandler]; + return new locationsm.LocationsApi(serverUrl, handlers, optionsClone); + }); + } + getManagementApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "f101720c-9790-45a6-9fb3-494a09fddeeb"); + handlers = handlers || [this.authHandler]; + return new managementm.ManagementApi(serverUrl, handlers, this.options); + }); + } + getNotificationApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, ""); + handlers = handlers || [this.authHandler]; + return new notificationm.NotificationApi(serverUrl, handlers, this.options); + }); + } + getPolicyApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "fb13a388-40dd-4a04-b530-013a739c72ef"); + handlers = handlers || [this.authHandler]; + return new policym.PolicyApi(serverUrl, handlers, this.options); + }); + } + getProfileApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "8ccfef3d-2b87-4e99-8ccb-66e343d2daa8"); + handlers = handlers || [this.authHandler]; + return new profilem.ProfileApi(serverUrl, handlers, this.options); + }); + } + getProjectAnalysisApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "7658fa33-b1bf-4580-990f-fac5896773d3"); + handlers = handlers || [this.authHandler]; + return new projectm.ProjectAnalysisApi(serverUrl, handlers, this.options); + }); + } + getSecurityRolesApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, ""); + handlers = handlers || [this.authHandler]; + return new securityrolesm.SecurityRolesApi(serverUrl, handlers, this.options); + }); + } + getReleaseApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "efc2f575-36ef-48e9-b672-0c6fb4a48ac5"); + handlers = handlers || [this.authHandler]; + return new releasem.ReleaseApi(serverUrl, handlers, this.options); + }); + } + getTaskApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, ""); + handlers = handlers || [this.authHandler]; + return new taskm.TaskApi(serverUrl, handlers, this.options); + }); + } + getTaskAgentApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "a85b8835-c1a1-4aac-ae97-1c3d0ba72dbd"); + handlers = handlers || [this.authHandler]; + return new taskagentm.TaskAgentApi(serverUrl, handlers, this.options); + }); + } + getTestApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "c2aa639c-3ccc-4740-b3b6-ce2a1e1d984e"); + handlers = handlers || [this.authHandler]; + return new testm.TestApi(serverUrl, handlers, this.options); + }); + } + getTestPlanApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "e4c27205-9d23-4c98-b958-d798bc3f9cd4"); + handlers = handlers || [this.authHandler]; + return new testplanm.TestPlanApi(serverUrl, handlers, this.options); + }); + } + getTestResultsApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "c83eaf52-edf3-4034-ae11-17d38f25404c"); + handlers = handlers || [this.authHandler]; + return new testresultsm.TestResultsApi(serverUrl, handlers, this.options); + }); + } + getTfvcApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "8aa40520-446d-40e6-89f6-9c9f9ce44c48"); + handlers = handlers || [this.authHandler]; + return new tfvcm.TfvcApi(serverUrl, handlers, this.options); + }); + } + getWikiApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "bf7d82a0-8aa5-4613-94ef-6172a5ea01f3"); + handlers = handlers || [this.authHandler]; + return new wikim.WikiApi(serverUrl, handlers, this.options); + }); + } + getWorkApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "1d4f49f9-02b9-4e26-b826-2cdb6195f2a9"); + handlers = handlers || [this.authHandler]; + return new workm.WorkApi(serverUrl, handlers, this.options); + }); + } + getWorkItemTrackingApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, workitemtrackingm.WorkItemTrackingApi.RESOURCE_AREA_ID); + handlers = handlers || [this.authHandler]; + return new workitemtrackingm.WorkItemTrackingApi(serverUrl, handlers, this.options); + }); + } + getWorkItemTrackingProcessApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "5264459e-e5e0-4bd8-b118-0985e68a4ec5"); + handlers = handlers || [this.authHandler]; + return new workitemtrackingprocessm.WorkItemTrackingProcessApi(serverUrl, handlers, this.options); + }); + } + getWorkItemTrackingProcessDefinitionApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "5264459e-e5e0-4bd8-b118-0985e68a4ec5"); + handlers = handlers || [this.authHandler]; + return new workitemtrackingprocessdefinitionm.WorkItemTrackingProcessDefinitionsApi(serverUrl, handlers, this.options); + }); + } + getPipelinesApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "5264459e-e5e0-4bd8-b118-0985e68a4ec5"); + handlers = handlers || [this.authHandler]; + return new pipelinesm.PipelinesApi(serverUrl, handlers, this.options); + }); + } + getCixApi(serverUrl, handlers) { + return __awaiter2(this, void 0, void 0, function* () { + serverUrl = yield this._getResourceAreaUrl(serverUrl || this.serverUrl, "5264459e-e5e0-4bd8-b118-0985e68a4ec5"); + handlers = handlers || [this.authHandler]; + return new cixm.CixApi(serverUrl, handlers, this.options); + }); + } + _getResourceAreaUrl(serverUrl, resourceId) { + return __awaiter2(this, void 0, void 0, function* () { + if (!resourceId) { + return serverUrl; + } + const resourceAreas = yield this._getResourceAreas(); + if (resourceAreas === void 0) { + throw new Error(`Failed to retrieve resource areas ' + 'from server: ${serverUrl}`); + } + if (!resourceAreas || resourceAreas.length === 0 || resourceAreas.count === 0) { + return serverUrl; + } + for (var resourceArea of resourceAreas) { + if (resourceArea.id.toLowerCase() === resourceId.toLowerCase()) { + return resourceArea.locationUrl; + } + } + throw new Error(`Could not find information for resource area ${resourceId} ' + 'from server: ${serverUrl}`); + }); + } + _getResourceAreas() { + return __awaiter2(this, void 0, void 0, function* () { + if (!this._resourceAreas) { + const locationClient = yield this.getLocationsApi(); + this._resourceAreas = yield locationClient.getResourceAreas(); + } + return this._resourceAreas; + }); + } + _readTaskLibSecrets(lookupKey) { + if (isBrowser) { + throw new Error("Browsers can't securely keep secrets"); + } + if (lookupKey && lookupKey.indexOf(":") > 0) { + let lookupInfo = lookupKey.split(":", 2); + let keyFile = new Buffer(lookupInfo[0], "base64").toString("utf8"); + let encryptKey = new Buffer(fs3.readFileSync(keyFile, "utf8"), "base64"); + let encryptedContent = new Buffer(lookupInfo[1], "base64").toString("utf8"); + let decipher = crypto.createDecipher("aes-256-ctr", encryptKey); + let decryptedContent = decipher.update(encryptedContent, "hex", "utf8"); + decryptedContent += decipher.final("utf8"); + return decryptedContent; + } + } + }; + exports2.WebApi = WebApi; + } +}); + +// lib/gitApiProvider.js +var require_gitApiProvider = __commonJS({ + "lib/gitApiProvider.js"(exports2) { + "use strict"; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ function() { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function(o2) { + var ar = []; + for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function(mod) { + if (mod && mod.__esModule) return mod; + var result2 = {}; + if (mod != null) { + for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result2, mod, k[i]); + } + __setModuleDefault2(result2, mod); + return result2; + }; + }(); + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getGitApi = getGitApi; + var azdev = __importStar2(require_WebApi()); + var utils_12 = require_utils4(); + var gitApi = null; + function initApi() { + return __awaiter2(this, void 0, void 0, function* () { + const orgUrl = (0, utils_12.getVariable)("System.TeamFoundationCollectionUri"); + const token = (0, utils_12.getVariable)("System.AccessToken"); + const authHandler = azdev.getPersonalAccessTokenHandler(token); + const webApi = new azdev.WebApi(orgUrl, authHandler); + const api = yield webApi.getGitApi(); + gitApi = api; + return api; + }); + } + function getGitApi() { + return __awaiter2(this, void 0, void 0, function* () { + const api = gitApi; + if (!api) { + return yield initApi(); + } else { + return api; + } + }); + } + } +}); + +// lib/output.js +var require_output = __commonJS({ + "lib/output.js"(exports2) { + "use strict"; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ function() { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function(o2) { + var ar = []; + for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function(mod) { + if (mod && mod.__esModule) return mod; + var result2 = {}; + if (mod != null) { + for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result2, mod, k[i]); + } + __setModuleDefault2(result2, mod); + return result2; + }; + }(); + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.VIEW_REPORT_OPTIONS = exports2.DEPENDENCY_CHARS_LIMIT = void 0; + exports2.publishOutput = publishOutput; + exports2.prFixesBody = prFixesBody; + var tl2 = __importStar2(require("azure-pipelines-task-lib/task")); + var qodana_12 = (init_qodana(), __toCommonJS(qodana_exports)); + var utils_12 = require_utils4(); + var output_12 = (init_output(), __toCommonJS(output_exports)); + exports2.DEPENDENCY_CHARS_LIMIT = 15e4; + exports2.VIEW_REPORT_OPTIONS = `To be able to view the detailed Qodana report, you can either: + - Register at [Qodana Cloud](https://qodana.cloud/) and [configure the task](https://www.jetbrains.com/help/qodana/qodana-azure-pipelines.html#Qodana+Cloud) + - Use [SARIF SAST Scans Tab](https://marketplace.visualstudio.com/items?itemName=sariftools.scans) extension to display report summary in Azure DevOps UI in 'Scans' tab + - Inspect and use \`qodana.sarif.json\` (see [the Qodana SARIF format](https://www.jetbrains.com/help/qodana/qodana-sarif-output.html#Report+structure) for details) + +To get \`*.log\` files or any other Qodana artifacts, run the task with \`uploadResult\` option set to \`true\`, +so that the action will upload the files as the job artifacts: +\`\`\`yaml + - task: QodanaScan@${qodana_12.VERSION} + inputs: + uploadResult: true +\`\`\` +`; + function publishOutput(projectDir, sourceDir, resultsDir, postComment, isPrMode, execute) { + return __awaiter2(this, void 0, void 0, function* () { + var _a, _b; + if (!execute) { + return; + } + try { + const problems = (0, utils_12.parseSarif)(`${resultsDir}/${qodana_12.QODANA_SARIF_NAME}`); + const reportUrl = (0, output_12.getReportURL)(resultsDir); + const coverageInfo = (0, output_12.getCoverageStats)((0, qodana_12.getCoverageFromSarif)(`${resultsDir}/${qodana_12.QODANA_SHORT_SARIF_NAME}`)); + const licensesInfo = (0, output_12.getLicenseInfo)(resultsDir); + const problemsDescriptions = (_a = problems.problemDescriptions) !== null && _a !== void 0 ? _a : []; + const toolName = (_b = problems.title.split("found by ")[1]) !== null && _b !== void 0 ? _b : output_12.QODANA_CHECK_NAME; + problems.summary = (0, output_12.getSummary)(toolName, projectDir, sourceDir, problemsDescriptions, coverageInfo, licensesInfo.packages, licensesInfo.licenses, reportUrl, isPrMode, exports2.DEPENDENCY_CHARS_LIMIT, exports2.VIEW_REPORT_OPTIONS); + (0, utils_12.postSummary)(problems.summary); + yield (0, utils_12.postResultsToPRComments)(toolName, sourceDir, problems.summary, problemsDescriptions.length != 0, postComment); + } catch (error) { + tl2.warning(`Qodana has problems with publishing results to Azure \u2013 ${error.message}`); + } + }); + } + function prFixesBody(jobUrl) { + return ` \u{1F590} Hey there! + +This pull request has been auto-generated by the [Qodana Scan task](<${jobUrl}>) configured in your repository. +It has performed code analysis and applied some suggested fixes to improve your code quality \u{1F9F9}\u2728 + +> **Warning** +> It's crucial to review these changes to ensure everything shipshape manually. Please take a moment to examine the changes here. Remember to run your integration tests against this PR to validate the fixes and ensure everything's functioning as expected. + +_\u{1F4BB}\u{1F50D} Happy reviewing and testing! +Best, +[Qodana Scan \u{1F916}](https://marketplace.visualstudio.com/items?itemName=JetBrains.qodana)_`; + } + } +}); + +// lib/utils.js +var require_utils4 = __commonJS({ + "lib/utils.js"(exports2) { + "use strict"; + var __createBinding2 = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault2 = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar2 = exports2 && exports2.__importStar || /* @__PURE__ */ function() { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function(o2) { + var ar = []; + for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function(mod) { + if (mod && mod.__esModule) return mod; + var result2 = {}; + if (mod != null) { + for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result2, mod, k[i]); + } + __setModuleDefault2(result2, mod); + return result2; + }; + }(); + var __awaiter2 = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function(resolve) { + resolve(value); + }); + } + return new (P || (P = Promise))(function(resolve, reject2) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject2(e); + } + } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject2(e); + } + } + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.setFailed = setFailed; + exports2.getInputs = getInputs; + exports2.qodana = qodana; + exports2.prepareAgent = prepareAgent; + exports2.uploadArtifacts = uploadArtifacts; + exports2.uploadSarif = uploadSarif; + exports2.parseSarif = parseSarif; + exports2.getWorkflowRunUrl = getWorkflowRunUrl; + exports2.postResultsToPRComments = postResultsToPRComments; + exports2.findCommentByTag = findCommentByTag; + exports2.getVariable = getVariable; + exports2.postSummary = postSummary; + exports2.pushQuickFixes = pushQuickFixes; + var tl2 = __importStar2(require("azure-pipelines-task-lib/task")); + var tool = __importStar2(require_tool()); + var node_stream_1 = require("node:stream"); + var fs_1 = __importDefault(require("fs")); + var path_1 = __importDefault(require("path")); + var GitInterfaces = __importStar2(require_GitInterfaces()); + var qodana_12 = (init_qodana(), __toCommonJS(qodana_exports)); + var output_12 = (init_output(), __toCommonJS(output_exports)); + var utils_12 = (init_utils(), __toCommonJS(utils_exports)); + var gitApiProvider_1 = require_gitApiProvider(); + var output_2 = require_output(); + function setFailed(message) { + tl2.setResult(tl2.TaskResult.Failed, message); + } + function getInputs() { + const home = path_1.default.join(process.env["AGENT_TEMPDIRECTORY"], "qodana"); + return { + args: (tl2.getInput("args", false) || "").split(",").map((arg) => arg.trim()), + resultsDir: tl2.getInput("resultsDir", false) || path_1.default.join(home, "results"), + cacheDir: tl2.getInput("cacheDir", false) || path_1.default.join(home, "cache"), + uploadResult: tl2.getBoolInput("uploadResult", false), + uploadSarif: tl2.getBoolInput("uploadSarif", false), + artifactName: tl2.getInput("artifactName", false) || "qodana-report", + useNightly: tl2.getBoolInput("useNightly", false), + prMode: tl2.getBoolInput("prMode", true), + postComment: tl2.getBoolInput("postPrComment", false), + pushFixes: tl2.getInput("pushFixes", false) || "none", + commitMessage: tl2.getInput("commitMessage", false) || "\u{1F916} Apply quick-fixes by Qodana", + // Not used by the Azure task + additionalCacheKey: "", + primaryCacheKey: "", + useAnnotations: false, + useCaches: false, + cacheDefaultBranchOnly: false, + githubToken: "" + }; + } + function qodana() { + return __awaiter2(this, arguments, void 0, function* (args = []) { + const env = Object.assign(Object.assign({}, process.env), { NONINTERACTIVE: "1" }); + if (args.length === 0) { + const inputs = getInputs(); + args = (0, qodana_12.getQodanaScanArgs)(inputs.args, inputs.resultsDir, inputs.cacheDir); + if (inputs.prMode && tl2.getVariable("Build.Reason") === "PullRequest") { + const sha = yield getPrSha(); + if (sha !== "") { + args.push("--commit", sha); + const sourceBranch = process.env.QODANA_BRANCH || getSourceAndTargetBranches().sourceBranch; + if (sourceBranch) { + env.QODANA_BRANCH = sourceBranch; + } + } + } + } + return yield tl2.execAsync(qodana_12.EXECUTABLE, args, { + ignoreReturnCode: true, + env + }); + }); + } + function prepareAgent(args_1) { + return __awaiter2(this, arguments, void 0, function* (args, useNightly = false) { + const arch = (0, qodana_12.getProcessArchName)(); + const platform = (0, qodana_12.getProcessPlatformName)(); + const temp = yield tool.downloadTool((0, qodana_12.getQodanaUrl)(arch, platform, useNightly)); + if (!useNightly) { + const expectedChecksum = (0, qodana_12.getQodanaSha256)(arch, platform); + const actualChecksum = (0, qodana_12.sha256sum)(temp); + if (expectedChecksum !== actualChecksum) { + setFailed((0, qodana_12.getQodanaSha256MismatchMessage)(expectedChecksum, actualChecksum)); + } + } + let extractRoot; + if (process.platform === "win32") { + extractRoot = yield tool.extractZip(temp); + } else { + extractRoot = yield tool.extractTar(temp); + } + tool.prependPath(yield tool.cacheDir(extractRoot, qodana_12.EXECUTABLE, qodana_12.VERSION)); + if (!(0, qodana_12.isNativeMode)(args)) { + const pull = yield qodana((0, qodana_12.getQodanaPullArgs)(args)); + if (pull !== 0) { + setFailed("Unable to run 'qodana pull'"); + } + } + }); + } + function uploadArtifacts(resultsDir, artifactName, execute) { + return __awaiter2(this, void 0, void 0, function* () { + if (!execute) { + return; + } + try { + const workingDir = path_1.default.dirname(resultsDir); + const archivePath = path_1.default.join(workingDir, `${artifactName}.zip`); + yield (0, qodana_12.compressFolder)(resultsDir, archivePath); + tl2.uploadArtifact("Qodana", archivePath, artifactName); + } catch (error) { + tl2.warning(`Failed to upload report \u2013 ${error.message}`); + } + }); + } + function uploadSarif(resultsDir, execute) { + if (!execute) { + return; + } + try { + const parentDir = path_1.default.dirname(resultsDir); + const qodanaSarif = path_1.default.join(parentDir, "qodana.sarif"); + tl2.cp(path_1.default.join(resultsDir, "qodana.sarif.json"), qodanaSarif); + tl2.uploadArtifact("CodeAnalysisLogs", qodanaSarif, "CodeAnalysisLogs"); + } catch (error) { + tl2.warning(`Failed to upload SARIF \u2013 ${error.message}`); + } + } + function getSourceAndTargetBranches() { + var _a, _b; + const sourceBranch = (_a = tl2.getVariable("System.PullRequest.SourceBranch")) === null || _a === void 0 ? void 0 : _a.replace("refs/heads/", ""); + const targetBranch = (_b = tl2.getVariable("System.PullRequest.TargetBranch")) === null || _b === void 0 ? void 0 : _b.replace("refs/heads/", ""); + return { sourceBranch, targetBranch }; + } + function getPrSha() { + return __awaiter2(this, void 0, void 0, function* () { + if (process.env.QODANA_PR_SHA) { + return process.env.QODANA_PR_SHA; + } + const { sourceBranch, targetBranch } = getSourceAndTargetBranches(); + if (sourceBranch && targetBranch) { + yield git(["fetch", "origin"]); + const output = yield gitOutput(["merge-base", "origin/" + sourceBranch, "origin/" + targetBranch], { + ignoreReturnCode: true + }); + if (output.exitCode === 0) { + return output.stdout.trim(); + } + } + return ""; + }); + } + function git(args_1) { + return __awaiter2(this, arguments, void 0, function* (args, options = {}) { + return (yield gitOutput(args, options)).exitCode; + }); + } + function gitOutput(args_1) { + return __awaiter2(this, arguments, void 0, function* (args, options = {}) { + const result2 = { + exitCode: 0, + stdout: "", + stderr: "" + }; + const outStream = new node_stream_1.Writable({ + write(chunk2, _3, callback) { + result2.stdout += chunk2.toString("utf8"); + callback(); + } + }); + const errStream = new node_stream_1.Writable({ + write(chunk2, _3, callback) { + result2.stderr += chunk2.toString("utf8"); + callback(); + } + }); + options.outStream = outStream; + options.errStream = errStream; + result2.exitCode = yield tl2.execAsync("git", args, options).catch((error) => { + tl2.warning(`Failed to run git command with arguments: ${args.join(" ")}`); + throw error; + }); + result2.stdout = result2.stdout.replace("[command]/usr/bin/git " + args.join(" "), "").trim(); + return result2; + }); + } + function getQodanaHelpString() { + return `This result was published with [Qodana Task](<${getWorkflowRunUrl()}>)`; + } + function parseSarif(path2) { + var _a; + const sarif = JSON.parse(fs_1.default.readFileSync(path2, { encoding: "utf8" })); + const run = sarif.runs[0]; + const rules = (0, utils_12.parseRules)(run.tool); + let title = "No new problems found by "; + let problemDescriptions = []; + if ((_a = run.results) === null || _a === void 0 ? void 0 : _a.length) { + title = `${run.results.length} ${(0, output_12.getProblemPlural)(run.results.length)} found by `; + problemDescriptions = run.results.filter((result2) => result2.baselineState !== "unchanged" && result2.baselineState !== "absent").map((result2) => (0, output_12.parseResult)(result2, rules)).filter((a) => a !== null && a !== void 0); + } + const name = run.tool.driver.fullName || "Qodana"; + title += name; + return { + title, + text: getQodanaHelpString(), + summary: title, + problemDescriptions + }; + } + function getWorkflowRunUrl() { + const serverUri = process.env.SYSTEM_TEAMFOUNDATIONSERVERURI; + const projectName = process.env.SYSTEM_TEAMPROJECT; + const buildId = process.env.BUILD_BUILDID; + return `${serverUri}${projectName}/_build/results?buildId=${buildId}`; + } + function postResultsToPRComments(toolName, sourceDir, content, hasIssues, postComment) { + return __awaiter2(this, void 0, void 0, function* () { + try { + if (!postComment) { + return; + } + const comment_tag_pattern = ``; + const body = `${content} +${comment_tag_pattern}`; + const pullRequestId = parseInt(getVariable("System.PullRequest.PullRequestId"), 10); + const project = getVariable("System.TeamProject"); + const repoId = getVariable("Build.Repository.Id"); + const gitApi = yield (0, gitApiProvider_1.getGitApi)(); + const { thread, comment } = yield findCommentByTag(comment_tag_pattern); + const newComment = { + content: body + }; + if ((comment === null || comment === void 0 ? void 0 : comment.id) === void 0 || (thread === null || thread === void 0 ? void 0 : thread.id) === void 0) { + const thread2 = { + comments: [newComment], + status: hasIssues ? GitInterfaces.CommentThreadStatus.Active : GitInterfaces.CommentThreadStatus.ByDesign + }; + yield gitApi.createThread(thread2, repoId, pullRequestId, project); + } else { + const threadStatusUpdated = { + status: hasIssues ? GitInterfaces.CommentThreadStatus.Active : GitInterfaces.CommentThreadStatus.ByDesign + }; + yield gitApi.updateThread(threadStatusUpdated, repoId, pullRequestId, thread.id, project); + yield gitApi.updateComment(newComment, repoId, pullRequestId, thread.id, comment.id, project); + } + } catch (error) { + tl2.warning(`Failed to post results to comment: ${error.message}`); + } + }); + } + function findCommentByTag(tag) { + return __awaiter2(this, void 0, void 0, function* () { + var _a; + try { + const gitApi = yield (0, gitApiProvider_1.getGitApi)(); + const project = getVariable("System.TeamProject"); + const repoId = getVariable("Build.Repository.Id"); + const pullRequestId = parseInt(getVariable("System.PullRequest.PullRequestId"), 10); + const threads = yield gitApi.getThreads(repoId, pullRequestId, project); + for (const thread of threads) { + const comment = (_a = thread.comments) === null || _a === void 0 ? void 0 : _a.find((comment2) => { + var _a2; + return (_a2 = comment2.content) === null || _a2 === void 0 ? void 0 : _a2.includes(tag); + }); + if (comment != void 0) { + return { thread, comment }; + } + } + return { thread: void 0, comment: void 0 }; + } catch (error) { + tl2.debug(`Failed to find comment by tag \u2013 ${error.message}`); + return { thread: void 0, comment: void 0 }; + } + }); + } + function getVariable(name) { + const result2 = tl2.getVariable(name); + if (!result2) { + throw new Error(`Variable ${name} is not set`); + } + return result2; + } + function postSummary(summary) { + const tempDir = getVariable("Agent.TempDirectory"); + const filePath = path_1.default.join(tempDir, "Qodana Task Summary.md"); + fs_1.default.writeFileSync(filePath, summary); + tl2.uploadSummary(filePath); + } + function pushQuickFixes(mode, commitMessage) { + return __awaiter2(this, void 0, void 0, function* () { + if (mode === qodana_12.NONE) { + return; + } + try { + const pullRequest = tl2.getVariable("Build.Reason") === "PullRequest"; + let currentBranch; + if (pullRequest) { + currentBranch = getVariable("System.PullRequest.SourceBranch"); + } else { + currentBranch = getVariable("Build.SourceBranch"); + } + currentBranch = currentBranch.replace("refs/heads/", ""); + currentBranch = (0, qodana_12.validateBranchName)(currentBranch); + const currentCommit = (yield gitOutput(["rev-parse", "HEAD"])).stdout.trim(); + yield git(["config", "user.name", output_12.COMMIT_USER]); + yield git(["config", "user.email", output_12.COMMIT_EMAIL]); + yield git(["add", "."]); + let exitCode = yield git(["commit", "-m", commitMessage], { + ignoreReturnCode: true + }); + if (exitCode !== 0) { + return; + } + exitCode = yield git(["pull", "--rebase", "origin", currentBranch]); + if (exitCode !== 0) { + return; + } + if (mode === qodana_12.BRANCH) { + if (pullRequest) { + const commitToCherryPick = (yield gitOutput(["rev-parse", "HEAD"])).stdout.trim(); + yield git(["checkout", currentBranch]); + yield git(["cherry-pick", commitToCherryPick]); + } + yield gitPush(currentBranch); + } else if (mode === qodana_12.PULL_REQUEST) { + const newBranch = `qodana/quick-fixes-${currentCommit.slice(0, 7)}`; + yield git(["checkout", "-b", newBranch]); + yield gitPush(newBranch); + yield createPr(commitMessage, currentBranch, newBranch); + } + } catch (error) { + tl2.warning(`Failed to push quick fixes \u2013 ${error.message}`); + } + }); + } + function gitPush(branch) { + return __awaiter2(this, void 0, void 0, function* () { + const output = yield gitOutput(["push", "origin", branch], { + ignoreReturnCode: true + }); + if (output.exitCode == 1) { + tl2.warning(`Branch ${branch} already exists. Push of quick-fixes was skipped.`); + } else if (output.exitCode !== 0) { + tl2.warning(`Failed to push branch ${branch}: ${output.stderr}`); + } + }); + } + function createPr(title, base, head) { + return __awaiter2(this, void 0, void 0, function* () { + if (!head.startsWith("refs/heads/")) { + head = "refs/heads/" + head; + } + if (!base.startsWith("refs/heads/")) { + base = "refs/heads/" + base; + } + const description = (0, output_2.prFixesBody)(getWorkflowRunUrl()); + const gitApi = yield (0, gitApiProvider_1.getGitApi)(); + const project = getVariable("System.TeamProject"); + const repoId = getVariable("Build.Repository.Id"); + const pr = { + sourceRefName: head, + targetRefName: base, + title, + description + }; + try { + yield gitApi.createPullRequest(pr, repoId, project); + } catch (error) { + tl2.warning(`Failed to create pull request ${head} -> ${base}: ${error.message}`); + } + }); + } + } +}); + +// lib/main.js +var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { + return m[k]; + } }; + } + Object.defineProperty(o, k2, desc); +} : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; +}); +var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); } : function(o, v) { o["default"] = v; @@ -14885,12 +79553,12 @@ var __importStar = exports && exports.__importStar || /* @__PURE__ */ function() }; return function(mod) { if (mod && mod.__esModule) return mod; - var result = {}; + var result2 = {}; if (mod != null) { - for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result2, mod, k[i]); } - __setModuleDefault(result, mod); - return result; + __setModuleDefault(result2, mod); + return result2; }; }(); var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) { @@ -14899,23 +79567,23 @@ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, resolve(value); }); } - return new (P || (P = Promise))(function(resolve, reject) { + return new (P || (P = Promise))(function(resolve, reject2) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { - reject(e); + reject2(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { - reject(e); + reject2(e); } } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + function step(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); @@ -14923,7 +79591,8 @@ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, Object.defineProperty(exports, "__esModule", { value: true }); var tl = __importStar(require("azure-pipelines-task-lib/task")); var qodana_1 = (init_qodana(), __toCommonJS(qodana_exports)); -var utils_1 = require_utils3(); +var utils_1 = require_utils4(); +var output_1 = require_output(); process.on("uncaughtException", (e) => tl.warning(e.message)); function main() { return __awaiter(this, void 0, void 0, function* () { @@ -14933,7 +79602,11 @@ function main() { tl.mkdirP(inputs.cacheDir); yield (0, utils_1.prepareAgent)(inputs.args, inputs.useNightly); const exitCode = yield (0, utils_1.qodana)(); - yield (0, utils_1.uploadArtifacts)(inputs.resultsDir, inputs.artifactName, inputs.uploadResult); + yield Promise.all([ + (0, utils_1.pushQuickFixes)(inputs.pushFixes, inputs.commitMessage), + (0, utils_1.uploadArtifacts)(inputs.resultsDir, inputs.artifactName, inputs.uploadResult), + (0, output_1.publishOutput)((0, qodana_1.extractArg)("-i", "--project-dir", inputs.args), (0, qodana_1.extractArg)("-d", "--source-directory", inputs.args), inputs.resultsDir, inputs.postComment, inputs.prMode, (0, qodana_1.isExecutionSuccessful)(exitCode)) + ]); (0, utils_1.uploadSarif)(inputs.resultsDir, inputs.uploadSarif); if (!(0, qodana_1.isExecutionSuccessful)(exitCode)) { (0, utils_1.setFailed)(`qodana scan failed with exit code ${exitCode}`); @@ -14946,3 +79619,16 @@ function main() { }); } void main(); +/*! Bundled license information: + +js-md4/src/md4.js: + (** + * [js-md4]{@link https://github.com/emn178/js-md4} + * + * @namespace md4 + * @version 0.3.2 + * @author Yi-Cyuan Chen [emn178@gmail.com] + * @copyright Yi-Cyuan Chen 2015-2027 + * @license MIT + *) +*/ diff --git a/vsts/README.md b/vsts/README.md index 230f5812..219a3101 100644 --- a/vsts/README.md +++ b/vsts/README.md @@ -55,6 +55,42 @@ Triggering this job depends on [what type of repository you are using in Azure P The task can be run on any OS and x86_64/arm64 CPUs, but it requires the agent to have Docker installed. And since most of the Qodana Docker images are Linux-based, the docker daemon must be able to run Linux containers. +### Apply quick-fixes + +To make Qodana automatically fix found issues and push the changes to your repository, +you need +to +1. Choose what kind of fixes to apply + - [Specify `fixesStrategy` in the `qodana.yaml` file in your repository root](https://www.jetbrains.com/help/qodana/qodana-yaml.html) + - Or set the task `args` property with the quick-fix strategy to use: `--apply-fixes` or `--cleanup` +2. Set `pushFixes` property to + - `pull-request`: create a new branch with fixes and create a pull request to the original branch + - or `branch`: push fixes to the original branch +3. Set the correct permissions for the job. Go to `Repositories` β†’ `Manage repositories` β†’ `Security`. Choose `Qodana for Azure Pipelines Build Service` user. Allow: + - `Contribute` + - `Bypass policies when pushing`. Without this, the analysis will be performed twice + - `Create branch` if you use `pull-request` value + + Also, set `persistCredentials` property to `true`. This is needed for pushing changes to the repository + +Example configuration: + +```yaml +steps: + - checkout: self + fetchDepth: 0 + persistCredentials: true + - task: QodanaScan@2024 + env: + QODANA_TOKEN: $(QODANA_TOKEN) + inputs: + pushFixes: "branch" + args: "--apply-fixes" +``` + +> **Note** +> Qodana could automatically modify not only the code, but also the configuration in `.idea`: if you do not wish to push these changes, add `.idea` to your `.gitignore` file. + ### Qodana Cloud To send the results to Qodana Cloud, all you need to do is to specify the `QODANA_TOKEN` environment variable in the build configuration. @@ -84,15 +120,17 @@ To display Qodana report summary in Azure DevOps UI in 'Scans' tab, install Micr You probably won't need other options than `args`: all other options can be helpful if you are configuring multiple Qodana Scan jobs in one workflow. -| Name | Description | Default Value | -|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------| -| `args` | Additional [Qodana CLI `scan` command](https://github.com/jetbrains/qodana-cli#scan) arguments, split the arguments with commas (`,`), for example `-i,frontend`. Optional. | - | -| `resultsDir` | Directory to store the analysis results. Optional. | `$(Agent.TempDirectory)/qodana/results` | -| `uploadResult` | Upload Qodana results as an artifact to the job. Optional. | `false` | -| `uploadSarif` | For SARIF SAST Scans Tab extension. Upload qodana.sarif.json as an qodana.sarif artifact to the job. Optional. | `true` | -| `artifactName` | Specify Qodana results artifact name, used for results uploading. Optional. | `qodana-report` | -| `cacheDir` | Directory to store Qodana caches. Optional. | `$(Agent.TempDirectory)/qodana/cache` | -| `prMode` | Analyze ONLY changed files in a pull request. Optional. | `false` | +| Name | Description | Default Value | +|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------| +| `args` | Additional [Qodana CLI `scan` command](https://github.com/jetbrains/qodana-cli#scan) arguments, split the arguments with commas (`,`), for example `-i,frontend`. Optional. | | +| `resultsDir` | Directory to store the analysis results. Optional. | `$(Agent.TempDirectory)/qodana/results` | +| `uploadResult` | Upload Qodana results as an artifact to the job. Optional. | `false` | +| `uploadSarif` | For SARIF SAST Scans Tab extension. Upload qodana.sarif.json as an qodana.sarif artifact to the job. Optional. | `true` | +| `artifactName` | Specify Qodana results artifact name, used for results uploading. Optional. | `qodana-report` | +| `cacheDir` | Directory to store Qodana caches. Optional. | `$(Agent.TempDirectory)/qodana/cache` | +| `prMode` | Analyze ONLY changed files in a pull request. Optional. | `true` | +| `postPrComment` | Post a comment with the Qodana results summary to the pull request. Needs `Contribute to pull request` permission and [SYSTEM_ACCESSTOKEN](https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#systemaccesstoken) or `persistCredentials` set to true during checkout step. Optional. | `false` | +| `pushFixes` | Push Qodana fixes to the repository, can be `none`, `branch` to the current branch, or `pull-request`. Optional. | `none` | [gh:qodana]: https://github.com/JetBrains/qodana-action/actions/workflows/code_scanning.yml [youtrack]: https://youtrack.jetbrains.com/issues/QD diff --git a/vsts/__tests__/data/empty.sarif.json b/vsts/__tests__/data/empty.sarif.json new file mode 100644 index 00000000..f210772f --- /dev/null +++ b/vsts/__tests__/data/empty.sarif.json @@ -0,0 +1,8053 @@ +{ + "version": "2.1.0", + "runs": [ + { + "tool": { + "driver": { + "name": "QDJVM", + "fullName": "Qodana for JVM", + "version": "213.6433.60", + "rules": [], + "taxa": [], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + "extensions": [ + { + "name": "org.jetbrains.kotlin", + "version": "213-1.5.10-release-949-IJ6433", + "rules": [ + { + "id": "RedundantRunCatching", + "shortDescription": { + "text": "Redundant 'runCatching' call" + }, + "fullDescription": { + "text": "Reports 'runCatching' calls that are immediately followed by 'getOrThrow'. Such calls can be replaced with just 'run'. Example: 'fun foo() = runCatching { doSomething() }.getOrThrow()' After the quick-fix is applied: 'fun foo() = run { doSomething() }'", + "markdown": "Reports `runCatching` calls that are immediately followed by `getOrThrow`. Such calls can be replaced with just `run`.\n\n**Example:**\n\n\n fun foo() = runCatching { doSomething() }.getOrThrow()\n\nAfter the quick-fix is applied:\n\n\n fun foo() = run { doSomething() }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimpleRedundantLet", + "shortDescription": { + "text": "Redundant receiver-based 'let' call" + }, + "fullDescription": { + "text": "Reports redundant receiver-based 'let' calls. The quick-fix removes the redundant 'let' call. Example: 'fun test(s: String?): Int? = s?.let { it.length }' After the quick-fix is applied: 'fun test(s: String?): Int? = s?.length'", + "markdown": "Reports redundant receiver-based `let` calls.\n\nThe quick-fix removes the redundant `let` call.\n\n**Example:**\n\n\n fun test(s: String?): Int? = s?.let { it.length }\n\nAfter the quick-fix is applied:\n\n\n fun test(s: String?): Int? = s?.length\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveSingleExpressionStringTemplate", + "shortDescription": { + "text": "Redundant string template" + }, + "fullDescription": { + "text": "Reports single-expression string templates that can be safely removed. Example: 'val x = \"Hello\"\n val y = \"$x\"' After the quick-fix is applied: 'val x = \"Hello\"\n val y = x // <== Updated'", + "markdown": "Reports single-expression string templates that can be safely removed.\n\n**Example:**\n\n val x = \"Hello\"\n val y = \"$x\"\n\nAfter the quick-fix is applied:\n\n val x = \"Hello\"\n val y = x // <== Updated\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IncompleteDestructuring", + "shortDescription": { + "text": "Incomplete destructuring declaration" + }, + "fullDescription": { + "text": "Reports incomplete destructuring declaration. Example: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person' The quick fix completes destructuring declaration with new variables: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person'", + "markdown": "Reports incomplete destructuring declaration.\n\n**Example:**\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person\n\nThe quick fix completes destructuring declaration with new variables:\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ScopeFunctionConversion", + "shortDescription": { + "text": "Scope function can be converted to another one" + }, + "fullDescription": { + "text": "Reports scope functions ('let', 'run', 'apply', 'also') that can be converted between each other. Using corresponding functions makes your code simpler. The quick-fix replaces the scope function to another one. Example: 'val x = \"\".let {\n it.length\n }' After the quick-fix is applied: 'val x = \"\".run {\n length\n }'", + "markdown": "Reports scope functions (`let`, `run`, `apply`, `also`) that can be converted between each other.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the scope function to another one.\n\n**Example:**\n\n\n val x = \"\".let {\n it.length\n }\n\nAfter the quick-fix is applied:\n\n\n val x = \"\".run {\n length\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TrailingComma", + "shortDescription": { + "text": "Trailing comma recommendations" + }, + "fullDescription": { + "text": "Reports trailing commas that are not follow the recommended style guide.", + "markdown": "Reports trailing commas that are not follow the recommended [style guide](https://kotlinlang.org/docs/coding-conventions.html#trailing-commas)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FoldInitializerAndIfToElvis", + "shortDescription": { + "text": "If-Null return/break/... foldable to '?:'" + }, + "fullDescription": { + "text": "Reports an 'if' expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer. Example: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }' The quick-fix converts the 'if' expression with an initializer into an elvis expression: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }'", + "markdown": "Reports an `if` expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer.\n\n**Example:**\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }\n\nThe quick-fix converts the `if` expression with an initializer into an elvis expression:\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinInvalidBundleOrProperty", + "shortDescription": { + "text": "Invalid property key" + }, + "fullDescription": { + "text": "Reports unresolved references to '.properties' file keys and resource bundles in Kotlin files.", + "markdown": "Reports unresolved references to `.properties` file keys and resource bundles in Kotlin files." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UselessCallOnCollection", + "shortDescription": { + "text": "Useless call on collection type" + }, + "fullDescription": { + "text": "Reports 'filter…' calls from the standard library on already filtered collections. Several functions from the standard library such as 'filterNotNull()' or 'filterIsInstance' have sense only when they are called on receivers that have types distinct from the resulting one. Otherwise, such calls can be omitted as the result will be the same. Remove redundant call quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }'", + "markdown": "Reports `filter...` calls from the standard library on already filtered collections.\n\nSeveral functions from the standard library such as `filterNotNull()` or `filterIsInstance`\nhave sense only when they are called on receivers that have types distinct from the resulting one. Otherwise,\nsuch calls can be omitted as the result will be the same.\n\n**Remove redundant call** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantRequireNotNullCall", + "shortDescription": { + "text": "Redundant 'requireNotNull' or 'checkNotNull' call" + }, + "fullDescription": { + "text": "Reports redundant 'requireNotNull' or 'checkNotNull' call on non-nullable expressions. Example: 'fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }' After the quick-fix is applied: 'fun foo(i: Int) {\n ...\n }'", + "markdown": "Reports redundant `requireNotNull` or `checkNotNull` call on non-nullable expressions.\n\n**Example:**\n\n\n fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(i: Int) {\n ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObjectPropertyName", + "shortDescription": { + "text": "Object property naming convention" + }, + "fullDescription": { + "text": "Reports properties that do not follow the naming conventions. The following properties are reported: Top-level properties Properties in objects and companion objects You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with an uppercase letter, use camel case and no underscores. Example: '// top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }'", + "markdown": "Reports properties that do not follow the naming conventions.\n\nThe following properties are reported:\n\n* Top-level properties\n* Properties in objects and companion objects\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): it has to start with an uppercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n // top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PackageDirectoryMismatch", + "shortDescription": { + "text": "Package name does not match containing directory" + }, + "fullDescription": { + "text": "Reports 'package' directives that do not match the location of the file.", + "markdown": "Reports `package` directives that do not match the location of the file." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinCovariantEquals", + "shortDescription": { + "text": "Covariant 'equals()'" + }, + "fullDescription": { + "text": "Reports 'equals()' that takes an argument type other than 'Any?' if the class does not have another 'equals()' that takes 'Any?' as its argument type. Example: 'class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }' To fix the problem create 'equals()' method that takes an argument of type 'Any?'.", + "markdown": "Reports `equals()` that takes an argument type other than `Any?` if the class does not have another `equals()` that takes `Any?` as its argument type.\n\n**Example:**\n\n\n class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }\n\nTo fix the problem create `equals()` method that takes an argument of type `Any?`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSizeZeroCheckWithIsEmpty", + "shortDescription": { + "text": "Size zero check can be replaced with 'isEmpty()'" + }, + "fullDescription": { + "text": "Reports 'size == 0' checks on 'Collections/Array/String' that should be replaced with 'isEmpty()'. Using 'isEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }'", + "markdown": "Reports `size == 0` checks on `Collections/Array/String` that should be replaced with `isEmpty()`.\n\nUsing `isEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantEnumConstructorInvocation", + "shortDescription": { + "text": "Redundant enum constructor invocation" + }, + "fullDescription": { + "text": "Reports redundant constructor invocation on an enum entry. Example: 'enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }' After the quick-fix is applied: 'enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }'", + "markdown": "Reports redundant constructor invocation on an enum entry.\n\n**Example:**\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }\n\nAfter the quick-fix is applied:\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DirectUseOfResultType", + "shortDescription": { + "text": "Function returning Result directly" + }, + "fullDescription": { + "text": "Reports functions that use 'Result' as a return type. 'Result' should never be used as a return type. Throw an exception, use a nullable type, or use a domain-specific result class to indicate failure. Example: 'fun foo() = Result.success(true)'", + "markdown": "Reports functions that use `Result` as a return type.\n\n\n`Result` should never be used as a return type.\nThrow an exception, use a nullable type, or use a domain-specific result class to indicate failure.\n\n**Example:**\n\n\n fun foo() = Result.success(true)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FakeJvmFieldConstant", + "shortDescription": { + "text": "Kotlin non-const property used as Java constant" + }, + "fullDescription": { + "text": "Reports Kotlin properties that are not 'const' and used as Java annotation arguments. For example, a property with the '@JvmField' annotation has an initializer that can be evaluated at compile-time, and it has a primitive or 'String' type. Such properties have a 'ConstantValue' attribute in bytecode in Kotlin 1.1-1.2. This attribute allows javac to fold usages of the corresponding field and use that field in annotations. This can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code. This behavior is subject to change in Kotlin 1.3 (no 'ConstantValue' attribute any more). Example: Kotlin code in foo.kt file: 'annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"' Java code: 'public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }' To fix the problem replace the '@JvmField' annotation with the 'const' modifier on a relevant Kotlin property or inline it.", + "markdown": "Reports Kotlin properties that are not `const` and used as Java annotation arguments.\n\n\nFor example, a property with the `@JvmField` annotation has an initializer that can be evaluated at compile-time,\nand it has a primitive or `String` type.\n\n\nSuch properties have a `ConstantValue` attribute in bytecode in Kotlin 1.1-1.2.\nThis attribute allows javac to fold usages of the corresponding field and use that field in annotations.\nThis can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code.\nThis behavior is subject to change in Kotlin 1.3 (no `ConstantValue` attribute any more).\n\n**Example:**\n\nKotlin code in foo.kt file:\n\n\n annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"\n\nJava code:\n\n\n public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }\n\nTo fix the problem replace the `@JvmField` annotation with the `const` modifier on a relevant Kotlin property or inline it." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WhenWithOnlyElse", + "shortDescription": { + "text": "'when' has only 'else' branch and can be simplified" + }, + "fullDescription": { + "text": "Reports 'when' expressions with only an 'else' branch that can be simplified. Simplify expression quick-fix can be used to amend the code automatically. Example: 'fun redundant() {\n val x = when { // <== redundant, a quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }'", + "markdown": "Reports `when` expressions with only an `else` branch that can be simplified.\n\n**Simplify expression** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun redundant() {\n val x = when { // <== redundant, a quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Reformat", + "shortDescription": { + "text": "File is not formatted according to project settings" + }, + "fullDescription": { + "text": "Reports places that are not formatted according to the project settings. Use the 'Reformat Code' and 'Reformat File...' quick-fixes to format either the highlighted code block or the entire file accordingly.", + "markdown": "Reports places that are not formatted according to the project settings.\n\nUse the 'Reformat Code' and 'Reformat File...' quick-fixes to format either the highlighted code block\nor the entire file accordingly." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinTestJUnit", + "shortDescription": { + "text": "kotlin-test-junit could be used" + }, + "fullDescription": { + "text": "Reports usage of 'kotlin-test' and 'junit' dependency without 'kotlin-test-junit'. It is recommended to use 'kotlin-test-junit' dependency to work with Kotlin and JUnit.", + "markdown": "Reports usage of `kotlin-test` and `junit` dependency without `kotlin-test-junit`.\n\nIt is recommended to use `kotlin-test-junit` dependency to work with Kotlin and JUnit." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SafeCastWithReturn", + "shortDescription": { + "text": "Safe cast with 'return' should be replaced with 'if' type check" + }, + "fullDescription": { + "text": "Reports safe cast with 'return' that can be replaced with 'if' type check. Using corresponding functions makes your code simpler. The quick-fix replaces the safe cast with 'if' type check. Example: 'fun test(x: Any) {\n x as? String ?: return\n }' After the quick-fix is applied: 'fun test(x: Any) {\n if (x !is String) return\n }'", + "markdown": "Reports safe cast with `return` that can be replaced with `if` type check.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the safe cast with `if` type check.\n\n**Example:**\n\n\n fun test(x: Any) {\n x as? String ?: return\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(x: Any) {\n if (x !is String) return\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceAssertBooleanWithAssertEquality", + "shortDescription": { + "text": "Assert boolean could be replaced with assert equality" + }, + "fullDescription": { + "text": "Reports calls to 'assertTrue()' and 'assertFalse()' that can be replaced with assert equality functions. 'assertEquals()', 'assertSame()', and their negating counterparts (-Not-) provide more informative messages on failure. Example: 'assertTrue(a == b)' After the quick-fix is applied: 'assertEquals(a, b)'", + "markdown": "Reports calls to `assertTrue()` and `assertFalse()` that can be replaced with assert equality functions.\n\n\n`assertEquals()`, `assertSame()`, and their negating counterparts (-Not-) provide more informative messages on\nfailure.\n\n**Example:**\n\n assertTrue(a == b)\n\nAfter the quick-fix is applied:\n\n assertEquals(a, b)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceStringFormatWithLiteral", + "shortDescription": { + "text": "'String.format' call can be replaced with string templates" + }, + "fullDescription": { + "text": "Reports 'String.format' calls that can be replaced with string templates. Using string templates makes your code simpler. The quick-fix replaces the call with a string template. Example: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }' After the quick-fix is applied: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }'", + "markdown": "Reports `String.format` calls that can be replaced with string templates.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces the call with a string template.\n\n**Example:**\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceNotNullAssertionWithElvisReturn", + "shortDescription": { + "text": "Not-null assertion can be replaced with 'return'" + }, + "fullDescription": { + "text": "Reports not-null assertion ('!!') calls that can be replaced with the elvis operator and return ('?: return'). A not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of '!!' is good practice. The quick-fix replaces the not-null assertion with 'return' or 'return null'. Example: 'fun test(number: Int?) {\n val x = number!!\n }' After the quick-fix is applied: 'fun test(number: Int?) {\n val x = number ?: return\n }'", + "markdown": "Reports not-null assertion (`!!`) calls that can be replaced with the elvis operator and return (`?: return`).\n\nA not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of `!!` is good practice.\n\nThe quick-fix replaces the not-null assertion with `return` or `return null`.\n\n**Example:**\n\n\n fun test(number: Int?) {\n val x = number!!\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(number: Int?) {\n val x = number ?: return\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithSubstringBefore", + "shortDescription": { + "text": "'substring' call should be replaced with 'substringBefore'" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, s.indexOf(x))' that can be replaced with 's.substringBefore(x)'. Using 'substringBefore()' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringBefore'. Example: 'fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringBefore('x')\n }'", + "markdown": "Reports calls like `s.substring(0, s.indexOf(x))` that can be replaced with `s.substringBefore(x)`.\n\nUsing `substringBefore()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringBefore`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringBefore('x')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithOperatorAssignment", + "shortDescription": { + "text": "Assignment can be replaced with operator assignment" + }, + "fullDescription": { + "text": "Reports modifications of variables with a simple assignment (such as 'y = y + x') that can be replaced with an operator assignment. The quick-fix replaces the assignment with an assignment operator. Example: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }' After the quick-fix is applied: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }'", + "markdown": "Reports modifications of variables with a simple assignment (such as `y = y + x`) that can be replaced with an operator assignment.\n\nThe quick-fix replaces the assignment with an assignment operator.\n\n**Example:**\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedSymbol", + "shortDescription": { + "text": "Unused symbol" + }, + "fullDescription": { + "text": "Reports symbols that are not used or not reachable from entry points.", + "markdown": "Reports symbols that are not used or not reachable from entry points." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceCollectionCountWithSize", + "shortDescription": { + "text": "Collection count can be converted to size" + }, + "fullDescription": { + "text": "Reports calls to 'Collection.count()'. This function call can be replaced with '.size'. '.size' form ensures that the operation is O(1) and won't allocate extra objects, whereas 'count()' could be confused with 'Iterable.count()', which is O(n) and allocating. Example: 'fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }' After the quick-fix is applied: 'fun foo() {\n var list = listOf(1,2,3)\n list.size\n }'", + "markdown": "Reports calls to `Collection.count()`.\n\n\nThis function call can be replaced with `.size`.\n\n\n`.size` form ensures that the operation is O(1) and won't allocate extra objects, whereas\n`count()` could be confused with `Iterable.count()`, which is O(n) and allocating.\n\n\n**Example:**\n\n fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }\n\nAfter the quick-fix is applied:\n\n fun foo() {\n var list = listOf(1,2,3)\n list.size\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceArrayEqualityOpWithArraysEquals", + "shortDescription": { + "text": "Arrays comparison via '==' and '!='" + }, + "fullDescription": { + "text": "Reports usages of '==' or '!=' operator for arrays that should be replaced with 'contentEquals()'. The '==' and '!='operators compare array references instead of their content. Examples: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }' After the quick-fix is applied: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }'", + "markdown": "Reports usages of `==` or `!=` operator for arrays that should be replaced with `contentEquals()`.\n\n\nThe `==` and `!=`operators compare array references instead of their content.\n\n**Examples:**\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }\n\nAfter the quick-fix is applied:\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedGradleDependency", + "shortDescription": { + "text": "Deprecated library is used in Gradle" + }, + "fullDescription": { + "text": "Reports deprecated dependencies in Gradle build scripts. Example: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }' After the quick-fix applied: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }'", + "markdown": "Reports deprecated dependencies in Gradle build scripts.\n\n**Example:**\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }\n\nAfter the quick-fix applied:\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertReferenceToLambda", + "shortDescription": { + "text": "Can be replaced with lambda" + }, + "fullDescription": { + "text": "Reports a function reference expression that can be replaced with a function literal (lambda). Sometimes, passing a lambda looks more straightforward and more consistent with the rest of the code. Also, the fix might be handy if you need to replace a simple call with something more complex. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }'", + "markdown": "Reports a function reference expression that can be replaced with a function literal (lambda).\n\n\nSometimes, passing a lambda looks more straightforward and more consistent with the rest of the code.\nAlso, the fix might be handy if you need to replace a simple call with something more complex.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnlabeledReturnInsideLambda", + "shortDescription": { + "text": "Unlabeled return inside lambda" + }, + "fullDescription": { + "text": "Reports unlabeled 'return' expressions inside inline lambda. Such expressions can be confusing because it might be unclear which scope belongs to 'return'. Change to return@… quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }'", + "markdown": "Reports unlabeled `return` expressions inside inline lambda.\n\nSuch expressions can be confusing because it might be unclear which scope belongs to `return`.\n\n**Change to return@...** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LateinitVarOverridesLateinitVar", + "shortDescription": { + "text": "lateinit var property overrides lateinit var property" + }, + "fullDescription": { + "text": "Reports 'lateinit var' properties that override another 'lateinit var' property. A subclass instance will have two fields for the single property, and the one from the superclass will remain effectively unused. Example: open class BaseClass { open lateinit var name: String } class RealClass : BaseClass() { override lateinit var name: String } ''", + "markdown": "Reports `lateinit var` properties that override another `lateinit var` property.\n\n\nA subclass instance will have two fields for the single property, and the one from the superclass will remain effectively unused.\n\n**Example:**\nopen class BaseClass { open lateinit var name: String } class RealClass : BaseClass() { override lateinit var name: String }\n\n```\n\n```" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentKotlinGradleVersion", + "shortDescription": { + "text": "Kotlin Gradle and IDE plugins versions are different" + }, + "fullDescription": { + "text": "Reports that different IDE and Gradle plugin versions are used. This can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }' To fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin.", + "markdown": "Reports that different IDE and Gradle plugin versions are used.\n\nThis can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }\n\nTo fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinEqualsBetweenInconvertibleTypes", + "shortDescription": { + "text": "'equals()' between objects of inconvertible types" + }, + "fullDescription": { + "text": "Reports calls to 'equals()' where the receiver and the argument are of incompatible primitive, enum, or string types. While such a call might theoretically be useful, most likely it represents a bug. Example: '5.equals(\"\");'", + "markdown": "Reports calls to `equals()` where the receiver and the argument are of incompatible primitive, enum, or string types.\n\nWhile such a call might theoretically be useful, most likely it represents a bug.\n\n**Example:**\n\n 5.equals(\"\");\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JoinDeclarationAndAssignment", + "shortDescription": { + "text": "Join declaration and assignment" + }, + "fullDescription": { + "text": "Reports property declarations that can be joined with the following assignment. Example: 'val x: String\n x = System.getProperty(\"\")' The quick fix joins the declaration with the assignment: 'val x = System.getProperty(\"\")'", + "markdown": "Reports property declarations that can be joined with the following assignment.\n\n**Example:**\n\n\n val x: String\n x = System.getProperty(\"\")\n\nThe quick fix joins the declaration with the assignment:\n\n\n val x = System.getProperty(\"\")\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HasPlatformType", + "shortDescription": { + "text": "Function or property has platform type" + }, + "fullDescription": { + "text": "Reports functions and properties that have a platform type. To prevent unexpected errors, the type should be declared explicitly. Example: 'fun foo() = java.lang.String.valueOf(1)' The quick fix allows you to specify the return type: 'fun foo(): String = java.lang.String.valueOf(1)'", + "markdown": "Reports functions and properties that have a platform type.\n\nTo prevent unexpected errors, the type should be declared explicitly.\n\n**Example:**\n\n\n fun foo() = java.lang.String.valueOf(1)\n\nThe quick fix allows you to specify the return type:\n\n\n fun foo(): String = java.lang.String.valueOf(1)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DataClassPrivateConstructor", + "shortDescription": { + "text": "Private data class constructor is exposed via the 'copy' method" + }, + "fullDescription": { + "text": "Reports the 'private' primary constructor in data classes. 'data' classes have a 'copy()' factory method that can be used similarly to a constructor. A constructor should not be marked as 'private' to provide enough safety. Example: 'data class User private constructor(val name: String)' A quick-fix changes the constructor visibility modifier to 'public': 'data class User(val name: String)'", + "markdown": "Reports the `private` primary constructor in data classes.\n\n\n`data` classes have a `copy()` factory method that can be used similarly to a constructor.\nA constructor should not be marked as `private` to provide enough safety.\n\n**Example:**\n\n\n data class User private constructor(val name: String)\n\nA quick-fix changes the constructor visibility modifier to `public`:\n\n\n data class User(val name: String)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantInnerClassModifier", + "shortDescription": { + "text": "Redundant 'inner' modifier" + }, + "fullDescription": { + "text": "Reports the 'inner' modifier on a class as redundant if it doesn't reference members of its outer class. Example: 'class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }' After the quick-fix is applied: 'class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }'", + "markdown": "Reports the `inner` modifier on a class as redundant if it doesn't reference members of its outer class.\n\n**Example:**\n\n\n class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaCollectionsStaticMethodOnImmutableList", + "shortDescription": { + "text": "Call of Java mutator method on immutable Kotlin collection" + }, + "fullDescription": { + "text": "Reports Java mutator methods calls (like 'fill', 'reverse', 'shuffle', 'sort') on an immutable Kotlin collection. This can lead to 'UnsupportedOperationException' at runtime. Example: 'import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }' To fix the problem make the list mutable.", + "markdown": "Reports Java mutator methods calls (like `fill`, `reverse`, `shuffle`, `sort`) on an immutable Kotlin collection.\n\nThis can lead to `UnsupportedOperationException` at runtime.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }\n\nTo fix the problem make the list mutable." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MavenCoroutinesDeprecation", + "shortDescription": { + "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Maven" + }, + "fullDescription": { + "text": "Reports kotlinx.coroutines library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later.", + "markdown": "Reports **kotlinx.coroutines** library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration/Maven", + "index": 119, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NullableBooleanElvis", + "shortDescription": { + "text": "Equality check can be used instead of elvis for nullable boolean check" + }, + "fullDescription": { + "text": "Reports cases when an equality check should be used instead of the elvis operator. Example: 'fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n}' After the quick-fix is applied: 'fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n}'", + "markdown": "Reports cases when an equality check should be used instead of the elvis operator.\n\n**Example:**\n\n\n fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n }\n\nAfter the quick-fix is applied:\n\n\n fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedMavenDependency", + "shortDescription": { + "text": "Deprecated library is used in Maven" + }, + "fullDescription": { + "text": "Reports deprecated maven dependency. Example: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n ' The quick fix changes the deprecated dependency to a maintained one: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n '", + "markdown": "Reports deprecated maven dependency.\n\n**Example:**\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n \n\nThe quick fix changes the deprecated dependency to a maintained one:\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnnecessaryVariable", + "shortDescription": { + "text": "Unnecessary local variable" + }, + "fullDescription": { + "text": "Reports local variables that used only in the very next 'return' statement or exact copies of other variables. Such variables can be safely inlined to make the code more clear.", + "markdown": "Reports local variables that used only in the very next `return` statement or exact copies of other variables.\n\nSuch variables can be safely inlined to make the code more clear." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantEmptyInitializerBlock", + "shortDescription": { + "text": "Redundant empty initializer block" + }, + "fullDescription": { + "text": "Reports redundant empty initializer blocks. Example: 'class Foo {\n init {\n // Empty init block\n }\n }' After the quick-fix is applied: 'class Foo {\n }'", + "markdown": "Reports redundant empty initializer blocks.\n\n**Example:**\n\n\n class Foo {\n init {\n // Empty init block\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "GradleKotlinxCoroutinesDeprecation", + "shortDescription": { + "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Gradle" + }, + "fullDescription": { + "text": "Reports 'kotlinx.coroutines' library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+. Example: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }' The quick fix changes the 'kotlinx.coroutines' library version to a compatible with Kotlin 1.3: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }'", + "markdown": "Reports `kotlinx.coroutines` library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+.\n\n**Example:**\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }\n\nThe quick fix changes the `kotlinx.coroutines` library version to a compatible with Kotlin 1.3:\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration/Gradle", + "index": 127, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantWith", + "shortDescription": { + "text": "Redundant 'with' call" + }, + "fullDescription": { + "text": "Reports redundant 'with' function calls that don't access anything from the receiver. Examples: 'class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }'", + "markdown": "Reports redundant `with` function calls that don't access anything from the receiver.\n\n**Examples:**\n\n\n class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WarningOnMainUnusedParameterMigration", + "shortDescription": { + "text": "Unused `args` on `main` since 1.4" + }, + "fullDescription": { + "text": "Reports 'main' function with an unused single parameter. Since Kotlin 1.4, it is possible to use the 'main' function without parameter as the entry point to the Kotlin program. The compiler reports a warning for the 'main' function with an unused parameter.", + "markdown": "Reports `main` function with an unused single parameter.\n\nSince Kotlin 1.4, it is possible to use the `main` function without parameter as the entry point to the Kotlin program.\nThe compiler reports a warning for the `main` function with an unused parameter." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLabelMigration", + "shortDescription": { + "text": "Redundant label" + }, + "fullDescription": { + "text": "Reports redundant labels which cause compilation errors since Kotlin 1.4. Since Kotlin 1.0, one can mark any statement with a label: 'fun foo() {\n L1@ val x = L2@bar()\n }' However, these labels can be referenced only in a limited number of ways: break / continue from a loop non-local return from an inline lambda or inline anonymous function sssss Such labels are prohibited since Kotlin 1.4. This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports redundant labels which cause compilation errors since Kotlin 1.4.\n\nSince Kotlin 1.0, one can mark any statement with a label:\n\n\n fun foo() {\n L1@ val x = L2@bar()\n }\n\nHowever, these labels can be referenced only in a limited number of ways:\n\n* break / continue from a loop\n* non-local return from an inline lambda or inline anonymous function\nsssss\n\nSuch labels are prohibited since Kotlin 1.4.\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceNegatedIsEmptyWithIsNotEmpty", + "shortDescription": { + "text": "Negated call can be simplified" + }, + "fullDescription": { + "text": "Reports negation 'isEmpty()' and 'isNotEmpty()' for collections and 'String', or 'isBlank()' and 'isNotBlank()' for 'String'. Using corresponding functions makes your code simpler. The quick-fix replaces the negation call with the corresponding call from the Standard Library. Example: 'fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }' After the quick-fix is applied: 'fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }'", + "markdown": "Reports negation `isEmpty()` and `isNotEmpty()` for collections and `String`, or `isBlank()` and `isNotBlank()` for `String`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the negation call with the corresponding call from the Standard Library.\n\n**Example:**\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DelegationToVarProperty", + "shortDescription": { + "text": "Delegating to 'var' property" + }, + "fullDescription": { + "text": "Reports interface delegation to a 'var' property. Only initial value of a property is used for delegation, any later assignments do not affect it. Example: 'class Example(var text: CharSequence): CharSequence by text' A quick-fix replaces a property with immutable one: 'class Example(val text: CharSequence): CharSequence by text' Alternative way, if you rely on mutability for some reason: 'class Example(text: CharSequence): CharSequence by text {\n var text = text\n }'", + "markdown": "Reports interface delegation to a `var` property.\n\nOnly initial value of a property is used for delegation, any later assignments do not affect it.\n\n**Example:**\n\n\n class Example(var text: CharSequence): CharSequence by text\n\nA quick-fix replaces a property with immutable one:\n\n\n class Example(val text: CharSequence): CharSequence by text\n\nAlternative way, if you rely on mutability for some reason:\n\n\n class Example(text: CharSequence): CharSequence by text {\n var text = text\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstantConditionIf", + "shortDescription": { + "text": "Condition of 'if' expression is constant" + }, + "fullDescription": { + "text": "Reports 'if' expressions that have 'true' or 'false' constant literal condition and can be simplified. While occasionally intended, this construction is confusing and often the result of a typo or previous refactoring. Example: 'fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }' A quick-fix removes the 'if' condition: 'fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }'", + "markdown": "Reports `if` expressions that have `true` or `false` constant literal condition and can be simplified.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo\nor previous refactoring.\n\n**Example:**\n\n\n fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }\n\nA quick-fix removes the `if` condition:\n\n\n fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLambdaArrow", + "shortDescription": { + "text": "Redundant lambda arrow" + }, + "fullDescription": { + "text": "Reports redundant lambda arrows in lambdas without parameters. Example: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -> println(\"Hi!\") }\n }' After the quick-fix is applied: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }'", + "markdown": "Reports redundant lambda arrows in lambdas without parameters.\n\n**Example:**\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -\\> println(\"Hi!\") }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinInternalInJava", + "shortDescription": { + "text": "Usage of Kotlin internal declarations from Java" + }, + "fullDescription": { + "text": "Reports usages of Kotlin 'internal' declarations in Java code that is located in a different module. The 'internal' keyword is designed to restrict access to a class, function, or property from other modules. Due to JVM limitations, 'internal' classes, functions, and properties can still be accessed from outside Kotlin, which may later lead to compatibility problems.", + "markdown": "Reports usages of Kotlin `internal` declarations in Java code that is located in a different module.\n\n\nThe `internal` keyword is designed to restrict access to a class, function, or property from other modules.\nDue to JVM limitations, `internal` classes, functions, and properties can still be\naccessed from outside Kotlin, which may later lead to compatibility problems." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UseWithIndex", + "shortDescription": { + "text": "Manually incremented index variable can be replaced with use of 'withIndex()'" + }, + "fullDescription": { + "text": "Reports 'for' loops with a manually incremented index variable. 'for' loops with a manually incremented index variable can be simplified with the 'withIndex()' function. Use withIndex() instead of manual index increment quick-fix can be used to amend the code automatically. Example: 'fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }' After the quick-fix is applied: 'fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }'", + "markdown": "Reports `for` loops with a manually incremented index variable.\n\n`for` loops with a manually incremented index variable can be simplified with the `withIndex()` function.\n\n**Use withIndex() instead of manual index increment** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ImplicitThis", + "shortDescription": { + "text": "Implicit 'this'" + }, + "fullDescription": { + "text": "Reports usages of implicit this. Example: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }' The quick fix specifies this explicitly: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }'", + "markdown": "Reports usages of implicit **this** .\n\n**Example:**\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }\n\nThe quick fix specifies **this** explicitly:\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinCatchMayIgnoreException", + "shortDescription": { + "text": "'catch' block may ignore exception" + }, + "fullDescription": { + "text": "Reports 'catch' blocks that are empty or may ignore an exception. While occasionally intended, empty 'catch' blocks may complicate debugging. Also, ignoring a 'catch' parameter might be wrong. The inspection won't report any 'catch' parameters named 'ignore', 'ignored', or '_'. You can use a quick-fix to change the exception name to '_'. Example: 'try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }' After the quick-fix is applied: 'try {\n throwingMethod()\n } catch (_: IOException) {\n\n }' Use the Do not warn when 'catch' block contains a comment option to ignore 'catch' blocks with comments.", + "markdown": "Reports `catch` blocks that are empty or may ignore an exception.\n\nWhile occasionally intended, empty `catch` blocks may complicate debugging.\nAlso, ignoring a `catch` parameter might be wrong.\n\n\nThe inspection won't report any `catch` parameters named `ignore`, `ignored`, or `_`.\n\n\nYou can use a quick-fix to change the exception name to `_`.\n\n**Example:**\n\n\n try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n throwingMethod()\n } catch (_: IOException) {\n\n }\n\nUse the **Do not warn when 'catch' block contains a comment** option to ignore `catch` blocks with comments." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentStdlibGradleVersion", + "shortDescription": { + "text": "Kotlin library and Gradle plugin versions are different" + }, + "fullDescription": { + "text": "Reports different Kotlin stdlib and compiler versions. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }' To fix the problem change the kotlin stdlib version to match the kotlin compiler version.", + "markdown": "Reports different Kotlin stdlib and compiler versions.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }\n\nTo fix the problem change the kotlin stdlib version to match the kotlin compiler version." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBeVal", + "shortDescription": { + "text": "Local 'var' is never modified and can be declared as 'val'" + }, + "fullDescription": { + "text": "Reports local variables declared with the 'var' keyword that are never modified. Kotlin encourages to declare practically immutable variables using the 'val' keyword, ensuring that their value will never change. Example: 'fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }' A quick-fix replaces the 'var' keyword with 'val': 'fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }'", + "markdown": "Reports local variables declared with the `var` keyword that are never modified.\n\nKotlin encourages to declare practically immutable variables using the `val` keyword, ensuring that their value will never change.\n\n**Example:**\n\n\n fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n\nA quick-fix replaces the `var` keyword with `val`:\n\n\n fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithIgnoreCaseEquals", + "shortDescription": { + "text": "Should be replaced with 'equals(..., ignoreCase = true)'" + }, + "fullDescription": { + "text": "Reports case-insensitive comparisons that can be replaced with 'equals(..., ignoreCase = true)'. By using 'equals()' you don't have to allocate extra strings with 'toLowerCase()' or 'toUpperCase()' to compare strings. The quick-fix replaces the case-insensitive comparison that uses 'toLowerCase()' or 'toUpperCase()' with 'equals(..., ignoreCase = true)'. Note: May change semantics for some locales. Example: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }' After the quick-fix is applied: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }'", + "markdown": "Reports case-insensitive comparisons that can be replaced with `equals(..., ignoreCase = true)`.\n\nBy using `equals()` you don't have to allocate extra strings with `toLowerCase()` or `toUpperCase()` to compare strings.\n\nThe quick-fix replaces the case-insensitive comparison that uses `toLowerCase()` or `toUpperCase()` with `equals(..., ignoreCase = true)`.\n\n**Note:** May change semantics for some locales.\n\n**Example:**\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithSubstringAfter", + "shortDescription": { + "text": "'substring' call should be replaced with 'substringAfter'" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(s.indexOf(x))' that can be replaced with 's.substringAfter(x)'. Using 's.substringAfter(x)' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringAfter'. Example: 'fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringAfter('x')\n }'", + "markdown": "Reports calls like `s.substring(s.indexOf(x))` that can be replaced with `s.substringAfter(x)`.\n\nUsing `s.substringAfter(x)` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringAfter`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringAfter('x')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantCompanionReference", + "shortDescription": { + "text": "Redundant 'Companion' reference" + }, + "fullDescription": { + "text": "Reports redundant 'Companion' reference. Example: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }' After the quick-fix is applied: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }'", + "markdown": "Reports redundant `Companion` reference.\n\n**Example:**\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }\n\nAfter the quick-fix is applied:\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KDocUnresolvedReference", + "shortDescription": { + "text": "Unresolved reference in KDoc" + }, + "fullDescription": { + "text": "Reports unresolved references in KDoc comments. Example: '/**\n * [unresolvedLink]\n */\n fun foo() {}' To fix the problem make the link valid.", + "markdown": "Reports unresolved references in KDoc comments.\n\n**Example:**\n\n\n /**\n * [unresolvedLink]\n */\n fun foo() {}\n\nTo fix the problem make the link valid." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NestedLambdaShadowedImplicitParameter", + "shortDescription": { + "text": "Nested lambda has shadowed implicit parameter" + }, + "fullDescription": { + "text": "Reports nested lambdas with shadowed implicit parameters. Example: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n}' After the quick-fix is applied: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n}'", + "markdown": "Reports nested lambdas with shadowed implicit parameters.\n\n**Example:**\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSamConstructor", + "shortDescription": { + "text": "Redundant SAM constructor" + }, + "fullDescription": { + "text": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas. Example: 'fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}' After the quick-fix is applied: 'fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}'", + "markdown": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas.\n\n**Example:**\n\n\n fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "InconsistentCommentForJavaParameter", + "shortDescription": { + "text": "Inconsistent comment for java parameter" + }, + "fullDescription": { + "text": "Reports inconsistent parameter name for java method specified in a comment block. Examples: '// Java\n public class JavaService {\n public void invoke(String command) {}\n }' '// Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }' The quick fix corrects parameter name in a comment block: 'fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }'", + "markdown": "Reports inconsistent parameter name for **java** method specified in a comment block.\n\n**Examples:**\n\n\n // Java\n public class JavaService {\n public void invoke(String command) {}\n }\n\n\n // Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }\n\nThe quick fix corrects parameter name in a comment block:\n\n\n fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantCallsOfConversionMethods", + "shortDescription": { + "text": "Redundant call of conversion method" + }, + "fullDescription": { + "text": "Reports redundant calls to conversion methods (for example, 'toString()' on a 'String' or 'toDouble()' on a 'Double'). Use the 'Remove redundant calls of the conversion method' quick-fix to clean up the code.", + "markdown": "Reports redundant calls to conversion methods (for example, `toString()` on a `String` or `toDouble()` on a `Double`).\n\nUse the 'Remove redundant calls of the conversion method' quick-fix to clean up the code." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinThrowableNotThrown", + "shortDescription": { + "text": "Throwable not thrown" + }, + "fullDescription": { + "text": "Reports instantiations of 'Throwable' or its subclasses, when the created 'Throwable' is never actually thrown. The reported code indicates mistakes that are hard to catch in tests. Also, this inspection reports method calls that return instances of 'Throwable' or its subclasses, when the resulting 'Throwable' instance is not thrown. Example: 'fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }'", + "markdown": "Reports instantiations of `Throwable` or its subclasses, when the created `Throwable` is never actually thrown.\n\nThe reported code indicates mistakes that are hard to catch in tests.\n\n\nAlso, this inspection reports method calls that return instances of `Throwable` or its subclasses,\nwhen the resulting `Throwable` instance is not thrown.\n\n**Example:**\n\n\n fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinSealedInheritorsInJava", + "shortDescription": { + "text": "Inheritance of Kotlin sealed interface/class from Java" + }, + "fullDescription": { + "text": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code. Example: '// Kotlin file: MathExpression.kt\n\nsealed class MathExpression\n\ndata class Const(val number: Double) : MathExpression()\ndata class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()' '// Java file: NotANumber.java\n\npublic class NotANumber extends MathExpression {\n}'", + "markdown": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code.\n\n**Example:**\n\n\n // Kotlin file: MathExpression.kt\n\n sealed class MathExpression\n\n data class Const(val number: Double) : MathExpression()\n data class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()\n\n\n // Java file: NotANumber.java\n\n public class NotANumber extends MathExpression {\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyNegatedBinaryExpression", + "shortDescription": { + "text": "Negated boolean expression can be simplified" + }, + "fullDescription": { + "text": "Reports negated binary expressions that can be simplified. The quick-fix simplifies the binary expression. Example: 'fun test(n: Int) {\n !(0 == 1)\n }' After the quick-fix is applied: 'fun test(n: Int) {\n 0 != 1\n }'", + "markdown": "Reports negated binary expressions that can be simplified.\n\nThe quick-fix simplifies the binary expression.\n\n**Example:**\n\n\n fun test(n: Int) {\n !(0 == 1)\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(n: Int) {\n 0 != 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MemberVisibilityCanBePrivate", + "shortDescription": { + "text": "Class member can have 'private' visibility" + }, + "fullDescription": { + "text": "Reports declarations that can be made 'private' to follow the encapsulation principle. Example: 'class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}' After the quick-fix is applied (considering there are no usages of 'url' outside of 'Service' class): 'class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}'", + "markdown": "Reports declarations that can be made `private` to follow the encapsulation principle.\n\n**Example:**\n\n\n class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n\nAfter the quick-fix is applied (considering there are no usages of `url` outside of `Service` class):\n\n\n class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SelfAssignment", + "shortDescription": { + "text": "Redundant assignment" + }, + "fullDescription": { + "text": "Reports assignments of a variable to itself. The quick-fix removes the redundant assignment. Example: 'fun test() {\n var bar = 1\n bar = bar\n }' After the quick-fix is applied: 'fun test() {\n var bar = 1\n }'", + "markdown": "Reports assignments of a variable to itself.\n\nThe quick-fix removes the redundant assignment.\n\n**Example:**\n\n\n fun test() {\n var bar = 1\n bar = bar\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n var bar = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RecursiveEqualsCall", + "shortDescription": { + "text": "Recursive equals call" + }, + "fullDescription": { + "text": "Reports recursive 'equals'('==') calls. In Kotlin, '==' compares object values by calling 'equals' method under the hood. '===', on the other hand, compares objects by reference. '===' is commonly used in 'equals' method implementation. But '===' may be mistakenly mixed up with '==' leading to infinite recursion. Example: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }' After the quick-fix is applied: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }'", + "markdown": "Reports recursive `equals`(`==`) calls.\n\n\nIn Kotlin, `==` compares object values by calling `equals` method under the hood.\n`===`, on the other hand, compares objects by reference.\n\n\n`===` is commonly used in `equals` method implementation.\nBut `===` may be mistakenly mixed up with `==` leading to infinite recursion.\n\n**Example:**\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ExplicitThis", + "shortDescription": { + "text": "Redundant explicit 'this'" + }, + "fullDescription": { + "text": "Reports an explicit 'this' when it can be omitted. Example: 'class C {\n private val i = 1\n fun f() = this.i\n }' The quick-fix removes the redundant 'this': 'class C {\n private val i = 1\n fun f() = i\n }'", + "markdown": "Reports an explicit `this` when it can be omitted.\n\n**Example:**\n\n\n class C {\n private val i = 1\n fun f() = this.i\n }\n\nThe quick-fix removes the redundant `this`:\n\n\n class C {\n private val i = 1\n fun f() = i\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NullChecksToSafeCall", + "shortDescription": { + "text": "Null-checks can be replaced with safe-calls" + }, + "fullDescription": { + "text": "Reports chained null-checks that can be replaced with safe-calls. Example: 'fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }' After the quick-fix is applied: 'fun test(my: My?) {\n if (my?.foo() != null) {}\n }'", + "markdown": "Reports chained null-checks that can be replaced with safe-calls.\n\n**Example:**\n\n\n fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(my: My?) {\n if (my?.foo() != null) {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedMainParameter", + "shortDescription": { + "text": "Main parameter is not necessary" + }, + "fullDescription": { + "text": "Reports 'main' function with an unused single parameter.", + "markdown": "Reports `main` function with an unused single parameter." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionWithLambdaExpressionBody", + "shortDescription": { + "text": "Function with `= { ... }` and inferred return type" + }, + "fullDescription": { + "text": "Reports functions with '= { ... }' and inferred return type. Example: 'fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.' The quick fix removes braces: 'fun sum(a: Int, b: Int) = a + b'", + "markdown": "Reports functions with `= { ... }` and inferred return type.\n\n**Example:**\n\n\n fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.\n\nThe quick fix removes braces:\n\n\n fun sum(a: Int, b: Int) = a + b\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ArrayInDataClass", + "shortDescription": { + "text": "Array property in data class" + }, + "fullDescription": { + "text": "Reports properties with an 'Array' type in a 'data' class without overridden 'equals()' or 'hashCode()'. Array parameters are compared by reference equality, which is likely an unexpected behavior. It is strongly recommended to override 'equals()' and 'hashCode()' in such cases. Example: 'data class Text(val lines: Array)' A quick-fix generates missing 'equals()' and 'hashCode()' implementations: 'data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }'", + "markdown": "Reports properties with an `Array` type in a `data` class without overridden `equals()` or `hashCode()`.\n\n\nArray parameters are compared by reference equality, which is likely an unexpected behavior.\nIt is strongly recommended to override `equals()` and `hashCode()` in such cases.\n\n**Example:**\n\n\n data class Text(val lines: Array)\n\nA quick-fix generates missing `equals()` and `hashCode()` implementations:\n\n\n data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertTwoComparisonsToRangeCheck", + "shortDescription": { + "text": "Two comparisons should be converted to a range check" + }, + "fullDescription": { + "text": "Reports two consecutive comparisons that can be converted to a range check. Checking against a range makes code simpler by removing test subject duplication. Example: 'fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }' A quick-fix replaces the comparison-based check with a range one: 'fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }'", + "markdown": "Reports two consecutive comparisons that can be converted to a range check.\n\nChecking against a range makes code simpler by removing test subject duplication.\n\n**Example:**\n\n\n fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }\n\nA quick-fix replaces the comparison-based check with a range one:\n\n\n fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LocalVariableName", + "shortDescription": { + "text": "Local variable naming convention" + }, + "fullDescription": { + "text": "Reports local variables that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with a lowercase letter, use camel case and no underscores. Example: 'fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }'", + "markdown": "Reports local variables that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#function-names): it has to start with a lowercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantQualifierName", + "shortDescription": { + "text": "Redundant qualifier name" + }, + "fullDescription": { + "text": "Reports redundant qualifiers (or their parts) on class names, functions, and properties. A fully qualified name is an unambiguous identifier that specifies which object, function, or property a call refers to. In the contexts where the name can be shortened, the inspection informs on the opportunity and the associated 'Remove redundant qualifier name' quick-fix allows amending the code. Examples: 'package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = my.simple.name.Foo() // 'Foo' resides in the declared 'my.simple.name' package, qualifier is redundant\n val b = kotlin.Int.MAX_VALUE // Can be replaced with 'MAX_VALUE' since it's imported\n val c = kotlin.Double.MAX_VALUE // Can be replaced with 'Double.MAX_VALUE' since built-in types are imported automatically\n }' After the quick-fix is applied: 'package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = Foo()\n val b = MAX_VALUE\n val c = Double.MAX_VALUE\n }'", + "markdown": "Reports redundant qualifiers (or their parts) on class names, functions, and properties.\n\n\nA fully qualified name is an unambiguous identifier that specifies which object, function, or property a call refers to.\nIn the contexts where the name can be shortened, the inspection informs on the opportunity and the associated\n'Remove redundant qualifier name' quick-fix allows amending the code.\n\n**Examples:**\n\n\n package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = my.simple.name.Foo() // 'Foo' resides in the declared 'my.simple.name' package, qualifier is redundant\n val b = kotlin.Int.MAX_VALUE // Can be replaced with 'MAX_VALUE' since it's imported\n val c = kotlin.Double.MAX_VALUE // Can be replaced with 'Double.MAX_VALUE' since built-in types are imported automatically\n }\n\nAfter the quick-fix is applied:\n\n\n package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = Foo()\n val b = MAX_VALUE\n val c = Double.MAX_VALUE\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveCurlyBracesFromTemplate", + "shortDescription": { + "text": "Redundant curly braces in string template" + }, + "fullDescription": { + "text": "Reports usages of curly braces in string templates around simple identifiers. Use the 'Remove curly braces' quick-fix to remove the redundant braces. Examples: 'fun redundant() {\n val x = 4\n val y = \"${x}\" // <== redundant\n }\n\n fun correctUsage() {\n val x = \"x\"\n val y = \"${x.length}\" // <== Ok\n }' After the quick-fix is applied: 'fun redundant() {\n val x = 4\n val y = \"$x\"\n }\n\n fun correctUsage() {\n val x = \"x\" <== Updated\n val y = \"${x.length}\"\n }'", + "markdown": "Reports usages of curly braces in string templates around simple identifiers.\n\nUse the 'Remove curly braces' quick-fix to remove the redundant braces.\n\n**Examples:**\n\n\n fun redundant() {\n val x = 4\n val y = \"${x}\" // <== redundant\n }\n\n fun correctUsage() {\n val x = \"x\"\n val y = \"${x.length}\" // <== Ok\n }\n\nAfter the quick-fix is applied:\n\n\n fun redundant() {\n val x = 4\n val y = \"$x\"\n }\n\n fun correctUsage() {\n val x = \"x\" <== Updated\n val y = \"${x.length}\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithIndexingOperation", + "shortDescription": { + "text": "'substring' call should be replaced with indexing operator" + }, + "fullDescription": { + "text": "Reports calls like '\"abc\".substring(0, 1)' that can be replaced with '\"abc\"[0]'. Obtaining the element by index makes your code simpler. The quick-fix replaces the 'substring' call with the indexing operator. Example: 'fun foo() {\n \"abc\".substring(0, 1)\n }' After the quick-fix is applied: 'fun foo() {\n \"abc\"[0]\n }'", + "markdown": "Reports calls like `\"abc\".substring(0, 1)` that can be replaced with `\"abc\"[0]`.\n\nObtaining the element by index makes your code simpler.\n\nThe quick-fix replaces the `substring` call with the indexing operator.\n\n**Example:**\n\n\n fun foo() {\n \"abc\".substring(0, 1)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n \"abc\"[0]\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MoveLambdaOutsideParentheses", + "shortDescription": { + "text": "Lambda argument inside parentheses" + }, + "fullDescription": { + "text": "Reports lambda expressions in parentheses which can be moved outside. Example: 'fun square(a: Int, b: (Int) -> Int) {\n b(a * a)\n}\n\nfun foo() {\n square(2, { it })\n}' After the quick-fix is applied: 'fun foo() {\n square(2){ it }\n}'", + "markdown": "Reports lambda expressions in parentheses which can be moved outside.\n\n**Example:**\n\n\n fun square(a: Int, b: (Int) -> Int) {\n b(a * a)\n }\n\n fun foo() {\n square(2, { it })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n square(2){ it }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OverridingDeprecatedMember", + "shortDescription": { + "text": "Overriding deprecated member" + }, + "fullDescription": { + "text": "Reports declarations that inherit from deprecated members. Example: 'open class BaseService {\n @Deprecated(\"obsolete\", replaceWith = ReplaceWith(\"connection\"))\n open fun connect() {}\n\n open fun connection() {}\n} \n\nclass SomeService: BaseService() {\n override fun connect() {\n super.connect()\n }\n}'", + "markdown": "Reports declarations that inherit from deprecated members.\n\n**Example:**\n\n\n open class BaseService {\n @Deprecated(\"obsolete\", replaceWith = ReplaceWith(\"connection\"))\n open fun connect() {}\n\n open fun connection() {}\n } \n\n class SomeService: BaseService() {\n override fun connect() {\n super.connect()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitTypeParametersForLocalVariablesMigration", + "shortDescription": { + "text": "Local variable with type parameters" + }, + "fullDescription": { + "text": "Reports local variables with type parameters. A type parameter for a local variable doesn't make sense because it can't be specialized. Example: 'fun main() {\n val x = \"\"\n }' After the quick-fix is applied: 'fun main() {\n val x = \"\"\n }' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports local variables with type parameters.\n\nA type parameter for a local variable doesn't make sense because it can't be specialized.\n\n**Example:**\n\n\n fun main() {\n val x = \"\"\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val x = \"\"\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TestFunctionName", + "shortDescription": { + "text": "Test function naming convention" + }, + "fullDescription": { + "text": "Reports test function names that do not follow the recommended naming conventions.", + "markdown": "Reports test function names that do not follow the [recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#names-for-test-methods)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RecursivePropertyAccessor", + "shortDescription": { + "text": "Recursive property accessor" + }, + "fullDescription": { + "text": "Reports recursive property accessor calls which can end up with a 'StackOverflowError'. Such calls are usually confused with backing field access. Example: 'var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }' After the quick-fix is applied: 'var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }'", + "markdown": "Reports recursive property accessor calls which can end up with a `StackOverflowError`.\nSuch calls are usually confused with backing field access.\n\n**Example:**\n\n\n var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }\n\nAfter the quick-fix is applied:\n\n\n var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantUnitExpression", + "shortDescription": { + "text": "Redundant 'Unit'" + }, + "fullDescription": { + "text": "Reports redundant 'Unit' expressions. 'Unit' in Kotlin can be used as the return type of functions that do not return anything meaningful. The 'Unit' type has only one possible value, which is the 'Unit' object. Examples: 'fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }'", + "markdown": "Reports redundant `Unit` expressions.\n\n\n`Unit` in Kotlin can be used as the return type of functions that do not return anything meaningful.\nThe `Unit` type has only one possible value, which is the `Unit` object.\n\n**Examples:**\n\n\n fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PlatformExtensionReceiverOfInline", + "shortDescription": { + "text": "'inline fun' with nullable receiver until Kotlin 1.2" + }, + "fullDescription": { + "text": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). It's recommended to add an explicit '!!' you want an exception to be thrown, or consider changing the function's receiver type to nullable if it should work without exceptions. Example: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }' After the quick-fix is applied: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", + "markdown": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nIt's recommended to add an explicit `!!` you want an exception to be thrown,\nor consider changing the function's receiver type to nullable if it should work without exceptions.\n\n**Example:**\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousEqualsCombination", + "shortDescription": { + "text": "Suspicious combination of == and ===" + }, + "fullDescription": { + "text": "Reports '==' and '===' comparisons that are both used on the same variable within a single expression. Due to similarities '==' and '===' could be mixed without notice, and it takes a close look to check that '==' used instead of '===' Example: 'if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return'", + "markdown": "Reports `==` and `===` comparisons that are both used on the same variable within a single expression.\n\nDue to similarities `==` and `===` could be mixed without notice, and\nit takes a close look to check that `==` used instead of `===`\n\nExample:\n\n\n if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedDataClassCopyResult", + "shortDescription": { + "text": "Unused result of data class copy" + }, + "fullDescription": { + "text": "Reports calls to data class 'copy' function without using its result.", + "markdown": "Reports calls to data class `copy` function without using its result." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantElseInIf", + "shortDescription": { + "text": "Redundant 'else' in 'if'" + }, + "fullDescription": { + "text": "Reports redundant 'else' in 'if' with 'return' Example: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }' After the quick-fix is applied: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }'", + "markdown": "Reports redundant `else` in `if` with `return`\n\n**Example:**\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplacePutWithAssignment", + "shortDescription": { + "text": "'map.put()' can be converted to assignment" + }, + "fullDescription": { + "text": "Reports 'map.put' function calls that can be replaced with indexing operator ('[]'). Using syntactic sugar makes your code simpler. The quick-fix replaces 'put' call with the assignment. Example: 'fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }' After the quick-fix is applied: 'fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }'", + "markdown": "Reports `map.put` function calls that can be replaced with indexing operator (`[]`).\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces `put` call with the assignment.\n\n**Example:**\n\n\n fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinDoubleNegation", + "shortDescription": { + "text": "Redundant double negation" + }, + "fullDescription": { + "text": "Reports redundant double negations. Example: 'val truth = !!true'", + "markdown": "Reports redundant double negations.\n\n**Example:**\n\n val truth = !!true\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionName", + "shortDescription": { + "text": "Function naming convention" + }, + "fullDescription": { + "text": "Reports function names that do not follow the recommended naming conventions. Example: 'fun Foo() {}' To fix the problem change the name of the function to match the recommended naming conventions.", + "markdown": "Reports function names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n fun Foo() {}\n\nTo fix the problem change the name of the function to match the recommended naming conventions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentKotlinMavenVersion", + "shortDescription": { + "text": "Maven and IDE plugins versions are different" + }, + "fullDescription": { + "text": "Reports the Maven plugin version of the Kotlin compiler that is different from the one that is used in the IDE plugin. This inconsistency may lead to different error reporting behavior in the IDE and the compiler", + "markdown": "Reports the Maven plugin version of the Kotlin compiler that is different from the one that is used in the IDE plugin.\n\nThis inconsistency may lead to different error reporting behavior in the IDE and the compiler" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantUnitReturnType", + "shortDescription": { + "text": "Redundant 'Unit' return type" + }, + "fullDescription": { + "text": "Reports a redundant 'Unit' return type which can be omitted.", + "markdown": "Reports a redundant `Unit` return type which can be omitted." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceRangeToWithUntil", + "shortDescription": { + "text": "'rangeTo' or the '..' call should be replaced with 'until'" + }, + "fullDescription": { + "text": "Reports calls to 'rangeTo' or the '..' operator instead of calls to 'until'. Using corresponding functions makes your code simpler. The quick-fix replaces 'rangeTo' or the '..' call with 'until'. Example: 'fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }' After the quick-fix is applied: 'fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }'", + "markdown": "Reports calls to `rangeTo` or the `..` operator instead of calls to `until`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces `rangeTo` or the `..` call with `until`.\n\n**Example:**\n\n\n fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedEquals", + "shortDescription": { + "text": "Unused equals expression" + }, + "fullDescription": { + "text": "Reports unused 'equals'('==') expressions.", + "markdown": "Reports unused `equals`(`==`) expressions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnclearPrecedenceOfBinaryExpression", + "shortDescription": { + "text": "Multiple operators with different precedence" + }, + "fullDescription": { + "text": "Reports binary expressions that consist of different operators without parentheses. Such expressions can be less readable due to different precedence rules of operators. Example: fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }", + "markdown": "Reports binary expressions that consist of different operators without parentheses.\n\nSuch expressions can be less readable due to different [precedence rules](https://kotlinlang.org/docs/reference/grammar.html#expressions) of operators.\n\nExample:\n\n```\n fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }\n```" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedLambdaExpressionBody", + "shortDescription": { + "text": "Unused return value of a function with lambda expression body" + }, + "fullDescription": { + "text": "Reports calls with an unused return value when the called function returns a lambda from an expression body. If there is '=' between function header and body block, code from the function will not be evaluated which can lead to incorrect behavior. Remove = token from function declaration can be used to amend the code automatically. Example: 'fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }' After the quick-fix is applied: 'fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }'", + "markdown": "Reports calls with an unused return value when the called function returns a lambda from an expression body.\n\n\nIf there is `=` between function header and body block,\ncode from the function will not be evaluated which can lead to incorrect behavior.\n\n**Remove = token from function declaration** can be used to amend the code automatically.\n\nExample:\n\n\n fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }\n\nAfter the quick-fix is applied:\n\n\n fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertLambdaToReference", + "shortDescription": { + "text": "Can be replaced with function reference" + }, + "fullDescription": { + "text": "Reports function literal expressions that can be replaced with function references. Replacing lambdas with function references often makes code look more concise and understandable. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }'", + "markdown": "Reports function literal expressions that can be replaced with function references.\n\nReplacing lambdas with function references often makes code look more concise and understandable.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSetter", + "shortDescription": { + "text": "Redundant property setter" + }, + "fullDescription": { + "text": "Reports redundant property setters. Setter is considered to be redundant in one of the following cases: Setter has no body. Accessor visibility isn't changed, declaration isn't 'external' and has no annotations. 'var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated' Setter body is a block with a single statement assigning the parameter to the backing field. 'var prop: Int = 0\n set(value) { // redundant\n field = value\n }'", + "markdown": "Reports redundant property setters.\n\n\nSetter is considered to be redundant in one of the following cases:\n\n1. Setter has no body. Accessor visibility isn't changed, declaration isn't `external` and has no annotations.\n\n\n var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated\n \n2. Setter body is a block with a single statement assigning the parameter to the backing field.\n\n\n var prop: Int = 0\n set(value) { // redundant\n field = value\n }\n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanSealedSubClassBeObject", + "shortDescription": { + "text": "Sealed sub-class without state and overridden equals" + }, + "fullDescription": { + "text": "Reports direct inheritors of 'sealed' classes that have no state and overridden 'equals()' method. It's highly recommended to override 'equals()' to provide comparison stability, or convert the 'class' to an 'object' to reach the same effect. Example: 'sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }' A quick-fix converts a 'class' into an 'object': 'sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }'", + "markdown": "Reports direct inheritors of `sealed` classes that have no state and overridden `equals()` method.\n\nIt's highly recommended to override `equals()` to provide comparison stability, or convert the `class` to an `object` to reach the same effect.\n\n**Example:**\n\n\n sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n\nA quick-fix converts a `class` into an `object`:\n\n\n sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PropertyName", + "shortDescription": { + "text": "Property naming convention" + }, + "fullDescription": { + "text": "Reports property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, property names should start with a lowercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val My_Cool_Property = \"\"' A quick-fix renames the class according to the Kotlin naming conventions: 'val myCoolProperty = \"\"'", + "markdown": "Reports property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nproperty names should start with a lowercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val My_Cool_Property = \"\"\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val myCoolProperty = \"\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinMavenPluginPhase", + "shortDescription": { + "text": "Kotlin Maven Plugin misconfigured" + }, + "fullDescription": { + "text": "Reports kotlin-maven-plugin configuration issues", + "markdown": "Reports kotlin-maven-plugin configuration issues" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertToStringTemplate", + "shortDescription": { + "text": "String concatenation that can be converted to string template" + }, + "fullDescription": { + "text": "Reports string concatenation that can be converted to a string template. Using string templates is recommended as it makes code easier to read. Example: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }' After the quick-fix is applied: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }'", + "markdown": "Reports string concatenation that can be converted to a string template.\n\nUsing string templates is recommended as it makes code easier to read.\n\n**Example:**\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifiableCall", + "shortDescription": { + "text": "Library function call could be simplified" + }, + "fullDescription": { + "text": "Reports library function calls which could be replaced by simplified one. Using corresponding functions makes your code simpler. The quick-fix replaces the function calls with another one. Example: 'fun test(list: List) {\n list.filter { it is String }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.filterIsInstance()\n }'", + "markdown": "Reports library function calls which could be replaced by simplified one.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the function calls with another one.\n\n**Example:**\n\n\n fun test(list: List) {\n list.filter { it is String }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.filterIsInstance()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObjectLiteralToLambda", + "shortDescription": { + "text": "Object literal can be converted to lambda" + }, + "fullDescription": { + "text": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression. Example: 'class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n}' After the quick-fix is applied: 'fun foo() {\n threadPool.submit { println(\"hello\") }\n }'", + "markdown": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression.\n\n**Example:**\n\n\n class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n threadPool.submit { println(\"hello\") }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLambdaOrAnonymousFunction", + "shortDescription": { + "text": "Redundant creation of lambda or anonymous function" + }, + "fullDescription": { + "text": "Reports lambdas or anonymous functions that are created and used immediately. 'fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }'", + "markdown": "Reports lambdas or anonymous functions that are created and used immediately.\n\n\n fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "BooleanLiteralArgument", + "shortDescription": { + "text": "Boolean literal argument without parameter name" + }, + "fullDescription": { + "text": "Reports call arguments with 'Boolean' type without explicit parameter names specified. When multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes. Explicit parameter names allow for easier code reading and understanding. Example: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }' A quick-fix adds missing parameter names: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }'", + "markdown": "Reports call arguments with `Boolean` type without explicit parameter names specified.\n\n\nWhen multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes.\nExplicit parameter names allow for easier code reading and understanding.\n\n**Example:**\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }\n\nA quick-fix adds missing parameter names:\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertArgumentToSet", + "shortDescription": { + "text": "Argument could be converted to 'Set' to improve performance" + }, + "fullDescription": { + "text": "Detects the function calls that could work faster with an argument converted to 'Set'. Operations like 'minus' or 'intersect' are more effective when their argument is a set. An explicit conversion of an 'Iterable' or an 'Array' into a 'Set' can often make code more effective. The quick-fix adds an explicit conversion to the function call. Example: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size' After the quick-fix is applied: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size'", + "markdown": "Detects the function calls that could work faster with an argument converted to `Set`.\n\n\nOperations like 'minus' or 'intersect' are more effective when their argument is a set.\nAn explicit conversion of an `Iterable` or an `Array`\ninto a `Set` can often make code more effective.\n\n\nThe quick-fix adds an explicit conversion to the function call.\n\n**Example:**\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size\n\nAfter the quick-fix is applied:\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceGuardClauseWithFunctionCall", + "shortDescription": { + "text": "Guard clause can be replaced with Kotlin's function call" + }, + "fullDescription": { + "text": "Reports guard clauses that can be replaced with a function call. Example: 'fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }' After the quick-fix is applied: 'fun test(foo: Int?) {\n checkNotNull(foo)\n }'", + "markdown": "Reports guard clauses that can be replaced with a function call.\n\n**Example:**\n\n fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }\n\nAfter the quick-fix is applied:\n\n fun test(foo: Int?) {\n checkNotNull(foo)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceToStringWithStringTemplate", + "shortDescription": { + "text": "Call of 'toString' could be replaced with string template" + }, + "fullDescription": { + "text": "Reports 'toString' function calls that can be replaced with a string template. Using string templates makes your code simpler. The quick-fix replaces 'toString' with a string template. Example: 'fun test(): String {\n val x = 1\n return x.toString()\n }' After the quick-fix is applied: 'fun test(): String {\n val x = 1\n return \"$x\"\n }'", + "markdown": "Reports `toString` function calls that can be replaced with a string template.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces `toString` with a string template.\n\n**Example:**\n\n\n fun test(): String {\n val x = 1\n return x.toString()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(): String {\n val x = 1\n return \"$x\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProtectedInFinal", + "shortDescription": { + "text": "'protected' visibility is effectively 'private' in a final class" + }, + "fullDescription": { + "text": "Reports 'protected' visibility used inside of a 'final' class. In such cases 'protected' members are accessible only in the class itself, so they are effectively 'private'. Example: 'class FinalClass {\n protected fun foo() {}\n }' After the quick-fix is applied: 'class FinalClass {\n private fun foo() {}\n }'", + "markdown": "Reports `protected` visibility used inside of a `final` class. In such cases `protected` members are accessible only in the class itself, so they are effectively `private`.\n\n**Example:**\n\n\n class FinalClass {\n protected fun foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class FinalClass {\n private fun foo() {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceRangeStartEndInclusiveWithFirstLast", + "shortDescription": { + "text": "Boxed properties should be replaced with unboxed" + }, + "fullDescription": { + "text": "Reports boxed 'Range.start' and 'Range.endInclusive' properties. These properties can be replaced with unboxed 'first' and 'last' properties to avoid redundant calls. The quick-fix replaces 'start' and 'endInclusive' properties with the corresponding 'first' and 'last'. Example: 'fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }' After the quick-fix is applied: 'fun foo(range: CharRange) {\n val lastElement = range.last\n }'", + "markdown": "Reports **boxed** `Range.start` and `Range.endInclusive` properties.\n\nThese properties can be replaced with **unboxed** `first` and `last` properties to avoid redundant calls.\n\nThe quick-fix replaces `start` and `endInclusive` properties with the corresponding `first` and `last`.\n\n**Example:**\n\n\n fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(range: CharRange) {\n val lastElement = range.last\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSizeCheckWithIsNotEmpty", + "shortDescription": { + "text": "Size check can be replaced with 'isNotEmpty()'" + }, + "fullDescription": { + "text": "Reports size checks of 'Collections/Array/String' that should be replaced with 'isNotEmpty()'. Using 'isNotEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isNotEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }'", + "markdown": "Reports size checks of `Collections/Array/String` that should be replaced with `isNotEmpty()`.\n\nUsing `isNotEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isNotEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSemicolon", + "shortDescription": { + "text": "Redundant semicolon" + }, + "fullDescription": { + "text": "Reports redundant semicolons (';') that can be safely removed. Kotlin does not require a semicolon at the end of each statement or expression. A quick-fix is suggested to remove redundant semicolons. Example: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};' After the quick-fix is applied: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}' There are two cases though where a semicolon is required: Several statements placed on a single line need to be separated with semicolons: 'map.forEach { val (key, value) = it; println(\"$key -> $value\") }' 'enum' classes that also declare properties or functions, require a semicolon after the list of enum constants: 'enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }'", + "markdown": "Reports redundant semicolons (`;`) that can be safely removed.\n\n\nKotlin does not require a semicolon at the end of each statement or expression.\nA quick-fix is suggested to remove redundant semicolons.\n\n**Example:**\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};\n\nAfter the quick-fix is applied:\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}\n\nThere are two cases though where a semicolon is required:\n\n1. Several statements placed on a single line need to be separated with semicolons:\n\n\n map.forEach { val (key, value) = it; println(\"$key -> $value\") }\n\n2. `enum` classes that also declare properties or functions, require a semicolon after the list of enum constants:\n\n\n enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }\n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IntroduceWhenSubject", + "shortDescription": { + "text": "'when' that can be simplified by introducing an argument" + }, + "fullDescription": { + "text": "Reports a 'when' expression that can be simplified by introducing a subject argument. Example: 'fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }' The quick fix introduces a subject argument: 'fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }'", + "markdown": "Reports a `when` expression that can be simplified by introducing a subject argument.\n\n**Example:**\n\n\n fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n\nThe quick fix introduces a subject argument:\n\n\n fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedCallableAddReplaceWith", + "shortDescription": { + "text": "@Deprecated annotation without 'replaceWith' argument" + }, + "fullDescription": { + "text": "Reports deprecated functions and properties that do not have the 'kotlin.ReplaceWith' argument in its 'kotlin.deprecated' annotation and suggests to add one based on their body. Kotlin provides the 'ReplaceWith' argument to replace deprecated declarations automatically. It is recommended to use the argument to fix deprecation issues in code. Example: '@Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42' A quick-fix adds the 'ReplaceWith()' argument: '@Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42'", + "markdown": "Reports deprecated functions and properties that do not have the `kotlin.ReplaceWith` argument in its `kotlin.deprecated` annotation and suggests to add one based on their body.\n\n\nKotlin provides the `ReplaceWith` argument to replace deprecated declarations automatically.\nIt is recommended to use the argument to fix deprecation issues in code.\n\n**Example:**\n\n\n @Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42\n\nA quick-fix adds the `ReplaceWith()` argument:\n\n\n @Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ComplexRedundantLet", + "shortDescription": { + "text": "Redundant argument-based `let` call" + }, + "fullDescription": { + "text": "Reports a redundant argument-based 'let' call. 'let' is redundant when the lambda parameter is only used as a qualifier in a call expression. If you need to give a name to the qualifying expression, declare a local variable. Example: 'fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }' A quick-fix removes the extra 'let()' call: 'fun example() {\n \"1,2,3\".split(',')\n }' Alternative: 'fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }'", + "markdown": "Reports a redundant argument-based `let` call.\n\n`let` is redundant when the lambda parameter is only used as a qualifier in a call expression.\n\nIf you need to give a name to the qualifying expression, declare a local variable.\n\n**Example:**\n\n\n fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }\n\nA quick-fix removes the extra `let()` call:\n\n\n fun example() {\n \"1,2,3\".split(',')\n }\n\nAlternative:\n\n\n fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantSpreadOperator", + "shortDescription": { + "text": "Redundant spread operator" + }, + "fullDescription": { + "text": "Reports the use of a redundant spread operator for a family of 'arrayOf' function calls. Use the 'Remove redundant spread operator' quick-fix to clean up the code. Examples: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }' After the quick-fix is applied: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }'", + "markdown": "Reports the use of a redundant spread operator for a family of `arrayOf` function calls.\n\nUse the 'Remove redundant spread operator' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitJvmOverloadsOnConstructorsOfAnnotationClassesMigration", + "shortDescription": { + "text": "'@JvmOverloads' annotation cannot be used on constructors of annotation classes since 1.4" + }, + "fullDescription": { + "text": "Reports '@JvmOverloads' on constructors of annotation classes because it's meaningless. There is no footprint of '@JvmOverloads' in the generated bytecode and Kotlin metadata, so '@JvmOverloads' doesn't affect the generated bytecode and the code behavior. '@JvmOverloads' on constructors of annotation classes causes a compilation error since Kotlin 1.4. Example: 'annotation class A @JvmOverloads constructor(val x: Int = 1)' After the quick-fix is applied: 'annotation class A constructor(val x: Int = 1)'", + "markdown": "Reports `@JvmOverloads` on constructors of annotation classes because it's meaningless.\n\n\nThere is no footprint of `@JvmOverloads` in the generated bytecode and Kotlin metadata,\nso `@JvmOverloads` doesn't affect the generated bytecode and the code behavior.\n\n`@JvmOverloads` on constructors of annotation classes causes a compilation error since Kotlin 1.4.\n\n**Example:**\n\n\n annotation class A @JvmOverloads constructor(val x: Int = 1)\n\nAfter the quick-fix is applied:\n\n\n annotation class A constructor(val x: Int = 1)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveSetterParameterType", + "shortDescription": { + "text": "Redundant setter parameter type" + }, + "fullDescription": { + "text": "Reports explicitly specified parameter types in property setters. Setter parameter type always matches the property type, so it's not required to be explicit. The 'Remove explicit type specification' quick-fix allows amending the code accordingly. Examples: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted' After the quick-fix is applied: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)'", + "markdown": "Reports explicitly specified parameter types in property setters.\n\n\nSetter parameter type always matches the property type, so it's not required to be explicit.\nThe 'Remove explicit type specification' quick-fix allows amending the code accordingly.\n\n**Examples:**\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted\n\nAfter the quick-fix is applied:\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IfThenToElvis", + "shortDescription": { + "text": "If-Then foldable to '?:'" + }, + "fullDescription": { + "text": "Reports 'if-then' expressions that can be folded into elvis ('?:') expressions. Example: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo' The quick fix converts the 'if-then' expression into an elvis ('?:') expression: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"'", + "markdown": "Reports `if-then` expressions that can be folded into elvis (`?:`) expressions.\n\n**Example:**\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo\n\nThe quick fix converts the `if-then` expression into an elvis (`?:`) expression:\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WrapUnaryOperator", + "shortDescription": { + "text": "Ambiguous unary operator use with number constant" + }, + "fullDescription": { + "text": "Reports an unary operator followed by a dot qualifier such as '-1.inc()'. Code like '-1.inc()' can be misleading because '-' has a lower precedence than '.inc()'. As a result, '-1.inc()' evaluates to '-2' and not '0' as it might be expected. Wrap unary operator and value with () quick-fix can be used to amend the code automatically.", + "markdown": "Reports an unary operator followed by a dot qualifier such as `-1.inc()`.\n\nCode like `-1.inc()` can be misleading because `-` has a lower precedence than `.inc()`.\nAs a result, `-1.inc()` evaluates to `-2` and not `0` as it might be expected.\n\n**Wrap unary operator and value with ()** quick-fix can be used to amend the code automatically." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConflictingExtensionProperty", + "shortDescription": { + "text": "Extension property conflicting with synthetic one" + }, + "fullDescription": { + "text": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java 'get' or 'set' methods. Such properties should be either removed or renamed to avoid breaking code by future changes in the compiler. A quick-fix deletes an extention property. Example: 'val File.name: String\n get() = getName()' A quick-fix adds the '@Deprecated' annotation: '@Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()'", + "markdown": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java `get` or `set` methods.\n\nSuch properties should be either removed or renamed to avoid breaking code by future changes in the compiler.\n\nA quick-fix deletes an extention property.\n\n**Example:**\n\n\n val File.name: String\n get() = getName()\n\nA quick-fix adds the `@Deprecated` annotation:\n\n\n @Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceJavaStaticMethodWithKotlinAnalog", + "shortDescription": { + "text": "Java methods should be replaced with Kotlin analog" + }, + "fullDescription": { + "text": "Reports a Java method call that can be replaced with a Kotlin function, for example, 'System.out.println()'. Replacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code. The quick-fix replaces the Java method calls on the same Kotlin call. Example: 'import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }' After the quick-fix is applied: 'fun main() {\n val a = listOf(1, 3, null)\n }'", + "markdown": "Reports a Java method call that can be replaced with a Kotlin function, for example, `System.out.println()`.\n\nReplacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code.\n\nThe quick-fix replaces the Java method calls on the same Kotlin call.\n\n**Example:**\n\n\n import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = listOf(1, 3, null)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyParenthesesFromLambdaCall", + "shortDescription": { + "text": "Remove unnecessary parentheses from function call with lambda" + }, + "fullDescription": { + "text": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses. Use the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code. Examples: 'fun foo() {\n listOf(1).forEach() { }\n }' After the quick-fix is applied: 'fun foo() {\n listOf(1).forEach { }\n }'", + "markdown": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses.\n\nUse the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo() {\n listOf(1).forEach() { }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n listOf(1).forEach { }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveExplicitSuperQualifier", + "shortDescription": { + "text": "Unnecessary supertype qualification" + }, + "fullDescription": { + "text": "Reports 'super' member calls with redundant supertype qualification. Code in a derived class can call its superclass functions and property accessors implementations using the 'super' keyword. To specify the supertype from which the inherited implementation is taken, 'super' can be qualified by the supertype name in angle brackets, e.g. 'super'. Sometimes this qualification is redundant and can be omitted. Use the 'Remove explicit supertype qualification' quick-fix to clean up the code. Examples: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }' After the quick-fix is applied: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }'", + "markdown": "Reports `super` member calls with redundant supertype qualification.\n\n\nCode in a derived class can call its superclass functions and property accessors implementations using the `super` keyword.\nTo specify the supertype from which the inherited implementation is taken, `super` can be qualified by the supertype name in\nangle brackets, e.g. `super`. Sometimes this qualification is redundant and can be omitted.\nUse the 'Remove explicit supertype qualification' quick-fix to clean up the code.\n\n**Examples:**\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }\n\nAfter the quick-fix is applied:\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantExplicitType", + "shortDescription": { + "text": "Obvious explicit type" + }, + "fullDescription": { + "text": "Reports local variables' explicitly given types which are obvious and thus redundant, like 'val f: Foo = Foo()'. Example: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }' After the quick-fix is applied: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }'", + "markdown": "Reports local variables' explicitly given types which are obvious and thus redundant, like `val f: Foo = Foo()`.\n\n**Example:**\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }\n\nAfter the quick-fix is applied:\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousVarProperty", + "shortDescription": { + "text": "Suspicious 'var' property: its setter does not influence its getter result" + }, + "fullDescription": { + "text": "Reports 'var' properties with default setter and getter that do not reference backing field. Such properties do not affect calling its setter; therefore, it will be clearer to change such property to 'val' and delete the initializer. Change to val and delete initializer quick-fix can be used to amend the code automatically. Example: '// This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1'", + "markdown": "Reports `var` properties with default setter and getter that do not reference backing field.\n\n\nSuch properties do not affect calling its setter; therefore, it will be clearer to change such property to `val` and delete the initializer.\n\n**Change to val and delete initializer** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n // This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaCollectionsStaticMethod", + "shortDescription": { + "text": "Java Collections static method call can be replaced with Kotlin stdlib" + }, + "fullDescription": { + "text": "Reports a Java 'Collections' static method call that can be replaced with Kotlin stdlib. Example: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }' The quick fix replaces Java 'Collections' static method call with the corresponding Kotlin stdlib method call: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }'", + "markdown": "Reports a Java `Collections` static method call that can be replaced with Kotlin stdlib.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }\n\nThe quick fix replaces Java `Collections` static method call with the corresponding Kotlin stdlib method call:\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantAsync", + "shortDescription": { + "text": "Redundant 'async' call" + }, + "fullDescription": { + "text": "Reports 'async' calls that are immediately followed by 'await'. Such calls can be replaced with blocking calls. Example: 'suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n scope.async(ctx) { doSomeJob() }.await()\n }' After the quick-fix is applied: 'suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n withContext(scope.coroutineContext + ctx) { doSomeJob() }\n }'", + "markdown": "Reports `async` calls that are immediately followed by `await`.\nSuch calls can be replaced with blocking calls.\n\n**Example:**\n\n\n suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n scope.async(ctx) { doSomeJob() }.await()\n }\n\nAfter the quick-fix is applied:\n\n\n suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n withContext(scope.coroutineContext + ctx) { doSomeJob() }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MoveVariableDeclarationIntoWhen", + "shortDescription": { + "text": "Variable declaration could be moved inside `when`" + }, + "fullDescription": { + "text": "Reports variable declarations that can be moved inside a 'when' expression. Example: 'fun someCalc(x: Int) = x * 42\n\nfun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}' After the quick-fix is applied: 'fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}'", + "markdown": "Reports variable declarations that can be moved inside a `when` expression.\n\n**Example:**\n\n\n fun someCalc(x: Int) = x * 42\n\n fun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeferredIsResult", + "shortDescription": { + "text": "Function returning Deferred directly" + }, + "fullDescription": { + "text": "Reports functions with the 'kotlinx.coroutines.Deferred' return type. Functions that use 'Deferred' as return type should have a name with the 'Async' suffix. Otherwise, it's recommended to mark a function as 'suspend' and unwrap 'Deferred' inside it. Example: 'fun calcEverything(): Deferred {\n return CompletableDeferred(42)\n }' After the quick-fix that adds the 'Async' suffix applied: 'fun calcEverythingAsync(): Deferred {\n return CompletableDeferred(42)\n }' After the quick-fix that converts the function into a 'suspend' one applied: 'suspend fun calcEverything(): Int {\n return CompletableDeferred(42).await()\n }'", + "markdown": "Reports functions with the `kotlinx.coroutines.Deferred` return type.\n\n\nFunctions that use `Deferred` as return type should have a name with the `Async` suffix.\nOtherwise, it's recommended to mark a function as `suspend` and unwrap `Deferred` inside it.\n\n**Example:**\n\n\n fun calcEverything(): Deferred {\n return CompletableDeferred(42)\n }\n\nAfter the quick-fix that adds the `Async` suffix applied:\n\n\n fun calcEverythingAsync(): Deferred {\n return CompletableDeferred(42)\n }\n\nAfter the quick-fix that converts the function into a `suspend` one applied:\n\n\n suspend fun calcEverything(): Int {\n return CompletableDeferred(42).await()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyParenthesesFromAnnotationEntry", + "shortDescription": { + "text": "Remove unnecessary parentheses" + }, + "fullDescription": { + "text": "Reports redundant empty parentheses in annotation entries. Use the 'Remove unnecessary parentheses' quick-fix to clean up the code. Examples: 'annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }'", + "markdown": "Reports redundant empty parentheses in annotation entries.\n\nUse the 'Remove unnecessary parentheses' quick-fix to clean up the code.\n\n**Examples:**\n\n\n annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifiableCallChain", + "shortDescription": { + "text": "Call chain on collection type can be simplified" + }, + "fullDescription": { + "text": "Reports two-call chains replaceable by a single call. It can help you to avoid redundant code execution. The quick-fix replaces the call chain with a single call. Example: 'fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }' After the quick-fix is applied: 'fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }'", + "markdown": "Reports two-call chains replaceable by a single call.\n\nIt can help you to avoid redundant code execution.\n\nThe quick-fix replaces the call chain with a single call.\n\n**Example:**\n\n\n fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceCallWithBinaryOperator", + "shortDescription": { + "text": "Can be replaced with binary operator" + }, + "fullDescription": { + "text": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones. Example: 'fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }' After the quick-fix is applied: 'fun test(): Boolean {\n return 2 > 1\n }'", + "markdown": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones.\n\n**Example:**\n\n fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }\n\nAfter the quick-fix is applied:\n\n fun test(): Boolean {\n return 2 > 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedUnaryOperator", + "shortDescription": { + "text": "Unused unary operator" + }, + "fullDescription": { + "text": "Reports unary operators for number types on unused expressions. Unary operators break previous expression if they are used without braces. As a result, mathematical expressions spanning multi lines can be misleading. Example: 'fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }'", + "markdown": "Reports unary operators for number types on unused expressions.\n\nUnary operators break previous expression if they are used without braces.\nAs a result, mathematical expressions spanning multi lines can be misleading.\n\nExample:\n\n\n fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ClassName", + "shortDescription": { + "text": "Class naming convention" + }, + "fullDescription": { + "text": "Reports class names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, class names should start with an uppercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'class user(val name: String)' A quick-fix renames the class according to the Kotlin naming conventions: 'class User(val name: String)'", + "markdown": "Reports class names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nclass names should start with an uppercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n class user(val name: String)\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n class User(val name: String)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyPrimaryConstructor", + "shortDescription": { + "text": "Redundant empty primary constructor" + }, + "fullDescription": { + "text": "Reports empty primary constructors when they are implicitly available anyway. A primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers. Use the 'Remove empty primary constructor' quick-fix to clean up the code. Examples: 'class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier'", + "markdown": "Reports empty primary constructors when they are implicitly available anyway.\n\n\nA primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers.\nUse the 'Remove empty primary constructor' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptySecondaryConstructorBody", + "shortDescription": { + "text": "Redundant constructor body" + }, + "fullDescription": { + "text": "Reports empty bodies of secondary constructors.", + "markdown": "Reports empty bodies of secondary constructors." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FloatingPointLiteralPrecision", + "shortDescription": { + "text": "Floating-point literal exceeds the available precision" + }, + "fullDescription": { + "text": "Reports floating-point literals that cannot be represented with the required precision using IEEE 754 'Float' and 'Double' types. For example, '1.9999999999999999999' has too many significant digits, so its representation as a 'Double' will be rounded to '2.0'. Specifying excess digits may be misleading as it hides the fact that computations use rounded values instead. The quick-fix replaces the literal with a rounded value that matches the actual representation of the constant. Example: 'val x: Float = 3.14159265359f' After the quick-fix is applied: 'val x: Float = 3.1415927f'", + "markdown": "Reports floating-point literals that cannot be represented with the required precision using [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) `Float` and `Double` types.\n\n\nFor example, `1.9999999999999999999` has too many significant digits,\nso its representation as a `Double` will be rounded to `2.0`.\nSpecifying excess digits may be misleading as it hides the fact that computations\nuse rounded values instead.\n\n\nThe quick-fix replaces the literal with a rounded value that matches the actual representation\nof the constant.\n\n**Example:**\n\n\n val x: Float = 3.14159265359f\n\nAfter the quick-fix is applied:\n\n\n val x: Float = 3.1415927f\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertPairConstructorToToFunction", + "shortDescription": { + "text": "Convert Pair constructor to 'to' function" + }, + "fullDescription": { + "text": "Reports a 'Pair' constructor invocation that can be replaced with a 'to()' infix function call. Explicit constructor invocations may add verbosity, especially if they are used multiple times. Replacing constructor calls with 'to()' makes code easier to read and maintain. Example: 'val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )' After the quick-fix is applied: 'val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )'", + "markdown": "Reports a `Pair` constructor invocation that can be replaced with a `to()` infix function call.\n\n\nExplicit constructor invocations may add verbosity, especially if they are used multiple times.\nReplacing constructor calls with `to()` makes code easier to read and maintain.\n\n**Example:**\n\n\n val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )\n\nAfter the quick-fix is applied:\n\n\n val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantGetter", + "shortDescription": { + "text": "Redundant property getter" + }, + "fullDescription": { + "text": "Reports redundant property getters. Example: 'class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }' After the quick-fix is applied: 'class Test {\n val a = 1\n val b = 1\n }'", + "markdown": "Reports redundant property getters.\n\n**Example:**\n\n\n class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n val a = 1\n val b = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantIf", + "shortDescription": { + "text": "Redundant 'if' statement" + }, + "fullDescription": { + "text": "Reports 'if' statements which can be simplified to a single statement. Example: 'fun test() {\n if (foo()) {\n return true\n } else {\n return false\n }\n }' After the quick-fix is applied: 'fun test() {\n return foo()\n }'", + "markdown": "Reports `if` statements which can be simplified to a single statement.\n\n**Example:**\n\n\n fun test() {\n if (foo()) {\n return true\n } else {\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n return foo()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KDocMissingDocumentation", + "shortDescription": { + "text": "Missing KDoc comments for public declarations" + }, + "fullDescription": { + "text": "Reports public declarations that do not have KDoc comments. Example: 'class A' The quick fix generates the comment block above the declaration: '/**\n *\n */\n class A'", + "markdown": "Reports public declarations that do not have KDoc comments.\n\n**Example:**\n\n\n class A\n\nThe quick fix generates the comment block above the declaration:\n\n\n /**\n *\n */\n class A\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveExplicitTypeArguments", + "shortDescription": { + "text": "Unnecessary type argument" + }, + "fullDescription": { + "text": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted. Use the 'Remove explicit type arguments' quick-fix to clean up the code. Examples: '// 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()' After the quick-fix is applied: 'fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()'", + "markdown": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted.\n\nUse the 'Remove explicit type arguments' quick-fix to clean up the code.\n\n**Examples:**\n\n\n // 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()\n\nAfter the quick-fix is applied:\n\n\n fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantVisibilityModifier", + "shortDescription": { + "text": "Redundant visibility modifier" + }, + "fullDescription": { + "text": "Reports visibility modifiers that match the default visibility of an element ('public' for most elements, 'protected' for members that override a protected member).", + "markdown": "Reports visibility modifiers that match the default visibility of an element (`public` for most elements, `protected` for members that override a protected member)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UsePropertyAccessSyntax", + "shortDescription": { + "text": "Accessor call that can be replaced with property access syntax" + }, + "fullDescription": { + "text": "Reports Java 'get' and 'set' method calls that can be replaced with the Kotlin synthetic properties. Use property access syntax quick-fix can be used to amen the code automatically. Example: '// Java:\n public class JavaClassWithGetter {\n private final String expr = \"result\";\n\n // ...\n\n public String getExpr() {\n return expr;\n }\n }' '// Kotlin:\n fun test(j: JavaClassWithGetter) {\n // ...\n j.getExpr() // <== A quick-fix simplifies the expression to 'j.expr'\n }'", + "markdown": "Reports Java `get` and `set` method calls that can be replaced with the Kotlin synthetic properties.\n\n**Use property access syntax** quick-fix can be used to amen the code automatically.\n\nExample:\n\n\n // Java:\n public class JavaClassWithGetter {\n private final String expr = \"result\";\n\n // ...\n\n public String getExpr() {\n return expr;\n }\n }\n\n\n // Kotlin:\n fun test(j: JavaClassWithGetter) {\n // ...\n j.getExpr() // <== A quick-fix simplifies the expression to 'j.expr'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UseExpressionBody", + "shortDescription": { + "text": "Expression body syntax is preferable here" + }, + "fullDescription": { + "text": "Reports 'return' expressions (one-liners or 'when') that can be replaced with expression body syntax. Expression body syntax is recommended by the style guide. Convert to expression body quick-fix can be used to amend the code automatically. Example: 'fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }' After the quick-fix is applied: 'fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }'", + "markdown": "Reports `return` expressions (one-liners or `when`) that can be replaced with expression body syntax.\n\nExpression body syntax is recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#functions).\n\n**Convert to expression body** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MapGetWithNotNullAssertionOperator", + "shortDescription": { + "text": "'map.get()' with not-null assertion operator (!!)" + }, + "fullDescription": { + "text": "Reports 'map.get()!!' that can be replaced with 'map.getValue()', 'map.getOrElse()', and so on. Example: 'fun test(map: Map): String = map.get(0)!!' After the quick-fix is applied: 'fun test(map: Map): String = map.getValue(0)'", + "markdown": "Reports `map.get()!!` that can be replaced with `map.getValue()`, `map.getOrElse()`, and so on.\n\n**Example:**\n\n\n fun test(map: Map): String = map.get(0)!!\n\nAfter the quick-fix is applied:\n\n\n fun test(map: Map): String = map.getValue(0)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SortModifiers", + "shortDescription": { + "text": "Non-canonical modifier order" + }, + "fullDescription": { + "text": "Reports modifiers that do not follow the order recommended by the style guide. Sort modifiers quick-fix can be used to amend the code automatically. Examples: 'private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"'", + "markdown": "Reports modifiers that do not follow the order recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#modifiers-order).\n\n**Sort modifiers** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EnumEntryName", + "shortDescription": { + "text": "Enum entry naming convention" + }, + "fullDescription": { + "text": "Reports enum entry names that do not follow the recommended naming conventions. Example: 'enum class Foo {\n _Foo,\n foo\n }' To fix the problem rename enum entries to match the recommended naming conventions.", + "markdown": "Reports enum entry names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n enum class Foo {\n _Foo,\n foo\n }\n\nTo fix the problem rename enum entries to match the recommended naming conventions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithDropLast", + "shortDescription": { + "text": "'substring' call should be replaced with 'dropLast' call" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, s.length - x)' that can be replaced with 's.dropLast(x)'. Using corresponding functions makes your code simpler. The quick-fix replaces the 'substring' call with 'dropLast'. Example: 'fun foo(s: String) {\n s.substring(0, s.length - 5)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.dropLast(5)\n }'", + "markdown": "Reports calls like `s.substring(0, s.length - x)` that can be replaced with `s.dropLast(x)`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `dropLast`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.length - 5)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.dropLast(5)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SetterBackingFieldAssignment", + "shortDescription": { + "text": "Existing backing field without assignment" + }, + "fullDescription": { + "text": "Reports property setters that don't update the backing field. The quick-fix adds an assignment to the backing field. Example: 'class Test {\n var foo: Int = 1\n set(value) {\n }\n }' After the quick-fix is applied: 'class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }'", + "markdown": "Reports property setters that don't update the backing field.\n\nThe quick-fix adds an assignment to the backing field.\n\n**Example:**\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CopyWithoutNamedArguments", + "shortDescription": { + "text": "'copy' method of data class is called without named arguments" + }, + "fullDescription": { + "text": "Reports calls to a data class' 'copy()' method without named arguments. As all arguments of the 'copy()' function are optional, it might be hard to understand what properties are modified. Providing parameter names explicitly makes code easy to understand without navigating to the 'data class' declaration. Example: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }' A quick-fix provides parameter names to all 'copy()' arguments: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }'", + "markdown": "Reports calls to a data class' `copy()` method without named arguments.\n\n\nAs all arguments of the `copy()` function are optional, it might be hard to understand what properties are modified.\nProviding parameter names explicitly makes code easy to understand without navigating to the `data class` declaration.\n\n**Example:**\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }\n\nA quick-fix provides parameter names to all `copy()` arguments:\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinDeprecation", + "shortDescription": { + "text": "Usage of redundant or deprecated syntax or deprecated symbols" + }, + "fullDescription": { + "text": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (Code | Code Cleanup). A quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax. It also replaces deprecated symbols with their proposed substitutions.", + "markdown": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (**Code \\| Code Cleanup** ).\n\n\nA quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax.\n\n\nIt also replaces deprecated symbols with their proposed substitutions." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithTake", + "shortDescription": { + "text": "'substring' call should be replaced with 'take' call" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, x)' that can be replaced with 's.take(x)'. Using 'take()' makes your code simpler. The quick-fix replaces the 'substring' call with 'take()'. Example: 'fun foo(s: String) {\n s.substring(0, 10)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.take(10)\n }'", + "markdown": "Reports calls like `s.substring(0, x)` that can be replaced with `s.take(x)`.\n\nUsing `take()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `take()`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, 10)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.take(10)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertCallChainIntoSequence", + "shortDescription": { + "text": "Call chain on collection could be converted into 'Sequence' to improve performance" + }, + "fullDescription": { + "text": "Reports call chain on a 'Collection' that should be converted into Sequence. Each 'Collection' transforming function (such as 'map()' or 'filter()') creates a new 'Collection' (typically 'List' or 'Set') under the hood. In case of multiple consequent calls, and a huge number of items in 'Collection', memory traffic might be significant. In such a case, using 'Sequence' is preferred. Example: 'class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }' A quick-fix wraps call chain into 'asSequence()' and 'toList()': 'class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()'", + "markdown": "Reports call chain on a `Collection` that should be converted into **Sequence** .\n\nEach `Collection` transforming function (such as `map()` or `filter()`) creates a new\n`Collection` (typically `List` or `Set`) under the hood.\nIn case of multiple consequent calls, and a huge number of items in `Collection`, memory traffic might be significant.\nIn such a case, using `Sequence` is preferred.\n\n**Example:**\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n\nA quick-fix wraps call chain into `asSequence()` and `toList()`:\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AddOperatorModifier", + "shortDescription": { + "text": "Function should have 'operator' modifier" + }, + "fullDescription": { + "text": "Reports a function that matches one of the operator conventions but lacks the 'operator' keyword. By adding the 'operator' modifier, you might allow function consumers to write idiomatic Kotlin code. Example: 'class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }' A quick-fix adds the 'operator' modifier keyword: 'class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }'", + "markdown": "Reports a function that matches one of the operator conventions but lacks the `operator` keyword.\n\nBy adding the `operator` modifier, you might allow function consumers to write idiomatic Kotlin code.\n\n**Example:**\n\n\n class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }\n\nA quick-fix adds the `operator` modifier keyword:\n\n\n class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MayBeConstant", + "shortDescription": { + "text": "Might be 'const'" + }, + "fullDescription": { + "text": "Reports top-level 'val' properties in objects that might be declared as 'const' for better performance and Java interoperability. Example: 'object A {\n val foo = 1\n }' After the quick-fix is applied: 'object A {\n const val foo = 1\n }'", + "markdown": "Reports top-level `val` properties in objects that might be declared as `const` for better performance and Java interoperability.\n\n**Example:**\n\n\n object A {\n val foo = 1\n }\n\nAfter the quick-fix is applied:\n\n\n object A {\n const val foo = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceIsEmptyWithIfEmpty", + "shortDescription": { + "text": "'if' condition can be replaced with lambda call" + }, + "fullDescription": { + "text": "Reports 'isEmpty', 'isBlank', 'isNotEmpty', or 'isNotBlank' calls in an 'if' statement to assign a default value. The quick-fix replaces the 'if' condition with 'ifEmpty' or 'ifBlank' calls. Example: 'fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }' After the quick-fix is applied: 'fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }' This inspection only reports if the Kotlin language version of the project or module is 1.3 or higher.", + "markdown": "Reports `isEmpty`, `isBlank`, `isNotEmpty`, or `isNotBlank` calls in an `if` statement to assign a default value.\n\nThe quick-fix replaces the `if` condition with `ifEmpty` or `ifBlank` calls.\n\n**Example:**\n\n\n fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }\n\nThis inspection only reports if the Kotlin language version of the project or module is 1.3 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithImportAlias", + "shortDescription": { + "text": "Fully qualified name can be replaced with existing import alias" + }, + "fullDescription": { + "text": "Reports fully qualified names that can be replaced with an existing import alias. Example: 'import foo.Foo as Bar\nfun main() {\n foo.Foo()\n}' After the quick-fix is applied: 'import foo.Foo as Bar\nfun main() {\n Bar()\n}'", + "markdown": "Reports fully qualified names that can be replaced with an existing import alias.\n\n**Example:**\n\n\n import foo.Foo as Bar\n fun main() {\n foo.Foo()\n }\n\nAfter the quick-fix is applied:\n\n\n import foo.Foo as Bar\n fun main() {\n Bar()\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyBooleanWithConstants", + "shortDescription": { + "text": "Boolean expression can be simplified" + }, + "fullDescription": { + "text": "Reports boolean expression parts that can be reduced to constants. The quick-fix simplifies the condition. Example: 'fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }' After the quick-fix is applied: 'fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }'", + "markdown": "Reports boolean expression parts that can be reduced to constants.\n\nThe quick-fix simplifies the condition.\n\n**Example:**\n\n\n fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantModalityModifier", + "shortDescription": { + "text": "Redundant modality modifier" + }, + "fullDescription": { + "text": "Reports the modality modifiers that match the default modality of an element ('final' for most elements, 'open' for members with an 'override'). Example: 'final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }' After the quick-fix is applied: 'class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }'", + "markdown": "Reports the modality modifiers that match the default modality of an element (`final` for most elements, `open` for members with an `override`).\n\n**Example:**\n\n\n final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyAssertNotNull", + "shortDescription": { + "text": "'assert' call can be replaced with '!!' or '?:'" + }, + "fullDescription": { + "text": "Reports 'assert' calls that check a not null value of the declared variable. Using '!!' or '?:' makes your code simpler. The quick-fix replaces 'assert' with '!!' or '?:' operator in the variable initializer. Example: 'fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }' After the quick-fix is applied: 'fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }'", + "markdown": "Reports `assert` calls that check a not null value of the declared variable.\n\nUsing `!!` or `?:` makes your code simpler.\n\nThe quick-fix replaces `assert` with `!!` or `?:` operator in the variable initializer.\n\n**Example:**\n\n\n fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertNaNEquality", + "shortDescription": { + "text": "Convert equality check with 'NaN' to 'isNaN' call" + }, + "fullDescription": { + "text": "Reports an equality check with 'Float.NaN' or 'Double.NaN' that should be replaced with an 'isNaN()' check. According to IEEE 754, equality check against NaN always returns 'false', even for 'NaN == NaN'. Therefore, such a check is likely to be a mistake. A quick-fix replaces comparison with 'isNaN()' check that uses a different comparison technique and handles 'NaN' values correctly. Example: 'fun check(value: Double): Boolean {\n return Double.NaN == value\n }' After the fix is applied: 'fun check(value: Double): Boolean {\n return value.isNaN()\n }'", + "markdown": "Reports an equality check with `Float.NaN` or `Double.NaN` that should be replaced with an `isNaN()` check.\n\n\nAccording to IEEE 754, equality check against NaN always returns `false`, even for `NaN == NaN`.\nTherefore, such a check is likely to be a mistake.\n\nA quick-fix replaces comparison with `isNaN()` check that uses a different comparison technique and handles `NaN` values correctly.\n\n**Example:**\n\n\n fun check(value: Double): Boolean {\n return Double.NaN == value\n }\n\nAfter the fix is applied:\n\n\n fun check(value: Double): Boolean {\n return value.isNaN()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceManualRangeWithIndicesCalls", + "shortDescription": { + "text": "Range can be converted to indices or iteration" + }, + "fullDescription": { + "text": "Reports 'until' and 'rangeTo' operators that can be replaced with 'Collection.indices' or iteration over collection inside 'for' loop. Using syntactic sugar makes your code simpler. The quick-fix replaces the manual range with the corresponding construction. Example: 'fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }' After the quick-fix is applied: 'fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }'", + "markdown": "Reports `until` and `rangeTo` operators that can be replaced with `Collection.indices` or iteration over collection inside `for` loop.\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces the manual range with the corresponding construction.\n\n**Example:**\n\n\n fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinLoggerInitializedWithForeignClass", + "shortDescription": { + "text": "Logger initialized with foreign class" + }, + "fullDescription": { + "text": "Reports 'Logger' instances initialized with a class literal other than the class the 'Logger' resides in. This can happen when copy-pasting from another class. It may result in logging events under an unexpected category and incorrect filtering. Use the inspection options to specify the logger factory classes and methods recognized by this inspection. Example: 'class AnotherService\nclass MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n}' After the quick-fix is applied: 'class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n}'", + "markdown": "Reports `Logger` instances initialized with a class literal other than the class the `Logger` resides in.\n\n\nThis can happen when copy-pasting from another class.\nIt may result in logging events under an unexpected category and incorrect filtering.\n\n\nUse the inspection options to specify the logger factory classes and methods recognized by this inspection.\n\n**Example:**\n\n\n class AnotherService\n class MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n }\n\nAfter the quick-fix is applied:\n\n\n class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Logging", + "index": 158, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantAsSequence", + "shortDescription": { + "text": "Redundant 'asSequence' call" + }, + "fullDescription": { + "text": "Reports redundant 'asSequence()' call that can never have a positive performance effect. 'asSequence()' speeds up collection processing that includes multiple operations because it performs operations lazily and doesn't create intermediate collections. However, if a terminal operation (such as 'toList()') is used right after 'asSequence()', this doesn't give you any positive performance effect. Example: 'fun test(list: List) {\n list.asSequence().last()\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.last()\n }'", + "markdown": "Reports redundant `asSequence()` call that can never have a positive performance effect.\n\n\n`asSequence()` speeds up collection processing that includes multiple operations because it performs operations lazily\nand doesn't create intermediate collections.\n\n\nHowever, if a terminal operation (such as `toList()`) is used right after `asSequence()`, this doesn't give\nyou any positive performance effect.\n\n**Example:**\n\n\n fun test(list: List) {\n list.asSequence().last()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.last()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveToStringInStringTemplate", + "shortDescription": { + "text": "Redundant call to 'toString()' in string template" + }, + "fullDescription": { + "text": "Reports calls to 'toString()' in string templates that can be safely removed. Example: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }'", + "markdown": "Reports calls to `toString()` in string templates that can be safely removed.\n\n**Example:**\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }\n\nAfter the quick-fix is applied:\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinUnusedImport", + "shortDescription": { + "text": "Unused import directive" + }, + "fullDescription": { + "text": "Reports redundant 'import' statements. Default and unused imports can be safely removed. Example: 'import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }'", + "markdown": "Reports redundant `import` statements.\n\nDefault and unused imports can be safely removed.\n\n**Example:**\n\n\n import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBePrimaryConstructorProperty", + "shortDescription": { + "text": "Property is explicitly assigned to constructor parameter" + }, + "fullDescription": { + "text": "Reports properties that are explicitly assigned to primary constructor parameters. Properties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability. Example: 'class User(name: String) {\n val name = name\n }' A quick-fix joins the parameter and property declaration into a primary constructor parameter: 'class User(val name: String) {\n }'", + "markdown": "Reports properties that are explicitly assigned to primary constructor parameters.\n\nProperties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability.\n\n**Example:**\n\n\n class User(name: String) {\n val name = name\n }\n\nA quick-fix joins the parameter and property declaration into a primary constructor parameter:\n\n\n class User(val name: String) {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaMapForEach", + "shortDescription": { + "text": "Java Map.forEach method call should be replaced with Kotlin's forEach" + }, + "fullDescription": { + "text": "Reports a Java Map.'forEach' method call that can be replaced with Kotlin's forEach. Example: 'fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}' The quick fix removes parentheses: 'fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}'", + "markdown": "Reports a Java Map.`forEach` method call that can be replaced with Kotlin's **forEach** .\n\n**Example:**\n\n\n fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n\nThe quick fix removes parentheses:\n\n\n fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantObjectTypeCheck", + "shortDescription": { + "text": "Non-idiomatic 'is' type check for an object" + }, + "fullDescription": { + "text": "Reports non-idiomatic 'is' type checks for an object. It's recommended to replace such checks with reference comparison. Example: 'object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }' After the quick-fix is applied: 'object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }'", + "markdown": "Reports non-idiomatic `is` type checks for an object.\n\nIt's recommended to replace such checks with reference comparison.\n\n**Example:**\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }\n\nAfter the quick-fix is applied:\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspendFunctionOnCoroutineScope", + "shortDescription": { + "text": "Ambiguous coroutineContext due to CoroutineScope receiver of suspend function" + }, + "fullDescription": { + "text": "Reports calls and accesses of 'CoroutineScope' extensions or members inside suspend functions with 'CoroutineScope' receiver. When a function is 'suspend' and has 'CoroutineScope' receiver, it has ambiguous access to 'CoroutineContext' via 'kotlin.coroutines.coroutineContext' and via 'CoroutineScope.coroutineContext', and two these contexts are different in general. To improve this situation, one can wrap suspicious call inside 'coroutineScope { ... }' or get rid of 'CoroutineScope' function receiver.", + "markdown": "Reports calls and accesses of `CoroutineScope` extensions or members inside suspend functions with `CoroutineScope` receiver.\n\nWhen a function is `suspend` and has `CoroutineScope` receiver,\nit has ambiguous access to `CoroutineContext` via `kotlin.coroutines.coroutineContext` and via `CoroutineScope.coroutineContext`,\nand two these contexts are different in general.\n\n\nTo improve this situation, one can wrap suspicious call inside `coroutineScope { ... }` or\nget rid of `CoroutineScope` function receiver." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentMavenStdlibVersion", + "shortDescription": { + "text": "Library and maven plugin versions are different" + }, + "fullDescription": { + "text": "Reports different Kotlin stdlib and compiler versions. Using different versions of the Kotlin compiler and the standard library can lead to unpredictable runtime problems and should be avoided.", + "markdown": "Reports different Kotlin stdlib and compiler versions.\n\nUsing different versions of the Kotlin compiler and the standard library can lead to unpredictable\nruntime problems and should be avoided." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ImplicitNullableNothingType", + "shortDescription": { + "text": "Implicit `Nothing?` type" + }, + "fullDescription": { + "text": "Reports variables and functions with the implicit Nothing? type. Example: 'fun foo() = null' The quick fix specifies the return type explicitly: 'fun foo(): Nothing? = null'", + "markdown": "Reports variables and functions with the implicit **Nothing?** type.\n\n**Example:**\n\n\n fun foo() = null\n\nThe quick fix specifies the return type explicitly:\n\n\n fun foo(): Nothing? = null\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceAssociateFunction", + "shortDescription": { + "text": "'associate' can be replaced with 'associateBy' or 'associateWith'" + }, + "fullDescription": { + "text": "Reports calls to 'associate()' and 'associateTo()' that can be replaced with 'associateBy()' or 'associateWith()'. Both functions accept a transformer function applied to elements of a given sequence or collection (as a receiver). The pairs are then used to build the resulting 'Map'. Given the transformer refers to 'it', the 'associate[To]()' call can be replaced with more performant 'associateBy()' or 'associateWith()'. Examples: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }' After the quick-fix is applied: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }'", + "markdown": "Reports calls to `associate()` and `associateTo()` that can be replaced with `associateBy()` or `associateWith()`.\n\n\nBoth functions accept a transformer function applied to elements of a given sequence or collection (as a receiver).\nThe pairs are then used to build the resulting `Map`.\n\n\nGiven the transformer refers to `it`, the `associate[To]()` call can be replaced with more performant `associateBy()`\nor `associateWith()`.\n\n**Examples:**\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }\n\nAfter the quick-fix is applied:\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObsoleteExperimentalCoroutines", + "shortDescription": { + "text": "Experimental coroutines usages are deprecated since 1.3" + }, + "fullDescription": { + "text": "Reports code that uses experimental coroutines. Such usages are incompatible with Kotlin 1.3+ and should be updated.", + "markdown": "Reports code that uses experimental coroutines.\n\nSuch usages are incompatible with Kotlin 1.3+ and should be updated." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LiftReturnOrAssignment", + "shortDescription": { + "text": "Return or assignment can be lifted out" + }, + "fullDescription": { + "text": "Reports 'if', 'when', and 'try' statements that can be converted to expressions by lifting the 'return' statement or an assignment out. Example: 'fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }' After the quick-fix is applied: 'fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }'", + "markdown": "Reports `if`, `when`, and `try` statements that can be converted to expressions by lifting the `return` statement or an assignment out.\n\n**Example:**\n\n\n fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyWhenWithBooleanConstantCondition", + "shortDescription": { + "text": "Simplifiable 'when'" + }, + "fullDescription": { + "text": "Reports 'when' expressions with the constant 'true' or 'false' branches. Simplify \"when\" quick-fix can be used to amend the code automatically. Examples: 'fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }'", + "markdown": "Reports `when` expressions with the constant `true` or `false` branches.\n\n**Simplify \"when\"** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinConstantConditions", + "shortDescription": { + "text": "Constant conditions" + }, + "fullDescription": { + "text": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable 'when' branches and some expressions that are statically known to fail always. Examples: 'fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n}\nfun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n}' New in 2021.3", + "markdown": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable `when` branches and some expressions that are statically known to fail always.\n\nExamples:\n\n\n fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n }\n fun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n }\n\nNew in 2021.3" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ForEachParameterNotUsed", + "shortDescription": { + "text": "Iterated elements are not used in forEach" + }, + "fullDescription": { + "text": "Reports 'forEach' loops that do not use iterable values. Example: 'listOf(1, 2, 3).forEach { }' The quick fix introduces anonymous parameter in the 'forEach' section: 'listOf(1, 2, 3).forEach { _ -> }'", + "markdown": "Reports `forEach` loops that do not use iterable values.\n\n**Example:**\n\n\n listOf(1, 2, 3).forEach { }\n\nThe quick fix introduces anonymous parameter in the `forEach` section:\n\n\n listOf(1, 2, 3).forEach { _ -> }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LeakingThis", + "shortDescription": { + "text": "Leaking 'this' in constructor" + }, + "fullDescription": { + "text": "Reports unsafe operations with 'this' during object construction including: Accessing a non-final property during class initialization: from a constructor or property initialization Calling a non-final function during class initialization Using 'this' as a function argument in a constructor of a non-final class If other classes inherit from the given class, they may not be fully initialized at the moment when an unsafe operation is carried out. Example: 'abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }'", + "markdown": "Reports unsafe operations with `this` during object construction including:\n\n* Accessing a non-final property during class initialization: from a constructor or property initialization\n* Calling a non-final function during class initialization\n* Using `this` as a function argument in a constructor of a non-final class\n\n\nIf other classes inherit from the given class,\nthey may not be fully initialized at the moment when an unsafe operation is carried out.\n\n**Example:**\n\n\n abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AddVarianceModifier", + "shortDescription": { + "text": "Type parameter can have 'in' or 'out' variance" + }, + "fullDescription": { + "text": "Reports type parameters that can have 'in' or 'out' variance. Using 'in' and 'out' variance provides more precise type inference in Kotlin and clearer code semantics. Example: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }' A quick-fix adds the matching variance modifier: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }'", + "markdown": "Reports type parameters that can have `in` or `out` variance.\n\nUsing `in` and `out` variance provides more precise type inference in Kotlin and clearer code semantics.\n\n**Example:**\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }\n\nA quick-fix adds the matching variance modifier:\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveForLoopIndices", + "shortDescription": { + "text": "Unused loop index" + }, + "fullDescription": { + "text": "Reports 'for' loops iterating over a collection using the 'withIndex()' function and not using the index variable. Use the \"Remove indices in 'for' loop\" quick-fix to clean up the code. Examples: 'fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }' After the quick-fix is applied: 'fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }'", + "markdown": "Reports `for` loops iterating over a collection using the `withIndex()` function and not using the index variable.\n\nUse the \"Remove indices in 'for' loop\" quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSuspendModifier", + "shortDescription": { + "text": "Redundant 'suspend' modifier" + }, + "fullDescription": { + "text": "Reports 'suspend' modifier as redundant if no other suspending functions are called inside.", + "markdown": "Reports `suspend` modifier as redundant if no other suspending functions are called inside." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousAsDynamic", + "shortDescription": { + "text": "Suspicious 'asDynamic' member invocation" + }, + "fullDescription": { + "text": "Reports usages of 'asDynamic' function on a receiver of dynamic type. 'asDynamic' function has no effect for expressions of dynamic type. 'asDynamic' function on a receiver of dynamic type can lead to runtime problems because 'asDynamic' will be executed in JavaScript environment, and such function may not be present at runtime. The intended way is to use this function on usual Kotlin type. Remove \"asDynamic\" invocation quick-fix can be used to amend the code automatically. Example: 'fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }'", + "markdown": "Reports usages of `asDynamic` function on a receiver of dynamic type.\n\n`asDynamic` function has no effect for expressions of dynamic type.\n\n`asDynamic` function on a receiver of dynamic type can lead to runtime problems because `asDynamic`\nwill be executed in JavaScript environment, and such function may not be present at runtime.\nThe intended way is to use this function on usual Kotlin type.\n\n**Remove \"asDynamic\" invocation** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FromClosedRangeMigration", + "shortDescription": { + "text": "MIN_VALUE step in fromClosedRange() since 1.3" + }, + "fullDescription": { + "text": "Reports 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. It is prohibited to call 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. All such calls should be checked during migration to Kotlin 1.3+. Example: 'IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)' To fix the problem change the step of the progression.", + "markdown": "Reports `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with `MIN_VALUE` step.\n\n\nIt is prohibited to call `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with\n`MIN_VALUE` step. All such calls should be checked during migration to Kotlin 1.3+.\n\n**Example:**\n\n\n IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)\n\nTo fix the problem change the step of the progression." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantBackticks", + "shortDescription": { + "text": "Redundant backticks" + }, + "fullDescription": { + "text": "Reports redundant backticks in references. Some of the Kotlin keywords are valid identifiers in Java, for example: 'in', 'object', 'is'. If a Java library uses a Kotlin keyword for a method, you can still call the method escaping it with the backtick character ('`'), for example, 'foo.`is`(bar)'. Sometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is paired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code. Examples: 'fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks'", + "markdown": "Reports redundant backticks in references.\n\n\nSome of the Kotlin keywords are valid identifiers in Java, for example: `in`, `object`, `is`.\nIf a Java library uses a Kotlin keyword for a method, you can still call the method escaping it\nwith the backtick character (`````), for example, ``foo.`is`(bar)``.\nSometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is\npaired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code.\n\n**Examples:**\n\n\n fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyNestedEachInScopeFunction", + "shortDescription": { + "text": "Scope function with nested forEach can be simplified" + }, + "fullDescription": { + "text": "Reports 'forEach' functions in the scope functions such as 'also' or 'apply' that can be simplified. Convert forEach call to onEach quick-fix can be used to amend the code automatically. Examples: 'fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }' After the quick-fix is applied: 'fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }'", + "markdown": "Reports `forEach` functions in the scope functions such as `also` or `apply` that can be simplified.\n\n**Convert forEach call to onEach** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnsafeCastFromDynamic", + "shortDescription": { + "text": "Implicit (unsafe) cast from dynamic type" + }, + "fullDescription": { + "text": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type.", + "markdown": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PublicApiImplicitType", + "shortDescription": { + "text": "Public API declaration with implicit return type" + }, + "fullDescription": { + "text": "Reports 'public' and 'protected' functions and properties that have an implicit return type. For API stability reasons, it's recommended to specify such types explicitly. Example: 'fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()' After the quick-fix is applied: 'fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()'", + "markdown": "Reports `public` and `protected` functions and properties that have an implicit return type.\nFor API stability reasons, it's recommended to specify such types explicitly.\n\n**Example:**\n\n\n fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n\nAfter the quick-fix is applied:\n\n\n fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceMapIndexedWithListGenerator", + "shortDescription": { + "text": "Replace 'mapIndexed' with List generator" + }, + "fullDescription": { + "text": "Reports a 'mapIndexed' call that can be replaced by 'List' generator. Example: 'val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }' After the quick-fix is applied: 'val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }'", + "markdown": "Reports a `mapIndexed` call that can be replaced by `List` generator.\n\n**Example:**\n\n\n val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }\n\nAfter the quick-fix is applied:\n\n\n val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ControlFlowWithEmptyBody", + "shortDescription": { + "text": "Control flow with empty body" + }, + "fullDescription": { + "text": "Reports 'if', 'while', 'do' or 'for' statements with empty bodies. While occasionally intended, this construction is confusing and often the result of a typo. A quick-fix removes a statement. Example: 'if (a > b) {}'", + "markdown": "Reports `if`, `while`, `do` or `for` statements with empty bodies.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo.\n\nA quick-fix removes a statement.\n\n**Example:**\n\n\n if (a > b) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LoopToCallChain", + "shortDescription": { + "text": "Loop can be replaced with stdlib operations" + }, + "fullDescription": { + "text": "Reports 'for' loops that can be replaced with a sequence of stdlib operations (like 'map', 'filter', and so on). Example: 'fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n}' After the quick-fix is applied: 'fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n}'", + "markdown": "Reports `for` loops that can be replaced with a sequence of stdlib operations (like `map`, `filter`, and so on).\n\n**Example:**\n\n\n fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyClassBody", + "shortDescription": { + "text": "Replace empty class body" + }, + "fullDescription": { + "text": "Reports declarations of classes and objects with an empty body. Use the 'Remove redundant empty class body' quick-fix to clean up the code. Examples: 'class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }' After the quick fix is applied: 'class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }'", + "markdown": "Reports declarations of classes and objects with an empty body.\n\nUse the 'Remove redundant empty class body' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }\n\nAfter the quick fix is applied:\n\n\n class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBeParameter", + "shortDescription": { + "text": "Constructor parameter is never used as a property" + }, + "fullDescription": { + "text": "Reports primary constructor parameters that can have 'val' or 'var' removed. Class properties declared in the constructor increase memory consumption. If the parameter value is only used in the constructor, you can omit them. Note that the referenced object might be garbage-collected earlier. Example: 'class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }' A quick-fix removes the extra 'val' or 'var' keyword: 'class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }'", + "markdown": "Reports primary constructor parameters that can have `val` or `var` removed.\n\n\nClass properties declared in the constructor increase memory consumption.\nIf the parameter value is only used in the constructor, you can omit them.\n\nNote that the referenced object might be garbage-collected earlier.\n\n**Example:**\n\n\n class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n\nA quick-fix removes the extra `val` or `var` keyword:\n\n\n class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantReturnLabel", + "shortDescription": { + "text": "Redundant 'return' label" + }, + "fullDescription": { + "text": "Reports redundant return labels outside of lambda expressions. Example: 'fun test() {\n return@test\n }' After the quick-fix is applied: 'fun test() {\n return\n }'", + "markdown": "Reports redundant return labels outside of lambda expressions.\n\n**Example:**\n\n\n fun test() {\n return@test\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n return\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PackageName", + "shortDescription": { + "text": "Package naming convention" + }, + "fullDescription": { + "text": "Reports package names that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: names of packages are always lowercase and should not contain underscores. Example: 'org.example.project' Using multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case Example: 'org.example.myProject'", + "markdown": "Reports package names that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): names of packages are always lowercase and should not contain underscores.\n\n**Example:**\n`org.example.project`\n\nUsing multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case\n\n**Example:**\n`org.example.myProject`" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitUseSiteTargetAnnotationsOnSuperTypesMigration", + "shortDescription": { + "text": "Meaningless annotations targets on superclass" + }, + "fullDescription": { + "text": "Reports meaningless annotation targets on superclasses since Kotlin 1.4. Annotation targets such as '@get:' are meaningless on superclasses and are prohibited. Example: 'interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo' After the quick-fix is applied: 'interface Foo\n\n annotation class Ann\n\n class E : Foo' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports meaningless annotation targets on superclasses since Kotlin 1.4.\n\nAnnotation targets such as `@get:` are meaningless on superclasses and are prohibited.\n\n**Example:**\n\n\n interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo\n\nAfter the quick-fix is applied:\n\n\n interface Foo\n\n annotation class Ann\n\n class E : Foo\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithEnumMap", + "shortDescription": { + "text": "'HashMap' can be replaced with 'EnumMap'" + }, + "fullDescription": { + "text": "Reports 'hashMapOf' function or 'HashMap' constructor calls that can be replaced with an 'EnumMap' constructor call. Using 'EnumMap' constructor makes your code simpler. The quick-fix replaces the function call with the 'EnumMap' constructor call. Example: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()' After the quick-fix is applied: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)'", + "markdown": "Reports `hashMapOf` function or `HashMap` constructor calls that can be replaced with an `EnumMap` constructor call.\n\nUsing `EnumMap` constructor makes your code simpler.\n\nThe quick-fix replaces the function call with the `EnumMap` constructor call.\n\n**Example:**\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()\n\nAfter the quick-fix is applied:\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousCollectionReassignment", + "shortDescription": { + "text": "Augmented assignment creates a new collection under the hood" + }, + "fullDescription": { + "text": "Reports augmented assignment ('+=') expressions on read-only 'Collection'. Augment assignment ('+=') expression on read-only 'Collection' doesn't modify the target collection, it creates a new one under the hood which can be misleading and lead to performance issues. Change type to mutable quick-fix can be used to amend the code automatically. Example: 'fun test() {\n var list = listOf(0)\n list += 42 // new list is created, variable 'list' still contains only '0'\n }' After the quick-fix is applied: 'fun test() {\n val list = mutableListOf(0)\n list += 42\n }'", + "markdown": "Reports augmented assignment (`+=`) expressions on read-only `Collection`.\n\nAugment assignment (`+=`) expression on read-only `Collection` doesn't modify the target collection,\nit creates a new one under the hood which can be misleading and lead to performance issues.\n\n**Change type to mutable** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test() {\n var list = listOf(0)\n list += 42 // new list is created, variable 'list' still contains only '0'\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n val list = mutableListOf(0)\n list += 42\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantNotNullExtensionReceiverOfInline", + "shortDescription": { + "text": "'inline fun' extension receiver can be explicitly nullable until Kotlin 1.2" + }, + "fullDescription": { + "text": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). Thus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's recommended to make such functions to have nullable receiver. Example: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' After the quick-fix is applied: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", + "markdown": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nThus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's\nrecommended to make such functions to have nullable receiver.\n\n**Example:**\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantElvisReturnNull", + "shortDescription": { + "text": "Redundant '?: return null'" + }, + "fullDescription": { + "text": "Reports redundant '?: return null' Example: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }' After the quick-fix is applied: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }'", + "markdown": "Reports redundant `?: return null`\n\n**Example:**\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PrivatePropertyName", + "shortDescription": { + "text": "Private property naming convention" + }, + "fullDescription": { + "text": "Reports private property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, private property names should start with a lowercase letter and use camel case. Optionally, underscore prefix is allowed but only for private properties. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val _My_Cool_Property = \"\"' A quick-fix renames the class according to the Kotlin naming conventions: 'val _myCoolProperty = \"\"'", + "markdown": "Reports private property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nprivate property names should start with a lowercase letter and use camel case.\nOptionally, underscore prefix is allowed but only for **private** properties.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val _My_Cool_Property = \"\"\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val _myCoolProperty = \"\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObsoleteKotlinJsPackages", + "shortDescription": { + "text": "'kotlin.browser' and 'kotlin.dom' packages are deprecated since 1.4" + }, + "fullDescription": { + "text": "Reports usages of 'kotlin.dom' and 'kotlin.browser' packages. These packages were moved to 'kotlinx.dom' and 'kotlinx.browser' respectively in Kotlin 1.4+.", + "markdown": "Reports usages of `kotlin.dom` and `kotlin.browser` packages.\n\nThese packages were moved to `kotlinx.dom` and `kotlinx.browser`\nrespectively in Kotlin 1.4+." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CascadeIf", + "shortDescription": { + "text": "Cascade if can be replaced with when" + }, + "fullDescription": { + "text": "Reports 'if' statements with three or more branches that can be replaced with the 'when' expression. Example: 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }' A quick-fix converts the 'if' expression to 'when': 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }'", + "markdown": "Reports `if` statements with three or more branches that can be replaced with the `when` expression.\n\n**Example:**\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n\nA quick-fix converts the `if` expression to `when`:\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EmptyRange", + "shortDescription": { + "text": "Range with start greater than endInclusive is empty" + }, + "fullDescription": { + "text": "Reports ranges that are empty because the 'start' value is greater than the 'endInclusive' value. Example: 'val range = 2..1' The quick-fix changes the '..' operator to 'downTo': 'val range = 2 downTo 1'", + "markdown": "Reports ranges that are empty because the `start` value is greater than the `endInclusive` value.\n\n**Example:**\n\n\n val range = 2..1\n\nThe quick-fix changes the `..` operator to `downTo`:\n\n\n val range = 2 downTo 1\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OptionalExpectation", + "shortDescription": { + "text": "Optionally expected annotation has no actual annotation" + }, + "fullDescription": { + "text": "Reports optionally expected annotations without actual annotation in some platform modules. Example: '// common code\n@OptionalExpectation\nexpect annotation class JvmName(val name: String)\n\n@JvmName(name = \"JvmFoo\")\nfun foo() { }\n\n// jvm code\nactual annotation class JvmName(val name: String)' The inspection also reports cases when 'actual annotation class JvmName' is omitted for non-JVM platforms (for example, Native).", + "markdown": "Reports optionally expected annotations without actual annotation in some platform modules.\n\n**Example:**\n\n // common code\n @OptionalExpectation\n expect annotation class JvmName(val name: String)\n\n @JvmName(name = \"JvmFoo\")\n fun foo() { }\n\n // jvm code\n actual annotation class JvmName(val name: String)\n\nThe inspection also reports cases when `actual annotation class JvmName` is omitted for non-JVM platforms (for example, Native)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DestructuringWrongName", + "shortDescription": { + "text": "Variable in destructuring declaration uses name of a wrong data class property" + }, + "fullDescription": { + "text": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class. Example: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }' The quick-fix changes variable's name to match the name of the corresponding class field: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }'", + "markdown": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class.\n\n**Example:**\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }\n\nThe quick-fix changes variable's name to match the name of the corresponding class field:\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IfThenToSafeAccess", + "shortDescription": { + "text": "If-Then foldable to '?.'" + }, + "fullDescription": { + "text": "Reports 'if-then' expressions that can be folded into safe-access ('?.') expressions. Example: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }' The quick fix converts the 'if-then' expression into a safe-access ('?.') expression: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }'", + "markdown": "Reports `if-then` expressions that can be folded into safe-access (`?.`) expressions.\n\n**Example:**\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }\n\nThe quick fix converts the `if-then` expression into a safe-access (`?.`) expression:\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RestrictReturnStatementTargetMigration", + "shortDescription": { + "text": "Target label does not denote a function since 1.4" + }, + "fullDescription": { + "text": "Reports labels that don't points to a functions. It's forbidden to declare a target label that does not denote a function. The quick-fix removes the label. Example: 'fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }' After the quick-fix is applied: 'fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }' This inspection only reports if the language level of the project or module is 1.4 or higher.", + "markdown": "Reports labels that don't points to a functions.\n\nIt's forbidden to declare a target label that does not denote a function.\n\nThe quick-fix removes the label.\n\n**Example:**\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }\n\nAfter the quick-fix is applied:\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }\n\nThis inspection only reports if the language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MigrateDiagnosticSuppression", + "shortDescription": { + "text": "Diagnostic name should be replaced" + }, + "fullDescription": { + "text": "Reports suppressions with old diagnostic names, for example '@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")'. Some of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant. Example: '@Suppress(\"HEADER_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}' After the quick-fix is applied: '@Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}'", + "markdown": "Reports suppressions with old diagnostic names, for example `@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")`.\n\n\nSome of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant.\n\n**Example:**\n\n\n @Suppress(\"HEADER_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n\nAfter the quick-fix is applied:\n\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeferredResultUnused", + "shortDescription": { + "text": "'@Deferred' result is unused" + }, + "fullDescription": { + "text": "Reports function calls with the 'Deferred' result type if the return value is not used. If the 'Deferred' return value is not used, the call site would not wait to complete this function. Example: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }' A quick-fix provides a variable with the 'Deferred' initializer: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }'", + "markdown": "Reports function calls with the `Deferred` result type if the return value is not used.\n\nIf the `Deferred` return value is not used, the call site would not wait to complete this function.\n\n**Example:**\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }\n\nA quick-fix provides a variable with the `Deferred` initializer:\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SelfReferenceConstructorParameter", + "shortDescription": { + "text": "Constructor can never be complete" + }, + "fullDescription": { + "text": "Reports constructors with a non-null self-reference parameter. Such constructors never instantiate a class. The quick-fix converts the parameter type to nullable. Example: 'class SelfRef(val ref: SelfRef)' After the quick-fix is applied: 'class SelfRef(val ref: SelfRef?)'", + "markdown": "Reports constructors with a non-null self-reference parameter.\n\nSuch constructors never instantiate a class.\n\nThe quick-fix converts the parameter type to nullable.\n\n**Example:**\n\n\n class SelfRef(val ref: SelfRef)\n\nAfter the quick-fix is applied:\n\n\n class SelfRef(val ref: SelfRef?)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MainFunctionReturnUnit", + "shortDescription": { + "text": "Entry point function should return Unit" + }, + "fullDescription": { + "text": "Reports entry point functions with an incorrect return type (should be 'Unit'). Example: 'fun main() = \"Hello world!\"'", + "markdown": "Reports entry point functions with an incorrect return type (should be `Unit`).\n\n**Example:**\n`fun main() = \"Hello world!\"`" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousCallableReferenceInLambda", + "shortDescription": { + "text": "Suspicious callable reference used as lambda result" + }, + "fullDescription": { + "text": "Reports lambda expressions with one callable reference. It is a common error to replace a lambda with a callable reference without changing curly braces to parentheses. Example: 'listOf(1,2,3).map { it::toString }' After the quick-fix is applied: 'listOf(1,2,3).map(Int::toString)'", + "markdown": "Reports lambda expressions with one callable reference.\n\nIt is a common error to replace a lambda with a callable reference without changing curly braces to parentheses.\n\n**Example:**\n\n listOf(1,2,3).map { it::toString }\n\nAfter the quick-fix is applied:\n\n listOf(1,2,3).map(Int::toString)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertSecondaryConstructorToPrimary", + "shortDescription": { + "text": "Convert to primary constructor" + }, + "fullDescription": { + "text": "Reports a secondary constructor that can be replaced with a more concise primary constructor. Example: 'class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }' A quick-fix converts code automatically: 'class User(val name: String) {\n }'", + "markdown": "Reports a secondary constructor that can be replaced with a more concise primary constructor.\n\n**Example:**\n\n\n class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }\n\nA quick-fix converts code automatically:\n\n\n class User(val name: String) {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceGetOrSet", + "shortDescription": { + "text": "Explicit 'get' or 'set' call" + }, + "fullDescription": { + "text": "Reports explicit calls to 'get' or 'set' functions which can be replaced by an indexing operator '[]'. Kotlin allows custom implementations for the predefined set of operators on types. To overload an operator, you can mark the corresponding function with the 'operator' modifier: 'operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}' The functions above correspond to the indexing operator. Example: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }' After the quick-fix is applied: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }'", + "markdown": "Reports explicit calls to `get` or `set` functions which can be replaced by an indexing operator `[]`.\n\n\nKotlin allows custom implementations for the predefined set of operators on types.\nTo overload an operator, you can mark the corresponding function with the `operator` modifier:\n\n\n operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}\n \nThe functions above correspond to the indexing operator.\n\n**Example:**\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }\n\nAfter the quick-fix is applied:\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitRepeatedUseSiteTargetAnnotationsMigration", + "shortDescription": { + "text": "Repeated annotation which is not marked as '@Repeatable'" + }, + "fullDescription": { + "text": "Reports the repeated use of a non-'@Repeatable' annotation on property accessors. As a result of using non-'@Repeatable' annotation multiple times, both annotation usages will appear in the bytecode leading to an ambiguity in reflection calls. Since Kotlin 1.4 it's mandatory to either mark annotation as '@Repeatable' or not repeat the annotation, otherwise it will lead to compilation error. Example: 'annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports the repeated use of a non-`@Repeatable` annotation on property accessors.\n\n\nAs a result of using non-`@Repeatable` annotation multiple times, both annotation usages\nwill appear in the bytecode leading to an ambiguity in reflection calls.\n\n\nSince Kotlin 1.4 it's mandatory to either mark annotation as `@Repeatable` or not\nrepeat the annotation, otherwise it will lead to compilation error.\n\n**Example:**\n\n\n annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Destructure", + "shortDescription": { + "text": "Use destructuring declaration" + }, + "fullDescription": { + "text": "Reports declarations that can be destructured. Example: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }' The quick-fix destructures the declaration and introduces new variables with names from the corresponding class: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }'", + "markdown": "Reports declarations that can be destructured.\n\n**Example:**\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }\n\nThe quick-fix destructures the declaration and introduces new variables with names from the corresponding class:\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedReceiverParameter", + "shortDescription": { + "text": "Unused receiver parameter" + }, + "fullDescription": { + "text": "Reports receiver parameter of extension functions and properties that is not used. Remove redundant receiver parameter can be used to amend the code automatically.", + "markdown": "Reports receiver parameter of extension functions and properties that is not used.\n\n**Remove redundant receiver parameter** can be used to amend the code automatically." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertTryFinallyToUseCall", + "shortDescription": { + "text": "Convert try / finally to use() call" + }, + "fullDescription": { + "text": "Reports a 'try-finally' block with 'resource.close()' in 'finally' which can be converted to a 'resource.use()' call. 'use()' is easier to read and less error-prone as there is no need in explicit 'close()' call. Example: 'fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }' After the quick-fix applied: 'fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }'", + "markdown": "Reports a `try-finally` block with `resource.close()` in `finally` which can be converted to a `resource.use()` call.\n\n`use()` is easier to read and less error-prone as there is no need in explicit `close()` call.\n\n**Example:**\n\n\n fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }\n\nAfter the quick-fix applied:\n\n\n fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinRedundantOverride", + "shortDescription": { + "text": "Redundant overriding method" + }, + "fullDescription": { + "text": "Reports redundant overriding declarations. An override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility. Example: 'open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }' After the quick-fix is applied: 'class Bar : Foo() {\n }'", + "markdown": "Reports redundant overriding declarations.\n\n\nAn override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility.\n\n**Example:**\n\n\n open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }\n\nAfter the quick-fix is applied:\n\n\n class Bar : Foo() {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceArrayOfWithLiteral", + "shortDescription": { + "text": "'arrayOf' call can be replaced with array literal [...]" + }, + "fullDescription": { + "text": "Reports 'arrayOf' calls that can be replaced with array literals '[...]'. Examples: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass' After the quick-fix is applied: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass'", + "markdown": "Reports `arrayOf` calls that can be replaced with array literals `[...]`.\n\n**Examples:**\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass\n\nAfter the quick-fix is applied:\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceToWithInfixForm", + "shortDescription": { + "text": "'to' call should be replaced with infix form" + }, + "fullDescription": { + "text": "Reports 'to' function calls that can be replaced with the infix form. Using the infix form makes your code simpler. The quick-fix replaces 'to' with the infix form. Example: 'fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) {\n val pair = a to b\n }'", + "markdown": "Reports `to` function calls that can be replaced with the infix form.\n\nUsing the infix form makes your code simpler.\n\nThe quick-fix replaces `to` with the infix form.\n\n**Example:**\n\n\n fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int, b: Int) {\n val pair = a to b\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstPropertyName", + "shortDescription": { + "text": "Const property naming convention" + }, + "fullDescription": { + "text": "Reports 'const' property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, 'const' properties should use uppercase underscore-separated names. Example: 'const val Planck: Double = 6.62607015E-34' A quick-fix renames the property: 'const val PLANCK: Double = 6.62607015E-34'", + "markdown": "Reports `const` property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#property-names),\n`const` properties should use uppercase underscore-separated names.\n\n**Example:**\n\n\n const val Planck: Double = 6.62607015E-34\n\nA quick-fix renames the property:\n\n\n const val PLANCK: Double = 6.62607015E-34\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantNullableReturnType", + "shortDescription": { + "text": "Redundant nullable return type" + }, + "fullDescription": { + "text": "Reports functions and variables with nullable return type which never return or become 'null'. Example: 'fun greeting(user: String): String? = \"Hello, $user!\"' After the quick-fix is applied: 'fun greeting(user: String): String = \"Hello, $user!\"'", + "markdown": "Reports functions and variables with nullable return type which never return or become `null`.\n\n**Example:**\n\n\n fun greeting(user: String): String? = \"Hello, $user!\"\n\nAfter the quick-fix is applied:\n\n\n fun greeting(user: String): String = \"Hello, $user!\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UselessCallOnNotNull", + "shortDescription": { + "text": "Useless call on not-null type" + }, + "fullDescription": { + "text": "Reports calls on not-null receiver that make sense only for nullable receiver. Several functions from the standard library such as 'orEmpty()' or 'isNullOrEmpty' have sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same. Remove redundant call and Change call to … quick-fixes can be used to amend the code automatically. Examples: 'fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }'", + "markdown": "Reports calls on not-null receiver that make sense only for nullable receiver.\n\nSeveral functions from the standard library such as `orEmpty()` or `isNullOrEmpty`\nhave sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same.\n\n**Remove redundant call** and **Change call to ...** quick-fixes can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EqualsOrHashCode", + "shortDescription": { + "text": "'equals()' and 'hashCode()' not paired" + }, + "fullDescription": { + "text": "Reports classes that override 'equals()' but do not override 'hashCode()', or vice versa. It also reports object declarations that override either 'equals()' or 'hashCode()'. This can lead to undesired behavior when a class is added to a 'Collection' Example: 'class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }' The quick-fix overrides 'equals()' or 'hashCode()' for classes and deletes these methods for objects: 'class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }'", + "markdown": "Reports classes that override `equals()` but do not override `hashCode()`, or vice versa. It also reports object declarations that override either `equals()` or `hashCode()`.\n\nThis can lead to undesired behavior when a class is added to a `Collection`\n\n**Example:**\n\n\n class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }\n\nThe quick-fix overrides `equals()` or `hashCode()` for classes and deletes these methods for objects:\n\n\n class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + } + ] + }, + "invocations": [ + { + "exitCode": 0, + "toolExecutionNotifications": [], + "executionSuccessful": true + } + ], + "language": "en-US", + "results": [], + "automationDetails": { + "id": "project - 12/13/21, 3:48 PM", + "guid": "d0a57b70-6936-41ab-bf04-97c58449a43d" + }, + "newlineSequences": [ + "\r\n", + "\n" + ], + "properties": { + "coverage": { + "totalCoverage": 0, + "totalLines": 100, + "totalCoveredLines": 0, + "freshCoverage": 0, + "freshLines": 100, + "freshCoveredLines": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/vsts/__tests__/data/some.sarif.json b/vsts/__tests__/data/some.sarif.json new file mode 100644 index 00000000..296000c6 --- /dev/null +++ b/vsts/__tests__/data/some.sarif.json @@ -0,0 +1,8275 @@ +{ + "version": "2.1.0", + "runs": [ + { + "tool": { + "driver": { + "name": "QDJVM", + "fullName": "Qodana for JVM", + "version": "213.6433.60", + "rules": [], + "taxa": [], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + "extensions": [ + { + "name": "org.jetbrains.kotlin", + "version": "213-1.5.10-release-949-IJ6433", + "rules": [ + { + "id": "RedundantRunCatching", + "shortDescription": { + "text": "Redundant 'runCatching' call" + }, + "fullDescription": { + "text": "Reports 'runCatching' calls that are immediately followed by 'getOrThrow'. Such calls can be replaced with just 'run'. Example: 'fun foo() = runCatching { doSomething() }.getOrThrow()' After the quick-fix is applied: 'fun foo() = run { doSomething() }'", + "markdown": "Reports `runCatching` calls that are immediately followed by `getOrThrow`. Such calls can be replaced with just `run`.\n\n**Example:**\n\n\n fun foo() = runCatching { doSomething() }.getOrThrow()\n\nAfter the quick-fix is applied:\n\n\n fun foo() = run { doSomething() }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimpleRedundantLet", + "shortDescription": { + "text": "Redundant receiver-based 'let' call" + }, + "fullDescription": { + "text": "Reports redundant receiver-based 'let' calls. The quick-fix removes the redundant 'let' call. Example: 'fun test(s: String?): Int? = s?.let { it.length }' After the quick-fix is applied: 'fun test(s: String?): Int? = s?.length'", + "markdown": "Reports redundant receiver-based `let` calls.\n\nThe quick-fix removes the redundant `let` call.\n\n**Example:**\n\n\n fun test(s: String?): Int? = s?.let { it.length }\n\nAfter the quick-fix is applied:\n\n\n fun test(s: String?): Int? = s?.length\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveSingleExpressionStringTemplate", + "shortDescription": { + "text": "Redundant string template" + }, + "fullDescription": { + "text": "Reports single-expression string templates that can be safely removed. Example: 'val x = \"Hello\"\n val y = \"$x\"' After the quick-fix is applied: 'val x = \"Hello\"\n val y = x // <== Updated'", + "markdown": "Reports single-expression string templates that can be safely removed.\n\n**Example:**\n\n val x = \"Hello\"\n val y = \"$x\"\n\nAfter the quick-fix is applied:\n\n val x = \"Hello\"\n val y = x // <== Updated\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IncompleteDestructuring", + "shortDescription": { + "text": "Incomplete destructuring declaration" + }, + "fullDescription": { + "text": "Reports incomplete destructuring declaration. Example: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person' The quick fix completes destructuring declaration with new variables: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person'", + "markdown": "Reports incomplete destructuring declaration.\n\n**Example:**\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person\n\nThe quick fix completes destructuring declaration with new variables:\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ScopeFunctionConversion", + "shortDescription": { + "text": "Scope function can be converted to another one" + }, + "fullDescription": { + "text": "Reports scope functions ('let', 'run', 'apply', 'also') that can be converted between each other. Using corresponding functions makes your code simpler. The quick-fix replaces the scope function to another one. Example: 'val x = \"\".let {\n it.length\n }' After the quick-fix is applied: 'val x = \"\".run {\n length\n }'", + "markdown": "Reports scope functions (`let`, `run`, `apply`, `also`) that can be converted between each other.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the scope function to another one.\n\n**Example:**\n\n\n val x = \"\".let {\n it.length\n }\n\nAfter the quick-fix is applied:\n\n\n val x = \"\".run {\n length\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TrailingComma", + "shortDescription": { + "text": "Trailing comma recommendations" + }, + "fullDescription": { + "text": "Reports trailing commas that are not follow the recommended style guide.", + "markdown": "Reports trailing commas that are not follow the recommended [style guide](https://kotlinlang.org/docs/coding-conventions.html#trailing-commas)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FoldInitializerAndIfToElvis", + "shortDescription": { + "text": "If-Null return/break/... foldable to '?:'" + }, + "fullDescription": { + "text": "Reports an 'if' expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer. Example: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }' The quick-fix converts the 'if' expression with an initializer into an elvis expression: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }'", + "markdown": "Reports an `if` expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer.\n\n**Example:**\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }\n\nThe quick-fix converts the `if` expression with an initializer into an elvis expression:\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinInvalidBundleOrProperty", + "shortDescription": { + "text": "Invalid property key" + }, + "fullDescription": { + "text": "Reports unresolved references to '.properties' file keys and resource bundles in Kotlin files.", + "markdown": "Reports unresolved references to `.properties` file keys and resource bundles in Kotlin files." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UselessCallOnCollection", + "shortDescription": { + "text": "Useless call on collection type" + }, + "fullDescription": { + "text": "Reports 'filter…' calls from the standard library on already filtered collections. Several functions from the standard library such as 'filterNotNull()' or 'filterIsInstance' have sense only when they are called on receivers that have types distinct from the resulting one. Otherwise, such calls can be omitted as the result will be the same. Remove redundant call quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }'", + "markdown": "Reports `filter...` calls from the standard library on already filtered collections.\n\nSeveral functions from the standard library such as `filterNotNull()` or `filterIsInstance`\nhave sense only when they are called on receivers that have types distinct from the resulting one. Otherwise,\nsuch calls can be omitted as the result will be the same.\n\n**Remove redundant call** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantRequireNotNullCall", + "shortDescription": { + "text": "Redundant 'requireNotNull' or 'checkNotNull' call" + }, + "fullDescription": { + "text": "Reports redundant 'requireNotNull' or 'checkNotNull' call on non-nullable expressions. Example: 'fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }' After the quick-fix is applied: 'fun foo(i: Int) {\n ...\n }'", + "markdown": "Reports redundant `requireNotNull` or `checkNotNull` call on non-nullable expressions.\n\n**Example:**\n\n\n fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(i: Int) {\n ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObjectPropertyName", + "shortDescription": { + "text": "Object property naming convention" + }, + "fullDescription": { + "text": "Reports properties that do not follow the naming conventions. The following properties are reported: Top-level properties Properties in objects and companion objects You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with an uppercase letter, use camel case and no underscores. Example: '// top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }'", + "markdown": "Reports properties that do not follow the naming conventions.\n\nThe following properties are reported:\n\n* Top-level properties\n* Properties in objects and companion objects\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): it has to start with an uppercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n // top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PackageDirectoryMismatch", + "shortDescription": { + "text": "Package name does not match containing directory" + }, + "fullDescription": { + "text": "Reports 'package' directives that do not match the location of the file.", + "markdown": "Reports `package` directives that do not match the location of the file." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinCovariantEquals", + "shortDescription": { + "text": "Covariant 'equals()'" + }, + "fullDescription": { + "text": "Reports 'equals()' that takes an argument type other than 'Any?' if the class does not have another 'equals()' that takes 'Any?' as its argument type. Example: 'class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }' To fix the problem create 'equals()' method that takes an argument of type 'Any?'.", + "markdown": "Reports `equals()` that takes an argument type other than `Any?` if the class does not have another `equals()` that takes `Any?` as its argument type.\n\n**Example:**\n\n\n class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }\n\nTo fix the problem create `equals()` method that takes an argument of type `Any?`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSizeZeroCheckWithIsEmpty", + "shortDescription": { + "text": "Size zero check can be replaced with 'isEmpty()'" + }, + "fullDescription": { + "text": "Reports 'size == 0' checks on 'Collections/Array/String' that should be replaced with 'isEmpty()'. Using 'isEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }'", + "markdown": "Reports `size == 0` checks on `Collections/Array/String` that should be replaced with `isEmpty()`.\n\nUsing `isEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantEnumConstructorInvocation", + "shortDescription": { + "text": "Redundant enum constructor invocation" + }, + "fullDescription": { + "text": "Reports redundant constructor invocation on an enum entry. Example: 'enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }' After the quick-fix is applied: 'enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }'", + "markdown": "Reports redundant constructor invocation on an enum entry.\n\n**Example:**\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }\n\nAfter the quick-fix is applied:\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DirectUseOfResultType", + "shortDescription": { + "text": "Function returning Result directly" + }, + "fullDescription": { + "text": "Reports functions that use 'Result' as a return type. 'Result' should never be used as a return type. Throw an exception, use a nullable type, or use a domain-specific result class to indicate failure. Example: 'fun foo() = Result.success(true)'", + "markdown": "Reports functions that use `Result` as a return type.\n\n\n`Result` should never be used as a return type.\nThrow an exception, use a nullable type, or use a domain-specific result class to indicate failure.\n\n**Example:**\n\n\n fun foo() = Result.success(true)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FakeJvmFieldConstant", + "shortDescription": { + "text": "Kotlin non-const property used as Java constant" + }, + "fullDescription": { + "text": "Reports Kotlin properties that are not 'const' and used as Java annotation arguments. For example, a property with the '@JvmField' annotation has an initializer that can be evaluated at compile-time, and it has a primitive or 'String' type. Such properties have a 'ConstantValue' attribute in bytecode in Kotlin 1.1-1.2. This attribute allows javac to fold usages of the corresponding field and use that field in annotations. This can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code. This behavior is subject to change in Kotlin 1.3 (no 'ConstantValue' attribute any more). Example: Kotlin code in foo.kt file: 'annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"' Java code: 'public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }' To fix the problem replace the '@JvmField' annotation with the 'const' modifier on a relevant Kotlin property or inline it.", + "markdown": "Reports Kotlin properties that are not `const` and used as Java annotation arguments.\n\n\nFor example, a property with the `@JvmField` annotation has an initializer that can be evaluated at compile-time,\nand it has a primitive or `String` type.\n\n\nSuch properties have a `ConstantValue` attribute in bytecode in Kotlin 1.1-1.2.\nThis attribute allows javac to fold usages of the corresponding field and use that field in annotations.\nThis can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code.\nThis behavior is subject to change in Kotlin 1.3 (no `ConstantValue` attribute any more).\n\n**Example:**\n\nKotlin code in foo.kt file:\n\n\n annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"\n\nJava code:\n\n\n public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }\n\nTo fix the problem replace the `@JvmField` annotation with the `const` modifier on a relevant Kotlin property or inline it." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WhenWithOnlyElse", + "shortDescription": { + "text": "'when' has only 'else' branch and can be simplified" + }, + "fullDescription": { + "text": "Reports 'when' expressions with only an 'else' branch that can be simplified. Simplify expression quick-fix can be used to amend the code automatically. Example: 'fun redundant() {\n val x = when { // <== redundant, a quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }'", + "markdown": "Reports `when` expressions with only an `else` branch that can be simplified.\n\n**Simplify expression** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun redundant() {\n val x = when { // <== redundant, a quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Reformat", + "shortDescription": { + "text": "File is not formatted according to project settings" + }, + "fullDescription": { + "text": "Reports places that are not formatted according to the project settings. Use the 'Reformat Code' and 'Reformat File...' quick-fixes to format either the highlighted code block or the entire file accordingly.", + "markdown": "Reports places that are not formatted according to the project settings.\n\nUse the 'Reformat Code' and 'Reformat File...' quick-fixes to format either the highlighted code block\nor the entire file accordingly." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinTestJUnit", + "shortDescription": { + "text": "kotlin-test-junit could be used" + }, + "fullDescription": { + "text": "Reports usage of 'kotlin-test' and 'junit' dependency without 'kotlin-test-junit'. It is recommended to use 'kotlin-test-junit' dependency to work with Kotlin and JUnit.", + "markdown": "Reports usage of `kotlin-test` and `junit` dependency without `kotlin-test-junit`.\n\nIt is recommended to use `kotlin-test-junit` dependency to work with Kotlin and JUnit." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SafeCastWithReturn", + "shortDescription": { + "text": "Safe cast with 'return' should be replaced with 'if' type check" + }, + "fullDescription": { + "text": "Reports safe cast with 'return' that can be replaced with 'if' type check. Using corresponding functions makes your code simpler. The quick-fix replaces the safe cast with 'if' type check. Example: 'fun test(x: Any) {\n x as? String ?: return\n }' After the quick-fix is applied: 'fun test(x: Any) {\n if (x !is String) return\n }'", + "markdown": "Reports safe cast with `return` that can be replaced with `if` type check.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the safe cast with `if` type check.\n\n**Example:**\n\n\n fun test(x: Any) {\n x as? String ?: return\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(x: Any) {\n if (x !is String) return\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceAssertBooleanWithAssertEquality", + "shortDescription": { + "text": "Assert boolean could be replaced with assert equality" + }, + "fullDescription": { + "text": "Reports calls to 'assertTrue()' and 'assertFalse()' that can be replaced with assert equality functions. 'assertEquals()', 'assertSame()', and their negating counterparts (-Not-) provide more informative messages on failure. Example: 'assertTrue(a == b)' After the quick-fix is applied: 'assertEquals(a, b)'", + "markdown": "Reports calls to `assertTrue()` and `assertFalse()` that can be replaced with assert equality functions.\n\n\n`assertEquals()`, `assertSame()`, and their negating counterparts (-Not-) provide more informative messages on\nfailure.\n\n**Example:**\n\n assertTrue(a == b)\n\nAfter the quick-fix is applied:\n\n assertEquals(a, b)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceStringFormatWithLiteral", + "shortDescription": { + "text": "'String.format' call can be replaced with string templates" + }, + "fullDescription": { + "text": "Reports 'String.format' calls that can be replaced with string templates. Using string templates makes your code simpler. The quick-fix replaces the call with a string template. Example: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }' After the quick-fix is applied: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }'", + "markdown": "Reports `String.format` calls that can be replaced with string templates.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces the call with a string template.\n\n**Example:**\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceNotNullAssertionWithElvisReturn", + "shortDescription": { + "text": "Not-null assertion can be replaced with 'return'" + }, + "fullDescription": { + "text": "Reports not-null assertion ('!!') calls that can be replaced with the elvis operator and return ('?: return'). A not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of '!!' is good practice. The quick-fix replaces the not-null assertion with 'return' or 'return null'. Example: 'fun test(number: Int?) {\n val x = number!!\n }' After the quick-fix is applied: 'fun test(number: Int?) {\n val x = number ?: return\n }'", + "markdown": "Reports not-null assertion (`!!`) calls that can be replaced with the elvis operator and return (`?: return`).\n\nA not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of `!!` is good practice.\n\nThe quick-fix replaces the not-null assertion with `return` or `return null`.\n\n**Example:**\n\n\n fun test(number: Int?) {\n val x = number!!\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(number: Int?) {\n val x = number ?: return\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithSubstringBefore", + "shortDescription": { + "text": "'substring' call should be replaced with 'substringBefore'" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, s.indexOf(x))' that can be replaced with 's.substringBefore(x)'. Using 'substringBefore()' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringBefore'. Example: 'fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringBefore('x')\n }'", + "markdown": "Reports calls like `s.substring(0, s.indexOf(x))` that can be replaced with `s.substringBefore(x)`.\n\nUsing `substringBefore()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringBefore`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringBefore('x')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithOperatorAssignment", + "shortDescription": { + "text": "Assignment can be replaced with operator assignment" + }, + "fullDescription": { + "text": "Reports modifications of variables with a simple assignment (such as 'y = y + x') that can be replaced with an operator assignment. The quick-fix replaces the assignment with an assignment operator. Example: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }' After the quick-fix is applied: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }'", + "markdown": "Reports modifications of variables with a simple assignment (such as `y = y + x`) that can be replaced with an operator assignment.\n\nThe quick-fix replaces the assignment with an assignment operator.\n\n**Example:**\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedSymbol", + "shortDescription": { + "text": "Unused symbol" + }, + "fullDescription": { + "text": "Reports symbols that are not used or not reachable from entry points.", + "markdown": "Reports symbols that are not used or not reachable from entry points." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceCollectionCountWithSize", + "shortDescription": { + "text": "Collection count can be converted to size" + }, + "fullDescription": { + "text": "Reports calls to 'Collection.count()'. This function call can be replaced with '.size'. '.size' form ensures that the operation is O(1) and won't allocate extra objects, whereas 'count()' could be confused with 'Iterable.count()', which is O(n) and allocating. Example: 'fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }' After the quick-fix is applied: 'fun foo() {\n var list = listOf(1,2,3)\n list.size\n }'", + "markdown": "Reports calls to `Collection.count()`.\n\n\nThis function call can be replaced with `.size`.\n\n\n`.size` form ensures that the operation is O(1) and won't allocate extra objects, whereas\n`count()` could be confused with `Iterable.count()`, which is O(n) and allocating.\n\n\n**Example:**\n\n fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }\n\nAfter the quick-fix is applied:\n\n fun foo() {\n var list = listOf(1,2,3)\n list.size\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceArrayEqualityOpWithArraysEquals", + "shortDescription": { + "text": "Arrays comparison via '==' and '!='" + }, + "fullDescription": { + "text": "Reports usages of '==' or '!=' operator for arrays that should be replaced with 'contentEquals()'. The '==' and '!='operators compare array references instead of their content. Examples: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }' After the quick-fix is applied: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }'", + "markdown": "Reports usages of `==` or `!=` operator for arrays that should be replaced with `contentEquals()`.\n\n\nThe `==` and `!=`operators compare array references instead of their content.\n\n**Examples:**\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }\n\nAfter the quick-fix is applied:\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedGradleDependency", + "shortDescription": { + "text": "Deprecated library is used in Gradle" + }, + "fullDescription": { + "text": "Reports deprecated dependencies in Gradle build scripts. Example: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }' After the quick-fix applied: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }'", + "markdown": "Reports deprecated dependencies in Gradle build scripts.\n\n**Example:**\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }\n\nAfter the quick-fix applied:\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertReferenceToLambda", + "shortDescription": { + "text": "Can be replaced with lambda" + }, + "fullDescription": { + "text": "Reports a function reference expression that can be replaced with a function literal (lambda). Sometimes, passing a lambda looks more straightforward and more consistent with the rest of the code. Also, the fix might be handy if you need to replace a simple call with something more complex. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }'", + "markdown": "Reports a function reference expression that can be replaced with a function literal (lambda).\n\n\nSometimes, passing a lambda looks more straightforward and more consistent with the rest of the code.\nAlso, the fix might be handy if you need to replace a simple call with something more complex.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnlabeledReturnInsideLambda", + "shortDescription": { + "text": "Unlabeled return inside lambda" + }, + "fullDescription": { + "text": "Reports unlabeled 'return' expressions inside inline lambda. Such expressions can be confusing because it might be unclear which scope belongs to 'return'. Change to return@… quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }'", + "markdown": "Reports unlabeled `return` expressions inside inline lambda.\n\nSuch expressions can be confusing because it might be unclear which scope belongs to `return`.\n\n**Change to return@...** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LateinitVarOverridesLateinitVar", + "shortDescription": { + "text": "lateinit var property overrides lateinit var property" + }, + "fullDescription": { + "text": "Reports 'lateinit var' properties that override another 'lateinit var' property. A subclass instance will have two fields for the single property, and the one from the superclass will remain effectively unused. Example: open class BaseClass { open lateinit var name: String } class RealClass : BaseClass() { override lateinit var name: String } ''", + "markdown": "Reports `lateinit var` properties that override another `lateinit var` property.\n\n\nA subclass instance will have two fields for the single property, and the one from the superclass will remain effectively unused.\n\n**Example:**\nopen class BaseClass { open lateinit var name: String } class RealClass : BaseClass() { override lateinit var name: String }\n\n```\n\n```" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentKotlinGradleVersion", + "shortDescription": { + "text": "Kotlin Gradle and IDE plugins versions are different" + }, + "fullDescription": { + "text": "Reports that different IDE and Gradle plugin versions are used. This can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }' To fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin.", + "markdown": "Reports that different IDE and Gradle plugin versions are used.\n\nThis can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }\n\nTo fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinEqualsBetweenInconvertibleTypes", + "shortDescription": { + "text": "'equals()' between objects of inconvertible types" + }, + "fullDescription": { + "text": "Reports calls to 'equals()' where the receiver and the argument are of incompatible primitive, enum, or string types. While such a call might theoretically be useful, most likely it represents a bug. Example: '5.equals(\"\");'", + "markdown": "Reports calls to `equals()` where the receiver and the argument are of incompatible primitive, enum, or string types.\n\nWhile such a call might theoretically be useful, most likely it represents a bug.\n\n**Example:**\n\n 5.equals(\"\");\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JoinDeclarationAndAssignment", + "shortDescription": { + "text": "Join declaration and assignment" + }, + "fullDescription": { + "text": "Reports property declarations that can be joined with the following assignment. Example: 'val x: String\n x = System.getProperty(\"\")' The quick fix joins the declaration with the assignment: 'val x = System.getProperty(\"\")'", + "markdown": "Reports property declarations that can be joined with the following assignment.\n\n**Example:**\n\n\n val x: String\n x = System.getProperty(\"\")\n\nThe quick fix joins the declaration with the assignment:\n\n\n val x = System.getProperty(\"\")\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HasPlatformType", + "shortDescription": { + "text": "Function or property has platform type" + }, + "fullDescription": { + "text": "Reports functions and properties that have a platform type. To prevent unexpected errors, the type should be declared explicitly. Example: 'fun foo() = java.lang.String.valueOf(1)' The quick fix allows you to specify the return type: 'fun foo(): String = java.lang.String.valueOf(1)'", + "markdown": "Reports functions and properties that have a platform type.\n\nTo prevent unexpected errors, the type should be declared explicitly.\n\n**Example:**\n\n\n fun foo() = java.lang.String.valueOf(1)\n\nThe quick fix allows you to specify the return type:\n\n\n fun foo(): String = java.lang.String.valueOf(1)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DataClassPrivateConstructor", + "shortDescription": { + "text": "Private data class constructor is exposed via the 'copy' method" + }, + "fullDescription": { + "text": "Reports the 'private' primary constructor in data classes. 'data' classes have a 'copy()' factory method that can be used similarly to a constructor. A constructor should not be marked as 'private' to provide enough safety. Example: 'data class User private constructor(val name: String)' A quick-fix changes the constructor visibility modifier to 'public': 'data class User(val name: String)'", + "markdown": "Reports the `private` primary constructor in data classes.\n\n\n`data` classes have a `copy()` factory method that can be used similarly to a constructor.\nA constructor should not be marked as `private` to provide enough safety.\n\n**Example:**\n\n\n data class User private constructor(val name: String)\n\nA quick-fix changes the constructor visibility modifier to `public`:\n\n\n data class User(val name: String)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantInnerClassModifier", + "shortDescription": { + "text": "Redundant 'inner' modifier" + }, + "fullDescription": { + "text": "Reports the 'inner' modifier on a class as redundant if it doesn't reference members of its outer class. Example: 'class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }' After the quick-fix is applied: 'class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }'", + "markdown": "Reports the `inner` modifier on a class as redundant if it doesn't reference members of its outer class.\n\n**Example:**\n\n\n class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaCollectionsStaticMethodOnImmutableList", + "shortDescription": { + "text": "Call of Java mutator method on immutable Kotlin collection" + }, + "fullDescription": { + "text": "Reports Java mutator methods calls (like 'fill', 'reverse', 'shuffle', 'sort') on an immutable Kotlin collection. This can lead to 'UnsupportedOperationException' at runtime. Example: 'import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }' To fix the problem make the list mutable.", + "markdown": "Reports Java mutator methods calls (like `fill`, `reverse`, `shuffle`, `sort`) on an immutable Kotlin collection.\n\nThis can lead to `UnsupportedOperationException` at runtime.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }\n\nTo fix the problem make the list mutable." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MavenCoroutinesDeprecation", + "shortDescription": { + "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Maven" + }, + "fullDescription": { + "text": "Reports kotlinx.coroutines library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later.", + "markdown": "Reports **kotlinx.coroutines** library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration/Maven", + "index": 119, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NullableBooleanElvis", + "shortDescription": { + "text": "Equality check can be used instead of elvis for nullable boolean check" + }, + "fullDescription": { + "text": "Reports cases when an equality check should be used instead of the elvis operator. Example: 'fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n}' After the quick-fix is applied: 'fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n}'", + "markdown": "Reports cases when an equality check should be used instead of the elvis operator.\n\n**Example:**\n\n\n fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n }\n\nAfter the quick-fix is applied:\n\n\n fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedMavenDependency", + "shortDescription": { + "text": "Deprecated library is used in Maven" + }, + "fullDescription": { + "text": "Reports deprecated maven dependency. Example: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n ' The quick fix changes the deprecated dependency to a maintained one: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n '", + "markdown": "Reports deprecated maven dependency.\n\n**Example:**\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n \n\nThe quick fix changes the deprecated dependency to a maintained one:\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnnecessaryVariable", + "shortDescription": { + "text": "Unnecessary local variable" + }, + "fullDescription": { + "text": "Reports local variables that used only in the very next 'return' statement or exact copies of other variables. Such variables can be safely inlined to make the code more clear.", + "markdown": "Reports local variables that used only in the very next `return` statement or exact copies of other variables.\n\nSuch variables can be safely inlined to make the code more clear." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantEmptyInitializerBlock", + "shortDescription": { + "text": "Redundant empty initializer block" + }, + "fullDescription": { + "text": "Reports redundant empty initializer blocks. Example: 'class Foo {\n init {\n // Empty init block\n }\n }' After the quick-fix is applied: 'class Foo {\n }'", + "markdown": "Reports redundant empty initializer blocks.\n\n**Example:**\n\n\n class Foo {\n init {\n // Empty init block\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "GradleKotlinxCoroutinesDeprecation", + "shortDescription": { + "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Gradle" + }, + "fullDescription": { + "text": "Reports 'kotlinx.coroutines' library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+. Example: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }' The quick fix changes the 'kotlinx.coroutines' library version to a compatible with Kotlin 1.3: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }'", + "markdown": "Reports `kotlinx.coroutines` library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+.\n\n**Example:**\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }\n\nThe quick fix changes the `kotlinx.coroutines` library version to a compatible with Kotlin 1.3:\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration/Gradle", + "index": 127, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantWith", + "shortDescription": { + "text": "Redundant 'with' call" + }, + "fullDescription": { + "text": "Reports redundant 'with' function calls that don't access anything from the receiver. Examples: 'class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }'", + "markdown": "Reports redundant `with` function calls that don't access anything from the receiver.\n\n**Examples:**\n\n\n class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WarningOnMainUnusedParameterMigration", + "shortDescription": { + "text": "Unused `args` on `main` since 1.4" + }, + "fullDescription": { + "text": "Reports 'main' function with an unused single parameter. Since Kotlin 1.4, it is possible to use the 'main' function without parameter as the entry point to the Kotlin program. The compiler reports a warning for the 'main' function with an unused parameter.", + "markdown": "Reports `main` function with an unused single parameter.\n\nSince Kotlin 1.4, it is possible to use the `main` function without parameter as the entry point to the Kotlin program.\nThe compiler reports a warning for the `main` function with an unused parameter." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLabelMigration", + "shortDescription": { + "text": "Redundant label" + }, + "fullDescription": { + "text": "Reports redundant labels which cause compilation errors since Kotlin 1.4. Since Kotlin 1.0, one can mark any statement with a label: 'fun foo() {\n L1@ val x = L2@bar()\n }' However, these labels can be referenced only in a limited number of ways: break / continue from a loop non-local return from an inline lambda or inline anonymous function sssss Such labels are prohibited since Kotlin 1.4. This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports redundant labels which cause compilation errors since Kotlin 1.4.\n\nSince Kotlin 1.0, one can mark any statement with a label:\n\n\n fun foo() {\n L1@ val x = L2@bar()\n }\n\nHowever, these labels can be referenced only in a limited number of ways:\n\n* break / continue from a loop\n* non-local return from an inline lambda or inline anonymous function\nsssss\n\nSuch labels are prohibited since Kotlin 1.4.\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceNegatedIsEmptyWithIsNotEmpty", + "shortDescription": { + "text": "Negated call can be simplified" + }, + "fullDescription": { + "text": "Reports negation 'isEmpty()' and 'isNotEmpty()' for collections and 'String', or 'isBlank()' and 'isNotBlank()' for 'String'. Using corresponding functions makes your code simpler. The quick-fix replaces the negation call with the corresponding call from the Standard Library. Example: 'fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }' After the quick-fix is applied: 'fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }'", + "markdown": "Reports negation `isEmpty()` and `isNotEmpty()` for collections and `String`, or `isBlank()` and `isNotBlank()` for `String`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the negation call with the corresponding call from the Standard Library.\n\n**Example:**\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DelegationToVarProperty", + "shortDescription": { + "text": "Delegating to 'var' property" + }, + "fullDescription": { + "text": "Reports interface delegation to a 'var' property. Only initial value of a property is used for delegation, any later assignments do not affect it. Example: 'class Example(var text: CharSequence): CharSequence by text' A quick-fix replaces a property with immutable one: 'class Example(val text: CharSequence): CharSequence by text' Alternative way, if you rely on mutability for some reason: 'class Example(text: CharSequence): CharSequence by text {\n var text = text\n }'", + "markdown": "Reports interface delegation to a `var` property.\n\nOnly initial value of a property is used for delegation, any later assignments do not affect it.\n\n**Example:**\n\n\n class Example(var text: CharSequence): CharSequence by text\n\nA quick-fix replaces a property with immutable one:\n\n\n class Example(val text: CharSequence): CharSequence by text\n\nAlternative way, if you rely on mutability for some reason:\n\n\n class Example(text: CharSequence): CharSequence by text {\n var text = text\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstantConditionIf", + "shortDescription": { + "text": "Condition of 'if' expression is constant" + }, + "fullDescription": { + "text": "Reports 'if' expressions that have 'true' or 'false' constant literal condition and can be simplified. While occasionally intended, this construction is confusing and often the result of a typo or previous refactoring. Example: 'fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }' A quick-fix removes the 'if' condition: 'fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }'", + "markdown": "Reports `if` expressions that have `true` or `false` constant literal condition and can be simplified.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo\nor previous refactoring.\n\n**Example:**\n\n\n fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }\n\nA quick-fix removes the `if` condition:\n\n\n fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLambdaArrow", + "shortDescription": { + "text": "Redundant lambda arrow" + }, + "fullDescription": { + "text": "Reports redundant lambda arrows in lambdas without parameters. Example: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -> println(\"Hi!\") }\n }' After the quick-fix is applied: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }'", + "markdown": "Reports redundant lambda arrows in lambdas without parameters.\n\n**Example:**\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -\\> println(\"Hi!\") }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinInternalInJava", + "shortDescription": { + "text": "Usage of Kotlin internal declarations from Java" + }, + "fullDescription": { + "text": "Reports usages of Kotlin 'internal' declarations in Java code that is located in a different module. The 'internal' keyword is designed to restrict access to a class, function, or property from other modules. Due to JVM limitations, 'internal' classes, functions, and properties can still be accessed from outside Kotlin, which may later lead to compatibility problems.", + "markdown": "Reports usages of Kotlin `internal` declarations in Java code that is located in a different module.\n\n\nThe `internal` keyword is designed to restrict access to a class, function, or property from other modules.\nDue to JVM limitations, `internal` classes, functions, and properties can still be\naccessed from outside Kotlin, which may later lead to compatibility problems." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UseWithIndex", + "shortDescription": { + "text": "Manually incremented index variable can be replaced with use of 'withIndex()'" + }, + "fullDescription": { + "text": "Reports 'for' loops with a manually incremented index variable. 'for' loops with a manually incremented index variable can be simplified with the 'withIndex()' function. Use withIndex() instead of manual index increment quick-fix can be used to amend the code automatically. Example: 'fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }' After the quick-fix is applied: 'fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }'", + "markdown": "Reports `for` loops with a manually incremented index variable.\n\n`for` loops with a manually incremented index variable can be simplified with the `withIndex()` function.\n\n**Use withIndex() instead of manual index increment** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ImplicitThis", + "shortDescription": { + "text": "Implicit 'this'" + }, + "fullDescription": { + "text": "Reports usages of implicit this. Example: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }' The quick fix specifies this explicitly: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }'", + "markdown": "Reports usages of implicit **this** .\n\n**Example:**\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }\n\nThe quick fix specifies **this** explicitly:\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinCatchMayIgnoreException", + "shortDescription": { + "text": "'catch' block may ignore exception" + }, + "fullDescription": { + "text": "Reports 'catch' blocks that are empty or may ignore an exception. While occasionally intended, empty 'catch' blocks may complicate debugging. Also, ignoring a 'catch' parameter might be wrong. The inspection won't report any 'catch' parameters named 'ignore', 'ignored', or '_'. You can use a quick-fix to change the exception name to '_'. Example: 'try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }' After the quick-fix is applied: 'try {\n throwingMethod()\n } catch (_: IOException) {\n\n }' Use the Do not warn when 'catch' block contains a comment option to ignore 'catch' blocks with comments.", + "markdown": "Reports `catch` blocks that are empty or may ignore an exception.\n\nWhile occasionally intended, empty `catch` blocks may complicate debugging.\nAlso, ignoring a `catch` parameter might be wrong.\n\n\nThe inspection won't report any `catch` parameters named `ignore`, `ignored`, or `_`.\n\n\nYou can use a quick-fix to change the exception name to `_`.\n\n**Example:**\n\n\n try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n throwingMethod()\n } catch (_: IOException) {\n\n }\n\nUse the **Do not warn when 'catch' block contains a comment** option to ignore `catch` blocks with comments." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentStdlibGradleVersion", + "shortDescription": { + "text": "Kotlin library and Gradle plugin versions are different" + }, + "fullDescription": { + "text": "Reports different Kotlin stdlib and compiler versions. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }' To fix the problem change the kotlin stdlib version to match the kotlin compiler version.", + "markdown": "Reports different Kotlin stdlib and compiler versions.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }\n\nTo fix the problem change the kotlin stdlib version to match the kotlin compiler version." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBeVal", + "shortDescription": { + "text": "Local 'var' is never modified and can be declared as 'val'" + }, + "fullDescription": { + "text": "Reports local variables declared with the 'var' keyword that are never modified. Kotlin encourages to declare practically immutable variables using the 'val' keyword, ensuring that their value will never change. Example: 'fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }' A quick-fix replaces the 'var' keyword with 'val': 'fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }'", + "markdown": "Reports local variables declared with the `var` keyword that are never modified.\n\nKotlin encourages to declare practically immutable variables using the `val` keyword, ensuring that their value will never change.\n\n**Example:**\n\n\n fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n\nA quick-fix replaces the `var` keyword with `val`:\n\n\n fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithIgnoreCaseEquals", + "shortDescription": { + "text": "Should be replaced with 'equals(..., ignoreCase = true)'" + }, + "fullDescription": { + "text": "Reports case-insensitive comparisons that can be replaced with 'equals(..., ignoreCase = true)'. By using 'equals()' you don't have to allocate extra strings with 'toLowerCase()' or 'toUpperCase()' to compare strings. The quick-fix replaces the case-insensitive comparison that uses 'toLowerCase()' or 'toUpperCase()' with 'equals(..., ignoreCase = true)'. Note: May change semantics for some locales. Example: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }' After the quick-fix is applied: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }'", + "markdown": "Reports case-insensitive comparisons that can be replaced with `equals(..., ignoreCase = true)`.\n\nBy using `equals()` you don't have to allocate extra strings with `toLowerCase()` or `toUpperCase()` to compare strings.\n\nThe quick-fix replaces the case-insensitive comparison that uses `toLowerCase()` or `toUpperCase()` with `equals(..., ignoreCase = true)`.\n\n**Note:** May change semantics for some locales.\n\n**Example:**\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithSubstringAfter", + "shortDescription": { + "text": "'substring' call should be replaced with 'substringAfter'" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(s.indexOf(x))' that can be replaced with 's.substringAfter(x)'. Using 's.substringAfter(x)' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringAfter'. Example: 'fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringAfter('x')\n }'", + "markdown": "Reports calls like `s.substring(s.indexOf(x))` that can be replaced with `s.substringAfter(x)`.\n\nUsing `s.substringAfter(x)` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringAfter`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringAfter('x')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantCompanionReference", + "shortDescription": { + "text": "Redundant 'Companion' reference" + }, + "fullDescription": { + "text": "Reports redundant 'Companion' reference. Example: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }' After the quick-fix is applied: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }'", + "markdown": "Reports redundant `Companion` reference.\n\n**Example:**\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }\n\nAfter the quick-fix is applied:\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KDocUnresolvedReference", + "shortDescription": { + "text": "Unresolved reference in KDoc" + }, + "fullDescription": { + "text": "Reports unresolved references in KDoc comments. Example: '/**\n * [unresolvedLink]\n */\n fun foo() {}' To fix the problem make the link valid.", + "markdown": "Reports unresolved references in KDoc comments.\n\n**Example:**\n\n\n /**\n * [unresolvedLink]\n */\n fun foo() {}\n\nTo fix the problem make the link valid." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NestedLambdaShadowedImplicitParameter", + "shortDescription": { + "text": "Nested lambda has shadowed implicit parameter" + }, + "fullDescription": { + "text": "Reports nested lambdas with shadowed implicit parameters. Example: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n}' After the quick-fix is applied: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n}'", + "markdown": "Reports nested lambdas with shadowed implicit parameters.\n\n**Example:**\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSamConstructor", + "shortDescription": { + "text": "Redundant SAM constructor" + }, + "fullDescription": { + "text": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas. Example: 'fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}' After the quick-fix is applied: 'fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}'", + "markdown": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas.\n\n**Example:**\n\n\n fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "InconsistentCommentForJavaParameter", + "shortDescription": { + "text": "Inconsistent comment for java parameter" + }, + "fullDescription": { + "text": "Reports inconsistent parameter name for java method specified in a comment block. Examples: '// Java\n public class JavaService {\n public void invoke(String command) {}\n }' '// Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }' The quick fix corrects parameter name in a comment block: 'fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }'", + "markdown": "Reports inconsistent parameter name for **java** method specified in a comment block.\n\n**Examples:**\n\n\n // Java\n public class JavaService {\n public void invoke(String command) {}\n }\n\n\n // Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }\n\nThe quick fix corrects parameter name in a comment block:\n\n\n fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantCallsOfConversionMethods", + "shortDescription": { + "text": "Redundant call of conversion method" + }, + "fullDescription": { + "text": "Reports redundant calls to conversion methods (for example, 'toString()' on a 'String' or 'toDouble()' on a 'Double'). Use the 'Remove redundant calls of the conversion method' quick-fix to clean up the code.", + "markdown": "Reports redundant calls to conversion methods (for example, `toString()` on a `String` or `toDouble()` on a `Double`).\n\nUse the 'Remove redundant calls of the conversion method' quick-fix to clean up the code." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinThrowableNotThrown", + "shortDescription": { + "text": "Throwable not thrown" + }, + "fullDescription": { + "text": "Reports instantiations of 'Throwable' or its subclasses, when the created 'Throwable' is never actually thrown. The reported code indicates mistakes that are hard to catch in tests. Also, this inspection reports method calls that return instances of 'Throwable' or its subclasses, when the resulting 'Throwable' instance is not thrown. Example: 'fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }'", + "markdown": "Reports instantiations of `Throwable` or its subclasses, when the created `Throwable` is never actually thrown.\n\nThe reported code indicates mistakes that are hard to catch in tests.\n\n\nAlso, this inspection reports method calls that return instances of `Throwable` or its subclasses,\nwhen the resulting `Throwable` instance is not thrown.\n\n**Example:**\n\n\n fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinSealedInheritorsInJava", + "shortDescription": { + "text": "Inheritance of Kotlin sealed interface/class from Java" + }, + "fullDescription": { + "text": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code. Example: '// Kotlin file: MathExpression.kt\n\nsealed class MathExpression\n\ndata class Const(val number: Double) : MathExpression()\ndata class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()' '// Java file: NotANumber.java\n\npublic class NotANumber extends MathExpression {\n}'", + "markdown": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code.\n\n**Example:**\n\n\n // Kotlin file: MathExpression.kt\n\n sealed class MathExpression\n\n data class Const(val number: Double) : MathExpression()\n data class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()\n\n\n // Java file: NotANumber.java\n\n public class NotANumber extends MathExpression {\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyNegatedBinaryExpression", + "shortDescription": { + "text": "Negated boolean expression can be simplified" + }, + "fullDescription": { + "text": "Reports negated binary expressions that can be simplified. The quick-fix simplifies the binary expression. Example: 'fun test(n: Int) {\n !(0 == 1)\n }' After the quick-fix is applied: 'fun test(n: Int) {\n 0 != 1\n }'", + "markdown": "Reports negated binary expressions that can be simplified.\n\nThe quick-fix simplifies the binary expression.\n\n**Example:**\n\n\n fun test(n: Int) {\n !(0 == 1)\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(n: Int) {\n 0 != 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MemberVisibilityCanBePrivate", + "shortDescription": { + "text": "Class member can have 'private' visibility" + }, + "fullDescription": { + "text": "Reports declarations that can be made 'private' to follow the encapsulation principle. Example: 'class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}' After the quick-fix is applied (considering there are no usages of 'url' outside of 'Service' class): 'class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}'", + "markdown": "Reports declarations that can be made `private` to follow the encapsulation principle.\n\n**Example:**\n\n\n class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n\nAfter the quick-fix is applied (considering there are no usages of `url` outside of `Service` class):\n\n\n class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SelfAssignment", + "shortDescription": { + "text": "Redundant assignment" + }, + "fullDescription": { + "text": "Reports assignments of a variable to itself. The quick-fix removes the redundant assignment. Example: 'fun test() {\n var bar = 1\n bar = bar\n }' After the quick-fix is applied: 'fun test() {\n var bar = 1\n }'", + "markdown": "Reports assignments of a variable to itself.\n\nThe quick-fix removes the redundant assignment.\n\n**Example:**\n\n\n fun test() {\n var bar = 1\n bar = bar\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n var bar = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RecursiveEqualsCall", + "shortDescription": { + "text": "Recursive equals call" + }, + "fullDescription": { + "text": "Reports recursive 'equals'('==') calls. In Kotlin, '==' compares object values by calling 'equals' method under the hood. '===', on the other hand, compares objects by reference. '===' is commonly used in 'equals' method implementation. But '===' may be mistakenly mixed up with '==' leading to infinite recursion. Example: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }' After the quick-fix is applied: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }'", + "markdown": "Reports recursive `equals`(`==`) calls.\n\n\nIn Kotlin, `==` compares object values by calling `equals` method under the hood.\n`===`, on the other hand, compares objects by reference.\n\n\n`===` is commonly used in `equals` method implementation.\nBut `===` may be mistakenly mixed up with `==` leading to infinite recursion.\n\n**Example:**\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ExplicitThis", + "shortDescription": { + "text": "Redundant explicit 'this'" + }, + "fullDescription": { + "text": "Reports an explicit 'this' when it can be omitted. Example: 'class C {\n private val i = 1\n fun f() = this.i\n }' The quick-fix removes the redundant 'this': 'class C {\n private val i = 1\n fun f() = i\n }'", + "markdown": "Reports an explicit `this` when it can be omitted.\n\n**Example:**\n\n\n class C {\n private val i = 1\n fun f() = this.i\n }\n\nThe quick-fix removes the redundant `this`:\n\n\n class C {\n private val i = 1\n fun f() = i\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NullChecksToSafeCall", + "shortDescription": { + "text": "Null-checks can be replaced with safe-calls" + }, + "fullDescription": { + "text": "Reports chained null-checks that can be replaced with safe-calls. Example: 'fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }' After the quick-fix is applied: 'fun test(my: My?) {\n if (my?.foo() != null) {}\n }'", + "markdown": "Reports chained null-checks that can be replaced with safe-calls.\n\n**Example:**\n\n\n fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(my: My?) {\n if (my?.foo() != null) {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedMainParameter", + "shortDescription": { + "text": "Main parameter is not necessary" + }, + "fullDescription": { + "text": "Reports 'main' function with an unused single parameter.", + "markdown": "Reports `main` function with an unused single parameter." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionWithLambdaExpressionBody", + "shortDescription": { + "text": "Function with `= { ... }` and inferred return type" + }, + "fullDescription": { + "text": "Reports functions with '= { ... }' and inferred return type. Example: 'fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.' The quick fix removes braces: 'fun sum(a: Int, b: Int) = a + b'", + "markdown": "Reports functions with `= { ... }` and inferred return type.\n\n**Example:**\n\n\n fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.\n\nThe quick fix removes braces:\n\n\n fun sum(a: Int, b: Int) = a + b\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ArrayInDataClass", + "shortDescription": { + "text": "Array property in data class" + }, + "fullDescription": { + "text": "Reports properties with an 'Array' type in a 'data' class without overridden 'equals()' or 'hashCode()'. Array parameters are compared by reference equality, which is likely an unexpected behavior. It is strongly recommended to override 'equals()' and 'hashCode()' in such cases. Example: 'data class Text(val lines: Array)' A quick-fix generates missing 'equals()' and 'hashCode()' implementations: 'data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }'", + "markdown": "Reports properties with an `Array` type in a `data` class without overridden `equals()` or `hashCode()`.\n\n\nArray parameters are compared by reference equality, which is likely an unexpected behavior.\nIt is strongly recommended to override `equals()` and `hashCode()` in such cases.\n\n**Example:**\n\n\n data class Text(val lines: Array)\n\nA quick-fix generates missing `equals()` and `hashCode()` implementations:\n\n\n data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertTwoComparisonsToRangeCheck", + "shortDescription": { + "text": "Two comparisons should be converted to a range check" + }, + "fullDescription": { + "text": "Reports two consecutive comparisons that can be converted to a range check. Checking against a range makes code simpler by removing test subject duplication. Example: 'fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }' A quick-fix replaces the comparison-based check with a range one: 'fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }'", + "markdown": "Reports two consecutive comparisons that can be converted to a range check.\n\nChecking against a range makes code simpler by removing test subject duplication.\n\n**Example:**\n\n\n fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }\n\nA quick-fix replaces the comparison-based check with a range one:\n\n\n fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LocalVariableName", + "shortDescription": { + "text": "Local variable naming convention" + }, + "fullDescription": { + "text": "Reports local variables that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with a lowercase letter, use camel case and no underscores. Example: 'fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }'", + "markdown": "Reports local variables that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#function-names): it has to start with a lowercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantQualifierName", + "shortDescription": { + "text": "Redundant qualifier name" + }, + "fullDescription": { + "text": "Reports redundant qualifiers (or their parts) on class names, functions, and properties. A fully qualified name is an unambiguous identifier that specifies which object, function, or property a call refers to. In the contexts where the name can be shortened, the inspection informs on the opportunity and the associated 'Remove redundant qualifier name' quick-fix allows amending the code. Examples: 'package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = my.simple.name.Foo() // 'Foo' resides in the declared 'my.simple.name' package, qualifier is redundant\n val b = kotlin.Int.MAX_VALUE // Can be replaced with 'MAX_VALUE' since it's imported\n val c = kotlin.Double.MAX_VALUE // Can be replaced with 'Double.MAX_VALUE' since built-in types are imported automatically\n }' After the quick-fix is applied: 'package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = Foo()\n val b = MAX_VALUE\n val c = Double.MAX_VALUE\n }'", + "markdown": "Reports redundant qualifiers (or their parts) on class names, functions, and properties.\n\n\nA fully qualified name is an unambiguous identifier that specifies which object, function, or property a call refers to.\nIn the contexts where the name can be shortened, the inspection informs on the opportunity and the associated\n'Remove redundant qualifier name' quick-fix allows amending the code.\n\n**Examples:**\n\n\n package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = my.simple.name.Foo() // 'Foo' resides in the declared 'my.simple.name' package, qualifier is redundant\n val b = kotlin.Int.MAX_VALUE // Can be replaced with 'MAX_VALUE' since it's imported\n val c = kotlin.Double.MAX_VALUE // Can be replaced with 'Double.MAX_VALUE' since built-in types are imported automatically\n }\n\nAfter the quick-fix is applied:\n\n\n package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = Foo()\n val b = MAX_VALUE\n val c = Double.MAX_VALUE\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveCurlyBracesFromTemplate", + "shortDescription": { + "text": "Redundant curly braces in string template" + }, + "fullDescription": { + "text": "Reports usages of curly braces in string templates around simple identifiers. Use the 'Remove curly braces' quick-fix to remove the redundant braces. Examples: 'fun redundant() {\n val x = 4\n val y = \"${x}\" // <== redundant\n }\n\n fun correctUsage() {\n val x = \"x\"\n val y = \"${x.length}\" // <== Ok\n }' After the quick-fix is applied: 'fun redundant() {\n val x = 4\n val y = \"$x\"\n }\n\n fun correctUsage() {\n val x = \"x\" <== Updated\n val y = \"${x.length}\"\n }'", + "markdown": "Reports usages of curly braces in string templates around simple identifiers.\n\nUse the 'Remove curly braces' quick-fix to remove the redundant braces.\n\n**Examples:**\n\n\n fun redundant() {\n val x = 4\n val y = \"${x}\" // <== redundant\n }\n\n fun correctUsage() {\n val x = \"x\"\n val y = \"${x.length}\" // <== Ok\n }\n\nAfter the quick-fix is applied:\n\n\n fun redundant() {\n val x = 4\n val y = \"$x\"\n }\n\n fun correctUsage() {\n val x = \"x\" <== Updated\n val y = \"${x.length}\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithIndexingOperation", + "shortDescription": { + "text": "'substring' call should be replaced with indexing operator" + }, + "fullDescription": { + "text": "Reports calls like '\"abc\".substring(0, 1)' that can be replaced with '\"abc\"[0]'. Obtaining the element by index makes your code simpler. The quick-fix replaces the 'substring' call with the indexing operator. Example: 'fun foo() {\n \"abc\".substring(0, 1)\n }' After the quick-fix is applied: 'fun foo() {\n \"abc\"[0]\n }'", + "markdown": "Reports calls like `\"abc\".substring(0, 1)` that can be replaced with `\"abc\"[0]`.\n\nObtaining the element by index makes your code simpler.\n\nThe quick-fix replaces the `substring` call with the indexing operator.\n\n**Example:**\n\n\n fun foo() {\n \"abc\".substring(0, 1)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n \"abc\"[0]\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MoveLambdaOutsideParentheses", + "shortDescription": { + "text": "Lambda argument inside parentheses" + }, + "fullDescription": { + "text": "Reports lambda expressions in parentheses which can be moved outside. Example: 'fun square(a: Int, b: (Int) -> Int) {\n b(a * a)\n}\n\nfun foo() {\n square(2, { it })\n}' After the quick-fix is applied: 'fun foo() {\n square(2){ it }\n}'", + "markdown": "Reports lambda expressions in parentheses which can be moved outside.\n\n**Example:**\n\n\n fun square(a: Int, b: (Int) -> Int) {\n b(a * a)\n }\n\n fun foo() {\n square(2, { it })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n square(2){ it }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OverridingDeprecatedMember", + "shortDescription": { + "text": "Overriding deprecated member" + }, + "fullDescription": { + "text": "Reports declarations that inherit from deprecated members. Example: 'open class BaseService {\n @Deprecated(\"obsolete\", replaceWith = ReplaceWith(\"connection\"))\n open fun connect() {}\n\n open fun connection() {}\n} \n\nclass SomeService: BaseService() {\n override fun connect() {\n super.connect()\n }\n}'", + "markdown": "Reports declarations that inherit from deprecated members.\n\n**Example:**\n\n\n open class BaseService {\n @Deprecated(\"obsolete\", replaceWith = ReplaceWith(\"connection\"))\n open fun connect() {}\n\n open fun connection() {}\n } \n\n class SomeService: BaseService() {\n override fun connect() {\n super.connect()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitTypeParametersForLocalVariablesMigration", + "shortDescription": { + "text": "Local variable with type parameters" + }, + "fullDescription": { + "text": "Reports local variables with type parameters. A type parameter for a local variable doesn't make sense because it can't be specialized. Example: 'fun main() {\n val x = \"\"\n }' After the quick-fix is applied: 'fun main() {\n val x = \"\"\n }' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports local variables with type parameters.\n\nA type parameter for a local variable doesn't make sense because it can't be specialized.\n\n**Example:**\n\n\n fun main() {\n val x = \"\"\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val x = \"\"\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TestFunctionName", + "shortDescription": { + "text": "Test function naming convention" + }, + "fullDescription": { + "text": "Reports test function names that do not follow the recommended naming conventions.", + "markdown": "Reports test function names that do not follow the [recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#names-for-test-methods)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RecursivePropertyAccessor", + "shortDescription": { + "text": "Recursive property accessor" + }, + "fullDescription": { + "text": "Reports recursive property accessor calls which can end up with a 'StackOverflowError'. Such calls are usually confused with backing field access. Example: 'var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }' After the quick-fix is applied: 'var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }'", + "markdown": "Reports recursive property accessor calls which can end up with a `StackOverflowError`.\nSuch calls are usually confused with backing field access.\n\n**Example:**\n\n\n var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }\n\nAfter the quick-fix is applied:\n\n\n var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantUnitExpression", + "shortDescription": { + "text": "Redundant 'Unit'" + }, + "fullDescription": { + "text": "Reports redundant 'Unit' expressions. 'Unit' in Kotlin can be used as the return type of functions that do not return anything meaningful. The 'Unit' type has only one possible value, which is the 'Unit' object. Examples: 'fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }'", + "markdown": "Reports redundant `Unit` expressions.\n\n\n`Unit` in Kotlin can be used as the return type of functions that do not return anything meaningful.\nThe `Unit` type has only one possible value, which is the `Unit` object.\n\n**Examples:**\n\n\n fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PlatformExtensionReceiverOfInline", + "shortDescription": { + "text": "'inline fun' with nullable receiver until Kotlin 1.2" + }, + "fullDescription": { + "text": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). It's recommended to add an explicit '!!' you want an exception to be thrown, or consider changing the function's receiver type to nullable if it should work without exceptions. Example: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }' After the quick-fix is applied: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", + "markdown": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nIt's recommended to add an explicit `!!` you want an exception to be thrown,\nor consider changing the function's receiver type to nullable if it should work without exceptions.\n\n**Example:**\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousEqualsCombination", + "shortDescription": { + "text": "Suspicious combination of == and ===" + }, + "fullDescription": { + "text": "Reports '==' and '===' comparisons that are both used on the same variable within a single expression. Due to similarities '==' and '===' could be mixed without notice, and it takes a close look to check that '==' used instead of '===' Example: 'if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return'", + "markdown": "Reports `==` and `===` comparisons that are both used on the same variable within a single expression.\n\nDue to similarities `==` and `===` could be mixed without notice, and\nit takes a close look to check that `==` used instead of `===`\n\nExample:\n\n\n if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedDataClassCopyResult", + "shortDescription": { + "text": "Unused result of data class copy" + }, + "fullDescription": { + "text": "Reports calls to data class 'copy' function without using its result.", + "markdown": "Reports calls to data class `copy` function without using its result." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantElseInIf", + "shortDescription": { + "text": "Redundant 'else' in 'if'" + }, + "fullDescription": { + "text": "Reports redundant 'else' in 'if' with 'return' Example: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }' After the quick-fix is applied: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }'", + "markdown": "Reports redundant `else` in `if` with `return`\n\n**Example:**\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplacePutWithAssignment", + "shortDescription": { + "text": "'map.put()' can be converted to assignment" + }, + "fullDescription": { + "text": "Reports 'map.put' function calls that can be replaced with indexing operator ('[]'). Using syntactic sugar makes your code simpler. The quick-fix replaces 'put' call with the assignment. Example: 'fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }' After the quick-fix is applied: 'fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }'", + "markdown": "Reports `map.put` function calls that can be replaced with indexing operator (`[]`).\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces `put` call with the assignment.\n\n**Example:**\n\n\n fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinDoubleNegation", + "shortDescription": { + "text": "Redundant double negation" + }, + "fullDescription": { + "text": "Reports redundant double negations. Example: 'val truth = !!true'", + "markdown": "Reports redundant double negations.\n\n**Example:**\n\n val truth = !!true\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionName", + "shortDescription": { + "text": "Function naming convention" + }, + "fullDescription": { + "text": "Reports function names that do not follow the recommended naming conventions. Example: 'fun Foo() {}' To fix the problem change the name of the function to match the recommended naming conventions.", + "markdown": "Reports function names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n fun Foo() {}\n\nTo fix the problem change the name of the function to match the recommended naming conventions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentKotlinMavenVersion", + "shortDescription": { + "text": "Maven and IDE plugins versions are different" + }, + "fullDescription": { + "text": "Reports the Maven plugin version of the Kotlin compiler that is different from the one that is used in the IDE plugin. This inconsistency may lead to different error reporting behavior in the IDE and the compiler", + "markdown": "Reports the Maven plugin version of the Kotlin compiler that is different from the one that is used in the IDE plugin.\n\nThis inconsistency may lead to different error reporting behavior in the IDE and the compiler" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantUnitReturnType", + "shortDescription": { + "text": "Redundant 'Unit' return type" + }, + "fullDescription": { + "text": "Reports a redundant 'Unit' return type which can be omitted.", + "markdown": "Reports a redundant `Unit` return type which can be omitted." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceRangeToWithUntil", + "shortDescription": { + "text": "'rangeTo' or the '..' call should be replaced with 'until'" + }, + "fullDescription": { + "text": "Reports calls to 'rangeTo' or the '..' operator instead of calls to 'until'. Using corresponding functions makes your code simpler. The quick-fix replaces 'rangeTo' or the '..' call with 'until'. Example: 'fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }' After the quick-fix is applied: 'fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }'", + "markdown": "Reports calls to `rangeTo` or the `..` operator instead of calls to `until`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces `rangeTo` or the `..` call with `until`.\n\n**Example:**\n\n\n fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedEquals", + "shortDescription": { + "text": "Unused equals expression" + }, + "fullDescription": { + "text": "Reports unused 'equals'('==') expressions.", + "markdown": "Reports unused `equals`(`==`) expressions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnclearPrecedenceOfBinaryExpression", + "shortDescription": { + "text": "Multiple operators with different precedence" + }, + "fullDescription": { + "text": "Reports binary expressions that consist of different operators without parentheses. Such expressions can be less readable due to different precedence rules of operators. Example: fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }", + "markdown": "Reports binary expressions that consist of different operators without parentheses.\n\nSuch expressions can be less readable due to different [precedence rules](https://kotlinlang.org/docs/reference/grammar.html#expressions) of operators.\n\nExample:\n\n```\n fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }\n```" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedLambdaExpressionBody", + "shortDescription": { + "text": "Unused return value of a function with lambda expression body" + }, + "fullDescription": { + "text": "Reports calls with an unused return value when the called function returns a lambda from an expression body. If there is '=' between function header and body block, code from the function will not be evaluated which can lead to incorrect behavior. Remove = token from function declaration can be used to amend the code automatically. Example: 'fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }' After the quick-fix is applied: 'fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }'", + "markdown": "Reports calls with an unused return value when the called function returns a lambda from an expression body.\n\n\nIf there is `=` between function header and body block,\ncode from the function will not be evaluated which can lead to incorrect behavior.\n\n**Remove = token from function declaration** can be used to amend the code automatically.\n\nExample:\n\n\n fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }\n\nAfter the quick-fix is applied:\n\n\n fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertLambdaToReference", + "shortDescription": { + "text": "Can be replaced with function reference" + }, + "fullDescription": { + "text": "Reports function literal expressions that can be replaced with function references. Replacing lambdas with function references often makes code look more concise and understandable. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }'", + "markdown": "Reports function literal expressions that can be replaced with function references.\n\nReplacing lambdas with function references often makes code look more concise and understandable.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSetter", + "shortDescription": { + "text": "Redundant property setter" + }, + "fullDescription": { + "text": "Reports redundant property setters. Setter is considered to be redundant in one of the following cases: Setter has no body. Accessor visibility isn't changed, declaration isn't 'external' and has no annotations. 'var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated' Setter body is a block with a single statement assigning the parameter to the backing field. 'var prop: Int = 0\n set(value) { // redundant\n field = value\n }'", + "markdown": "Reports redundant property setters.\n\n\nSetter is considered to be redundant in one of the following cases:\n\n1. Setter has no body. Accessor visibility isn't changed, declaration isn't `external` and has no annotations.\n\n\n var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated\n \n2. Setter body is a block with a single statement assigning the parameter to the backing field.\n\n\n var prop: Int = 0\n set(value) { // redundant\n field = value\n }\n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanSealedSubClassBeObject", + "shortDescription": { + "text": "Sealed sub-class without state and overridden equals" + }, + "fullDescription": { + "text": "Reports direct inheritors of 'sealed' classes that have no state and overridden 'equals()' method. It's highly recommended to override 'equals()' to provide comparison stability, or convert the 'class' to an 'object' to reach the same effect. Example: 'sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }' A quick-fix converts a 'class' into an 'object': 'sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }'", + "markdown": "Reports direct inheritors of `sealed` classes that have no state and overridden `equals()` method.\n\nIt's highly recommended to override `equals()` to provide comparison stability, or convert the `class` to an `object` to reach the same effect.\n\n**Example:**\n\n\n sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n\nA quick-fix converts a `class` into an `object`:\n\n\n sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PropertyName", + "shortDescription": { + "text": "Property naming convention" + }, + "fullDescription": { + "text": "Reports property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, property names should start with a lowercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val My_Cool_Property = \"\"' A quick-fix renames the class according to the Kotlin naming conventions: 'val myCoolProperty = \"\"'", + "markdown": "Reports property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nproperty names should start with a lowercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val My_Cool_Property = \"\"\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val myCoolProperty = \"\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinMavenPluginPhase", + "shortDescription": { + "text": "Kotlin Maven Plugin misconfigured" + }, + "fullDescription": { + "text": "Reports kotlin-maven-plugin configuration issues", + "markdown": "Reports kotlin-maven-plugin configuration issues" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertToStringTemplate", + "shortDescription": { + "text": "String concatenation that can be converted to string template" + }, + "fullDescription": { + "text": "Reports string concatenation that can be converted to a string template. Using string templates is recommended as it makes code easier to read. Example: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }' After the quick-fix is applied: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }'", + "markdown": "Reports string concatenation that can be converted to a string template.\n\nUsing string templates is recommended as it makes code easier to read.\n\n**Example:**\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifiableCall", + "shortDescription": { + "text": "Library function call could be simplified" + }, + "fullDescription": { + "text": "Reports library function calls which could be replaced by simplified one. Using corresponding functions makes your code simpler. The quick-fix replaces the function calls with another one. Example: 'fun test(list: List) {\n list.filter { it is String }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.filterIsInstance()\n }'", + "markdown": "Reports library function calls which could be replaced by simplified one.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the function calls with another one.\n\n**Example:**\n\n\n fun test(list: List) {\n list.filter { it is String }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.filterIsInstance()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObjectLiteralToLambda", + "shortDescription": { + "text": "Object literal can be converted to lambda" + }, + "fullDescription": { + "text": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression. Example: 'class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n}' After the quick-fix is applied: 'fun foo() {\n threadPool.submit { println(\"hello\") }\n }'", + "markdown": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression.\n\n**Example:**\n\n\n class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n threadPool.submit { println(\"hello\") }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLambdaOrAnonymousFunction", + "shortDescription": { + "text": "Redundant creation of lambda or anonymous function" + }, + "fullDescription": { + "text": "Reports lambdas or anonymous functions that are created and used immediately. 'fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }'", + "markdown": "Reports lambdas or anonymous functions that are created and used immediately.\n\n\n fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "BooleanLiteralArgument", + "shortDescription": { + "text": "Boolean literal argument without parameter name" + }, + "fullDescription": { + "text": "Reports call arguments with 'Boolean' type without explicit parameter names specified. When multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes. Explicit parameter names allow for easier code reading and understanding. Example: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }' A quick-fix adds missing parameter names: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }'", + "markdown": "Reports call arguments with `Boolean` type without explicit parameter names specified.\n\n\nWhen multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes.\nExplicit parameter names allow for easier code reading and understanding.\n\n**Example:**\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }\n\nA quick-fix adds missing parameter names:\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertArgumentToSet", + "shortDescription": { + "text": "Argument could be converted to 'Set' to improve performance" + }, + "fullDescription": { + "text": "Detects the function calls that could work faster with an argument converted to 'Set'. Operations like 'minus' or 'intersect' are more effective when their argument is a set. An explicit conversion of an 'Iterable' or an 'Array' into a 'Set' can often make code more effective. The quick-fix adds an explicit conversion to the function call. Example: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size' After the quick-fix is applied: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size'", + "markdown": "Detects the function calls that could work faster with an argument converted to `Set`.\n\n\nOperations like 'minus' or 'intersect' are more effective when their argument is a set.\nAn explicit conversion of an `Iterable` or an `Array`\ninto a `Set` can often make code more effective.\n\n\nThe quick-fix adds an explicit conversion to the function call.\n\n**Example:**\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size\n\nAfter the quick-fix is applied:\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceGuardClauseWithFunctionCall", + "shortDescription": { + "text": "Guard clause can be replaced with Kotlin's function call" + }, + "fullDescription": { + "text": "Reports guard clauses that can be replaced with a function call. Example: 'fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }' After the quick-fix is applied: 'fun test(foo: Int?) {\n checkNotNull(foo)\n }'", + "markdown": "Reports guard clauses that can be replaced with a function call.\n\n**Example:**\n\n fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }\n\nAfter the quick-fix is applied:\n\n fun test(foo: Int?) {\n checkNotNull(foo)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceToStringWithStringTemplate", + "shortDescription": { + "text": "Call of 'toString' could be replaced with string template" + }, + "fullDescription": { + "text": "Reports 'toString' function calls that can be replaced with a string template. Using string templates makes your code simpler. The quick-fix replaces 'toString' with a string template. Example: 'fun test(): String {\n val x = 1\n return x.toString()\n }' After the quick-fix is applied: 'fun test(): String {\n val x = 1\n return \"$x\"\n }'", + "markdown": "Reports `toString` function calls that can be replaced with a string template.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces `toString` with a string template.\n\n**Example:**\n\n\n fun test(): String {\n val x = 1\n return x.toString()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(): String {\n val x = 1\n return \"$x\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProtectedInFinal", + "shortDescription": { + "text": "'protected' visibility is effectively 'private' in a final class" + }, + "fullDescription": { + "text": "Reports 'protected' visibility used inside of a 'final' class. In such cases 'protected' members are accessible only in the class itself, so they are effectively 'private'. Example: 'class FinalClass {\n protected fun foo() {}\n }' After the quick-fix is applied: 'class FinalClass {\n private fun foo() {}\n }'", + "markdown": "Reports `protected` visibility used inside of a `final` class. In such cases `protected` members are accessible only in the class itself, so they are effectively `private`.\n\n**Example:**\n\n\n class FinalClass {\n protected fun foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class FinalClass {\n private fun foo() {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceRangeStartEndInclusiveWithFirstLast", + "shortDescription": { + "text": "Boxed properties should be replaced with unboxed" + }, + "fullDescription": { + "text": "Reports boxed 'Range.start' and 'Range.endInclusive' properties. These properties can be replaced with unboxed 'first' and 'last' properties to avoid redundant calls. The quick-fix replaces 'start' and 'endInclusive' properties with the corresponding 'first' and 'last'. Example: 'fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }' After the quick-fix is applied: 'fun foo(range: CharRange) {\n val lastElement = range.last\n }'", + "markdown": "Reports **boxed** `Range.start` and `Range.endInclusive` properties.\n\nThese properties can be replaced with **unboxed** `first` and `last` properties to avoid redundant calls.\n\nThe quick-fix replaces `start` and `endInclusive` properties with the corresponding `first` and `last`.\n\n**Example:**\n\n\n fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(range: CharRange) {\n val lastElement = range.last\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSizeCheckWithIsNotEmpty", + "shortDescription": { + "text": "Size check can be replaced with 'isNotEmpty()'" + }, + "fullDescription": { + "text": "Reports size checks of 'Collections/Array/String' that should be replaced with 'isNotEmpty()'. Using 'isNotEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isNotEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }'", + "markdown": "Reports size checks of `Collections/Array/String` that should be replaced with `isNotEmpty()`.\n\nUsing `isNotEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isNotEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSemicolon", + "shortDescription": { + "text": "Redundant semicolon" + }, + "fullDescription": { + "text": "Reports redundant semicolons (';') that can be safely removed. Kotlin does not require a semicolon at the end of each statement or expression. A quick-fix is suggested to remove redundant semicolons. Example: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};' After the quick-fix is applied: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}' There are two cases though where a semicolon is required: Several statements placed on a single line need to be separated with semicolons: 'map.forEach { val (key, value) = it; println(\"$key -> $value\") }' 'enum' classes that also declare properties or functions, require a semicolon after the list of enum constants: 'enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }'", + "markdown": "Reports redundant semicolons (`;`) that can be safely removed.\n\n\nKotlin does not require a semicolon at the end of each statement or expression.\nA quick-fix is suggested to remove redundant semicolons.\n\n**Example:**\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};\n\nAfter the quick-fix is applied:\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}\n\nThere are two cases though where a semicolon is required:\n\n1. Several statements placed on a single line need to be separated with semicolons:\n\n\n map.forEach { val (key, value) = it; println(\"$key -> $value\") }\n\n2. `enum` classes that also declare properties or functions, require a semicolon after the list of enum constants:\n\n\n enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }\n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IntroduceWhenSubject", + "shortDescription": { + "text": "'when' that can be simplified by introducing an argument" + }, + "fullDescription": { + "text": "Reports a 'when' expression that can be simplified by introducing a subject argument. Example: 'fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }' The quick fix introduces a subject argument: 'fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }'", + "markdown": "Reports a `when` expression that can be simplified by introducing a subject argument.\n\n**Example:**\n\n\n fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n\nThe quick fix introduces a subject argument:\n\n\n fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedCallableAddReplaceWith", + "shortDescription": { + "text": "@Deprecated annotation without 'replaceWith' argument" + }, + "fullDescription": { + "text": "Reports deprecated functions and properties that do not have the 'kotlin.ReplaceWith' argument in its 'kotlin.deprecated' annotation and suggests to add one based on their body. Kotlin provides the 'ReplaceWith' argument to replace deprecated declarations automatically. It is recommended to use the argument to fix deprecation issues in code. Example: '@Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42' A quick-fix adds the 'ReplaceWith()' argument: '@Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42'", + "markdown": "Reports deprecated functions and properties that do not have the `kotlin.ReplaceWith` argument in its `kotlin.deprecated` annotation and suggests to add one based on their body.\n\n\nKotlin provides the `ReplaceWith` argument to replace deprecated declarations automatically.\nIt is recommended to use the argument to fix deprecation issues in code.\n\n**Example:**\n\n\n @Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42\n\nA quick-fix adds the `ReplaceWith()` argument:\n\n\n @Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ComplexRedundantLet", + "shortDescription": { + "text": "Redundant argument-based `let` call" + }, + "fullDescription": { + "text": "Reports a redundant argument-based 'let' call. 'let' is redundant when the lambda parameter is only used as a qualifier in a call expression. If you need to give a name to the qualifying expression, declare a local variable. Example: 'fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }' A quick-fix removes the extra 'let()' call: 'fun example() {\n \"1,2,3\".split(',')\n }' Alternative: 'fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }'", + "markdown": "Reports a redundant argument-based `let` call.\n\n`let` is redundant when the lambda parameter is only used as a qualifier in a call expression.\n\nIf you need to give a name to the qualifying expression, declare a local variable.\n\n**Example:**\n\n\n fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }\n\nA quick-fix removes the extra `let()` call:\n\n\n fun example() {\n \"1,2,3\".split(',')\n }\n\nAlternative:\n\n\n fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantSpreadOperator", + "shortDescription": { + "text": "Redundant spread operator" + }, + "fullDescription": { + "text": "Reports the use of a redundant spread operator for a family of 'arrayOf' function calls. Use the 'Remove redundant spread operator' quick-fix to clean up the code. Examples: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }' After the quick-fix is applied: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }'", + "markdown": "Reports the use of a redundant spread operator for a family of `arrayOf` function calls.\n\nUse the 'Remove redundant spread operator' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitJvmOverloadsOnConstructorsOfAnnotationClassesMigration", + "shortDescription": { + "text": "'@JvmOverloads' annotation cannot be used on constructors of annotation classes since 1.4" + }, + "fullDescription": { + "text": "Reports '@JvmOverloads' on constructors of annotation classes because it's meaningless. There is no footprint of '@JvmOverloads' in the generated bytecode and Kotlin metadata, so '@JvmOverloads' doesn't affect the generated bytecode and the code behavior. '@JvmOverloads' on constructors of annotation classes causes a compilation error since Kotlin 1.4. Example: 'annotation class A @JvmOverloads constructor(val x: Int = 1)' After the quick-fix is applied: 'annotation class A constructor(val x: Int = 1)'", + "markdown": "Reports `@JvmOverloads` on constructors of annotation classes because it's meaningless.\n\n\nThere is no footprint of `@JvmOverloads` in the generated bytecode and Kotlin metadata,\nso `@JvmOverloads` doesn't affect the generated bytecode and the code behavior.\n\n`@JvmOverloads` on constructors of annotation classes causes a compilation error since Kotlin 1.4.\n\n**Example:**\n\n\n annotation class A @JvmOverloads constructor(val x: Int = 1)\n\nAfter the quick-fix is applied:\n\n\n annotation class A constructor(val x: Int = 1)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveSetterParameterType", + "shortDescription": { + "text": "Redundant setter parameter type" + }, + "fullDescription": { + "text": "Reports explicitly specified parameter types in property setters. Setter parameter type always matches the property type, so it's not required to be explicit. The 'Remove explicit type specification' quick-fix allows amending the code accordingly. Examples: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted' After the quick-fix is applied: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)'", + "markdown": "Reports explicitly specified parameter types in property setters.\n\n\nSetter parameter type always matches the property type, so it's not required to be explicit.\nThe 'Remove explicit type specification' quick-fix allows amending the code accordingly.\n\n**Examples:**\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted\n\nAfter the quick-fix is applied:\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IfThenToElvis", + "shortDescription": { + "text": "If-Then foldable to '?:'" + }, + "fullDescription": { + "text": "Reports 'if-then' expressions that can be folded into elvis ('?:') expressions. Example: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo' The quick fix converts the 'if-then' expression into an elvis ('?:') expression: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"'", + "markdown": "Reports `if-then` expressions that can be folded into elvis (`?:`) expressions.\n\n**Example:**\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo\n\nThe quick fix converts the `if-then` expression into an elvis (`?:`) expression:\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WrapUnaryOperator", + "shortDescription": { + "text": "Ambiguous unary operator use with number constant" + }, + "fullDescription": { + "text": "Reports an unary operator followed by a dot qualifier such as '-1.inc()'. Code like '-1.inc()' can be misleading because '-' has a lower precedence than '.inc()'. As a result, '-1.inc()' evaluates to '-2' and not '0' as it might be expected. Wrap unary operator and value with () quick-fix can be used to amend the code automatically.", + "markdown": "Reports an unary operator followed by a dot qualifier such as `-1.inc()`.\n\nCode like `-1.inc()` can be misleading because `-` has a lower precedence than `.inc()`.\nAs a result, `-1.inc()` evaluates to `-2` and not `0` as it might be expected.\n\n**Wrap unary operator and value with ()** quick-fix can be used to amend the code automatically." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConflictingExtensionProperty", + "shortDescription": { + "text": "Extension property conflicting with synthetic one" + }, + "fullDescription": { + "text": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java 'get' or 'set' methods. Such properties should be either removed or renamed to avoid breaking code by future changes in the compiler. A quick-fix deletes an extention property. Example: 'val File.name: String\n get() = getName()' A quick-fix adds the '@Deprecated' annotation: '@Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()'", + "markdown": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java `get` or `set` methods.\n\nSuch properties should be either removed or renamed to avoid breaking code by future changes in the compiler.\n\nA quick-fix deletes an extention property.\n\n**Example:**\n\n\n val File.name: String\n get() = getName()\n\nA quick-fix adds the `@Deprecated` annotation:\n\n\n @Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceJavaStaticMethodWithKotlinAnalog", + "shortDescription": { + "text": "Java methods should be replaced with Kotlin analog" + }, + "fullDescription": { + "text": "Reports a Java method call that can be replaced with a Kotlin function, for example, 'System.out.println()'. Replacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code. The quick-fix replaces the Java method calls on the same Kotlin call. Example: 'import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }' After the quick-fix is applied: 'fun main() {\n val a = listOf(1, 3, null)\n }'", + "markdown": "Reports a Java method call that can be replaced with a Kotlin function, for example, `System.out.println()`.\n\nReplacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code.\n\nThe quick-fix replaces the Java method calls on the same Kotlin call.\n\n**Example:**\n\n\n import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = listOf(1, 3, null)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyParenthesesFromLambdaCall", + "shortDescription": { + "text": "Remove unnecessary parentheses from function call with lambda" + }, + "fullDescription": { + "text": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses. Use the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code. Examples: 'fun foo() {\n listOf(1).forEach() { }\n }' After the quick-fix is applied: 'fun foo() {\n listOf(1).forEach { }\n }'", + "markdown": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses.\n\nUse the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo() {\n listOf(1).forEach() { }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n listOf(1).forEach { }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveExplicitSuperQualifier", + "shortDescription": { + "text": "Unnecessary supertype qualification" + }, + "fullDescription": { + "text": "Reports 'super' member calls with redundant supertype qualification. Code in a derived class can call its superclass functions and property accessors implementations using the 'super' keyword. To specify the supertype from which the inherited implementation is taken, 'super' can be qualified by the supertype name in angle brackets, e.g. 'super'. Sometimes this qualification is redundant and can be omitted. Use the 'Remove explicit supertype qualification' quick-fix to clean up the code. Examples: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }' After the quick-fix is applied: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }'", + "markdown": "Reports `super` member calls with redundant supertype qualification.\n\n\nCode in a derived class can call its superclass functions and property accessors implementations using the `super` keyword.\nTo specify the supertype from which the inherited implementation is taken, `super` can be qualified by the supertype name in\nangle brackets, e.g. `super`. Sometimes this qualification is redundant and can be omitted.\nUse the 'Remove explicit supertype qualification' quick-fix to clean up the code.\n\n**Examples:**\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }\n\nAfter the quick-fix is applied:\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantExplicitType", + "shortDescription": { + "text": "Obvious explicit type" + }, + "fullDescription": { + "text": "Reports local variables' explicitly given types which are obvious and thus redundant, like 'val f: Foo = Foo()'. Example: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }' After the quick-fix is applied: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }'", + "markdown": "Reports local variables' explicitly given types which are obvious and thus redundant, like `val f: Foo = Foo()`.\n\n**Example:**\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }\n\nAfter the quick-fix is applied:\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousVarProperty", + "shortDescription": { + "text": "Suspicious 'var' property: its setter does not influence its getter result" + }, + "fullDescription": { + "text": "Reports 'var' properties with default setter and getter that do not reference backing field. Such properties do not affect calling its setter; therefore, it will be clearer to change such property to 'val' and delete the initializer. Change to val and delete initializer quick-fix can be used to amend the code automatically. Example: '// This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1'", + "markdown": "Reports `var` properties with default setter and getter that do not reference backing field.\n\n\nSuch properties do not affect calling its setter; therefore, it will be clearer to change such property to `val` and delete the initializer.\n\n**Change to val and delete initializer** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n // This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaCollectionsStaticMethod", + "shortDescription": { + "text": "Java Collections static method call can be replaced with Kotlin stdlib" + }, + "fullDescription": { + "text": "Reports a Java 'Collections' static method call that can be replaced with Kotlin stdlib. Example: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }' The quick fix replaces Java 'Collections' static method call with the corresponding Kotlin stdlib method call: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }'", + "markdown": "Reports a Java `Collections` static method call that can be replaced with Kotlin stdlib.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }\n\nThe quick fix replaces Java `Collections` static method call with the corresponding Kotlin stdlib method call:\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantAsync", + "shortDescription": { + "text": "Redundant 'async' call" + }, + "fullDescription": { + "text": "Reports 'async' calls that are immediately followed by 'await'. Such calls can be replaced with blocking calls. Example: 'suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n scope.async(ctx) { doSomeJob() }.await()\n }' After the quick-fix is applied: 'suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n withContext(scope.coroutineContext + ctx) { doSomeJob() }\n }'", + "markdown": "Reports `async` calls that are immediately followed by `await`.\nSuch calls can be replaced with blocking calls.\n\n**Example:**\n\n\n suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n scope.async(ctx) { doSomeJob() }.await()\n }\n\nAfter the quick-fix is applied:\n\n\n suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n withContext(scope.coroutineContext + ctx) { doSomeJob() }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MoveVariableDeclarationIntoWhen", + "shortDescription": { + "text": "Variable declaration could be moved inside `when`" + }, + "fullDescription": { + "text": "Reports variable declarations that can be moved inside a 'when' expression. Example: 'fun someCalc(x: Int) = x * 42\n\nfun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}' After the quick-fix is applied: 'fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}'", + "markdown": "Reports variable declarations that can be moved inside a `when` expression.\n\n**Example:**\n\n\n fun someCalc(x: Int) = x * 42\n\n fun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeferredIsResult", + "shortDescription": { + "text": "Function returning Deferred directly" + }, + "fullDescription": { + "text": "Reports functions with the 'kotlinx.coroutines.Deferred' return type. Functions that use 'Deferred' as return type should have a name with the 'Async' suffix. Otherwise, it's recommended to mark a function as 'suspend' and unwrap 'Deferred' inside it. Example: 'fun calcEverything(): Deferred {\n return CompletableDeferred(42)\n }' After the quick-fix that adds the 'Async' suffix applied: 'fun calcEverythingAsync(): Deferred {\n return CompletableDeferred(42)\n }' After the quick-fix that converts the function into a 'suspend' one applied: 'suspend fun calcEverything(): Int {\n return CompletableDeferred(42).await()\n }'", + "markdown": "Reports functions with the `kotlinx.coroutines.Deferred` return type.\n\n\nFunctions that use `Deferred` as return type should have a name with the `Async` suffix.\nOtherwise, it's recommended to mark a function as `suspend` and unwrap `Deferred` inside it.\n\n**Example:**\n\n\n fun calcEverything(): Deferred {\n return CompletableDeferred(42)\n }\n\nAfter the quick-fix that adds the `Async` suffix applied:\n\n\n fun calcEverythingAsync(): Deferred {\n return CompletableDeferred(42)\n }\n\nAfter the quick-fix that converts the function into a `suspend` one applied:\n\n\n suspend fun calcEverything(): Int {\n return CompletableDeferred(42).await()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyParenthesesFromAnnotationEntry", + "shortDescription": { + "text": "Remove unnecessary parentheses" + }, + "fullDescription": { + "text": "Reports redundant empty parentheses in annotation entries. Use the 'Remove unnecessary parentheses' quick-fix to clean up the code. Examples: 'annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }'", + "markdown": "Reports redundant empty parentheses in annotation entries.\n\nUse the 'Remove unnecessary parentheses' quick-fix to clean up the code.\n\n**Examples:**\n\n\n annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifiableCallChain", + "shortDescription": { + "text": "Call chain on collection type can be simplified" + }, + "fullDescription": { + "text": "Reports two-call chains replaceable by a single call. It can help you to avoid redundant code execution. The quick-fix replaces the call chain with a single call. Example: 'fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }' After the quick-fix is applied: 'fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }'", + "markdown": "Reports two-call chains replaceable by a single call.\n\nIt can help you to avoid redundant code execution.\n\nThe quick-fix replaces the call chain with a single call.\n\n**Example:**\n\n\n fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceCallWithBinaryOperator", + "shortDescription": { + "text": "Can be replaced with binary operator" + }, + "fullDescription": { + "text": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones. Example: 'fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }' After the quick-fix is applied: 'fun test(): Boolean {\n return 2 > 1\n }'", + "markdown": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones.\n\n**Example:**\n\n fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }\n\nAfter the quick-fix is applied:\n\n fun test(): Boolean {\n return 2 > 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedUnaryOperator", + "shortDescription": { + "text": "Unused unary operator" + }, + "fullDescription": { + "text": "Reports unary operators for number types on unused expressions. Unary operators break previous expression if they are used without braces. As a result, mathematical expressions spanning multi lines can be misleading. Example: 'fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }'", + "markdown": "Reports unary operators for number types on unused expressions.\n\nUnary operators break previous expression if they are used without braces.\nAs a result, mathematical expressions spanning multi lines can be misleading.\n\nExample:\n\n\n fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ClassName", + "shortDescription": { + "text": "Class naming convention" + }, + "fullDescription": { + "text": "Reports class names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, class names should start with an uppercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'class user(val name: String)' A quick-fix renames the class according to the Kotlin naming conventions: 'class User(val name: String)'", + "markdown": "Reports class names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nclass names should start with an uppercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n class user(val name: String)\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n class User(val name: String)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyPrimaryConstructor", + "shortDescription": { + "text": "Redundant empty primary constructor" + }, + "fullDescription": { + "text": "Reports empty primary constructors when they are implicitly available anyway. A primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers. Use the 'Remove empty primary constructor' quick-fix to clean up the code. Examples: 'class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier'", + "markdown": "Reports empty primary constructors when they are implicitly available anyway.\n\n\nA primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers.\nUse the 'Remove empty primary constructor' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptySecondaryConstructorBody", + "shortDescription": { + "text": "Redundant constructor body" + }, + "fullDescription": { + "text": "Reports empty bodies of secondary constructors.", + "markdown": "Reports empty bodies of secondary constructors." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FloatingPointLiteralPrecision", + "shortDescription": { + "text": "Floating-point literal exceeds the available precision" + }, + "fullDescription": { + "text": "Reports floating-point literals that cannot be represented with the required precision using IEEE 754 'Float' and 'Double' types. For example, '1.9999999999999999999' has too many significant digits, so its representation as a 'Double' will be rounded to '2.0'. Specifying excess digits may be misleading as it hides the fact that computations use rounded values instead. The quick-fix replaces the literal with a rounded value that matches the actual representation of the constant. Example: 'val x: Float = 3.14159265359f' After the quick-fix is applied: 'val x: Float = 3.1415927f'", + "markdown": "Reports floating-point literals that cannot be represented with the required precision using [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) `Float` and `Double` types.\n\n\nFor example, `1.9999999999999999999` has too many significant digits,\nso its representation as a `Double` will be rounded to `2.0`.\nSpecifying excess digits may be misleading as it hides the fact that computations\nuse rounded values instead.\n\n\nThe quick-fix replaces the literal with a rounded value that matches the actual representation\nof the constant.\n\n**Example:**\n\n\n val x: Float = 3.14159265359f\n\nAfter the quick-fix is applied:\n\n\n val x: Float = 3.1415927f\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertPairConstructorToToFunction", + "shortDescription": { + "text": "Convert Pair constructor to 'to' function" + }, + "fullDescription": { + "text": "Reports a 'Pair' constructor invocation that can be replaced with a 'to()' infix function call. Explicit constructor invocations may add verbosity, especially if they are used multiple times. Replacing constructor calls with 'to()' makes code easier to read and maintain. Example: 'val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )' After the quick-fix is applied: 'val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )'", + "markdown": "Reports a `Pair` constructor invocation that can be replaced with a `to()` infix function call.\n\n\nExplicit constructor invocations may add verbosity, especially if they are used multiple times.\nReplacing constructor calls with `to()` makes code easier to read and maintain.\n\n**Example:**\n\n\n val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )\n\nAfter the quick-fix is applied:\n\n\n val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantGetter", + "shortDescription": { + "text": "Redundant property getter" + }, + "fullDescription": { + "text": "Reports redundant property getters. Example: 'class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }' After the quick-fix is applied: 'class Test {\n val a = 1\n val b = 1\n }'", + "markdown": "Reports redundant property getters.\n\n**Example:**\n\n\n class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n val a = 1\n val b = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantIf", + "shortDescription": { + "text": "Redundant 'if' statement" + }, + "fullDescription": { + "text": "Reports 'if' statements which can be simplified to a single statement. Example: 'fun test() {\n if (foo()) {\n return true\n } else {\n return false\n }\n }' After the quick-fix is applied: 'fun test() {\n return foo()\n }'", + "markdown": "Reports `if` statements which can be simplified to a single statement.\n\n**Example:**\n\n\n fun test() {\n if (foo()) {\n return true\n } else {\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n return foo()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KDocMissingDocumentation", + "shortDescription": { + "text": "Missing KDoc comments for public declarations" + }, + "fullDescription": { + "text": "Reports public declarations that do not have KDoc comments. Example: 'class A' The quick fix generates the comment block above the declaration: '/**\n *\n */\n class A'", + "markdown": "Reports public declarations that do not have KDoc comments.\n\n**Example:**\n\n\n class A\n\nThe quick fix generates the comment block above the declaration:\n\n\n /**\n *\n */\n class A\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveExplicitTypeArguments", + "shortDescription": { + "text": "Unnecessary type argument" + }, + "fullDescription": { + "text": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted. Use the 'Remove explicit type arguments' quick-fix to clean up the code. Examples: '// 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()' After the quick-fix is applied: 'fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()'", + "markdown": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted.\n\nUse the 'Remove explicit type arguments' quick-fix to clean up the code.\n\n**Examples:**\n\n\n // 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()\n\nAfter the quick-fix is applied:\n\n\n fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantVisibilityModifier", + "shortDescription": { + "text": "Redundant visibility modifier" + }, + "fullDescription": { + "text": "Reports visibility modifiers that match the default visibility of an element ('public' for most elements, 'protected' for members that override a protected member).", + "markdown": "Reports visibility modifiers that match the default visibility of an element (`public` for most elements, `protected` for members that override a protected member)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UsePropertyAccessSyntax", + "shortDescription": { + "text": "Accessor call that can be replaced with property access syntax" + }, + "fullDescription": { + "text": "Reports Java 'get' and 'set' method calls that can be replaced with the Kotlin synthetic properties. Use property access syntax quick-fix can be used to amen the code automatically. Example: '// Java:\n public class JavaClassWithGetter {\n private final String expr = \"result\";\n\n // ...\n\n public String getExpr() {\n return expr;\n }\n }' '// Kotlin:\n fun test(j: JavaClassWithGetter) {\n // ...\n j.getExpr() // <== A quick-fix simplifies the expression to 'j.expr'\n }'", + "markdown": "Reports Java `get` and `set` method calls that can be replaced with the Kotlin synthetic properties.\n\n**Use property access syntax** quick-fix can be used to amen the code automatically.\n\nExample:\n\n\n // Java:\n public class JavaClassWithGetter {\n private final String expr = \"result\";\n\n // ...\n\n public String getExpr() {\n return expr;\n }\n }\n\n\n // Kotlin:\n fun test(j: JavaClassWithGetter) {\n // ...\n j.getExpr() // <== A quick-fix simplifies the expression to 'j.expr'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UseExpressionBody", + "shortDescription": { + "text": "Expression body syntax is preferable here" + }, + "fullDescription": { + "text": "Reports 'return' expressions (one-liners or 'when') that can be replaced with expression body syntax. Expression body syntax is recommended by the style guide. Convert to expression body quick-fix can be used to amend the code automatically. Example: 'fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }' After the quick-fix is applied: 'fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }'", + "markdown": "Reports `return` expressions (one-liners or `when`) that can be replaced with expression body syntax.\n\nExpression body syntax is recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#functions).\n\n**Convert to expression body** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MapGetWithNotNullAssertionOperator", + "shortDescription": { + "text": "'map.get()' with not-null assertion operator (!!)" + }, + "fullDescription": { + "text": "Reports 'map.get()!!' that can be replaced with 'map.getValue()', 'map.getOrElse()', and so on. Example: 'fun test(map: Map): String = map.get(0)!!' After the quick-fix is applied: 'fun test(map: Map): String = map.getValue(0)'", + "markdown": "Reports `map.get()!!` that can be replaced with `map.getValue()`, `map.getOrElse()`, and so on.\n\n**Example:**\n\n\n fun test(map: Map): String = map.get(0)!!\n\nAfter the quick-fix is applied:\n\n\n fun test(map: Map): String = map.getValue(0)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SortModifiers", + "shortDescription": { + "text": "Non-canonical modifier order" + }, + "fullDescription": { + "text": "Reports modifiers that do not follow the order recommended by the style guide. Sort modifiers quick-fix can be used to amend the code automatically. Examples: 'private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"'", + "markdown": "Reports modifiers that do not follow the order recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#modifiers-order).\n\n**Sort modifiers** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EnumEntryName", + "shortDescription": { + "text": "Enum entry naming convention" + }, + "fullDescription": { + "text": "Reports enum entry names that do not follow the recommended naming conventions. Example: 'enum class Foo {\n _Foo,\n foo\n }' To fix the problem rename enum entries to match the recommended naming conventions.", + "markdown": "Reports enum entry names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n enum class Foo {\n _Foo,\n foo\n }\n\nTo fix the problem rename enum entries to match the recommended naming conventions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithDropLast", + "shortDescription": { + "text": "'substring' call should be replaced with 'dropLast' call" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, s.length - x)' that can be replaced with 's.dropLast(x)'. Using corresponding functions makes your code simpler. The quick-fix replaces the 'substring' call with 'dropLast'. Example: 'fun foo(s: String) {\n s.substring(0, s.length - 5)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.dropLast(5)\n }'", + "markdown": "Reports calls like `s.substring(0, s.length - x)` that can be replaced with `s.dropLast(x)`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `dropLast`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.length - 5)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.dropLast(5)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SetterBackingFieldAssignment", + "shortDescription": { + "text": "Existing backing field without assignment" + }, + "fullDescription": { + "text": "Reports property setters that don't update the backing field. The quick-fix adds an assignment to the backing field. Example: 'class Test {\n var foo: Int = 1\n set(value) {\n }\n }' After the quick-fix is applied: 'class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }'", + "markdown": "Reports property setters that don't update the backing field.\n\nThe quick-fix adds an assignment to the backing field.\n\n**Example:**\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CopyWithoutNamedArguments", + "shortDescription": { + "text": "'copy' method of data class is called without named arguments" + }, + "fullDescription": { + "text": "Reports calls to a data class' 'copy()' method without named arguments. As all arguments of the 'copy()' function are optional, it might be hard to understand what properties are modified. Providing parameter names explicitly makes code easy to understand without navigating to the 'data class' declaration. Example: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }' A quick-fix provides parameter names to all 'copy()' arguments: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }'", + "markdown": "Reports calls to a data class' `copy()` method without named arguments.\n\n\nAs all arguments of the `copy()` function are optional, it might be hard to understand what properties are modified.\nProviding parameter names explicitly makes code easy to understand without navigating to the `data class` declaration.\n\n**Example:**\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }\n\nA quick-fix provides parameter names to all `copy()` arguments:\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinDeprecation", + "shortDescription": { + "text": "Usage of redundant or deprecated syntax or deprecated symbols" + }, + "fullDescription": { + "text": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (Code | Code Cleanup). A quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax. It also replaces deprecated symbols with their proposed substitutions.", + "markdown": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (**Code \\| Code Cleanup** ).\n\n\nA quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax.\n\n\nIt also replaces deprecated symbols with their proposed substitutions." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithTake", + "shortDescription": { + "text": "'substring' call should be replaced with 'take' call" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, x)' that can be replaced with 's.take(x)'. Using 'take()' makes your code simpler. The quick-fix replaces the 'substring' call with 'take()'. Example: 'fun foo(s: String) {\n s.substring(0, 10)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.take(10)\n }'", + "markdown": "Reports calls like `s.substring(0, x)` that can be replaced with `s.take(x)`.\n\nUsing `take()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `take()`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, 10)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.take(10)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertCallChainIntoSequence", + "shortDescription": { + "text": "Call chain on collection could be converted into 'Sequence' to improve performance" + }, + "fullDescription": { + "text": "Reports call chain on a 'Collection' that should be converted into Sequence. Each 'Collection' transforming function (such as 'map()' or 'filter()') creates a new 'Collection' (typically 'List' or 'Set') under the hood. In case of multiple consequent calls, and a huge number of items in 'Collection', memory traffic might be significant. In such a case, using 'Sequence' is preferred. Example: 'class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }' A quick-fix wraps call chain into 'asSequence()' and 'toList()': 'class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()'", + "markdown": "Reports call chain on a `Collection` that should be converted into **Sequence** .\n\nEach `Collection` transforming function (such as `map()` or `filter()`) creates a new\n`Collection` (typically `List` or `Set`) under the hood.\nIn case of multiple consequent calls, and a huge number of items in `Collection`, memory traffic might be significant.\nIn such a case, using `Sequence` is preferred.\n\n**Example:**\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n\nA quick-fix wraps call chain into `asSequence()` and `toList()`:\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AddOperatorModifier", + "shortDescription": { + "text": "Function should have 'operator' modifier" + }, + "fullDescription": { + "text": "Reports a function that matches one of the operator conventions but lacks the 'operator' keyword. By adding the 'operator' modifier, you might allow function consumers to write idiomatic Kotlin code. Example: 'class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }' A quick-fix adds the 'operator' modifier keyword: 'class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }'", + "markdown": "Reports a function that matches one of the operator conventions but lacks the `operator` keyword.\n\nBy adding the `operator` modifier, you might allow function consumers to write idiomatic Kotlin code.\n\n**Example:**\n\n\n class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }\n\nA quick-fix adds the `operator` modifier keyword:\n\n\n class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MayBeConstant", + "shortDescription": { + "text": "Might be 'const'" + }, + "fullDescription": { + "text": "Reports top-level 'val' properties in objects that might be declared as 'const' for better performance and Java interoperability. Example: 'object A {\n val foo = 1\n }' After the quick-fix is applied: 'object A {\n const val foo = 1\n }'", + "markdown": "Reports top-level `val` properties in objects that might be declared as `const` for better performance and Java interoperability.\n\n**Example:**\n\n\n object A {\n val foo = 1\n }\n\nAfter the quick-fix is applied:\n\n\n object A {\n const val foo = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceIsEmptyWithIfEmpty", + "shortDescription": { + "text": "'if' condition can be replaced with lambda call" + }, + "fullDescription": { + "text": "Reports 'isEmpty', 'isBlank', 'isNotEmpty', or 'isNotBlank' calls in an 'if' statement to assign a default value. The quick-fix replaces the 'if' condition with 'ifEmpty' or 'ifBlank' calls. Example: 'fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }' After the quick-fix is applied: 'fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }' This inspection only reports if the Kotlin language version of the project or module is 1.3 or higher.", + "markdown": "Reports `isEmpty`, `isBlank`, `isNotEmpty`, or `isNotBlank` calls in an `if` statement to assign a default value.\n\nThe quick-fix replaces the `if` condition with `ifEmpty` or `ifBlank` calls.\n\n**Example:**\n\n\n fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }\n\nThis inspection only reports if the Kotlin language version of the project or module is 1.3 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithImportAlias", + "shortDescription": { + "text": "Fully qualified name can be replaced with existing import alias" + }, + "fullDescription": { + "text": "Reports fully qualified names that can be replaced with an existing import alias. Example: 'import foo.Foo as Bar\nfun main() {\n foo.Foo()\n}' After the quick-fix is applied: 'import foo.Foo as Bar\nfun main() {\n Bar()\n}'", + "markdown": "Reports fully qualified names that can be replaced with an existing import alias.\n\n**Example:**\n\n\n import foo.Foo as Bar\n fun main() {\n foo.Foo()\n }\n\nAfter the quick-fix is applied:\n\n\n import foo.Foo as Bar\n fun main() {\n Bar()\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyBooleanWithConstants", + "shortDescription": { + "text": "Boolean expression can be simplified" + }, + "fullDescription": { + "text": "Reports boolean expression parts that can be reduced to constants. The quick-fix simplifies the condition. Example: 'fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }' After the quick-fix is applied: 'fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }'", + "markdown": "Reports boolean expression parts that can be reduced to constants.\n\nThe quick-fix simplifies the condition.\n\n**Example:**\n\n\n fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantModalityModifier", + "shortDescription": { + "text": "Redundant modality modifier" + }, + "fullDescription": { + "text": "Reports the modality modifiers that match the default modality of an element ('final' for most elements, 'open' for members with an 'override'). Example: 'final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }' After the quick-fix is applied: 'class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }'", + "markdown": "Reports the modality modifiers that match the default modality of an element (`final` for most elements, `open` for members with an `override`).\n\n**Example:**\n\n\n final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyAssertNotNull", + "shortDescription": { + "text": "'assert' call can be replaced with '!!' or '?:'" + }, + "fullDescription": { + "text": "Reports 'assert' calls that check a not null value of the declared variable. Using '!!' or '?:' makes your code simpler. The quick-fix replaces 'assert' with '!!' or '?:' operator in the variable initializer. Example: 'fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }' After the quick-fix is applied: 'fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }'", + "markdown": "Reports `assert` calls that check a not null value of the declared variable.\n\nUsing `!!` or `?:` makes your code simpler.\n\nThe quick-fix replaces `assert` with `!!` or `?:` operator in the variable initializer.\n\n**Example:**\n\n\n fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertNaNEquality", + "shortDescription": { + "text": "Convert equality check with 'NaN' to 'isNaN' call" + }, + "fullDescription": { + "text": "Reports an equality check with 'Float.NaN' or 'Double.NaN' that should be replaced with an 'isNaN()' check. According to IEEE 754, equality check against NaN always returns 'false', even for 'NaN == NaN'. Therefore, such a check is likely to be a mistake. A quick-fix replaces comparison with 'isNaN()' check that uses a different comparison technique and handles 'NaN' values correctly. Example: 'fun check(value: Double): Boolean {\n return Double.NaN == value\n }' After the fix is applied: 'fun check(value: Double): Boolean {\n return value.isNaN()\n }'", + "markdown": "Reports an equality check with `Float.NaN` or `Double.NaN` that should be replaced with an `isNaN()` check.\n\n\nAccording to IEEE 754, equality check against NaN always returns `false`, even for `NaN == NaN`.\nTherefore, such a check is likely to be a mistake.\n\nA quick-fix replaces comparison with `isNaN()` check that uses a different comparison technique and handles `NaN` values correctly.\n\n**Example:**\n\n\n fun check(value: Double): Boolean {\n return Double.NaN == value\n }\n\nAfter the fix is applied:\n\n\n fun check(value: Double): Boolean {\n return value.isNaN()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceManualRangeWithIndicesCalls", + "shortDescription": { + "text": "Range can be converted to indices or iteration" + }, + "fullDescription": { + "text": "Reports 'until' and 'rangeTo' operators that can be replaced with 'Collection.indices' or iteration over collection inside 'for' loop. Using syntactic sugar makes your code simpler. The quick-fix replaces the manual range with the corresponding construction. Example: 'fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }' After the quick-fix is applied: 'fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }'", + "markdown": "Reports `until` and `rangeTo` operators that can be replaced with `Collection.indices` or iteration over collection inside `for` loop.\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces the manual range with the corresponding construction.\n\n**Example:**\n\n\n fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinLoggerInitializedWithForeignClass", + "shortDescription": { + "text": "Logger initialized with foreign class" + }, + "fullDescription": { + "text": "Reports 'Logger' instances initialized with a class literal other than the class the 'Logger' resides in. This can happen when copy-pasting from another class. It may result in logging events under an unexpected category and incorrect filtering. Use the inspection options to specify the logger factory classes and methods recognized by this inspection. Example: 'class AnotherService\nclass MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n}' After the quick-fix is applied: 'class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n}'", + "markdown": "Reports `Logger` instances initialized with a class literal other than the class the `Logger` resides in.\n\n\nThis can happen when copy-pasting from another class.\nIt may result in logging events under an unexpected category and incorrect filtering.\n\n\nUse the inspection options to specify the logger factory classes and methods recognized by this inspection.\n\n**Example:**\n\n\n class AnotherService\n class MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n }\n\nAfter the quick-fix is applied:\n\n\n class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Logging", + "index": 158, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantAsSequence", + "shortDescription": { + "text": "Redundant 'asSequence' call" + }, + "fullDescription": { + "text": "Reports redundant 'asSequence()' call that can never have a positive performance effect. 'asSequence()' speeds up collection processing that includes multiple operations because it performs operations lazily and doesn't create intermediate collections. However, if a terminal operation (such as 'toList()') is used right after 'asSequence()', this doesn't give you any positive performance effect. Example: 'fun test(list: List) {\n list.asSequence().last()\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.last()\n }'", + "markdown": "Reports redundant `asSequence()` call that can never have a positive performance effect.\n\n\n`asSequence()` speeds up collection processing that includes multiple operations because it performs operations lazily\nand doesn't create intermediate collections.\n\n\nHowever, if a terminal operation (such as `toList()`) is used right after `asSequence()`, this doesn't give\nyou any positive performance effect.\n\n**Example:**\n\n\n fun test(list: List) {\n list.asSequence().last()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.last()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveToStringInStringTemplate", + "shortDescription": { + "text": "Redundant call to 'toString()' in string template" + }, + "fullDescription": { + "text": "Reports calls to 'toString()' in string templates that can be safely removed. Example: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }'", + "markdown": "Reports calls to `toString()` in string templates that can be safely removed.\n\n**Example:**\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }\n\nAfter the quick-fix is applied:\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinUnusedImport", + "shortDescription": { + "text": "Unused import directive" + }, + "fullDescription": { + "text": "Reports redundant 'import' statements. Default and unused imports can be safely removed. Example: 'import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }'", + "markdown": "Reports redundant `import` statements.\n\nDefault and unused imports can be safely removed.\n\n**Example:**\n\n\n import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBePrimaryConstructorProperty", + "shortDescription": { + "text": "Property is explicitly assigned to constructor parameter" + }, + "fullDescription": { + "text": "Reports properties that are explicitly assigned to primary constructor parameters. Properties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability. Example: 'class User(name: String) {\n val name = name\n }' A quick-fix joins the parameter and property declaration into a primary constructor parameter: 'class User(val name: String) {\n }'", + "markdown": "Reports properties that are explicitly assigned to primary constructor parameters.\n\nProperties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability.\n\n**Example:**\n\n\n class User(name: String) {\n val name = name\n }\n\nA quick-fix joins the parameter and property declaration into a primary constructor parameter:\n\n\n class User(val name: String) {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaMapForEach", + "shortDescription": { + "text": "Java Map.forEach method call should be replaced with Kotlin's forEach" + }, + "fullDescription": { + "text": "Reports a Java Map.'forEach' method call that can be replaced with Kotlin's forEach. Example: 'fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}' The quick fix removes parentheses: 'fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}'", + "markdown": "Reports a Java Map.`forEach` method call that can be replaced with Kotlin's **forEach** .\n\n**Example:**\n\n\n fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n\nThe quick fix removes parentheses:\n\n\n fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantObjectTypeCheck", + "shortDescription": { + "text": "Non-idiomatic 'is' type check for an object" + }, + "fullDescription": { + "text": "Reports non-idiomatic 'is' type checks for an object. It's recommended to replace such checks with reference comparison. Example: 'object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }' After the quick-fix is applied: 'object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }'", + "markdown": "Reports non-idiomatic `is` type checks for an object.\n\nIt's recommended to replace such checks with reference comparison.\n\n**Example:**\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }\n\nAfter the quick-fix is applied:\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspendFunctionOnCoroutineScope", + "shortDescription": { + "text": "Ambiguous coroutineContext due to CoroutineScope receiver of suspend function" + }, + "fullDescription": { + "text": "Reports calls and accesses of 'CoroutineScope' extensions or members inside suspend functions with 'CoroutineScope' receiver. When a function is 'suspend' and has 'CoroutineScope' receiver, it has ambiguous access to 'CoroutineContext' via 'kotlin.coroutines.coroutineContext' and via 'CoroutineScope.coroutineContext', and two these contexts are different in general. To improve this situation, one can wrap suspicious call inside 'coroutineScope { ... }' or get rid of 'CoroutineScope' function receiver.", + "markdown": "Reports calls and accesses of `CoroutineScope` extensions or members inside suspend functions with `CoroutineScope` receiver.\n\nWhen a function is `suspend` and has `CoroutineScope` receiver,\nit has ambiguous access to `CoroutineContext` via `kotlin.coroutines.coroutineContext` and via `CoroutineScope.coroutineContext`,\nand two these contexts are different in general.\n\n\nTo improve this situation, one can wrap suspicious call inside `coroutineScope { ... }` or\nget rid of `CoroutineScope` function receiver." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentMavenStdlibVersion", + "shortDescription": { + "text": "Library and maven plugin versions are different" + }, + "fullDescription": { + "text": "Reports different Kotlin stdlib and compiler versions. Using different versions of the Kotlin compiler and the standard library can lead to unpredictable runtime problems and should be avoided.", + "markdown": "Reports different Kotlin stdlib and compiler versions.\n\nUsing different versions of the Kotlin compiler and the standard library can lead to unpredictable\nruntime problems and should be avoided." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ImplicitNullableNothingType", + "shortDescription": { + "text": "Implicit `Nothing?` type" + }, + "fullDescription": { + "text": "Reports variables and functions with the implicit Nothing? type. Example: 'fun foo() = null' The quick fix specifies the return type explicitly: 'fun foo(): Nothing? = null'", + "markdown": "Reports variables and functions with the implicit **Nothing?** type.\n\n**Example:**\n\n\n fun foo() = null\n\nThe quick fix specifies the return type explicitly:\n\n\n fun foo(): Nothing? = null\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceAssociateFunction", + "shortDescription": { + "text": "'associate' can be replaced with 'associateBy' or 'associateWith'" + }, + "fullDescription": { + "text": "Reports calls to 'associate()' and 'associateTo()' that can be replaced with 'associateBy()' or 'associateWith()'. Both functions accept a transformer function applied to elements of a given sequence or collection (as a receiver). The pairs are then used to build the resulting 'Map'. Given the transformer refers to 'it', the 'associate[To]()' call can be replaced with more performant 'associateBy()' or 'associateWith()'. Examples: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }' After the quick-fix is applied: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }'", + "markdown": "Reports calls to `associate()` and `associateTo()` that can be replaced with `associateBy()` or `associateWith()`.\n\n\nBoth functions accept a transformer function applied to elements of a given sequence or collection (as a receiver).\nThe pairs are then used to build the resulting `Map`.\n\n\nGiven the transformer refers to `it`, the `associate[To]()` call can be replaced with more performant `associateBy()`\nor `associateWith()`.\n\n**Examples:**\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }\n\nAfter the quick-fix is applied:\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObsoleteExperimentalCoroutines", + "shortDescription": { + "text": "Experimental coroutines usages are deprecated since 1.3" + }, + "fullDescription": { + "text": "Reports code that uses experimental coroutines. Such usages are incompatible with Kotlin 1.3+ and should be updated.", + "markdown": "Reports code that uses experimental coroutines.\n\nSuch usages are incompatible with Kotlin 1.3+ and should be updated." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LiftReturnOrAssignment", + "shortDescription": { + "text": "Return or assignment can be lifted out" + }, + "fullDescription": { + "text": "Reports 'if', 'when', and 'try' statements that can be converted to expressions by lifting the 'return' statement or an assignment out. Example: 'fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }' After the quick-fix is applied: 'fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }'", + "markdown": "Reports `if`, `when`, and `try` statements that can be converted to expressions by lifting the `return` statement or an assignment out.\n\n**Example:**\n\n\n fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyWhenWithBooleanConstantCondition", + "shortDescription": { + "text": "Simplifiable 'when'" + }, + "fullDescription": { + "text": "Reports 'when' expressions with the constant 'true' or 'false' branches. Simplify \"when\" quick-fix can be used to amend the code automatically. Examples: 'fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }'", + "markdown": "Reports `when` expressions with the constant `true` or `false` branches.\n\n**Simplify \"when\"** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinConstantConditions", + "shortDescription": { + "text": "Constant conditions" + }, + "fullDescription": { + "text": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable 'when' branches and some expressions that are statically known to fail always. Examples: 'fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n}\nfun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n}' New in 2021.3", + "markdown": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable `when` branches and some expressions that are statically known to fail always.\n\nExamples:\n\n\n fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n }\n fun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n }\n\nNew in 2021.3" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ForEachParameterNotUsed", + "shortDescription": { + "text": "Iterated elements are not used in forEach" + }, + "fullDescription": { + "text": "Reports 'forEach' loops that do not use iterable values. Example: 'listOf(1, 2, 3).forEach { }' The quick fix introduces anonymous parameter in the 'forEach' section: 'listOf(1, 2, 3).forEach { _ -> }'", + "markdown": "Reports `forEach` loops that do not use iterable values.\n\n**Example:**\n\n\n listOf(1, 2, 3).forEach { }\n\nThe quick fix introduces anonymous parameter in the `forEach` section:\n\n\n listOf(1, 2, 3).forEach { _ -> }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LeakingThis", + "shortDescription": { + "text": "Leaking 'this' in constructor" + }, + "fullDescription": { + "text": "Reports unsafe operations with 'this' during object construction including: Accessing a non-final property during class initialization: from a constructor or property initialization Calling a non-final function during class initialization Using 'this' as a function argument in a constructor of a non-final class If other classes inherit from the given class, they may not be fully initialized at the moment when an unsafe operation is carried out. Example: 'abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }'", + "markdown": "Reports unsafe operations with `this` during object construction including:\n\n* Accessing a non-final property during class initialization: from a constructor or property initialization\n* Calling a non-final function during class initialization\n* Using `this` as a function argument in a constructor of a non-final class\n\n\nIf other classes inherit from the given class,\nthey may not be fully initialized at the moment when an unsafe operation is carried out.\n\n**Example:**\n\n\n abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AddVarianceModifier", + "shortDescription": { + "text": "Type parameter can have 'in' or 'out' variance" + }, + "fullDescription": { + "text": "Reports type parameters that can have 'in' or 'out' variance. Using 'in' and 'out' variance provides more precise type inference in Kotlin and clearer code semantics. Example: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }' A quick-fix adds the matching variance modifier: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }'", + "markdown": "Reports type parameters that can have `in` or `out` variance.\n\nUsing `in` and `out` variance provides more precise type inference in Kotlin and clearer code semantics.\n\n**Example:**\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }\n\nA quick-fix adds the matching variance modifier:\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveForLoopIndices", + "shortDescription": { + "text": "Unused loop index" + }, + "fullDescription": { + "text": "Reports 'for' loops iterating over a collection using the 'withIndex()' function and not using the index variable. Use the \"Remove indices in 'for' loop\" quick-fix to clean up the code. Examples: 'fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }' After the quick-fix is applied: 'fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }'", + "markdown": "Reports `for` loops iterating over a collection using the `withIndex()` function and not using the index variable.\n\nUse the \"Remove indices in 'for' loop\" quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSuspendModifier", + "shortDescription": { + "text": "Redundant 'suspend' modifier" + }, + "fullDescription": { + "text": "Reports 'suspend' modifier as redundant if no other suspending functions are called inside.", + "markdown": "Reports `suspend` modifier as redundant if no other suspending functions are called inside." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousAsDynamic", + "shortDescription": { + "text": "Suspicious 'asDynamic' member invocation" + }, + "fullDescription": { + "text": "Reports usages of 'asDynamic' function on a receiver of dynamic type. 'asDynamic' function has no effect for expressions of dynamic type. 'asDynamic' function on a receiver of dynamic type can lead to runtime problems because 'asDynamic' will be executed in JavaScript environment, and such function may not be present at runtime. The intended way is to use this function on usual Kotlin type. Remove \"asDynamic\" invocation quick-fix can be used to amend the code automatically. Example: 'fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }'", + "markdown": "Reports usages of `asDynamic` function on a receiver of dynamic type.\n\n`asDynamic` function has no effect for expressions of dynamic type.\n\n`asDynamic` function on a receiver of dynamic type can lead to runtime problems because `asDynamic`\nwill be executed in JavaScript environment, and such function may not be present at runtime.\nThe intended way is to use this function on usual Kotlin type.\n\n**Remove \"asDynamic\" invocation** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FromClosedRangeMigration", + "shortDescription": { + "text": "MIN_VALUE step in fromClosedRange() since 1.3" + }, + "fullDescription": { + "text": "Reports 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. It is prohibited to call 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. All such calls should be checked during migration to Kotlin 1.3+. Example: 'IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)' To fix the problem change the step of the progression.", + "markdown": "Reports `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with `MIN_VALUE` step.\n\n\nIt is prohibited to call `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with\n`MIN_VALUE` step. All such calls should be checked during migration to Kotlin 1.3+.\n\n**Example:**\n\n\n IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)\n\nTo fix the problem change the step of the progression." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantBackticks", + "shortDescription": { + "text": "Redundant backticks" + }, + "fullDescription": { + "text": "Reports redundant backticks in references. Some of the Kotlin keywords are valid identifiers in Java, for example: 'in', 'object', 'is'. If a Java library uses a Kotlin keyword for a method, you can still call the method escaping it with the backtick character ('`'), for example, 'foo.`is`(bar)'. Sometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is paired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code. Examples: 'fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks'", + "markdown": "Reports redundant backticks in references.\n\n\nSome of the Kotlin keywords are valid identifiers in Java, for example: `in`, `object`, `is`.\nIf a Java library uses a Kotlin keyword for a method, you can still call the method escaping it\nwith the backtick character (`````), for example, ``foo.`is`(bar)``.\nSometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is\npaired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code.\n\n**Examples:**\n\n\n fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyNestedEachInScopeFunction", + "shortDescription": { + "text": "Scope function with nested forEach can be simplified" + }, + "fullDescription": { + "text": "Reports 'forEach' functions in the scope functions such as 'also' or 'apply' that can be simplified. Convert forEach call to onEach quick-fix can be used to amend the code automatically. Examples: 'fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }' After the quick-fix is applied: 'fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }'", + "markdown": "Reports `forEach` functions in the scope functions such as `also` or `apply` that can be simplified.\n\n**Convert forEach call to onEach** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnsafeCastFromDynamic", + "shortDescription": { + "text": "Implicit (unsafe) cast from dynamic type" + }, + "fullDescription": { + "text": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type.", + "markdown": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PublicApiImplicitType", + "shortDescription": { + "text": "Public API declaration with implicit return type" + }, + "fullDescription": { + "text": "Reports 'public' and 'protected' functions and properties that have an implicit return type. For API stability reasons, it's recommended to specify such types explicitly. Example: 'fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()' After the quick-fix is applied: 'fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()'", + "markdown": "Reports `public` and `protected` functions and properties that have an implicit return type.\nFor API stability reasons, it's recommended to specify such types explicitly.\n\n**Example:**\n\n\n fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n\nAfter the quick-fix is applied:\n\n\n fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceMapIndexedWithListGenerator", + "shortDescription": { + "text": "Replace 'mapIndexed' with List generator" + }, + "fullDescription": { + "text": "Reports a 'mapIndexed' call that can be replaced by 'List' generator. Example: 'val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }' After the quick-fix is applied: 'val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }'", + "markdown": "Reports a `mapIndexed` call that can be replaced by `List` generator.\n\n**Example:**\n\n\n val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }\n\nAfter the quick-fix is applied:\n\n\n val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ControlFlowWithEmptyBody", + "shortDescription": { + "text": "Control flow with empty body" + }, + "fullDescription": { + "text": "Reports 'if', 'while', 'do' or 'for' statements with empty bodies. While occasionally intended, this construction is confusing and often the result of a typo. A quick-fix removes a statement. Example: 'if (a > b) {}'", + "markdown": "Reports `if`, `while`, `do` or `for` statements with empty bodies.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo.\n\nA quick-fix removes a statement.\n\n**Example:**\n\n\n if (a > b) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LoopToCallChain", + "shortDescription": { + "text": "Loop can be replaced with stdlib operations" + }, + "fullDescription": { + "text": "Reports 'for' loops that can be replaced with a sequence of stdlib operations (like 'map', 'filter', and so on). Example: 'fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n}' After the quick-fix is applied: 'fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n}'", + "markdown": "Reports `for` loops that can be replaced with a sequence of stdlib operations (like `map`, `filter`, and so on).\n\n**Example:**\n\n\n fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyClassBody", + "shortDescription": { + "text": "Replace empty class body" + }, + "fullDescription": { + "text": "Reports declarations of classes and objects with an empty body. Use the 'Remove redundant empty class body' quick-fix to clean up the code. Examples: 'class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }' After the quick fix is applied: 'class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }'", + "markdown": "Reports declarations of classes and objects with an empty body.\n\nUse the 'Remove redundant empty class body' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }\n\nAfter the quick fix is applied:\n\n\n class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBeParameter", + "shortDescription": { + "text": "Constructor parameter is never used as a property" + }, + "fullDescription": { + "text": "Reports primary constructor parameters that can have 'val' or 'var' removed. Class properties declared in the constructor increase memory consumption. If the parameter value is only used in the constructor, you can omit them. Note that the referenced object might be garbage-collected earlier. Example: 'class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }' A quick-fix removes the extra 'val' or 'var' keyword: 'class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }'", + "markdown": "Reports primary constructor parameters that can have `val` or `var` removed.\n\n\nClass properties declared in the constructor increase memory consumption.\nIf the parameter value is only used in the constructor, you can omit them.\n\nNote that the referenced object might be garbage-collected earlier.\n\n**Example:**\n\n\n class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n\nA quick-fix removes the extra `val` or `var` keyword:\n\n\n class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantReturnLabel", + "shortDescription": { + "text": "Redundant 'return' label" + }, + "fullDescription": { + "text": "Reports redundant return labels outside of lambda expressions. Example: 'fun test() {\n return@test\n }' After the quick-fix is applied: 'fun test() {\n return\n }'", + "markdown": "Reports redundant return labels outside of lambda expressions.\n\n**Example:**\n\n\n fun test() {\n return@test\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n return\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PackageName", + "shortDescription": { + "text": "Package naming convention" + }, + "fullDescription": { + "text": "Reports package names that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: names of packages are always lowercase and should not contain underscores. Example: 'org.example.project' Using multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case Example: 'org.example.myProject'", + "markdown": "Reports package names that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): names of packages are always lowercase and should not contain underscores.\n\n**Example:**\n`org.example.project`\n\nUsing multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case\n\n**Example:**\n`org.example.myProject`" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitUseSiteTargetAnnotationsOnSuperTypesMigration", + "shortDescription": { + "text": "Meaningless annotations targets on superclass" + }, + "fullDescription": { + "text": "Reports meaningless annotation targets on superclasses since Kotlin 1.4. Annotation targets such as '@get:' are meaningless on superclasses and are prohibited. Example: 'interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo' After the quick-fix is applied: 'interface Foo\n\n annotation class Ann\n\n class E : Foo' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports meaningless annotation targets on superclasses since Kotlin 1.4.\n\nAnnotation targets such as `@get:` are meaningless on superclasses and are prohibited.\n\n**Example:**\n\n\n interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo\n\nAfter the quick-fix is applied:\n\n\n interface Foo\n\n annotation class Ann\n\n class E : Foo\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithEnumMap", + "shortDescription": { + "text": "'HashMap' can be replaced with 'EnumMap'" + }, + "fullDescription": { + "text": "Reports 'hashMapOf' function or 'HashMap' constructor calls that can be replaced with an 'EnumMap' constructor call. Using 'EnumMap' constructor makes your code simpler. The quick-fix replaces the function call with the 'EnumMap' constructor call. Example: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()' After the quick-fix is applied: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)'", + "markdown": "Reports `hashMapOf` function or `HashMap` constructor calls that can be replaced with an `EnumMap` constructor call.\n\nUsing `EnumMap` constructor makes your code simpler.\n\nThe quick-fix replaces the function call with the `EnumMap` constructor call.\n\n**Example:**\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()\n\nAfter the quick-fix is applied:\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousCollectionReassignment", + "shortDescription": { + "text": "Augmented assignment creates a new collection under the hood" + }, + "fullDescription": { + "text": "Reports augmented assignment ('+=') expressions on read-only 'Collection'. Augment assignment ('+=') expression on read-only 'Collection' doesn't modify the target collection, it creates a new one under the hood which can be misleading and lead to performance issues. Change type to mutable quick-fix can be used to amend the code automatically. Example: 'fun test() {\n var list = listOf(0)\n list += 42 // new list is created, variable 'list' still contains only '0'\n }' After the quick-fix is applied: 'fun test() {\n val list = mutableListOf(0)\n list += 42\n }'", + "markdown": "Reports augmented assignment (`+=`) expressions on read-only `Collection`.\n\nAugment assignment (`+=`) expression on read-only `Collection` doesn't modify the target collection,\nit creates a new one under the hood which can be misleading and lead to performance issues.\n\n**Change type to mutable** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test() {\n var list = listOf(0)\n list += 42 // new list is created, variable 'list' still contains only '0'\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n val list = mutableListOf(0)\n list += 42\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantNotNullExtensionReceiverOfInline", + "shortDescription": { + "text": "'inline fun' extension receiver can be explicitly nullable until Kotlin 1.2" + }, + "fullDescription": { + "text": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). Thus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's recommended to make such functions to have nullable receiver. Example: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' After the quick-fix is applied: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", + "markdown": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nThus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's\nrecommended to make such functions to have nullable receiver.\n\n**Example:**\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantElvisReturnNull", + "shortDescription": { + "text": "Redundant '?: return null'" + }, + "fullDescription": { + "text": "Reports redundant '?: return null' Example: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }' After the quick-fix is applied: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }'", + "markdown": "Reports redundant `?: return null`\n\n**Example:**\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PrivatePropertyName", + "shortDescription": { + "text": "Private property naming convention" + }, + "fullDescription": { + "text": "Reports private property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, private property names should start with a lowercase letter and use camel case. Optionally, underscore prefix is allowed but only for private properties. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val _My_Cool_Property = \"\"' A quick-fix renames the class according to the Kotlin naming conventions: 'val _myCoolProperty = \"\"'", + "markdown": "Reports private property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nprivate property names should start with a lowercase letter and use camel case.\nOptionally, underscore prefix is allowed but only for **private** properties.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val _My_Cool_Property = \"\"\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val _myCoolProperty = \"\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObsoleteKotlinJsPackages", + "shortDescription": { + "text": "'kotlin.browser' and 'kotlin.dom' packages are deprecated since 1.4" + }, + "fullDescription": { + "text": "Reports usages of 'kotlin.dom' and 'kotlin.browser' packages. These packages were moved to 'kotlinx.dom' and 'kotlinx.browser' respectively in Kotlin 1.4+.", + "markdown": "Reports usages of `kotlin.dom` and `kotlin.browser` packages.\n\nThese packages were moved to `kotlinx.dom` and `kotlinx.browser`\nrespectively in Kotlin 1.4+." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CascadeIf", + "shortDescription": { + "text": "Cascade if can be replaced with when" + }, + "fullDescription": { + "text": "Reports 'if' statements with three or more branches that can be replaced with the 'when' expression. Example: 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }' A quick-fix converts the 'if' expression to 'when': 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }'", + "markdown": "Reports `if` statements with three or more branches that can be replaced with the `when` expression.\n\n**Example:**\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n\nA quick-fix converts the `if` expression to `when`:\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EmptyRange", + "shortDescription": { + "text": "Range with start greater than endInclusive is empty" + }, + "fullDescription": { + "text": "Reports ranges that are empty because the 'start' value is greater than the 'endInclusive' value. Example: 'val range = 2..1' The quick-fix changes the '..' operator to 'downTo': 'val range = 2 downTo 1'", + "markdown": "Reports ranges that are empty because the `start` value is greater than the `endInclusive` value.\n\n**Example:**\n\n\n val range = 2..1\n\nThe quick-fix changes the `..` operator to `downTo`:\n\n\n val range = 2 downTo 1\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OptionalExpectation", + "shortDescription": { + "text": "Optionally expected annotation has no actual annotation" + }, + "fullDescription": { + "text": "Reports optionally expected annotations without actual annotation in some platform modules. Example: '// common code\n@OptionalExpectation\nexpect annotation class JvmName(val name: String)\n\n@JvmName(name = \"JvmFoo\")\nfun foo() { }\n\n// jvm code\nactual annotation class JvmName(val name: String)' The inspection also reports cases when 'actual annotation class JvmName' is omitted for non-JVM platforms (for example, Native).", + "markdown": "Reports optionally expected annotations without actual annotation in some platform modules.\n\n**Example:**\n\n // common code\n @OptionalExpectation\n expect annotation class JvmName(val name: String)\n\n @JvmName(name = \"JvmFoo\")\n fun foo() { }\n\n // jvm code\n actual annotation class JvmName(val name: String)\n\nThe inspection also reports cases when `actual annotation class JvmName` is omitted for non-JVM platforms (for example, Native)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DestructuringWrongName", + "shortDescription": { + "text": "Variable in destructuring declaration uses name of a wrong data class property" + }, + "fullDescription": { + "text": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class. Example: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }' The quick-fix changes variable's name to match the name of the corresponding class field: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }'", + "markdown": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class.\n\n**Example:**\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }\n\nThe quick-fix changes variable's name to match the name of the corresponding class field:\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IfThenToSafeAccess", + "shortDescription": { + "text": "If-Then foldable to '?.'" + }, + "fullDescription": { + "text": "Reports 'if-then' expressions that can be folded into safe-access ('?.') expressions. Example: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }' The quick fix converts the 'if-then' expression into a safe-access ('?.') expression: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }'", + "markdown": "Reports `if-then` expressions that can be folded into safe-access (`?.`) expressions.\n\n**Example:**\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }\n\nThe quick fix converts the `if-then` expression into a safe-access (`?.`) expression:\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RestrictReturnStatementTargetMigration", + "shortDescription": { + "text": "Target label does not denote a function since 1.4" + }, + "fullDescription": { + "text": "Reports labels that don't points to a functions. It's forbidden to declare a target label that does not denote a function. The quick-fix removes the label. Example: 'fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }' After the quick-fix is applied: 'fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }' This inspection only reports if the language level of the project or module is 1.4 or higher.", + "markdown": "Reports labels that don't points to a functions.\n\nIt's forbidden to declare a target label that does not denote a function.\n\nThe quick-fix removes the label.\n\n**Example:**\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }\n\nAfter the quick-fix is applied:\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }\n\nThis inspection only reports if the language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MigrateDiagnosticSuppression", + "shortDescription": { + "text": "Diagnostic name should be replaced" + }, + "fullDescription": { + "text": "Reports suppressions with old diagnostic names, for example '@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")'. Some of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant. Example: '@Suppress(\"HEADER_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}' After the quick-fix is applied: '@Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}'", + "markdown": "Reports suppressions with old diagnostic names, for example `@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")`.\n\n\nSome of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant.\n\n**Example:**\n\n\n @Suppress(\"HEADER_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n\nAfter the quick-fix is applied:\n\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeferredResultUnused", + "shortDescription": { + "text": "'@Deferred' result is unused" + }, + "fullDescription": { + "text": "Reports function calls with the 'Deferred' result type if the return value is not used. If the 'Deferred' return value is not used, the call site would not wait to complete this function. Example: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }' A quick-fix provides a variable with the 'Deferred' initializer: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }'", + "markdown": "Reports function calls with the `Deferred` result type if the return value is not used.\n\nIf the `Deferred` return value is not used, the call site would not wait to complete this function.\n\n**Example:**\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }\n\nA quick-fix provides a variable with the `Deferred` initializer:\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SelfReferenceConstructorParameter", + "shortDescription": { + "text": "Constructor can never be complete" + }, + "fullDescription": { + "text": "Reports constructors with a non-null self-reference parameter. Such constructors never instantiate a class. The quick-fix converts the parameter type to nullable. Example: 'class SelfRef(val ref: SelfRef)' After the quick-fix is applied: 'class SelfRef(val ref: SelfRef?)'", + "markdown": "Reports constructors with a non-null self-reference parameter.\n\nSuch constructors never instantiate a class.\n\nThe quick-fix converts the parameter type to nullable.\n\n**Example:**\n\n\n class SelfRef(val ref: SelfRef)\n\nAfter the quick-fix is applied:\n\n\n class SelfRef(val ref: SelfRef?)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MainFunctionReturnUnit", + "shortDescription": { + "text": "Entry point function should return Unit" + }, + "fullDescription": { + "text": "Reports entry point functions with an incorrect return type (should be 'Unit'). Example: 'fun main() = \"Hello world!\"'", + "markdown": "Reports entry point functions with an incorrect return type (should be `Unit`).\n\n**Example:**\n`fun main() = \"Hello world!\"`" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousCallableReferenceInLambda", + "shortDescription": { + "text": "Suspicious callable reference used as lambda result" + }, + "fullDescription": { + "text": "Reports lambda expressions with one callable reference. It is a common error to replace a lambda with a callable reference without changing curly braces to parentheses. Example: 'listOf(1,2,3).map { it::toString }' After the quick-fix is applied: 'listOf(1,2,3).map(Int::toString)'", + "markdown": "Reports lambda expressions with one callable reference.\n\nIt is a common error to replace a lambda with a callable reference without changing curly braces to parentheses.\n\n**Example:**\n\n listOf(1,2,3).map { it::toString }\n\nAfter the quick-fix is applied:\n\n listOf(1,2,3).map(Int::toString)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertSecondaryConstructorToPrimary", + "shortDescription": { + "text": "Convert to primary constructor" + }, + "fullDescription": { + "text": "Reports a secondary constructor that can be replaced with a more concise primary constructor. Example: 'class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }' A quick-fix converts code automatically: 'class User(val name: String) {\n }'", + "markdown": "Reports a secondary constructor that can be replaced with a more concise primary constructor.\n\n**Example:**\n\n\n class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }\n\nA quick-fix converts code automatically:\n\n\n class User(val name: String) {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceGetOrSet", + "shortDescription": { + "text": "Explicit 'get' or 'set' call" + }, + "fullDescription": { + "text": "Reports explicit calls to 'get' or 'set' functions which can be replaced by an indexing operator '[]'. Kotlin allows custom implementations for the predefined set of operators on types. To overload an operator, you can mark the corresponding function with the 'operator' modifier: 'operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}' The functions above correspond to the indexing operator. Example: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }' After the quick-fix is applied: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }'", + "markdown": "Reports explicit calls to `get` or `set` functions which can be replaced by an indexing operator `[]`.\n\n\nKotlin allows custom implementations for the predefined set of operators on types.\nTo overload an operator, you can mark the corresponding function with the `operator` modifier:\n\n\n operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}\n \nThe functions above correspond to the indexing operator.\n\n**Example:**\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }\n\nAfter the quick-fix is applied:\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitRepeatedUseSiteTargetAnnotationsMigration", + "shortDescription": { + "text": "Repeated annotation which is not marked as '@Repeatable'" + }, + "fullDescription": { + "text": "Reports the repeated use of a non-'@Repeatable' annotation on property accessors. As a result of using non-'@Repeatable' annotation multiple times, both annotation usages will appear in the bytecode leading to an ambiguity in reflection calls. Since Kotlin 1.4 it's mandatory to either mark annotation as '@Repeatable' or not repeat the annotation, otherwise it will lead to compilation error. Example: 'annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports the repeated use of a non-`@Repeatable` annotation on property accessors.\n\n\nAs a result of using non-`@Repeatable` annotation multiple times, both annotation usages\nwill appear in the bytecode leading to an ambiguity in reflection calls.\n\n\nSince Kotlin 1.4 it's mandatory to either mark annotation as `@Repeatable` or not\nrepeat the annotation, otherwise it will lead to compilation error.\n\n**Example:**\n\n\n annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Destructure", + "shortDescription": { + "text": "Use destructuring declaration" + }, + "fullDescription": { + "text": "Reports declarations that can be destructured. Example: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }' The quick-fix destructures the declaration and introduces new variables with names from the corresponding class: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }'", + "markdown": "Reports declarations that can be destructured.\n\n**Example:**\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }\n\nThe quick-fix destructures the declaration and introduces new variables with names from the corresponding class:\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedReceiverParameter", + "shortDescription": { + "text": "Unused receiver parameter" + }, + "fullDescription": { + "text": "Reports receiver parameter of extension functions and properties that is not used. Remove redundant receiver parameter can be used to amend the code automatically.", + "markdown": "Reports receiver parameter of extension functions and properties that is not used.\n\n**Remove redundant receiver parameter** can be used to amend the code automatically." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertTryFinallyToUseCall", + "shortDescription": { + "text": "Convert try / finally to use() call" + }, + "fullDescription": { + "text": "Reports a 'try-finally' block with 'resource.close()' in 'finally' which can be converted to a 'resource.use()' call. 'use()' is easier to read and less error-prone as there is no need in explicit 'close()' call. Example: 'fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }' After the quick-fix applied: 'fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }'", + "markdown": "Reports a `try-finally` block with `resource.close()` in `finally` which can be converted to a `resource.use()` call.\n\n`use()` is easier to read and less error-prone as there is no need in explicit `close()` call.\n\n**Example:**\n\n\n fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }\n\nAfter the quick-fix applied:\n\n\n fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinRedundantOverride", + "shortDescription": { + "text": "Redundant overriding method" + }, + "fullDescription": { + "text": "Reports redundant overriding declarations. An override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility. Example: 'open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }' After the quick-fix is applied: 'class Bar : Foo() {\n }'", + "markdown": "Reports redundant overriding declarations.\n\n\nAn override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility.\n\n**Example:**\n\n\n open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }\n\nAfter the quick-fix is applied:\n\n\n class Bar : Foo() {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceArrayOfWithLiteral", + "shortDescription": { + "text": "'arrayOf' call can be replaced with array literal [...]" + }, + "fullDescription": { + "text": "Reports 'arrayOf' calls that can be replaced with array literals '[...]'. Examples: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass' After the quick-fix is applied: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass'", + "markdown": "Reports `arrayOf` calls that can be replaced with array literals `[...]`.\n\n**Examples:**\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass\n\nAfter the quick-fix is applied:\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceToWithInfixForm", + "shortDescription": { + "text": "'to' call should be replaced with infix form" + }, + "fullDescription": { + "text": "Reports 'to' function calls that can be replaced with the infix form. Using the infix form makes your code simpler. The quick-fix replaces 'to' with the infix form. Example: 'fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) {\n val pair = a to b\n }'", + "markdown": "Reports `to` function calls that can be replaced with the infix form.\n\nUsing the infix form makes your code simpler.\n\nThe quick-fix replaces `to` with the infix form.\n\n**Example:**\n\n\n fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int, b: Int) {\n val pair = a to b\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstPropertyName", + "shortDescription": { + "text": "Const property naming convention" + }, + "fullDescription": { + "text": "Reports 'const' property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, 'const' properties should use uppercase underscore-separated names. Example: 'const val Planck: Double = 6.62607015E-34' A quick-fix renames the property: 'const val PLANCK: Double = 6.62607015E-34'", + "markdown": "Reports `const` property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#property-names),\n`const` properties should use uppercase underscore-separated names.\n\n**Example:**\n\n\n const val Planck: Double = 6.62607015E-34\n\nA quick-fix renames the property:\n\n\n const val PLANCK: Double = 6.62607015E-34\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantNullableReturnType", + "shortDescription": { + "text": "Redundant nullable return type" + }, + "fullDescription": { + "text": "Reports functions and variables with nullable return type which never return or become 'null'. Example: 'fun greeting(user: String): String? = \"Hello, $user!\"' After the quick-fix is applied: 'fun greeting(user: String): String = \"Hello, $user!\"'", + "markdown": "Reports functions and variables with nullable return type which never return or become `null`.\n\n**Example:**\n\n\n fun greeting(user: String): String? = \"Hello, $user!\"\n\nAfter the quick-fix is applied:\n\n\n fun greeting(user: String): String = \"Hello, $user!\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UselessCallOnNotNull", + "shortDescription": { + "text": "Useless call on not-null type" + }, + "fullDescription": { + "text": "Reports calls on not-null receiver that make sense only for nullable receiver. Several functions from the standard library such as 'orEmpty()' or 'isNullOrEmpty' have sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same. Remove redundant call and Change call to … quick-fixes can be used to amend the code automatically. Examples: 'fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }'", + "markdown": "Reports calls on not-null receiver that make sense only for nullable receiver.\n\nSeveral functions from the standard library such as `orEmpty()` or `isNullOrEmpty`\nhave sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same.\n\n**Remove redundant call** and **Change call to ...** quick-fixes can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RiderSolutionErrorsInspection", + "shortDescription": { + "text": "Rider toolset and environment errors" + }, + "fullDescription": { + "text": "Reports toolset and environment errors detected by Rider.", + "markdown": "Reports toolset and environment errors detected by Rider." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "RiderSolutionErrorsInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "Rider/General", + "index": 134, + "toolComponent": { + "name": "QDNET" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EqualsOrHashCode", + "shortDescription": { + "text": "'equals()' and 'hashCode()' not paired" + }, + "fullDescription": { + "text": "Reports classes that override 'equals()' but do not override 'hashCode()', or vice versa. It also reports object declarations that override either 'equals()' or 'hashCode()'. This can lead to undesired behavior when a class is added to a 'Collection' Example: 'class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }' The quick-fix overrides 'equals()' or 'hashCode()' for classes and deletes these methods for objects: 'class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }'", + "markdown": "Reports classes that override `equals()` but do not override `hashCode()`, or vice versa. It also reports object declarations that override either `equals()` or `hashCode()`.\n\nThis can lead to undesired behavior when a class is added to a `Collection`\n\n**Example:**\n\n\n class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }\n\nThe quick-fix overrides `equals()` or `hashCode()` for classes and deletes these methods for objects:\n\n\n class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + } + ] + }, + "invocations": [ + { + "exitCode": 0, + "toolExecutionNotifications": [], + "executionSuccessful": true + } + ], + "language": "en-US", + "results": [ + { + "ruleId": "ControlFlowWithEmptyBody", + "kind": "fail", + "level": "error", + "message": { + "text": "'while' has empty body", + "markdown": "'while' has empty body" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "dokker/src/main/kotlin/io/github/tiulpin/Dokker.kt", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 271, + "startColumn": 5, + "charOffset": 6917, + "charLength": 5, + "snippet": { + "text": "while" + }, + "sourceLanguage": "kotlin" + }, + "contextRegion": { + "startLine": 269, + "startColumn": 1, + "charOffset": 6885, + "charLength": 71, + "snippet": { + "text": " println(null)\n }\n while (false) {\n }\n if (update) {" + } + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "dokker.dokker.main", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f0b3b16328b5e11f45afdc0ae3fe79aa989b8909330a81d810ae499b347aca32" + }, + "properties": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + { + "ruleId": "ConstantConditionIf", + "kind": "fail", + "level": "warning", + "message": { + "text": "Condition is always 'true'", + "markdown": "Condition is always 'true'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "dokker/src/main/kotlin/io/github/tiulpin/Dokker.kt", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 268, + "startColumn": 9, + "charOffset": 6877, + "charLength": 4, + "snippet": { + "text": "true" + }, + "sourceLanguage": "kotlin" + }, + "contextRegion": { + "startLine": 266, + "startColumn": 1, + "charOffset": 6685, + "charLength": 227, + "snippet": { + "text": " val installPackages = packages.joinToString(INSTALL_SEP)\n var command = \"DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $INSTALL_SEP$installPackages\"\n if (true) {\n println(null)\n }" + } + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "dokker.dokker.main", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "eba2d761291ee6bda42bf3ff0a3856509e0140a940f297ba99450b51d0f7905e" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + { + "ruleId": "RiderSolutionErrorsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "[NU1101] Unable to find package PrivatePackage. No packages exist with this id in source(s): github at (0:0) Target: ResolvePackageAssets Task: ResolvePackageAssets", + "markdown": "\\[[NU1101](http://www.google.com/search?q=NU1101)\\] Unable to find package PrivatePackage. No packages exist with this id in source(s): github at (0:0) \n\nTarget: ResolvePackageAssets \nTask: ResolvePackageAssets" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "LibraryReferencingPackage/LibraryReferencingPackage.csproj", + "uriBaseId": "SRCROOT" + } + } + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2eb5998cec5651ad1ad36262cf210caa653ab138d3c22e4338d3eea704104bf6" + }, + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + { + "ruleId": "MayBeConstant", + "kind": "fail", + "level": "note", + "message": { + "text": "Might be 'const'", + "markdown": "Might be 'const'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "dokker/src/main/kotlin/io/github/tiulpin/Dokker.kt", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 283, + "startColumn": 5, + "charOffset": 7206, + "charLength": 4, + "snippet": { + "text": "help" + }, + "sourceLanguage": "kotlin" + }, + "contextRegion": { + "startLine": 281, + "startColumn": 1, + "charOffset": 7199, + "charLength": 17, + "snippet": { + "text": "}\n\nval help = \"\"\n" + } + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "dokker.dokker.main", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "54ac5fc68d708d7ae0f4fc0732dc3173126a76a86ec9f429bd133a5fb9a8f8fa" + }, + "properties": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + } + ], + "automationDetails": { + "id": "project - 12/13/21, 3:48 PM", + "guid": "d0a57b70-6936-41ab-bf04-97c58449a43d" + }, + "newlineSequences": [ + "\r\n", + "\n" + ], + "properties": { + "qodanaFailureConditions": { + "testCoverageThresholds": { + "totalCoverage": 40, + "freshCoverage": 40 + } + }, + "coverage": { + "totalCoverage": 45.0, + "totalLines": 124.0, + "totalCoveredLines": 56.0 + } + } + } + ] +} \ No newline at end of file diff --git a/vsts/__tests__/data/with.baseline.sarif.json b/vsts/__tests__/data/with.baseline.sarif.json new file mode 100644 index 00000000..ba9fa411 --- /dev/null +++ b/vsts/__tests__/data/with.baseline.sarif.json @@ -0,0 +1,8387 @@ +{ + "version": "2.1.0", + "runs": [ + { + "tool": { + "driver": { + "name": "QDJVM", + "fullName": "Qodana for JVM", + "version": "213.6433.60", + "rules": [], + "taxa": [], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + }, + "extensions": [ + { + "name": "org.jetbrains.kotlin", + "version": "213-1.5.10-release-949-IJ6433", + "rules": [ + { + "id": "RedundantRunCatching", + "shortDescription": { + "text": "Redundant 'runCatching' call" + }, + "fullDescription": { + "text": "Reports 'runCatching' calls that are immediately followed by 'getOrThrow'. Such calls can be replaced with just 'run'. Example: 'fun foo() = runCatching { doSomething() }.getOrThrow()' After the quick-fix is applied: 'fun foo() = run { doSomething() }'", + "markdown": "Reports `runCatching` calls that are immediately followed by `getOrThrow`. Such calls can be replaced with just `run`.\n\n**Example:**\n\n\n fun foo() = runCatching { doSomething() }.getOrThrow()\n\nAfter the quick-fix is applied:\n\n\n fun foo() = run { doSomething() }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimpleRedundantLet", + "shortDescription": { + "text": "Redundant receiver-based 'let' call" + }, + "fullDescription": { + "text": "Reports redundant receiver-based 'let' calls. The quick-fix removes the redundant 'let' call. Example: 'fun test(s: String?): Int? = s?.let { it.length }' After the quick-fix is applied: 'fun test(s: String?): Int? = s?.length'", + "markdown": "Reports redundant receiver-based `let` calls.\n\nThe quick-fix removes the redundant `let` call.\n\n**Example:**\n\n\n fun test(s: String?): Int? = s?.let { it.length }\n\nAfter the quick-fix is applied:\n\n\n fun test(s: String?): Int? = s?.length\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveSingleExpressionStringTemplate", + "shortDescription": { + "text": "Redundant string template" + }, + "fullDescription": { + "text": "Reports single-expression string templates that can be safely removed. Example: 'val x = \"Hello\"\n val y = \"$x\"' After the quick-fix is applied: 'val x = \"Hello\"\n val y = x // <== Updated'", + "markdown": "Reports single-expression string templates that can be safely removed.\n\n**Example:**\n\n val x = \"Hello\"\n val y = \"$x\"\n\nAfter the quick-fix is applied:\n\n val x = \"Hello\"\n val y = x // <== Updated\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IncompleteDestructuring", + "shortDescription": { + "text": "Incomplete destructuring declaration" + }, + "fullDescription": { + "text": "Reports incomplete destructuring declaration. Example: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person' The quick fix completes destructuring declaration with new variables: 'data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person'", + "markdown": "Reports incomplete destructuring declaration.\n\n**Example:**\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name) = person\n\nThe quick fix completes destructuring declaration with new variables:\n\n\n data class Person(val name: String, val age: Int)\n val person = Person(\"\", 0)\n val (name, age) = person\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ScopeFunctionConversion", + "shortDescription": { + "text": "Scope function can be converted to another one" + }, + "fullDescription": { + "text": "Reports scope functions ('let', 'run', 'apply', 'also') that can be converted between each other. Using corresponding functions makes your code simpler. The quick-fix replaces the scope function to another one. Example: 'val x = \"\".let {\n it.length\n }' After the quick-fix is applied: 'val x = \"\".run {\n length\n }'", + "markdown": "Reports scope functions (`let`, `run`, `apply`, `also`) that can be converted between each other.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the scope function to another one.\n\n**Example:**\n\n\n val x = \"\".let {\n it.length\n }\n\nAfter the quick-fix is applied:\n\n\n val x = \"\".run {\n length\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TrailingComma", + "shortDescription": { + "text": "Trailing comma recommendations" + }, + "fullDescription": { + "text": "Reports trailing commas that are not follow the recommended style guide.", + "markdown": "Reports trailing commas that are not follow the recommended [style guide](https://kotlinlang.org/docs/coding-conventions.html#trailing-commas)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FoldInitializerAndIfToElvis", + "shortDescription": { + "text": "If-Null return/break/... foldable to '?:'" + }, + "fullDescription": { + "text": "Reports an 'if' expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer. Example: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }' The quick-fix converts the 'if' expression with an initializer into an elvis expression: 'fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }'", + "markdown": "Reports an `if` expression that checks variable being null or not right after initializing it that can be converted into an elvis operator in the initializer.\n\n**Example:**\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo\n if (i == null) {\n return bar\n }\n return i\n }\n\nThe quick-fix converts the `if` expression with an initializer into an elvis expression:\n\n\n fun test(foo: Int?, bar: Int): Int {\n var i = foo ?: return bar\n return i\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinInvalidBundleOrProperty", + "shortDescription": { + "text": "Invalid property key" + }, + "fullDescription": { + "text": "Reports unresolved references to '.properties' file keys and resource bundles in Kotlin files.", + "markdown": "Reports unresolved references to `.properties` file keys and resource bundles in Kotlin files." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UselessCallOnCollection", + "shortDescription": { + "text": "Useless call on collection type" + }, + "fullDescription": { + "text": "Reports 'filter…' calls from the standard library on already filtered collections. Several functions from the standard library such as 'filterNotNull()' or 'filterIsInstance' have sense only when they are called on receivers that have types distinct from the resulting one. Otherwise, such calls can be omitted as the result will be the same. Remove redundant call quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }'", + "markdown": "Reports `filter...` calls from the standard library on already filtered collections.\n\nSeveral functions from the standard library such as `filterNotNull()` or `filterIsInstance`\nhave sense only when they are called on receivers that have types distinct from the resulting one. Otherwise,\nsuch calls can be omitted as the result will be the same.\n\n**Remove redundant call** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n val x = list.filterNotNull() // quick-fix simplifies to 'list'\n val y = list.filterIsInstance() // quick-fix simplifies to 'list'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantRequireNotNullCall", + "shortDescription": { + "text": "Redundant 'requireNotNull' or 'checkNotNull' call" + }, + "fullDescription": { + "text": "Reports redundant 'requireNotNull' or 'checkNotNull' call on non-nullable expressions. Example: 'fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }' After the quick-fix is applied: 'fun foo(i: Int) {\n ...\n }'", + "markdown": "Reports redundant `requireNotNull` or `checkNotNull` call on non-nullable expressions.\n\n**Example:**\n\n\n fun foo(i: Int) {\n requireNotNull(i) // This 'i' is always not null, so this 'requireNotNull' call is redundant.\n ...\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(i: Int) {\n ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObjectPropertyName", + "shortDescription": { + "text": "Object property naming convention" + }, + "fullDescription": { + "text": "Reports properties that do not follow the naming conventions. The following properties are reported: Top-level properties Properties in objects and companion objects You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with an uppercase letter, use camel case and no underscores. Example: '// top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }'", + "markdown": "Reports properties that do not follow the naming conventions.\n\nThe following properties are reported:\n\n* Top-level properties\n* Properties in objects and companion objects\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): it has to start with an uppercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n // top-level property\n val USER_NAME_FIELD = \"UserName\"\n // top-level property holding reference to singleton object\n val PersonComparator: Comparator = /*...*/\n\n class Person {\n companion object {\n // property in companion object\n val NO_NAME = Person()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PackageDirectoryMismatch", + "shortDescription": { + "text": "Package name does not match containing directory" + }, + "fullDescription": { + "text": "Reports 'package' directives that do not match the location of the file.", + "markdown": "Reports `package` directives that do not match the location of the file." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinCovariantEquals", + "shortDescription": { + "text": "Covariant 'equals()'" + }, + "fullDescription": { + "text": "Reports 'equals()' that takes an argument type other than 'Any?' if the class does not have another 'equals()' that takes 'Any?' as its argument type. Example: 'class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }' To fix the problem create 'equals()' method that takes an argument of type 'Any?'.", + "markdown": "Reports `equals()` that takes an argument type other than `Any?` if the class does not have another `equals()` that takes `Any?` as its argument type.\n\n**Example:**\n\n\n class Foo {\n fun equals(other: Foo?): Boolean {\n return true\n }\n }\n\nTo fix the problem create `equals()` method that takes an argument of type `Any?`." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSizeZeroCheckWithIsEmpty", + "shortDescription": { + "text": "Size zero check can be replaced with 'isEmpty()'" + }, + "fullDescription": { + "text": "Reports 'size == 0' checks on 'Collections/Array/String' that should be replaced with 'isEmpty()'. Using 'isEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }'", + "markdown": "Reports `size == 0` checks on `Collections/Array/String` that should be replaced with `isEmpty()`.\n\nUsing `isEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size == 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isEmpty()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantEnumConstructorInvocation", + "shortDescription": { + "text": "Redundant enum constructor invocation" + }, + "fullDescription": { + "text": "Reports redundant constructor invocation on an enum entry. Example: 'enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }' After the quick-fix is applied: 'enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }'", + "markdown": "Reports redundant constructor invocation on an enum entry.\n\n**Example:**\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B(),\n C(),\n }\n\nAfter the quick-fix is applied:\n\n\n enum class Baz(i: Int = 0) {\n A(1),\n B,\n C,\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DirectUseOfResultType", + "shortDescription": { + "text": "Function returning Result directly" + }, + "fullDescription": { + "text": "Reports functions that use 'Result' as a return type. 'Result' should never be used as a return type. Throw an exception, use a nullable type, or use a domain-specific result class to indicate failure. Example: 'fun foo() = Result.success(true)'", + "markdown": "Reports functions that use `Result` as a return type.\n\n\n`Result` should never be used as a return type.\nThrow an exception, use a nullable type, or use a domain-specific result class to indicate failure.\n\n**Example:**\n\n\n fun foo() = Result.success(true)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FakeJvmFieldConstant", + "shortDescription": { + "text": "Kotlin non-const property used as Java constant" + }, + "fullDescription": { + "text": "Reports Kotlin properties that are not 'const' and used as Java annotation arguments. For example, a property with the '@JvmField' annotation has an initializer that can be evaluated at compile-time, and it has a primitive or 'String' type. Such properties have a 'ConstantValue' attribute in bytecode in Kotlin 1.1-1.2. This attribute allows javac to fold usages of the corresponding field and use that field in annotations. This can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code. This behavior is subject to change in Kotlin 1.3 (no 'ConstantValue' attribute any more). Example: Kotlin code in foo.kt file: 'annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"' Java code: 'public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }' To fix the problem replace the '@JvmField' annotation with the 'const' modifier on a relevant Kotlin property or inline it.", + "markdown": "Reports Kotlin properties that are not `const` and used as Java annotation arguments.\n\n\nFor example, a property with the `@JvmField` annotation has an initializer that can be evaluated at compile-time,\nand it has a primitive or `String` type.\n\n\nSuch properties have a `ConstantValue` attribute in bytecode in Kotlin 1.1-1.2.\nThis attribute allows javac to fold usages of the corresponding field and use that field in annotations.\nThis can lead to incorrect behavior in the case of separate or incremental compilation in mixed Java/Kotlin code.\nThis behavior is subject to change in Kotlin 1.3 (no `ConstantValue` attribute any more).\n\n**Example:**\n\nKotlin code in foo.kt file:\n\n\n annotation class Ann(val s: String)\n @JvmField val importantString = \"important\"\n\nJava code:\n\n\n public class JavaUser {\n // This is dangerous\n @Ann(s = FooKt.importantString)\n public void foo() {}\n }\n\nTo fix the problem replace the `@JvmField` annotation with the `const` modifier on a relevant Kotlin property or inline it." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WhenWithOnlyElse", + "shortDescription": { + "text": "'when' has only 'else' branch and can be simplified" + }, + "fullDescription": { + "text": "Reports 'when' expressions with only an 'else' branch that can be simplified. Simplify expression quick-fix can be used to amend the code automatically. Example: 'fun redundant() {\n val x = when { // <== redundant, a quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }'", + "markdown": "Reports `when` expressions with only an `else` branch that can be simplified.\n\n**Simplify expression** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun redundant() {\n val x = when { // <== redundant, a quick-fix simplifies the when expression to \"val x = 1\"\n else -> 1\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Reformat", + "shortDescription": { + "text": "File is not formatted according to project settings" + }, + "fullDescription": { + "text": "Reports places that are not formatted according to the project settings. Use the 'Reformat Code' and 'Reformat File...' quick-fixes to format either the highlighted code block or the entire file accordingly.", + "markdown": "Reports places that are not formatted according to the project settings.\n\nUse the 'Reformat Code' and 'Reformat File...' quick-fixes to format either the highlighted code block\nor the entire file accordingly." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinTestJUnit", + "shortDescription": { + "text": "kotlin-test-junit could be used" + }, + "fullDescription": { + "text": "Reports usage of 'kotlin-test' and 'junit' dependency without 'kotlin-test-junit'. It is recommended to use 'kotlin-test-junit' dependency to work with Kotlin and JUnit.", + "markdown": "Reports usage of `kotlin-test` and `junit` dependency without `kotlin-test-junit`.\n\nIt is recommended to use `kotlin-test-junit` dependency to work with Kotlin and JUnit." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SafeCastWithReturn", + "shortDescription": { + "text": "Safe cast with 'return' should be replaced with 'if' type check" + }, + "fullDescription": { + "text": "Reports safe cast with 'return' that can be replaced with 'if' type check. Using corresponding functions makes your code simpler. The quick-fix replaces the safe cast with 'if' type check. Example: 'fun test(x: Any) {\n x as? String ?: return\n }' After the quick-fix is applied: 'fun test(x: Any) {\n if (x !is String) return\n }'", + "markdown": "Reports safe cast with `return` that can be replaced with `if` type check.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the safe cast with `if` type check.\n\n**Example:**\n\n\n fun test(x: Any) {\n x as? String ?: return\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(x: Any) {\n if (x !is String) return\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceAssertBooleanWithAssertEquality", + "shortDescription": { + "text": "Assert boolean could be replaced with assert equality" + }, + "fullDescription": { + "text": "Reports calls to 'assertTrue()' and 'assertFalse()' that can be replaced with assert equality functions. 'assertEquals()', 'assertSame()', and their negating counterparts (-Not-) provide more informative messages on failure. Example: 'assertTrue(a == b)' After the quick-fix is applied: 'assertEquals(a, b)'", + "markdown": "Reports calls to `assertTrue()` and `assertFalse()` that can be replaced with assert equality functions.\n\n\n`assertEquals()`, `assertSame()`, and their negating counterparts (-Not-) provide more informative messages on\nfailure.\n\n**Example:**\n\n assertTrue(a == b)\n\nAfter the quick-fix is applied:\n\n assertEquals(a, b)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceStringFormatWithLiteral", + "shortDescription": { + "text": "'String.format' call can be replaced with string templates" + }, + "fullDescription": { + "text": "Reports 'String.format' calls that can be replaced with string templates. Using string templates makes your code simpler. The quick-fix replaces the call with a string template. Example: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }' After the quick-fix is applied: 'fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }'", + "markdown": "Reports `String.format` calls that can be replaced with string templates.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces the call with a string template.\n\n**Example:**\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = String.format(\"%s_%s_%s\", id, date, id)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val id = \"abc\"\n val date = \"123\"\n val s = \"${id}_${date}_$id\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceNotNullAssertionWithElvisReturn", + "shortDescription": { + "text": "Not-null assertion can be replaced with 'return'" + }, + "fullDescription": { + "text": "Reports not-null assertion ('!!') calls that can be replaced with the elvis operator and return ('?: return'). A not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of '!!' is good practice. The quick-fix replaces the not-null assertion with 'return' or 'return null'. Example: 'fun test(number: Int?) {\n val x = number!!\n }' After the quick-fix is applied: 'fun test(number: Int?) {\n val x = number ?: return\n }'", + "markdown": "Reports not-null assertion (`!!`) calls that can be replaced with the elvis operator and return (`?: return`).\n\nA not-null assertion can lead to NPE (NullPointerException) that is not expected. Avoiding the use of `!!` is good practice.\n\nThe quick-fix replaces the not-null assertion with `return` or `return null`.\n\n**Example:**\n\n\n fun test(number: Int?) {\n val x = number!!\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(number: Int?) {\n val x = number ?: return\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithSubstringBefore", + "shortDescription": { + "text": "'substring' call should be replaced with 'substringBefore'" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, s.indexOf(x))' that can be replaced with 's.substringBefore(x)'. Using 'substringBefore()' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringBefore'. Example: 'fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringBefore('x')\n }'", + "markdown": "Reports calls like `s.substring(0, s.indexOf(x))` that can be replaced with `s.substringBefore(x)`.\n\nUsing `substringBefore()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringBefore`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringBefore('x')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithOperatorAssignment", + "shortDescription": { + "text": "Assignment can be replaced with operator assignment" + }, + "fullDescription": { + "text": "Reports modifications of variables with a simple assignment (such as 'y = y + x') that can be replaced with an operator assignment. The quick-fix replaces the assignment with an assignment operator. Example: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }' After the quick-fix is applied: 'fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }'", + "markdown": "Reports modifications of variables with a simple assignment (such as `y = y + x`) that can be replaced with an operator assignment.\n\nThe quick-fix replaces the assignment with an assignment operator.\n\n**Example:**\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list = list + 4\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val list = mutableListOf(1, 2, 3)\n list += 4\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedSymbol", + "shortDescription": { + "text": "Unused symbol" + }, + "fullDescription": { + "text": "Reports symbols that are not used or not reachable from entry points.", + "markdown": "Reports symbols that are not used or not reachable from entry points." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceCollectionCountWithSize", + "shortDescription": { + "text": "Collection count can be converted to size" + }, + "fullDescription": { + "text": "Reports calls to 'Collection.count()'. This function call can be replaced with '.size'. '.size' form ensures that the operation is O(1) and won't allocate extra objects, whereas 'count()' could be confused with 'Iterable.count()', which is O(n) and allocating. Example: 'fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }' After the quick-fix is applied: 'fun foo() {\n var list = listOf(1,2,3)\n list.size\n }'", + "markdown": "Reports calls to `Collection.count()`.\n\n\nThis function call can be replaced with `.size`.\n\n\n`.size` form ensures that the operation is O(1) and won't allocate extra objects, whereas\n`count()` could be confused with `Iterable.count()`, which is O(n) and allocating.\n\n\n**Example:**\n\n fun foo() {\n var list = listOf(1,2,3)\n list.count() // replaceable 'count()'\n }\n\nAfter the quick-fix is applied:\n\n fun foo() {\n var list = listOf(1,2,3)\n list.size\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceArrayEqualityOpWithArraysEquals", + "shortDescription": { + "text": "Arrays comparison via '==' and '!='" + }, + "fullDescription": { + "text": "Reports usages of '==' or '!=' operator for arrays that should be replaced with 'contentEquals()'. The '==' and '!='operators compare array references instead of their content. Examples: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }' After the quick-fix is applied: 'fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }'", + "markdown": "Reports usages of `==` or `!=` operator for arrays that should be replaced with `contentEquals()`.\n\n\nThe `==` and `!=`operators compare array references instead of their content.\n\n**Examples:**\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a == b) // references comparison\n }\n\nAfter the quick-fix is applied:\n\n fun test() {\n val a = arrayOf(1, 2, 3)\n val b = arrayOf(1, 2, 3)\n println(a.contentEquals(b))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedGradleDependency", + "shortDescription": { + "text": "Deprecated library is used in Gradle" + }, + "fullDescription": { + "text": "Reports deprecated dependencies in Gradle build scripts. Example: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }' After the quick-fix applied: 'dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }'", + "markdown": "Reports deprecated dependencies in Gradle build scripts.\n\n**Example:**\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.0\"\n }\n\nAfter the quick-fix applied:\n\n\n dependencies {\n compile \"org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.0\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertReferenceToLambda", + "shortDescription": { + "text": "Can be replaced with lambda" + }, + "fullDescription": { + "text": "Reports a function reference expression that can be replaced with a function literal (lambda). Sometimes, passing a lambda looks more straightforward and more consistent with the rest of the code. Also, the fix might be handy if you need to replace a simple call with something more complex. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }'", + "markdown": "Reports a function reference expression that can be replaced with a function literal (lambda).\n\n\nSometimes, passing a lambda looks more straightforward and more consistent with the rest of the code.\nAlso, the fix might be handy if you need to replace a simple call with something more complex.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnlabeledReturnInsideLambda", + "shortDescription": { + "text": "Unlabeled return inside lambda" + }, + "fullDescription": { + "text": "Reports unlabeled 'return' expressions inside inline lambda. Such expressions can be confusing because it might be unclear which scope belongs to 'return'. Change to return@… quick-fix can be used to amend the code automatically. Example: 'fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }'", + "markdown": "Reports unlabeled `return` expressions inside inline lambda.\n\nSuch expressions can be confusing because it might be unclear which scope belongs to `return`.\n\n**Change to return@...** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test(list: List) {\n list.forEach {\n // This return expression returns from the function test\n // One can change it to return@forEach to change the scope\n if (it == 10) return\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.forEach {\n if (it == 10) return@test\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LateinitVarOverridesLateinitVar", + "shortDescription": { + "text": "lateinit var property overrides lateinit var property" + }, + "fullDescription": { + "text": "Reports 'lateinit var' properties that override another 'lateinit var' property. A subclass instance will have two fields for the single property, and the one from the superclass will remain effectively unused. Example: open class BaseClass { open lateinit var name: String } class RealClass : BaseClass() { override lateinit var name: String } ''", + "markdown": "Reports `lateinit var` properties that override another `lateinit var` property.\n\n\nA subclass instance will have two fields for the single property, and the one from the superclass will remain effectively unused.\n\n**Example:**\nopen class BaseClass { open lateinit var name: String } class RealClass : BaseClass() { override lateinit var name: String }\n\n```\n\n```" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentKotlinGradleVersion", + "shortDescription": { + "text": "Kotlin Gradle and IDE plugins versions are different" + }, + "fullDescription": { + "text": "Reports that different IDE and Gradle plugin versions are used. This can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }' To fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin.", + "markdown": "Reports that different IDE and Gradle plugin versions are used.\n\nThis can cause inconsistencies between IDE and Gradle builds in error reporting or code behavior.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1\"\n }\n\nTo fix the problem change the kotlin gradle plugin version to match the version of kotlin that is bundled into the IDE plugin." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinEqualsBetweenInconvertibleTypes", + "shortDescription": { + "text": "'equals()' between objects of inconvertible types" + }, + "fullDescription": { + "text": "Reports calls to 'equals()' where the receiver and the argument are of incompatible primitive, enum, or string types. While such a call might theoretically be useful, most likely it represents a bug. Example: '5.equals(\"\");'", + "markdown": "Reports calls to `equals()` where the receiver and the argument are of incompatible primitive, enum, or string types.\n\nWhile such a call might theoretically be useful, most likely it represents a bug.\n\n**Example:**\n\n 5.equals(\"\");\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JoinDeclarationAndAssignment", + "shortDescription": { + "text": "Join declaration and assignment" + }, + "fullDescription": { + "text": "Reports property declarations that can be joined with the following assignment. Example: 'val x: String\n x = System.getProperty(\"\")' The quick fix joins the declaration with the assignment: 'val x = System.getProperty(\"\")'", + "markdown": "Reports property declarations that can be joined with the following assignment.\n\n**Example:**\n\n\n val x: String\n x = System.getProperty(\"\")\n\nThe quick fix joins the declaration with the assignment:\n\n\n val x = System.getProperty(\"\")\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "HasPlatformType", + "shortDescription": { + "text": "Function or property has platform type" + }, + "fullDescription": { + "text": "Reports functions and properties that have a platform type. To prevent unexpected errors, the type should be declared explicitly. Example: 'fun foo() = java.lang.String.valueOf(1)' The quick fix allows you to specify the return type: 'fun foo(): String = java.lang.String.valueOf(1)'", + "markdown": "Reports functions and properties that have a platform type.\n\nTo prevent unexpected errors, the type should be declared explicitly.\n\n**Example:**\n\n\n fun foo() = java.lang.String.valueOf(1)\n\nThe quick fix allows you to specify the return type:\n\n\n fun foo(): String = java.lang.String.valueOf(1)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DataClassPrivateConstructor", + "shortDescription": { + "text": "Private data class constructor is exposed via the 'copy' method" + }, + "fullDescription": { + "text": "Reports the 'private' primary constructor in data classes. 'data' classes have a 'copy()' factory method that can be used similarly to a constructor. A constructor should not be marked as 'private' to provide enough safety. Example: 'data class User private constructor(val name: String)' A quick-fix changes the constructor visibility modifier to 'public': 'data class User(val name: String)'", + "markdown": "Reports the `private` primary constructor in data classes.\n\n\n`data` classes have a `copy()` factory method that can be used similarly to a constructor.\nA constructor should not be marked as `private` to provide enough safety.\n\n**Example:**\n\n\n data class User private constructor(val name: String)\n\nA quick-fix changes the constructor visibility modifier to `public`:\n\n\n data class User(val name: String)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantInnerClassModifier", + "shortDescription": { + "text": "Redundant 'inner' modifier" + }, + "fullDescription": { + "text": "Reports the 'inner' modifier on a class as redundant if it doesn't reference members of its outer class. Example: 'class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }' After the quick-fix is applied: 'class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }'", + "markdown": "Reports the `inner` modifier on a class as redundant if it doesn't reference members of its outer class.\n\n**Example:**\n\n\n class Foo {\n inner class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n class InnerClass { // redundant `inner` modifier\n fun hello() {\n println(\"Hi!\")\n }\n }\n }\n\n class List {\n val objects = Array(42) { Any() }\n\n inner class Iterator { // Not redundant `inner` modifier\n fun next(): Any {\n return objects[0]\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaCollectionsStaticMethodOnImmutableList", + "shortDescription": { + "text": "Call of Java mutator method on immutable Kotlin collection" + }, + "fullDescription": { + "text": "Reports Java mutator methods calls (like 'fill', 'reverse', 'shuffle', 'sort') on an immutable Kotlin collection. This can lead to 'UnsupportedOperationException' at runtime. Example: 'import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }' To fix the problem make the list mutable.", + "markdown": "Reports Java mutator methods calls (like `fill`, `reverse`, `shuffle`, `sort`) on an immutable Kotlin collection.\n\nThis can lead to `UnsupportedOperationException` at runtime.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val immutableList = listOf(1, 2)\n Collections.reverse(immutableList)\n }\n\nTo fix the problem make the list mutable." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MavenCoroutinesDeprecation", + "shortDescription": { + "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Maven" + }, + "fullDescription": { + "text": "Reports kotlinx.coroutines library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later.", + "markdown": "Reports **kotlinx.coroutines** library dependencies in Maven that should be updated in order to be compatible with Kotlin 1.3 and later." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration/Maven", + "index": 119, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NullableBooleanElvis", + "shortDescription": { + "text": "Equality check can be used instead of elvis for nullable boolean check" + }, + "fullDescription": { + "text": "Reports cases when an equality check should be used instead of the elvis operator. Example: 'fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n}' After the quick-fix is applied: 'fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n}'", + "markdown": "Reports cases when an equality check should be used instead of the elvis operator.\n\n**Example:**\n\n\n fun check(a: Boolean? == null) {\n if (a ?: false) throw IllegalStateException()\n }\n\nAfter the quick-fix is applied:\n\n\n fun check(a: Boolean? == null) {\n if (a == true) throw IllegalStateException()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedMavenDependency", + "shortDescription": { + "text": "Deprecated library is used in Maven" + }, + "fullDescription": { + "text": "Reports deprecated maven dependency. Example: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n ' The quick fix changes the deprecated dependency to a maintained one: '\n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n '", + "markdown": "Reports deprecated maven dependency.\n\n**Example:**\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jre7\n ${kotlin.version}\n \n \n\nThe quick fix changes the deprecated dependency to a maintained one:\n\n\n \n \n org.jetbrains.kotlin\n kotlin-stdlib-jdk7\n ${kotlin.version}\n \n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnnecessaryVariable", + "shortDescription": { + "text": "Unnecessary local variable" + }, + "fullDescription": { + "text": "Reports local variables that used only in the very next 'return' statement or exact copies of other variables. Such variables can be safely inlined to make the code more clear.", + "markdown": "Reports local variables that used only in the very next `return` statement or exact copies of other variables.\n\nSuch variables can be safely inlined to make the code more clear." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantEmptyInitializerBlock", + "shortDescription": { + "text": "Redundant empty initializer block" + }, + "fullDescription": { + "text": "Reports redundant empty initializer blocks. Example: 'class Foo {\n init {\n // Empty init block\n }\n }' After the quick-fix is applied: 'class Foo {\n }'", + "markdown": "Reports redundant empty initializer blocks.\n\n**Example:**\n\n\n class Foo {\n init {\n // Empty init block\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "GradleKotlinxCoroutinesDeprecation", + "shortDescription": { + "text": "Incompatible kotlinx.coroutines dependency is used with Kotlin 1.3+ in Gradle" + }, + "fullDescription": { + "text": "Reports 'kotlinx.coroutines' library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+. Example: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }' The quick fix changes the 'kotlinx.coroutines' library version to a compatible with Kotlin 1.3: 'dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }'", + "markdown": "Reports `kotlinx.coroutines` library dependencies in Gradle that should be updated to be compatible with Kotlin 1.3+.\n\n**Example:**\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.0.1'\n }\n\nThe quick fix changes the `kotlinx.coroutines` library version to a compatible with Kotlin 1.3:\n\n\n dependencies {\n implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration/Gradle", + "index": 127, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantWith", + "shortDescription": { + "text": "Redundant 'with' call" + }, + "fullDescription": { + "text": "Reports redundant 'with' function calls that don't access anything from the receiver. Examples: 'class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }'", + "markdown": "Reports redundant `with` function calls that don't access anything from the receiver.\n\n**Examples:**\n\n\n class MyClass {\n fun f(): String = \"\"\n }\n\n fun testRedundant() {\n with(c) { // <== 'with' is redundant since 'c' isn't used\n println(\"1\")\n }\n }\n\n fun testOk() {\n val c = MyClass()\n with(c) { // <== OK because 'f()' is effectively 'c.f()'\n println(f())\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WarningOnMainUnusedParameterMigration", + "shortDescription": { + "text": "Unused `args` on `main` since 1.4" + }, + "fullDescription": { + "text": "Reports 'main' function with an unused single parameter. Since Kotlin 1.4, it is possible to use the 'main' function without parameter as the entry point to the Kotlin program. The compiler reports a warning for the 'main' function with an unused parameter.", + "markdown": "Reports `main` function with an unused single parameter.\n\nSince Kotlin 1.4, it is possible to use the `main` function without parameter as the entry point to the Kotlin program.\nThe compiler reports a warning for the `main` function with an unused parameter." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLabelMigration", + "shortDescription": { + "text": "Redundant label" + }, + "fullDescription": { + "text": "Reports redundant labels which cause compilation errors since Kotlin 1.4. Since Kotlin 1.0, one can mark any statement with a label: 'fun foo() {\n L1@ val x = L2@bar()\n }' However, these labels can be referenced only in a limited number of ways: break / continue from a loop non-local return from an inline lambda or inline anonymous function sssss Such labels are prohibited since Kotlin 1.4. This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports redundant labels which cause compilation errors since Kotlin 1.4.\n\nSince Kotlin 1.0, one can mark any statement with a label:\n\n\n fun foo() {\n L1@ val x = L2@bar()\n }\n\nHowever, these labels can be referenced only in a limited number of ways:\n\n* break / continue from a loop\n* non-local return from an inline lambda or inline anonymous function\nsssss\n\nSuch labels are prohibited since Kotlin 1.4.\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceNegatedIsEmptyWithIsNotEmpty", + "shortDescription": { + "text": "Negated call can be simplified" + }, + "fullDescription": { + "text": "Reports negation 'isEmpty()' and 'isNotEmpty()' for collections and 'String', or 'isBlank()' and 'isNotBlank()' for 'String'. Using corresponding functions makes your code simpler. The quick-fix replaces the negation call with the corresponding call from the Standard Library. Example: 'fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }' After the quick-fix is applied: 'fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }'", + "markdown": "Reports negation `isEmpty()` and `isNotEmpty()` for collections and `String`, or `isBlank()` and `isNotBlank()` for `String`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the negation call with the corresponding call from the Standard Library.\n\n**Example:**\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (!list.isEmpty()) {\n // do smth\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val list = listOf(1,2,3)\n if (list.isNotEmpty()) {\n // do smth\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DelegationToVarProperty", + "shortDescription": { + "text": "Delegating to 'var' property" + }, + "fullDescription": { + "text": "Reports interface delegation to a 'var' property. Only initial value of a property is used for delegation, any later assignments do not affect it. Example: 'class Example(var text: CharSequence): CharSequence by text' A quick-fix replaces a property with immutable one: 'class Example(val text: CharSequence): CharSequence by text' Alternative way, if you rely on mutability for some reason: 'class Example(text: CharSequence): CharSequence by text {\n var text = text\n }'", + "markdown": "Reports interface delegation to a `var` property.\n\nOnly initial value of a property is used for delegation, any later assignments do not affect it.\n\n**Example:**\n\n\n class Example(var text: CharSequence): CharSequence by text\n\nA quick-fix replaces a property with immutable one:\n\n\n class Example(val text: CharSequence): CharSequence by text\n\nAlternative way, if you rely on mutability for some reason:\n\n\n class Example(text: CharSequence): CharSequence by text {\n var text = text\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstantConditionIf", + "shortDescription": { + "text": "Condition of 'if' expression is constant" + }, + "fullDescription": { + "text": "Reports 'if' expressions that have 'true' or 'false' constant literal condition and can be simplified. While occasionally intended, this construction is confusing and often the result of a typo or previous refactoring. Example: 'fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }' A quick-fix removes the 'if' condition: 'fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }'", + "markdown": "Reports `if` expressions that have `true` or `false` constant literal condition and can be simplified.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo\nor previous refactoring.\n\n**Example:**\n\n\n fun example() {\n if (true) {\n throw IllegalStateException(\"Unexpected state\")\n }\n }\n\nA quick-fix removes the `if` condition:\n\n\n fun example() {\n throw IllegalStateException(\"Unexpected state\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLambdaArrow", + "shortDescription": { + "text": "Redundant lambda arrow" + }, + "fullDescription": { + "text": "Reports redundant lambda arrows in lambdas without parameters. Example: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -> println(\"Hi!\") }\n }' After the quick-fix is applied: 'fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }'", + "markdown": "Reports redundant lambda arrows in lambdas without parameters.\n\n**Example:**\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { -\\> println(\"Hi!\") }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(f: () -> Unit) = f()\n\n fun bar() {\n foo { println(\"Hi!\") }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinInternalInJava", + "shortDescription": { + "text": "Usage of Kotlin internal declarations from Java" + }, + "fullDescription": { + "text": "Reports usages of Kotlin 'internal' declarations in Java code that is located in a different module. The 'internal' keyword is designed to restrict access to a class, function, or property from other modules. Due to JVM limitations, 'internal' classes, functions, and properties can still be accessed from outside Kotlin, which may later lead to compatibility problems.", + "markdown": "Reports usages of Kotlin `internal` declarations in Java code that is located in a different module.\n\n\nThe `internal` keyword is designed to restrict access to a class, function, or property from other modules.\nDue to JVM limitations, `internal` classes, functions, and properties can still be\naccessed from outside Kotlin, which may later lead to compatibility problems." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UseWithIndex", + "shortDescription": { + "text": "Manually incremented index variable can be replaced with use of 'withIndex()'" + }, + "fullDescription": { + "text": "Reports 'for' loops with a manually incremented index variable. 'for' loops with a manually incremented index variable can be simplified with the 'withIndex()' function. Use withIndex() instead of manual index increment quick-fix can be used to amend the code automatically. Example: 'fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }' After the quick-fix is applied: 'fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }'", + "markdown": "Reports `for` loops with a manually incremented index variable.\n\n`for` loops with a manually incremented index variable can be simplified with the `withIndex()` function.\n\n**Use withIndex() instead of manual index increment** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun foo(list: List): Int? {\n var index = 0\n for (s in list) { <== can be simplified\n val x = s.length * index\n index++\n if (x > 0) return x\n }\n return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): Int? {\n for ((index, s) in list.withIndex()) {\n val x = s.length * index\n if (x > 0) return x\n }\n return null\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ImplicitThis", + "shortDescription": { + "text": "Implicit 'this'" + }, + "fullDescription": { + "text": "Reports usages of implicit this. Example: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }' The quick fix specifies this explicitly: 'class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }'", + "markdown": "Reports usages of implicit **this** .\n\n**Example:**\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n s()\n }\n }\n\nThe quick fix specifies **this** explicitly:\n\n\n class Foo {\n fun s() = \"\"\n\n fun test() {\n this.s()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinCatchMayIgnoreException", + "shortDescription": { + "text": "'catch' block may ignore exception" + }, + "fullDescription": { + "text": "Reports 'catch' blocks that are empty or may ignore an exception. While occasionally intended, empty 'catch' blocks may complicate debugging. Also, ignoring a 'catch' parameter might be wrong. The inspection won't report any 'catch' parameters named 'ignore', 'ignored', or '_'. You can use a quick-fix to change the exception name to '_'. Example: 'try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }' After the quick-fix is applied: 'try {\n throwingMethod()\n } catch (_: IOException) {\n\n }' Use the Do not warn when 'catch' block contains a comment option to ignore 'catch' blocks with comments.", + "markdown": "Reports `catch` blocks that are empty or may ignore an exception.\n\nWhile occasionally intended, empty `catch` blocks may complicate debugging.\nAlso, ignoring a `catch` parameter might be wrong.\n\n\nThe inspection won't report any `catch` parameters named `ignore`, `ignored`, or `_`.\n\n\nYou can use a quick-fix to change the exception name to `_`.\n\n**Example:**\n\n\n try {\n throwingMethod()\n } catch (ex: IOException) {\n\n }\n\nAfter the quick-fix is applied:\n\n\n try {\n throwingMethod()\n } catch (_: IOException) {\n\n }\n\nUse the **Do not warn when 'catch' block contains a comment** option to ignore `catch` blocks with comments." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentStdlibGradleVersion", + "shortDescription": { + "text": "Kotlin library and Gradle plugin versions are different" + }, + "fullDescription": { + "text": "Reports different Kotlin stdlib and compiler versions. Example: 'dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }' To fix the problem change the kotlin stdlib version to match the kotlin compiler version.", + "markdown": "Reports different Kotlin stdlib and compiler versions.\n\n**Example:**\n\n\n dependencies {\n classpath \"org.jetbrains.kotlin:kotlin-stdlib:0.0.1\"\n }\n\nTo fix the problem change the kotlin stdlib version to match the kotlin compiler version." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBeVal", + "shortDescription": { + "text": "Local 'var' is never modified and can be declared as 'val'" + }, + "fullDescription": { + "text": "Reports local variables declared with the 'var' keyword that are never modified. Kotlin encourages to declare practically immutable variables using the 'val' keyword, ensuring that their value will never change. Example: 'fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }' A quick-fix replaces the 'var' keyword with 'val': 'fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }'", + "markdown": "Reports local variables declared with the `var` keyword that are never modified.\n\nKotlin encourages to declare practically immutable variables using the `val` keyword, ensuring that their value will never change.\n\n**Example:**\n\n\n fun example() {\n var primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n var fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n\nA quick-fix replaces the `var` keyword with `val`:\n\n\n fun example() {\n val primeNumbers = listOf(1, 2, 3, 5, 7, 11, 13)\n val fibonacciNumbers = listOf(1, 1, 2, 3, 5, 8, 13)\n print(\"Same numbers: \" + primeNumbers.intersect(fibonacciNumbers))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithIgnoreCaseEquals", + "shortDescription": { + "text": "Should be replaced with 'equals(..., ignoreCase = true)'" + }, + "fullDescription": { + "text": "Reports case-insensitive comparisons that can be replaced with 'equals(..., ignoreCase = true)'. By using 'equals()' you don't have to allocate extra strings with 'toLowerCase()' or 'toUpperCase()' to compare strings. The quick-fix replaces the case-insensitive comparison that uses 'toLowerCase()' or 'toUpperCase()' with 'equals(..., ignoreCase = true)'. Note: May change semantics for some locales. Example: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }' After the quick-fix is applied: 'fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }'", + "markdown": "Reports case-insensitive comparisons that can be replaced with `equals(..., ignoreCase = true)`.\n\nBy using `equals()` you don't have to allocate extra strings with `toLowerCase()` or `toUpperCase()` to compare strings.\n\nThe quick-fix replaces the case-insensitive comparison that uses `toLowerCase()` or `toUpperCase()` with `equals(..., ignoreCase = true)`.\n\n**Note:** May change semantics for some locales.\n\n**Example:**\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.toLowerCase() == b.toLowerCase())\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = \"KoTliN\"\n val b = \"KOTLIN\"\n println(a.equals(b, ignoreCase = true))\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithSubstringAfter", + "shortDescription": { + "text": "'substring' call should be replaced with 'substringAfter'" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(s.indexOf(x))' that can be replaced with 's.substringAfter(x)'. Using 's.substringAfter(x)' makes your code simpler. The quick-fix replaces the 'substring' call with 'substringAfter'. Example: 'fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.substringAfter('x')\n }'", + "markdown": "Reports calls like `s.substring(s.indexOf(x))` that can be replaced with `s.substringAfter(x)`.\n\nUsing `s.substringAfter(x)` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `substringAfter`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(s.indexOf('x'))\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.substringAfter('x')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantCompanionReference", + "shortDescription": { + "text": "Redundant 'Companion' reference" + }, + "fullDescription": { + "text": "Reports redundant 'Companion' reference. Example: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }' After the quick-fix is applied: 'class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }'", + "markdown": "Reports redundant `Companion` reference.\n\n**Example:**\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.Companion.create()\n }\n\nAfter the quick-fix is applied:\n\n\n class A {\n companion object {\n fun create() = A()\n }\n }\n fun test() {\n val s = A.create()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KDocUnresolvedReference", + "shortDescription": { + "text": "Unresolved reference in KDoc" + }, + "fullDescription": { + "text": "Reports unresolved references in KDoc comments. Example: '/**\n * [unresolvedLink]\n */\n fun foo() {}' To fix the problem make the link valid.", + "markdown": "Reports unresolved references in KDoc comments.\n\n**Example:**\n\n\n /**\n * [unresolvedLink]\n */\n fun foo() {}\n\nTo fix the problem make the link valid." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NestedLambdaShadowedImplicitParameter", + "shortDescription": { + "text": "Nested lambda has shadowed implicit parameter" + }, + "fullDescription": { + "text": "Reports nested lambdas with shadowed implicit parameters. Example: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n}' After the quick-fix is applied: 'fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n}'", + "markdown": "Reports nested lambdas with shadowed implicit parameters.\n\n**Example:**\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach {\n println(it)\n }\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(listOfLists: List>) {\n listOfLists.forEach {\n it.forEach { it1 ->\n println(it1)\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSamConstructor", + "shortDescription": { + "text": "Redundant SAM constructor" + }, + "fullDescription": { + "text": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas. Example: 'fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}' After the quick-fix is applied: 'fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}'", + "markdown": "Reports SAM (Single Abstract Method) constructor usages which can be replaced with lambdas.\n\n**Example:**\n\n\n fun main() {\n foo(Runnable { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n foo( { println(\"Hi!\") })\n }\n\n fun foo(other: Runnable) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "InconsistentCommentForJavaParameter", + "shortDescription": { + "text": "Inconsistent comment for java parameter" + }, + "fullDescription": { + "text": "Reports inconsistent parameter name for java method specified in a comment block. Examples: '// Java\n public class JavaService {\n public void invoke(String command) {}\n }' '// Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }' The quick fix corrects parameter name in a comment block: 'fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }'", + "markdown": "Reports inconsistent parameter name for **java** method specified in a comment block.\n\n**Examples:**\n\n\n // Java\n public class JavaService {\n public void invoke(String command) {}\n }\n\n\n // Kotlin\n fun main() {\n JavaService().invoke(/* name = */ \"fix\")\n }\n\nThe quick fix corrects parameter name in a comment block:\n\n\n fun main() {\n JavaService().invoke(/* command = */ \"fix\")\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantCallsOfConversionMethods", + "shortDescription": { + "text": "Redundant call of conversion method" + }, + "fullDescription": { + "text": "Reports redundant calls to conversion methods (for example, 'toString()' on a 'String' or 'toDouble()' on a 'Double'). Use the 'Remove redundant calls of the conversion method' quick-fix to clean up the code.", + "markdown": "Reports redundant calls to conversion methods (for example, `toString()` on a `String` or `toDouble()` on a `Double`).\n\nUse the 'Remove redundant calls of the conversion method' quick-fix to clean up the code." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinThrowableNotThrown", + "shortDescription": { + "text": "Throwable not thrown" + }, + "fullDescription": { + "text": "Reports instantiations of 'Throwable' or its subclasses, when the created 'Throwable' is never actually thrown. The reported code indicates mistakes that are hard to catch in tests. Also, this inspection reports method calls that return instances of 'Throwable' or its subclasses, when the resulting 'Throwable' instance is not thrown. Example: 'fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }'", + "markdown": "Reports instantiations of `Throwable` or its subclasses, when the created `Throwable` is never actually thrown.\n\nThe reported code indicates mistakes that are hard to catch in tests.\n\n\nAlso, this inspection reports method calls that return instances of `Throwable` or its subclasses,\nwhen the resulting `Throwable` instance is not thrown.\n\n**Example:**\n\n\n fun check(condition: Boolean) {\n if (!condition) /* throw is missing here */ IllegalArgumentException(\"condition is not met\");\n }\n\n fun createError() = RuntimeException()\n\n fun foo() {\n /* throw is missing here */ createError()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinSealedInheritorsInJava", + "shortDescription": { + "text": "Inheritance of Kotlin sealed interface/class from Java" + }, + "fullDescription": { + "text": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code. Example: '// Kotlin file: MathExpression.kt\n\nsealed class MathExpression\n\ndata class Const(val number: Double) : MathExpression()\ndata class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()' '// Java file: NotANumber.java\n\npublic class NotANumber extends MathExpression {\n}'", + "markdown": "Reports attempts to inherit from Kotlin sealed interfaces or classes in Java code.\n\n**Example:**\n\n\n // Kotlin file: MathExpression.kt\n\n sealed class MathExpression\n\n data class Const(val number: Double) : MathExpression()\n data class Sum(val e1: MathExpression, val e2: MathExpression) : MathExpression()\n\n\n // Java file: NotANumber.java\n\n public class NotANumber extends MathExpression {\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyNegatedBinaryExpression", + "shortDescription": { + "text": "Negated boolean expression can be simplified" + }, + "fullDescription": { + "text": "Reports negated binary expressions that can be simplified. The quick-fix simplifies the binary expression. Example: 'fun test(n: Int) {\n !(0 == 1)\n }' After the quick-fix is applied: 'fun test(n: Int) {\n 0 != 1\n }'", + "markdown": "Reports negated binary expressions that can be simplified.\n\nThe quick-fix simplifies the binary expression.\n\n**Example:**\n\n\n fun test(n: Int) {\n !(0 == 1)\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(n: Int) {\n 0 != 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MemberVisibilityCanBePrivate", + "shortDescription": { + "text": "Class member can have 'private' visibility" + }, + "fullDescription": { + "text": "Reports declarations that can be made 'private' to follow the encapsulation principle. Example: 'class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}' After the quick-fix is applied (considering there are no usages of 'url' outside of 'Service' class): 'class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n}'", + "markdown": "Reports declarations that can be made `private` to follow the encapsulation principle.\n\n**Example:**\n\n\n class Service(val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n\nAfter the quick-fix is applied (considering there are no usages of `url` outside of `Service` class):\n\n\n class Service(private val url: String) {\n fun connect(): URLConnection = URL(url).openConnection()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SelfAssignment", + "shortDescription": { + "text": "Redundant assignment" + }, + "fullDescription": { + "text": "Reports assignments of a variable to itself. The quick-fix removes the redundant assignment. Example: 'fun test() {\n var bar = 1\n bar = bar\n }' After the quick-fix is applied: 'fun test() {\n var bar = 1\n }'", + "markdown": "Reports assignments of a variable to itself.\n\nThe quick-fix removes the redundant assignment.\n\n**Example:**\n\n\n fun test() {\n var bar = 1\n bar = bar\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n var bar = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RecursiveEqualsCall", + "shortDescription": { + "text": "Recursive equals call" + }, + "fullDescription": { + "text": "Reports recursive 'equals'('==') calls. In Kotlin, '==' compares object values by calling 'equals' method under the hood. '===', on the other hand, compares objects by reference. '===' is commonly used in 'equals' method implementation. But '===' may be mistakenly mixed up with '==' leading to infinite recursion. Example: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }' After the quick-fix is applied: 'class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }'", + "markdown": "Reports recursive `equals`(`==`) calls.\n\n\nIn Kotlin, `==` compares object values by calling `equals` method under the hood.\n`===`, on the other hand, compares objects by reference.\n\n\n`===` is commonly used in `equals` method implementation.\nBut `===` may be mistakenly mixed up with `==` leading to infinite recursion.\n\n**Example:**\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this == other) return true\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class X {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n return false\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ExplicitThis", + "shortDescription": { + "text": "Redundant explicit 'this'" + }, + "fullDescription": { + "text": "Reports an explicit 'this' when it can be omitted. Example: 'class C {\n private val i = 1\n fun f() = this.i\n }' The quick-fix removes the redundant 'this': 'class C {\n private val i = 1\n fun f() = i\n }'", + "markdown": "Reports an explicit `this` when it can be omitted.\n\n**Example:**\n\n\n class C {\n private val i = 1\n fun f() = this.i\n }\n\nThe quick-fix removes the redundant `this`:\n\n\n class C {\n private val i = 1\n fun f() = i\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "NullChecksToSafeCall", + "shortDescription": { + "text": "Null-checks can be replaced with safe-calls" + }, + "fullDescription": { + "text": "Reports chained null-checks that can be replaced with safe-calls. Example: 'fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }' After the quick-fix is applied: 'fun test(my: My?) {\n if (my?.foo() != null) {}\n }'", + "markdown": "Reports chained null-checks that can be replaced with safe-calls.\n\n**Example:**\n\n\n fun test(my: My?) {\n if (my != null && my.foo() != null) {}\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(my: My?) {\n if (my?.foo() != null) {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedMainParameter", + "shortDescription": { + "text": "Main parameter is not necessary" + }, + "fullDescription": { + "text": "Reports 'main' function with an unused single parameter.", + "markdown": "Reports `main` function with an unused single parameter." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionWithLambdaExpressionBody", + "shortDescription": { + "text": "Function with `= { ... }` and inferred return type" + }, + "fullDescription": { + "text": "Reports functions with '= { ... }' and inferred return type. Example: 'fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.' The quick fix removes braces: 'fun sum(a: Int, b: Int) = a + b'", + "markdown": "Reports functions with `= { ... }` and inferred return type.\n\n**Example:**\n\n\n fun sum(a: Int, b: Int) = { a + b } // The return type of this function is '() -> Int'.\n\nThe quick fix removes braces:\n\n\n fun sum(a: Int, b: Int) = a + b\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ArrayInDataClass", + "shortDescription": { + "text": "Array property in data class" + }, + "fullDescription": { + "text": "Reports properties with an 'Array' type in a 'data' class without overridden 'equals()' or 'hashCode()'. Array parameters are compared by reference equality, which is likely an unexpected behavior. It is strongly recommended to override 'equals()' and 'hashCode()' in such cases. Example: 'data class Text(val lines: Array)' A quick-fix generates missing 'equals()' and 'hashCode()' implementations: 'data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }'", + "markdown": "Reports properties with an `Array` type in a `data` class without overridden `equals()` or `hashCode()`.\n\n\nArray parameters are compared by reference equality, which is likely an unexpected behavior.\nIt is strongly recommended to override `equals()` and `hashCode()` in such cases.\n\n**Example:**\n\n\n data class Text(val lines: Array)\n\nA quick-fix generates missing `equals()` and `hashCode()` implementations:\n\n\n data class Text(val lines: Array) {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n\n other as Text\n\n if (!lines.contentEquals(other.lines)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return lines.contentHashCode()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertTwoComparisonsToRangeCheck", + "shortDescription": { + "text": "Two comparisons should be converted to a range check" + }, + "fullDescription": { + "text": "Reports two consecutive comparisons that can be converted to a range check. Checking against a range makes code simpler by removing test subject duplication. Example: 'fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }' A quick-fix replaces the comparison-based check with a range one: 'fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }'", + "markdown": "Reports two consecutive comparisons that can be converted to a range check.\n\nChecking against a range makes code simpler by removing test subject duplication.\n\n**Example:**\n\n\n fun checkMonth(month: Int): Boolean {\n return month >= 1 && month <= 12\n }\n\nA quick-fix replaces the comparison-based check with a range one:\n\n\n fun checkMonth(month: Int): Boolean {\n return month in 1..12\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LocalVariableName", + "shortDescription": { + "text": "Local variable naming convention" + }, + "fullDescription": { + "text": "Reports local variables that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: it has to start with a lowercase letter, use camel case and no underscores. Example: 'fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }'", + "markdown": "Reports local variables that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#function-names): it has to start with a lowercase letter, use camel case and no underscores.\n\n**Example:**\n\n\n fun fibonacciNumber(index: Int): Long = when(index) {\n 0 -> 0\n else -> {\n // does not follow naming conventions: contains underscore symbol (`_`)\n var number_one: Long = 0\n // does not follow naming conventions: starts with an uppercase letter\n var NUMBER_TWO: Long = 1\n // follow naming conventions: starts with a lowercase letter, use camel case and no underscores.\n var numberThree: Long = number_one + NUMBER_TWO\n\n for(currentIndex in 2..index) {\n numberThree = number_one + NUMBER_TWO\n number_one = NUMBER_TWO\n NUMBER_TWO = numberThree\n }\n numberThree\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantQualifierName", + "shortDescription": { + "text": "Redundant qualifier name" + }, + "fullDescription": { + "text": "Reports redundant qualifiers (or their parts) on class names, functions, and properties. A fully qualified name is an unambiguous identifier that specifies which object, function, or property a call refers to. In the contexts where the name can be shortened, the inspection informs on the opportunity and the associated 'Remove redundant qualifier name' quick-fix allows amending the code. Examples: 'package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = my.simple.name.Foo() // 'Foo' resides in the declared 'my.simple.name' package, qualifier is redundant\n val b = kotlin.Int.MAX_VALUE // Can be replaced with 'MAX_VALUE' since it's imported\n val c = kotlin.Double.MAX_VALUE // Can be replaced with 'Double.MAX_VALUE' since built-in types are imported automatically\n }' After the quick-fix is applied: 'package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = Foo()\n val b = MAX_VALUE\n val c = Double.MAX_VALUE\n }'", + "markdown": "Reports redundant qualifiers (or their parts) on class names, functions, and properties.\n\n\nA fully qualified name is an unambiguous identifier that specifies which object, function, or property a call refers to.\nIn the contexts where the name can be shortened, the inspection informs on the opportunity and the associated\n'Remove redundant qualifier name' quick-fix allows amending the code.\n\n**Examples:**\n\n\n package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = my.simple.name.Foo() // 'Foo' resides in the declared 'my.simple.name' package, qualifier is redundant\n val b = kotlin.Int.MAX_VALUE // Can be replaced with 'MAX_VALUE' since it's imported\n val c = kotlin.Double.MAX_VALUE // Can be replaced with 'Double.MAX_VALUE' since built-in types are imported automatically\n }\n\nAfter the quick-fix is applied:\n\n\n package my.simple.name\n import kotlin.Int.Companion.MAX_VALUE\n\n class Foo\n\n fun main() {\n val a = Foo()\n val b = MAX_VALUE\n val c = Double.MAX_VALUE\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveCurlyBracesFromTemplate", + "shortDescription": { + "text": "Redundant curly braces in string template" + }, + "fullDescription": { + "text": "Reports usages of curly braces in string templates around simple identifiers. Use the 'Remove curly braces' quick-fix to remove the redundant braces. Examples: 'fun redundant() {\n val x = 4\n val y = \"${x}\" // <== redundant\n }\n\n fun correctUsage() {\n val x = \"x\"\n val y = \"${x.length}\" // <== Ok\n }' After the quick-fix is applied: 'fun redundant() {\n val x = 4\n val y = \"$x\"\n }\n\n fun correctUsage() {\n val x = \"x\" <== Updated\n val y = \"${x.length}\"\n }'", + "markdown": "Reports usages of curly braces in string templates around simple identifiers.\n\nUse the 'Remove curly braces' quick-fix to remove the redundant braces.\n\n**Examples:**\n\n\n fun redundant() {\n val x = 4\n val y = \"${x}\" // <== redundant\n }\n\n fun correctUsage() {\n val x = \"x\"\n val y = \"${x.length}\" // <== Ok\n }\n\nAfter the quick-fix is applied:\n\n\n fun redundant() {\n val x = 4\n val y = \"$x\"\n }\n\n fun correctUsage() {\n val x = \"x\" <== Updated\n val y = \"${x.length}\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithIndexingOperation", + "shortDescription": { + "text": "'substring' call should be replaced with indexing operator" + }, + "fullDescription": { + "text": "Reports calls like '\"abc\".substring(0, 1)' that can be replaced with '\"abc\"[0]'. Obtaining the element by index makes your code simpler. The quick-fix replaces the 'substring' call with the indexing operator. Example: 'fun foo() {\n \"abc\".substring(0, 1)\n }' After the quick-fix is applied: 'fun foo() {\n \"abc\"[0]\n }'", + "markdown": "Reports calls like `\"abc\".substring(0, 1)` that can be replaced with `\"abc\"[0]`.\n\nObtaining the element by index makes your code simpler.\n\nThe quick-fix replaces the `substring` call with the indexing operator.\n\n**Example:**\n\n\n fun foo() {\n \"abc\".substring(0, 1)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n \"abc\"[0]\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MoveLambdaOutsideParentheses", + "shortDescription": { + "text": "Lambda argument inside parentheses" + }, + "fullDescription": { + "text": "Reports lambda expressions in parentheses which can be moved outside. Example: 'fun square(a: Int, b: (Int) -> Int) {\n b(a * a)\n}\n\nfun foo() {\n square(2, { it })\n}' After the quick-fix is applied: 'fun foo() {\n square(2){ it }\n}'", + "markdown": "Reports lambda expressions in parentheses which can be moved outside.\n\n**Example:**\n\n\n fun square(a: Int, b: (Int) -> Int) {\n b(a * a)\n }\n\n fun foo() {\n square(2, { it })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n square(2){ it }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OverridingDeprecatedMember", + "shortDescription": { + "text": "Overriding deprecated member" + }, + "fullDescription": { + "text": "Reports declarations that inherit from deprecated members. Example: 'open class BaseService {\n @Deprecated(\"obsolete\", replaceWith = ReplaceWith(\"connection\"))\n open fun connect() {}\n\n open fun connection() {}\n} \n\nclass SomeService: BaseService() {\n override fun connect() {\n super.connect()\n }\n}'", + "markdown": "Reports declarations that inherit from deprecated members.\n\n**Example:**\n\n\n open class BaseService {\n @Deprecated(\"obsolete\", replaceWith = ReplaceWith(\"connection\"))\n open fun connect() {}\n\n open fun connection() {}\n } \n\n class SomeService: BaseService() {\n override fun connect() {\n super.connect()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitTypeParametersForLocalVariablesMigration", + "shortDescription": { + "text": "Local variable with type parameters" + }, + "fullDescription": { + "text": "Reports local variables with type parameters. A type parameter for a local variable doesn't make sense because it can't be specialized. Example: 'fun main() {\n val x = \"\"\n }' After the quick-fix is applied: 'fun main() {\n val x = \"\"\n }' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports local variables with type parameters.\n\nA type parameter for a local variable doesn't make sense because it can't be specialized.\n\n**Example:**\n\n\n fun main() {\n val x = \"\"\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val x = \"\"\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "TestFunctionName", + "shortDescription": { + "text": "Test function naming convention" + }, + "fullDescription": { + "text": "Reports test function names that do not follow the recommended naming conventions.", + "markdown": "Reports test function names that do not follow the [recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#names-for-test-methods)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RecursivePropertyAccessor", + "shortDescription": { + "text": "Recursive property accessor" + }, + "fullDescription": { + "text": "Reports recursive property accessor calls which can end up with a 'StackOverflowError'. Such calls are usually confused with backing field access. Example: 'var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }' After the quick-fix is applied: 'var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }'", + "markdown": "Reports recursive property accessor calls which can end up with a `StackOverflowError`.\nSuch calls are usually confused with backing field access.\n\n**Example:**\n\n\n var counter: Int = 0\n set(value) {\n counter = if (value < 0) 0 else value\n }\n\nAfter the quick-fix is applied:\n\n\n var counter: Int = 0\n set(value) {\n field = if (value < 0) 0 else value\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantUnitExpression", + "shortDescription": { + "text": "Redundant 'Unit'" + }, + "fullDescription": { + "text": "Reports redundant 'Unit' expressions. 'Unit' in Kotlin can be used as the return type of functions that do not return anything meaningful. The 'Unit' type has only one possible value, which is the 'Unit' object. Examples: 'fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }'", + "markdown": "Reports redundant `Unit` expressions.\n\n\n`Unit` in Kotlin can be used as the return type of functions that do not return anything meaningful.\nThe `Unit` type has only one possible value, which is the `Unit` object.\n\n**Examples:**\n\n\n fun redundantA(): Unit {\n return Unit // redundant, 'Unit' is returned by default and matches the expected return type\n }\n\n fun requiredA(condition: Boolean): Any {\n if (condition) return \"hello\"\n return Unit // explicit 'Unit' is required since the expected type is 'Any'\n }\n\n fun redundantB(condition: Boolean): Any = if (condition) {\n fun ancillary(): Int = 1\n println(\"${ancillary()}\")\n Unit // redundant since the last expression is already of type 'Unit'\n } else {\n println(\"else\")\n }\n\n fun requiredB(condition: Boolean): Any = if (condition) {\n 1024\n Unit // required, otherwise '1024' (Int) would be the return value\n } else {\n println(\"else\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PlatformExtensionReceiverOfInline", + "shortDescription": { + "text": "'inline fun' with nullable receiver until Kotlin 1.2" + }, + "fullDescription": { + "text": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). It's recommended to add an explicit '!!' you want an exception to be thrown, or consider changing the function's receiver type to nullable if it should work without exceptions. Example: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }' After the quick-fix is applied: 'inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", + "markdown": "Reports potentially unsafe calls of inline functions with flexible nullable (platform type with unknown nullability) extension receivers.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nIt's recommended to add an explicit `!!` you want an exception to be thrown,\nor consider changing the function's receiver type to nullable if it should work without exceptions.\n\n**Example:**\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property.removePrefix(\"/home\"))\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.removePrefix(prefix: String): String {\n return this.substring(prefix.length)\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val property = System.getProperty(\"user.dir\")\n println(property!!.removePrefix(\"/home\"))\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousEqualsCombination", + "shortDescription": { + "text": "Suspicious combination of == and ===" + }, + "fullDescription": { + "text": "Reports '==' and '===' comparisons that are both used on the same variable within a single expression. Due to similarities '==' and '===' could be mixed without notice, and it takes a close look to check that '==' used instead of '===' Example: 'if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return'", + "markdown": "Reports `==` and `===` comparisons that are both used on the same variable within a single expression.\n\nDue to similarities `==` and `===` could be mixed without notice, and\nit takes a close look to check that `==` used instead of `===`\n\nExample:\n\n\n if (type === FIELD || type == METHOD || type == ANNOTATION_METHOD || // Note that \"==\" is used incorrectly\n type === LAMBDA_EXPRESSION) return\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedDataClassCopyResult", + "shortDescription": { + "text": "Unused result of data class copy" + }, + "fullDescription": { + "text": "Reports calls to data class 'copy' function without using its result.", + "markdown": "Reports calls to data class `copy` function without using its result." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantElseInIf", + "shortDescription": { + "text": "Redundant 'else' in 'if'" + }, + "fullDescription": { + "text": "Reports redundant 'else' in 'if' with 'return' Example: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }' After the quick-fix is applied: 'fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }'", + "markdown": "Reports redundant `else` in `if` with `return`\n\n**Example:**\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n else { // This else is redundant, code in braces could be just shifted left\n someCode()\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Boolean): Int {\n if (arg) return 0\n someCode()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplacePutWithAssignment", + "shortDescription": { + "text": "'map.put()' can be converted to assignment" + }, + "fullDescription": { + "text": "Reports 'map.put' function calls that can be replaced with indexing operator ('[]'). Using syntactic sugar makes your code simpler. The quick-fix replaces 'put' call with the assignment. Example: 'fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }' After the quick-fix is applied: 'fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }'", + "markdown": "Reports `map.put` function calls that can be replaced with indexing operator (`[]`).\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces `put` call with the assignment.\n\n**Example:**\n\n\n fun foo(map: MutableMap) {\n map.put(42, \"foo\")\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(map: MutableMap) {\n map[42] = \"foo\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinDoubleNegation", + "shortDescription": { + "text": "Redundant double negation" + }, + "fullDescription": { + "text": "Reports redundant double negations. Example: 'val truth = !!true'", + "markdown": "Reports redundant double negations.\n\n**Example:**\n\n val truth = !!true\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FunctionName", + "shortDescription": { + "text": "Function naming convention" + }, + "fullDescription": { + "text": "Reports function names that do not follow the recommended naming conventions. Example: 'fun Foo() {}' To fix the problem change the name of the function to match the recommended naming conventions.", + "markdown": "Reports function names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n fun Foo() {}\n\nTo fix the problem change the name of the function to match the recommended naming conventions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentKotlinMavenVersion", + "shortDescription": { + "text": "Maven and IDE plugins versions are different" + }, + "fullDescription": { + "text": "Reports the Maven plugin version of the Kotlin compiler that is different from the one that is used in the IDE plugin. This inconsistency may lead to different error reporting behavior in the IDE and the compiler", + "markdown": "Reports the Maven plugin version of the Kotlin compiler that is different from the one that is used in the IDE plugin.\n\nThis inconsistency may lead to different error reporting behavior in the IDE and the compiler" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantUnitReturnType", + "shortDescription": { + "text": "Redundant 'Unit' return type" + }, + "fullDescription": { + "text": "Reports a redundant 'Unit' return type which can be omitted.", + "markdown": "Reports a redundant `Unit` return type which can be omitted." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceRangeToWithUntil", + "shortDescription": { + "text": "'rangeTo' or the '..' call should be replaced with 'until'" + }, + "fullDescription": { + "text": "Reports calls to 'rangeTo' or the '..' operator instead of calls to 'until'. Using corresponding functions makes your code simpler. The quick-fix replaces 'rangeTo' or the '..' call with 'until'. Example: 'fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }' After the quick-fix is applied: 'fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }'", + "markdown": "Reports calls to `rangeTo` or the `..` operator instead of calls to `until`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces `rangeTo` or the `..` call with `until`.\n\n**Example:**\n\n\n fun foo(a: Int) {\n for (i in 0..a - 1) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int) {\n for (i in 0 until a) {\n\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedEquals", + "shortDescription": { + "text": "Unused equals expression" + }, + "fullDescription": { + "text": "Reports unused 'equals'('==') expressions.", + "markdown": "Reports unused `equals`(`==`) expressions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnclearPrecedenceOfBinaryExpression", + "shortDescription": { + "text": "Multiple operators with different precedence" + }, + "fullDescription": { + "text": "Reports binary expressions that consist of different operators without parentheses. Such expressions can be less readable due to different precedence rules of operators. Example: fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }", + "markdown": "Reports binary expressions that consist of different operators without parentheses.\n\nSuch expressions can be less readable due to different [precedence rules](https://kotlinlang.org/docs/reference/grammar.html#expressions) of operators.\n\nExample:\n\n```\n fun foo(b: Boolean?, i: Int?) {\n val x = b ?: i == null // evaluated as `(b ?: i) == null`\n val y = i ?: 0 + 1 // evaluated as `i ?: (0 + 1)`\n }\n```" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedLambdaExpressionBody", + "shortDescription": { + "text": "Unused return value of a function with lambda expression body" + }, + "fullDescription": { + "text": "Reports calls with an unused return value when the called function returns a lambda from an expression body. If there is '=' between function header and body block, code from the function will not be evaluated which can lead to incorrect behavior. Remove = token from function declaration can be used to amend the code automatically. Example: 'fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }' After the quick-fix is applied: 'fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }'", + "markdown": "Reports calls with an unused return value when the called function returns a lambda from an expression body.\n\n\nIf there is `=` between function header and body block,\ncode from the function will not be evaluated which can lead to incorrect behavior.\n\n**Remove = token from function declaration** can be used to amend the code automatically.\n\nExample:\n\n\n fun printHello() = { println(\"Hello\") }\n\n fun main() {\n printHello() // This function doesn't print anything\n }\n\nAfter the quick-fix is applied:\n\n\n fun printHello() { println(\"Hello\") }\n\n fun main() {\n printHello()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertLambdaToReference", + "shortDescription": { + "text": "Can be replaced with function reference" + }, + "fullDescription": { + "text": "Reports function literal expressions that can be replaced with function references. Replacing lambdas with function references often makes code look more concise and understandable. Example: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }' After the quick-fix is applied: 'fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }'", + "markdown": "Reports function literal expressions that can be replaced with function references.\n\nReplacing lambdas with function references often makes code look more concise and understandable.\n\n**Example:**\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter { it.isEven() }\n }\n\nAfter the quick-fix is applied:\n\n\n fun Int.isEven() = this % 2 == 0\n\n fun example() {\n val numbers = listOf(1, 2, 4, 7, 9, 10)\n val evenNumbers = numbers.filter(Int::isEven)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSetter", + "shortDescription": { + "text": "Redundant property setter" + }, + "fullDescription": { + "text": "Reports redundant property setters. Setter is considered to be redundant in one of the following cases: Setter has no body. Accessor visibility isn't changed, declaration isn't 'external' and has no annotations. 'var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated' Setter body is a block with a single statement assigning the parameter to the backing field. 'var prop: Int = 0\n set(value) { // redundant\n field = value\n }'", + "markdown": "Reports redundant property setters.\n\n\nSetter is considered to be redundant in one of the following cases:\n\n1. Setter has no body. Accessor visibility isn't changed, declaration isn't `external` and has no annotations.\n\n\n var myPropWithRedundantSetter: Int = 0\n set // redundant\n\n var myPropA: Int = 0\n private set // OK - property visibility is changed to private\n\n var myPropB: Int = 0\n external set // OK - implemented not in Kotlin (external)\n\n var myPropC: Int = 0\n @Inject set // OK - accessor is annotated\n \n2. Setter body is a block with a single statement assigning the parameter to the backing field.\n\n\n var prop: Int = 0\n set(value) { // redundant\n field = value\n }\n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanSealedSubClassBeObject", + "shortDescription": { + "text": "Sealed sub-class without state and overridden equals" + }, + "fullDescription": { + "text": "Reports direct inheritors of 'sealed' classes that have no state and overridden 'equals()' method. It's highly recommended to override 'equals()' to provide comparison stability, or convert the 'class' to an 'object' to reach the same effect. Example: 'sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }' A quick-fix converts a 'class' into an 'object': 'sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }'", + "markdown": "Reports direct inheritors of `sealed` classes that have no state and overridden `equals()` method.\n\nIt's highly recommended to override `equals()` to provide comparison stability, or convert the `class` to an `object` to reach the same effect.\n\n**Example:**\n\n\n sealed class Receiver {\n class Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n\nA quick-fix converts a `class` into an `object`:\n\n\n sealed class Receiver {\n object Everyone : Receiver()\n class User(val id: Int) : Receiver()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PropertyName", + "shortDescription": { + "text": "Property naming convention" + }, + "fullDescription": { + "text": "Reports property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, property names should start with a lowercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val My_Cool_Property = \"\"' A quick-fix renames the class according to the Kotlin naming conventions: 'val myCoolProperty = \"\"'", + "markdown": "Reports property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nproperty names should start with a lowercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val My_Cool_Property = \"\"\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val myCoolProperty = \"\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinMavenPluginPhase", + "shortDescription": { + "text": "Kotlin Maven Plugin misconfigured" + }, + "fullDescription": { + "text": "Reports kotlin-maven-plugin configuration issues", + "markdown": "Reports kotlin-maven-plugin configuration issues" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertToStringTemplate", + "shortDescription": { + "text": "String concatenation that can be converted to string template" + }, + "fullDescription": { + "text": "Reports string concatenation that can be converted to a string template. Using string templates is recommended as it makes code easier to read. Example: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }' After the quick-fix is applied: 'fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }'", + "markdown": "Reports string concatenation that can be converted to a string template.\n\nUsing string templates is recommended as it makes code easier to read.\n\n**Example:**\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(capital + \" is a capital of \" + country)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun example() {\n val capitals = mapOf(\"France\" to \"Paris\", \"Spain\" to \"Madrid\")\n for ((country, capital) in capitals) {\n print(\"$capital is a capital of $country\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifiableCall", + "shortDescription": { + "text": "Library function call could be simplified" + }, + "fullDescription": { + "text": "Reports library function calls which could be replaced by simplified one. Using corresponding functions makes your code simpler. The quick-fix replaces the function calls with another one. Example: 'fun test(list: List) {\n list.filter { it is String }\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.filterIsInstance()\n }'", + "markdown": "Reports library function calls which could be replaced by simplified one.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the function calls with another one.\n\n**Example:**\n\n\n fun test(list: List) {\n list.filter { it is String }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.filterIsInstance()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObjectLiteralToLambda", + "shortDescription": { + "text": "Object literal can be converted to lambda" + }, + "fullDescription": { + "text": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression. Example: 'class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n}' After the quick-fix is applied: 'fun foo() {\n threadPool.submit { println(\"hello\") }\n }'", + "markdown": "Reports anonymous object literals implementing a Java interface with a single abstract method that can be converted into a call with a lambda expression.\n\n**Example:**\n\n\n class SomeService {\n val threadPool = Executors.newCachedThreadPool()\n \n fun foo() {\n threadPool.submit(object : Runnable {\n override fun run() {\n println(\"hello\")\n }\n })\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n threadPool.submit { println(\"hello\") }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantLambdaOrAnonymousFunction", + "shortDescription": { + "text": "Redundant creation of lambda or anonymous function" + }, + "fullDescription": { + "text": "Reports lambdas or anonymous functions that are created and used immediately. 'fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }'", + "markdown": "Reports lambdas or anonymous functions that are created and used immediately.\n\n\n fun test() {\n ({ println() })() // redundant\n (fun() { println() })() // redundant\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "BooleanLiteralArgument", + "shortDescription": { + "text": "Boolean literal argument without parameter name" + }, + "fullDescription": { + "text": "Reports call arguments with 'Boolean' type without explicit parameter names specified. When multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes. Explicit parameter names allow for easier code reading and understanding. Example: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }' A quick-fix adds missing parameter names: 'fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }'", + "markdown": "Reports call arguments with `Boolean` type without explicit parameter names specified.\n\n\nWhen multiple boolean literals are passed sequentially, it's easy to forget parameter ordering that could lead to mistakes.\nExplicit parameter names allow for easier code reading and understanding.\n\n**Example:**\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(true, false, true) // What does this mean?\n }\n\nA quick-fix adds missing parameter names:\n\n\n fun check(checkName: Boolean, checkAddress: Boolean, checkPhone: Boolean) {}\n\n fun usage() {\n check(checkName = true, checkAddress = false, checkPhone = true)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertArgumentToSet", + "shortDescription": { + "text": "Argument could be converted to 'Set' to improve performance" + }, + "fullDescription": { + "text": "Detects the function calls that could work faster with an argument converted to 'Set'. Operations like 'minus' or 'intersect' are more effective when their argument is a set. An explicit conversion of an 'Iterable' or an 'Array' into a 'Set' can often make code more effective. The quick-fix adds an explicit conversion to the function call. Example: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size' After the quick-fix is applied: 'fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size'", + "markdown": "Detects the function calls that could work faster with an argument converted to `Set`.\n\n\nOperations like 'minus' or 'intersect' are more effective when their argument is a set.\nAn explicit conversion of an `Iterable` or an `Array`\ninto a `Set` can often make code more effective.\n\n\nThe quick-fix adds an explicit conversion to the function call.\n\n**Example:**\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b).size\n\nAfter the quick-fix is applied:\n\n\n fun f(a: Iterable, b: Iterable): Int =\n a.intersect(b.toSet()).size\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceGuardClauseWithFunctionCall", + "shortDescription": { + "text": "Guard clause can be replaced with Kotlin's function call" + }, + "fullDescription": { + "text": "Reports guard clauses that can be replaced with a function call. Example: 'fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }' After the quick-fix is applied: 'fun test(foo: Int?) {\n checkNotNull(foo)\n }'", + "markdown": "Reports guard clauses that can be replaced with a function call.\n\n**Example:**\n\n fun test(foo: Int?) {\n if (foo == null) throw IllegalArgumentException(\"foo\") // replaceable clause\n }\n\nAfter the quick-fix is applied:\n\n fun test(foo: Int?) {\n checkNotNull(foo)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceToStringWithStringTemplate", + "shortDescription": { + "text": "Call of 'toString' could be replaced with string template" + }, + "fullDescription": { + "text": "Reports 'toString' function calls that can be replaced with a string template. Using string templates makes your code simpler. The quick-fix replaces 'toString' with a string template. Example: 'fun test(): String {\n val x = 1\n return x.toString()\n }' After the quick-fix is applied: 'fun test(): String {\n val x = 1\n return \"$x\"\n }'", + "markdown": "Reports `toString` function calls that can be replaced with a string template.\n\nUsing string templates makes your code simpler.\n\nThe quick-fix replaces `toString` with a string template.\n\n**Example:**\n\n\n fun test(): String {\n val x = 1\n return x.toString()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(): String {\n val x = 1\n return \"$x\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProtectedInFinal", + "shortDescription": { + "text": "'protected' visibility is effectively 'private' in a final class" + }, + "fullDescription": { + "text": "Reports 'protected' visibility used inside of a 'final' class. In such cases 'protected' members are accessible only in the class itself, so they are effectively 'private'. Example: 'class FinalClass {\n protected fun foo() {}\n }' After the quick-fix is applied: 'class FinalClass {\n private fun foo() {}\n }'", + "markdown": "Reports `protected` visibility used inside of a `final` class. In such cases `protected` members are accessible only in the class itself, so they are effectively `private`.\n\n**Example:**\n\n\n class FinalClass {\n protected fun foo() {}\n }\n\nAfter the quick-fix is applied:\n\n\n class FinalClass {\n private fun foo() {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceRangeStartEndInclusiveWithFirstLast", + "shortDescription": { + "text": "Boxed properties should be replaced with unboxed" + }, + "fullDescription": { + "text": "Reports boxed 'Range.start' and 'Range.endInclusive' properties. These properties can be replaced with unboxed 'first' and 'last' properties to avoid redundant calls. The quick-fix replaces 'start' and 'endInclusive' properties with the corresponding 'first' and 'last'. Example: 'fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }' After the quick-fix is applied: 'fun foo(range: CharRange) {\n val lastElement = range.last\n }'", + "markdown": "Reports **boxed** `Range.start` and `Range.endInclusive` properties.\n\nThese properties can be replaced with **unboxed** `first` and `last` properties to avoid redundant calls.\n\nThe quick-fix replaces `start` and `endInclusive` properties with the corresponding `first` and `last`.\n\n**Example:**\n\n\n fun foo(range: CharRange) {\n val lastElement = range.endInclusive\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(range: CharRange) {\n val lastElement = range.last\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSizeCheckWithIsNotEmpty", + "shortDescription": { + "text": "Size check can be replaced with 'isNotEmpty()'" + }, + "fullDescription": { + "text": "Reports size checks of 'Collections/Array/String' that should be replaced with 'isNotEmpty()'. Using 'isNotEmpty()' makes your code simpler. The quick-fix replaces the size check with 'isNotEmpty()'. Example: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }' After the quick-fix is applied: 'fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }'", + "markdown": "Reports size checks of `Collections/Array/String` that should be replaced with `isNotEmpty()`.\n\nUsing `isNotEmpty()` makes your code simpler.\n\nThe quick-fix replaces the size check with `isNotEmpty()`.\n\n**Example:**\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.size > 0\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n val arrayOf = arrayOf(1, 2, 3)\n arrayOf.isNotEmpty()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSemicolon", + "shortDescription": { + "text": "Redundant semicolon" + }, + "fullDescription": { + "text": "Reports redundant semicolons (';') that can be safely removed. Kotlin does not require a semicolon at the end of each statement or expression. A quick-fix is suggested to remove redundant semicolons. Example: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};' After the quick-fix is applied: 'val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}' There are two cases though where a semicolon is required: Several statements placed on a single line need to be separated with semicolons: 'map.forEach { val (key, value) = it; println(\"$key -> $value\") }' 'enum' classes that also declare properties or functions, require a semicolon after the list of enum constants: 'enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }'", + "markdown": "Reports redundant semicolons (`;`) that can be safely removed.\n\n\nKotlin does not require a semicolon at the end of each statement or expression.\nA quick-fix is suggested to remove redundant semicolons.\n\n**Example:**\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2);\n myMap.forEach { (key, value) -> print(\"$key -> $value\")};\n\nAfter the quick-fix is applied:\n\n\n val myMap = mapOf(\"one\" to 1, \"two\" to 2)\n myMap.forEach { (key, value) -> print(\"$key -> $value\")}\n\nThere are two cases though where a semicolon is required:\n\n1. Several statements placed on a single line need to be separated with semicolons:\n\n\n map.forEach { val (key, value) = it; println(\"$key -> $value\") }\n\n2. `enum` classes that also declare properties or functions, require a semicolon after the list of enum constants:\n\n\n enum class Mode {\n SILENT, VERBOSE;\n\n fun isSilent(): Boolean = this == SILENT\n }\n \n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IntroduceWhenSubject", + "shortDescription": { + "text": "'when' that can be simplified by introducing an argument" + }, + "fullDescription": { + "text": "Reports a 'when' expression that can be simplified by introducing a subject argument. Example: 'fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }' The quick fix introduces a subject argument: 'fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }'", + "markdown": "Reports a `when` expression that can be simplified by introducing a subject argument.\n\n**Example:**\n\n\n fun test(obj: Any): String {\n return when {\n obj is String -> \"string\"\n obj is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n\nThe quick fix introduces a subject argument:\n\n\n fun test(obj: Any): String {\n return when (obj) {\n is String -> \"string\"\n is Int -> \"int\"\n else -> \"unknown\"\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeprecatedCallableAddReplaceWith", + "shortDescription": { + "text": "@Deprecated annotation without 'replaceWith' argument" + }, + "fullDescription": { + "text": "Reports deprecated functions and properties that do not have the 'kotlin.ReplaceWith' argument in its 'kotlin.deprecated' annotation and suggests to add one based on their body. Kotlin provides the 'ReplaceWith' argument to replace deprecated declarations automatically. It is recommended to use the argument to fix deprecation issues in code. Example: '@Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42' A quick-fix adds the 'ReplaceWith()' argument: '@Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42'", + "markdown": "Reports deprecated functions and properties that do not have the `kotlin.ReplaceWith` argument in its `kotlin.deprecated` annotation and suggests to add one based on their body.\n\n\nKotlin provides the `ReplaceWith` argument to replace deprecated declarations automatically.\nIt is recommended to use the argument to fix deprecation issues in code.\n\n**Example:**\n\n\n @Deprecated(\"Use refined() instead.\")\n fun deprecated() = refined()\n\n fun refined() = 42\n\nA quick-fix adds the `ReplaceWith()` argument:\n\n\n @Deprecated(\"Use refined() instead.\", ReplaceWith(\"refined()\"))\n fun deprecated() = refined()\n\n fun refined() = 42\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ComplexRedundantLet", + "shortDescription": { + "text": "Redundant argument-based `let` call" + }, + "fullDescription": { + "text": "Reports a redundant argument-based 'let' call. 'let' is redundant when the lambda parameter is only used as a qualifier in a call expression. If you need to give a name to the qualifying expression, declare a local variable. Example: 'fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }' A quick-fix removes the extra 'let()' call: 'fun example() {\n \"1,2,3\".split(',')\n }' Alternative: 'fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }'", + "markdown": "Reports a redundant argument-based `let` call.\n\n`let` is redundant when the lambda parameter is only used as a qualifier in a call expression.\n\nIf you need to give a name to the qualifying expression, declare a local variable.\n\n**Example:**\n\n\n fun splitNumbers() {\n \"1,2,3\".let { it.split(',') }\n }\n\nA quick-fix removes the extra `let()` call:\n\n\n fun example() {\n \"1,2,3\".split(',')\n }\n\nAlternative:\n\n\n fun splitNumbers() {\n val numbers = \"1,2,3\"\n numbers.split(',')\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantSpreadOperator", + "shortDescription": { + "text": "Redundant spread operator" + }, + "fullDescription": { + "text": "Reports the use of a redundant spread operator for a family of 'arrayOf' function calls. Use the 'Remove redundant spread operator' quick-fix to clean up the code. Examples: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }' After the quick-fix is applied: 'fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }'", + "markdown": "Reports the use of a redundant spread operator for a family of `arrayOf` function calls.\n\nUse the 'Remove redundant spread operator' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(*arrayOf(\"abc\")) // for the both calls of 'foo', array creation\n foo(*arrayOf(*ss, \"zzz\")) // and its subsequent \"spreading\" is redundant\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(vararg s: String) { }\n\n fun bar(ss: Array) {\n foo(\"abc\")\n foo(*ss, \"zzz\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitJvmOverloadsOnConstructorsOfAnnotationClassesMigration", + "shortDescription": { + "text": "'@JvmOverloads' annotation cannot be used on constructors of annotation classes since 1.4" + }, + "fullDescription": { + "text": "Reports '@JvmOverloads' on constructors of annotation classes because it's meaningless. There is no footprint of '@JvmOverloads' in the generated bytecode and Kotlin metadata, so '@JvmOverloads' doesn't affect the generated bytecode and the code behavior. '@JvmOverloads' on constructors of annotation classes causes a compilation error since Kotlin 1.4. Example: 'annotation class A @JvmOverloads constructor(val x: Int = 1)' After the quick-fix is applied: 'annotation class A constructor(val x: Int = 1)'", + "markdown": "Reports `@JvmOverloads` on constructors of annotation classes because it's meaningless.\n\n\nThere is no footprint of `@JvmOverloads` in the generated bytecode and Kotlin metadata,\nso `@JvmOverloads` doesn't affect the generated bytecode and the code behavior.\n\n`@JvmOverloads` on constructors of annotation classes causes a compilation error since Kotlin 1.4.\n\n**Example:**\n\n\n annotation class A @JvmOverloads constructor(val x: Int = 1)\n\nAfter the quick-fix is applied:\n\n\n annotation class A constructor(val x: Int = 1)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveSetterParameterType", + "shortDescription": { + "text": "Redundant setter parameter type" + }, + "fullDescription": { + "text": "Reports explicitly specified parameter types in property setters. Setter parameter type always matches the property type, so it's not required to be explicit. The 'Remove explicit type specification' quick-fix allows amending the code accordingly. Examples: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted' After the quick-fix is applied: 'fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)'", + "markdown": "Reports explicitly specified parameter types in property setters.\n\n\nSetter parameter type always matches the property type, so it's not required to be explicit.\nThe 'Remove explicit type specification' quick-fix allows amending the code accordingly.\n\n**Examples:**\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value: Int) = process(value) // <== 'Int' specification can be safely omitted\n\nAfter the quick-fix is applied:\n\n\n fun process(x: Int) {}\n\n var x: Int = 0\n set(value) = process(value)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IfThenToElvis", + "shortDescription": { + "text": "If-Then foldable to '?:'" + }, + "fullDescription": { + "text": "Reports 'if-then' expressions that can be folded into elvis ('?:') expressions. Example: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo' The quick fix converts the 'if-then' expression into an elvis ('?:') expression: 'fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"'", + "markdown": "Reports `if-then` expressions that can be folded into elvis (`?:`) expressions.\n\n**Example:**\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = if (foo == null) \"hello\" else foo\n\nThe quick fix converts the `if-then` expression into an elvis (`?:`) expression:\n\n\n fun maybeFoo(): String? = \"foo\"\n\n var foo = maybeFoo()\n val bar = foo ?: \"hello\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "WrapUnaryOperator", + "shortDescription": { + "text": "Ambiguous unary operator use with number constant" + }, + "fullDescription": { + "text": "Reports an unary operator followed by a dot qualifier such as '-1.inc()'. Code like '-1.inc()' can be misleading because '-' has a lower precedence than '.inc()'. As a result, '-1.inc()' evaluates to '-2' and not '0' as it might be expected. Wrap unary operator and value with () quick-fix can be used to amend the code automatically.", + "markdown": "Reports an unary operator followed by a dot qualifier such as `-1.inc()`.\n\nCode like `-1.inc()` can be misleading because `-` has a lower precedence than `.inc()`.\nAs a result, `-1.inc()` evaluates to `-2` and not `0` as it might be expected.\n\n**Wrap unary operator and value with ()** quick-fix can be used to amend the code automatically." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConflictingExtensionProperty", + "shortDescription": { + "text": "Extension property conflicting with synthetic one" + }, + "fullDescription": { + "text": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java 'get' or 'set' methods. Such properties should be either removed or renamed to avoid breaking code by future changes in the compiler. A quick-fix deletes an extention property. Example: 'val File.name: String\n get() = getName()' A quick-fix adds the '@Deprecated' annotation: '@Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()'", + "markdown": "Reports extension properties that conflict with synthetic ones that have been automatically produced from Java `get` or `set` methods.\n\nSuch properties should be either removed or renamed to avoid breaking code by future changes in the compiler.\n\nA quick-fix deletes an extention property.\n\n**Example:**\n\n\n val File.name: String\n get() = getName()\n\nA quick-fix adds the `@Deprecated` annotation:\n\n\n @Deprecated(\"Is replaced with automatic synthetic extension\", ReplaceWith(\"name\"), level = DeprecationLevel.HIDDEN)\n val File.name: String\n get() = getName()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceJavaStaticMethodWithKotlinAnalog", + "shortDescription": { + "text": "Java methods should be replaced with Kotlin analog" + }, + "fullDescription": { + "text": "Reports a Java method call that can be replaced with a Kotlin function, for example, 'System.out.println()'. Replacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code. The quick-fix replaces the Java method calls on the same Kotlin call. Example: 'import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }' After the quick-fix is applied: 'fun main() {\n val a = listOf(1, 3, null)\n }'", + "markdown": "Reports a Java method call that can be replaced with a Kotlin function, for example, `System.out.println()`.\n\nReplacing the code gets rid of the dependency to Java and makes the idiomatic Kotlin code.\n\nThe quick-fix replaces the Java method calls on the same Kotlin call.\n\n**Example:**\n\n\n import java.util.Arrays\n\n fun main() {\n val a = Arrays.asList(1, 3, null)\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n val a = listOf(1, 3, null)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyParenthesesFromLambdaCall", + "shortDescription": { + "text": "Remove unnecessary parentheses from function call with lambda" + }, + "fullDescription": { + "text": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses. Use the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code. Examples: 'fun foo() {\n listOf(1).forEach() { }\n }' After the quick-fix is applied: 'fun foo() {\n listOf(1).forEach { }\n }'", + "markdown": "Reports redundant empty parentheses of function calls where the only parameter is a lambda that's outside the parentheses.\n\nUse the 'Remove unnecessary parentheses from function call with lambda' quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo() {\n listOf(1).forEach() { }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo() {\n listOf(1).forEach { }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveExplicitSuperQualifier", + "shortDescription": { + "text": "Unnecessary supertype qualification" + }, + "fullDescription": { + "text": "Reports 'super' member calls with redundant supertype qualification. Code in a derived class can call its superclass functions and property accessors implementations using the 'super' keyword. To specify the supertype from which the inherited implementation is taken, 'super' can be qualified by the supertype name in angle brackets, e.g. 'super'. Sometimes this qualification is redundant and can be omitted. Use the 'Remove explicit supertype qualification' quick-fix to clean up the code. Examples: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }' After the quick-fix is applied: 'open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }'", + "markdown": "Reports `super` member calls with redundant supertype qualification.\n\n\nCode in a derived class can call its superclass functions and property accessors implementations using the `super` keyword.\nTo specify the supertype from which the inherited implementation is taken, `super` can be qualified by the supertype name in\nangle brackets, e.g. `super`. Sometimes this qualification is redundant and can be omitted.\nUse the 'Remove explicit supertype qualification' quick-fix to clean up the code.\n\n**Examples:**\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== redundant because 'B' is the only supertype\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo() // <== here qualifier is needed to distinguish 'B.foo()' from 'I.foo()'\n }\n }\n\nAfter the quick-fix is applied:\n\n\n open class B {\n open fun foo(){}\n }\n\n class A : B() {\n override fun foo() {\n super.foo() // <== Updated\n }\n }\n\n interface I {\n fun foo() {}\n }\n\n class C : B(), I {\n override fun foo() {\n super.foo()\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantExplicitType", + "shortDescription": { + "text": "Obvious explicit type" + }, + "fullDescription": { + "text": "Reports local variables' explicitly given types which are obvious and thus redundant, like 'val f: Foo = Foo()'. Example: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }' After the quick-fix is applied: 'class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }'", + "markdown": "Reports local variables' explicitly given types which are obvious and thus redundant, like `val f: Foo = Foo()`.\n\n**Example:**\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t: Boolean = true\n val p: Point = Point(1, 2)\n val i: Int = 42\n }\n\nAfter the quick-fix is applied:\n\n\n class Point(val x: Int, val y: Int)\n\n fun foo() {\n val t = true\n val p = Point(1, 2)\n val i = 42\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousVarProperty", + "shortDescription": { + "text": "Suspicious 'var' property: its setter does not influence its getter result" + }, + "fullDescription": { + "text": "Reports 'var' properties with default setter and getter that do not reference backing field. Such properties do not affect calling its setter; therefore, it will be clearer to change such property to 'val' and delete the initializer. Change to val and delete initializer quick-fix can be used to amend the code automatically. Example: '// This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1'", + "markdown": "Reports `var` properties with default setter and getter that do not reference backing field.\n\n\nSuch properties do not affect calling its setter; therefore, it will be clearer to change such property to `val` and delete the initializer.\n\n**Change to val and delete initializer** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n // This property always returns '1' and it doesn't important that the property is a 'var'\n var foo: Int = 0\n get() = 1\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaCollectionsStaticMethod", + "shortDescription": { + "text": "Java Collections static method call can be replaced with Kotlin stdlib" + }, + "fullDescription": { + "text": "Reports a Java 'Collections' static method call that can be replaced with Kotlin stdlib. Example: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }' The quick fix replaces Java 'Collections' static method call with the corresponding Kotlin stdlib method call: 'import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }'", + "markdown": "Reports a Java `Collections` static method call that can be replaced with Kotlin stdlib.\n\n**Example:**\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n Collections.fill(mutableList, 3)\n }\n\nThe quick fix replaces Java `Collections` static method call with the corresponding Kotlin stdlib method call:\n\n\n import java.util.Collections\n\n fun test() {\n val mutableList = mutableListOf(1, 2)\n mutableList.fill(3)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantAsync", + "shortDescription": { + "text": "Redundant 'async' call" + }, + "fullDescription": { + "text": "Reports 'async' calls that are immediately followed by 'await'. Such calls can be replaced with blocking calls. Example: 'suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n scope.async(ctx) { doSomeJob() }.await()\n }' After the quick-fix is applied: 'suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n withContext(scope.coroutineContext + ctx) { doSomeJob() }\n }'", + "markdown": "Reports `async` calls that are immediately followed by `await`.\nSuch calls can be replaced with blocking calls.\n\n**Example:**\n\n\n suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n scope.async(ctx) { doSomeJob() }.await()\n }\n\nAfter the quick-fix is applied:\n\n\n suspend fun test(ctx: CoroutineContext, scope: CoroutineScope) {\n withContext(scope.coroutineContext + ctx) { doSomeJob() }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MoveVariableDeclarationIntoWhen", + "shortDescription": { + "text": "Variable declaration could be moved inside `when`" + }, + "fullDescription": { + "text": "Reports variable declarations that can be moved inside a 'when' expression. Example: 'fun someCalc(x: Int) = x * 42\n\nfun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}' After the quick-fix is applied: 'fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n}'", + "markdown": "Reports variable declarations that can be moved inside a `when` expression.\n\n**Example:**\n\n\n fun someCalc(x: Int) = x * 42\n\n fun foo(x: Int): Int {\n val a = someCalc(x)\n return when (a) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(x: Int): Int {\n return when (val a = someCalc(x)) {\n 1 -> a\n 2 -> 2 * a\n else -> 24\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeferredIsResult", + "shortDescription": { + "text": "Function returning Deferred directly" + }, + "fullDescription": { + "text": "Reports functions with the 'kotlinx.coroutines.Deferred' return type. Functions that use 'Deferred' as return type should have a name with the 'Async' suffix. Otherwise, it's recommended to mark a function as 'suspend' and unwrap 'Deferred' inside it. Example: 'fun calcEverything(): Deferred {\n return CompletableDeferred(42)\n }' After the quick-fix that adds the 'Async' suffix applied: 'fun calcEverythingAsync(): Deferred {\n return CompletableDeferred(42)\n }' After the quick-fix that converts the function into a 'suspend' one applied: 'suspend fun calcEverything(): Int {\n return CompletableDeferred(42).await()\n }'", + "markdown": "Reports functions with the `kotlinx.coroutines.Deferred` return type.\n\n\nFunctions that use `Deferred` as return type should have a name with the `Async` suffix.\nOtherwise, it's recommended to mark a function as `suspend` and unwrap `Deferred` inside it.\n\n**Example:**\n\n\n fun calcEverything(): Deferred {\n return CompletableDeferred(42)\n }\n\nAfter the quick-fix that adds the `Async` suffix applied:\n\n\n fun calcEverythingAsync(): Deferred {\n return CompletableDeferred(42)\n }\n\nAfter the quick-fix that converts the function into a `suspend` one applied:\n\n\n suspend fun calcEverything(): Int {\n return CompletableDeferred(42).await()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyParenthesesFromAnnotationEntry", + "shortDescription": { + "text": "Remove unnecessary parentheses" + }, + "fullDescription": { + "text": "Reports redundant empty parentheses in annotation entries. Use the 'Remove unnecessary parentheses' quick-fix to clean up the code. Examples: 'annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }'", + "markdown": "Reports redundant empty parentheses in annotation entries.\n\nUse the 'Remove unnecessary parentheses' quick-fix to clean up the code.\n\n**Examples:**\n\n\n annotation class MyAnnotationA\n annotation class MyAnnotationB(val x: Int)\n annotation class MyAnnotationC(val x: Int = 10) // default value is present\n\n @MyAnnotationA() // <== parentheses are redundant\n fun testA() {\n }\n\n @MyAnnotationB() // <== missing argument, parentheses are required\n fun testB() {\n }\n\n @MyAnnotationC() // <== parentheses are redundant\n fun testC() {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifiableCallChain", + "shortDescription": { + "text": "Call chain on collection type can be simplified" + }, + "fullDescription": { + "text": "Reports two-call chains replaceable by a single call. It can help you to avoid redundant code execution. The quick-fix replaces the call chain with a single call. Example: 'fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }' After the quick-fix is applied: 'fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }'", + "markdown": "Reports two-call chains replaceable by a single call.\n\nIt can help you to avoid redundant code execution.\n\nThe quick-fix replaces the call chain with a single call.\n\n**Example:**\n\n\n fun main() {\n listOf(1, 2, 3).filter { it > 1 }.count()\n }\n\nAfter the quick-fix is applied:\n\n\n fun main() {\n listOf(1, 2, 3).count { it > 1 }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceCallWithBinaryOperator", + "shortDescription": { + "text": "Can be replaced with binary operator" + }, + "fullDescription": { + "text": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones. Example: 'fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }' After the quick-fix is applied: 'fun test(): Boolean {\n return 2 > 1\n }'", + "markdown": "Reports function calls that can be replaced with binary operators, in particular comparison-related ones.\n\n**Example:**\n\n fun test(): Boolean {\n return 2.compareTo(1) > 0 // replaceable 'compareTo()'\n }\n\nAfter the quick-fix is applied:\n\n fun test(): Boolean {\n return 2 > 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedUnaryOperator", + "shortDescription": { + "text": "Unused unary operator" + }, + "fullDescription": { + "text": "Reports unary operators for number types on unused expressions. Unary operators break previous expression if they are used without braces. As a result, mathematical expressions spanning multi lines can be misleading. Example: 'fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }'", + "markdown": "Reports unary operators for number types on unused expressions.\n\nUnary operators break previous expression if they are used without braces.\nAs a result, mathematical expressions spanning multi lines can be misleading.\n\nExample:\n\n\n fun main() {\n val result = 1 + 2 * 3\n + 3 // <== note that '+ 3' doesn't belong to the 'result' variable, it is unused\n println(\"Result = $result\") // The result is '7' and not '10' as it might be expected\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ClassName", + "shortDescription": { + "text": "Class naming convention" + }, + "fullDescription": { + "text": "Reports class names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, class names should start with an uppercase letter and use camel case. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'class user(val name: String)' A quick-fix renames the class according to the Kotlin naming conventions: 'class User(val name: String)'", + "markdown": "Reports class names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nclass names should start with an uppercase letter and use camel case.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n class user(val name: String)\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n class User(val name: String)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyPrimaryConstructor", + "shortDescription": { + "text": "Redundant empty primary constructor" + }, + "fullDescription": { + "text": "Reports empty primary constructors when they are implicitly available anyway. A primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers. Use the 'Remove empty primary constructor' quick-fix to clean up the code. Examples: 'class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier'", + "markdown": "Reports empty primary constructors when they are implicitly available anyway.\n\n\nA primary constructor is redundant and can be safely omitted when it does not have any annotations or visibility modifiers.\nUse the 'Remove empty primary constructor' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class MyClassA constructor() // redundant, can be replaced with 'class MyClassA'\n\n annotation class MyAnnotation\n class MyClassB @MyAnnotation constructor() // required because of annotation\n\n class MyClassC private constructor() // required because of visibility modifier\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptySecondaryConstructorBody", + "shortDescription": { + "text": "Redundant constructor body" + }, + "fullDescription": { + "text": "Reports empty bodies of secondary constructors.", + "markdown": "Reports empty bodies of secondary constructors." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FloatingPointLiteralPrecision", + "shortDescription": { + "text": "Floating-point literal exceeds the available precision" + }, + "fullDescription": { + "text": "Reports floating-point literals that cannot be represented with the required precision using IEEE 754 'Float' and 'Double' types. For example, '1.9999999999999999999' has too many significant digits, so its representation as a 'Double' will be rounded to '2.0'. Specifying excess digits may be misleading as it hides the fact that computations use rounded values instead. The quick-fix replaces the literal with a rounded value that matches the actual representation of the constant. Example: 'val x: Float = 3.14159265359f' After the quick-fix is applied: 'val x: Float = 3.1415927f'", + "markdown": "Reports floating-point literals that cannot be represented with the required precision using [IEEE 754](https://en.wikipedia.org/wiki/IEEE_754) `Float` and `Double` types.\n\n\nFor example, `1.9999999999999999999` has too many significant digits,\nso its representation as a `Double` will be rounded to `2.0`.\nSpecifying excess digits may be misleading as it hides the fact that computations\nuse rounded values instead.\n\n\nThe quick-fix replaces the literal with a rounded value that matches the actual representation\nof the constant.\n\n**Example:**\n\n\n val x: Float = 3.14159265359f\n\nAfter the quick-fix is applied:\n\n\n val x: Float = 3.1415927f\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertPairConstructorToToFunction", + "shortDescription": { + "text": "Convert Pair constructor to 'to' function" + }, + "fullDescription": { + "text": "Reports a 'Pair' constructor invocation that can be replaced with a 'to()' infix function call. Explicit constructor invocations may add verbosity, especially if they are used multiple times. Replacing constructor calls with 'to()' makes code easier to read and maintain. Example: 'val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )' After the quick-fix is applied: 'val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )'", + "markdown": "Reports a `Pair` constructor invocation that can be replaced with a `to()` infix function call.\n\n\nExplicit constructor invocations may add verbosity, especially if they are used multiple times.\nReplacing constructor calls with `to()` makes code easier to read and maintain.\n\n**Example:**\n\n\n val countries = mapOf(\n Pair(\"France\", \"Paris\"),\n Pair(\"Spain\", \"Madrid\"),\n Pair(\"Germany\", \"Berlin\")\n )\n\nAfter the quick-fix is applied:\n\n\n val countries = mapOf(\n \"France\" to \"Paris\",\n \"Spain\" to \"Madrid\",\n \"Germany\" to \"Berlin\"\n )\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantGetter", + "shortDescription": { + "text": "Redundant property getter" + }, + "fullDescription": { + "text": "Reports redundant property getters. Example: 'class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }' After the quick-fix is applied: 'class Test {\n val a = 1\n val b = 1\n }'", + "markdown": "Reports redundant property getters.\n\n**Example:**\n\n\n class Test {\n val a = 1\n get\n val b = 1\n get() = field\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n val a = 1\n val b = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantIf", + "shortDescription": { + "text": "Redundant 'if' statement" + }, + "fullDescription": { + "text": "Reports 'if' statements which can be simplified to a single statement. Example: 'fun test() {\n if (foo()) {\n return true\n } else {\n return false\n }\n }' After the quick-fix is applied: 'fun test() {\n return foo()\n }'", + "markdown": "Reports `if` statements which can be simplified to a single statement.\n\n**Example:**\n\n\n fun test() {\n if (foo()) {\n return true\n } else {\n return false\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n return foo()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KDocMissingDocumentation", + "shortDescription": { + "text": "Missing KDoc comments for public declarations" + }, + "fullDescription": { + "text": "Reports public declarations that do not have KDoc comments. Example: 'class A' The quick fix generates the comment block above the declaration: '/**\n *\n */\n class A'", + "markdown": "Reports public declarations that do not have KDoc comments.\n\n**Example:**\n\n\n class A\n\nThe quick fix generates the comment block above the declaration:\n\n\n /**\n *\n */\n class A\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveExplicitTypeArguments", + "shortDescription": { + "text": "Unnecessary type argument" + }, + "fullDescription": { + "text": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted. Use the 'Remove explicit type arguments' quick-fix to clean up the code. Examples: '// 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()' After the quick-fix is applied: 'fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()'", + "markdown": "Reports function calls with type arguments that can be automatically inferred. Such type arguments are redundant and can be safely omitted.\n\nUse the 'Remove explicit type arguments' quick-fix to clean up the code.\n\n**Examples:**\n\n\n // 'String' type can be inferred here\n fun foo(): MutableList = mutableListOf()\n\n // Here 'String' cannot be inferred, type argument is required.\n fun bar() = mutableListOf()\n\nAfter the quick-fix is applied:\n\n\n fun foo(): MutableList = mutableListOf() <== Updated\n\n fun bar() = mutableListOf()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantVisibilityModifier", + "shortDescription": { + "text": "Redundant visibility modifier" + }, + "fullDescription": { + "text": "Reports visibility modifiers that match the default visibility of an element ('public' for most elements, 'protected' for members that override a protected member).", + "markdown": "Reports visibility modifiers that match the default visibility of an element (`public` for most elements, `protected` for members that override a protected member)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UsePropertyAccessSyntax", + "shortDescription": { + "text": "Accessor call that can be replaced with property access syntax" + }, + "fullDescription": { + "text": "Reports Java 'get' and 'set' method calls that can be replaced with the Kotlin synthetic properties. Use property access syntax quick-fix can be used to amen the code automatically. Example: '// Java:\n public class JavaClassWithGetter {\n private final String expr = \"result\";\n\n // ...\n\n public String getExpr() {\n return expr;\n }\n }' '// Kotlin:\n fun test(j: JavaClassWithGetter) {\n // ...\n j.getExpr() // <== A quick-fix simplifies the expression to 'j.expr'\n }'", + "markdown": "Reports Java `get` and `set` method calls that can be replaced with the Kotlin synthetic properties.\n\n**Use property access syntax** quick-fix can be used to amen the code automatically.\n\nExample:\n\n\n // Java:\n public class JavaClassWithGetter {\n private final String expr = \"result\";\n\n // ...\n\n public String getExpr() {\n return expr;\n }\n }\n\n\n // Kotlin:\n fun test(j: JavaClassWithGetter) {\n // ...\n j.getExpr() // <== A quick-fix simplifies the expression to 'j.expr'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UseExpressionBody", + "shortDescription": { + "text": "Expression body syntax is preferable here" + }, + "fullDescription": { + "text": "Reports 'return' expressions (one-liners or 'when') that can be replaced with expression body syntax. Expression body syntax is recommended by the style guide. Convert to expression body quick-fix can be used to amend the code automatically. Example: 'fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }' After the quick-fix is applied: 'fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }'", + "markdown": "Reports `return` expressions (one-liners or `when`) that can be replaced with expression body syntax.\n\nExpression body syntax is recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#functions).\n\n**Convert to expression body** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun sign(x: Int): Int {\n return when { // <== can be simplified\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun sign(x: Int): Int = when {\n x < 0 -> -1\n x > 0 -> 1\n else -> 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MapGetWithNotNullAssertionOperator", + "shortDescription": { + "text": "'map.get()' with not-null assertion operator (!!)" + }, + "fullDescription": { + "text": "Reports 'map.get()!!' that can be replaced with 'map.getValue()', 'map.getOrElse()', and so on. Example: 'fun test(map: Map): String = map.get(0)!!' After the quick-fix is applied: 'fun test(map: Map): String = map.getValue(0)'", + "markdown": "Reports `map.get()!!` that can be replaced with `map.getValue()`, `map.getOrElse()`, and so on.\n\n**Example:**\n\n\n fun test(map: Map): String = map.get(0)!!\n\nAfter the quick-fix is applied:\n\n\n fun test(map: Map): String = map.getValue(0)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SortModifiers", + "shortDescription": { + "text": "Non-canonical modifier order" + }, + "fullDescription": { + "text": "Reports modifiers that do not follow the order recommended by the style guide. Sort modifiers quick-fix can be used to amend the code automatically. Examples: 'private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"'", + "markdown": "Reports modifiers that do not follow the order recommended by the [style guide](https://kotlinlang.org/docs/coding-conventions.html#modifiers-order).\n\n**Sort modifiers** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n private inline fun correctOrder(f: () -> Unit) {} // <== Ok\n\n infix private fun Int.wrongOrder(expr: Int) {} // <== wrong order, quick-fix amends the modifiers to \"private infix\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EnumEntryName", + "shortDescription": { + "text": "Enum entry naming convention" + }, + "fullDescription": { + "text": "Reports enum entry names that do not follow the recommended naming conventions. Example: 'enum class Foo {\n _Foo,\n foo\n }' To fix the problem rename enum entries to match the recommended naming conventions.", + "markdown": "Reports enum entry names that do not follow the recommended naming conventions.\n\n**Example:**\n\n\n enum class Foo {\n _Foo,\n foo\n }\n\nTo fix the problem rename enum entries to match the recommended naming conventions." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithDropLast", + "shortDescription": { + "text": "'substring' call should be replaced with 'dropLast' call" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, s.length - x)' that can be replaced with 's.dropLast(x)'. Using corresponding functions makes your code simpler. The quick-fix replaces the 'substring' call with 'dropLast'. Example: 'fun foo(s: String) {\n s.substring(0, s.length - 5)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.dropLast(5)\n }'", + "markdown": "Reports calls like `s.substring(0, s.length - x)` that can be replaced with `s.dropLast(x)`.\n\nUsing corresponding functions makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `dropLast`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, s.length - 5)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.dropLast(5)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SetterBackingFieldAssignment", + "shortDescription": { + "text": "Existing backing field without assignment" + }, + "fullDescription": { + "text": "Reports property setters that don't update the backing field. The quick-fix adds an assignment to the backing field. Example: 'class Test {\n var foo: Int = 1\n set(value) {\n }\n }' After the quick-fix is applied: 'class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }'", + "markdown": "Reports property setters that don't update the backing field.\n\nThe quick-fix adds an assignment to the backing field.\n\n**Example:**\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n }\n }\n\nAfter the quick-fix is applied:\n\n\n class Test {\n var foo: Int = 1\n set(value) {\n field = value\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CopyWithoutNamedArguments", + "shortDescription": { + "text": "'copy' method of data class is called without named arguments" + }, + "fullDescription": { + "text": "Reports calls to a data class' 'copy()' method without named arguments. As all arguments of the 'copy()' function are optional, it might be hard to understand what properties are modified. Providing parameter names explicitly makes code easy to understand without navigating to the 'data class' declaration. Example: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }' A quick-fix provides parameter names to all 'copy()' arguments: 'data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }'", + "markdown": "Reports calls to a data class' `copy()` method without named arguments.\n\n\nAs all arguments of the `copy()` function are optional, it might be hard to understand what properties are modified.\nProviding parameter names explicitly makes code easy to understand without navigating to the `data class` declaration.\n\n**Example:**\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(\"John\")\n }\n\nA quick-fix provides parameter names to all `copy()` arguments:\n\n\n data class User(val name: String, val age: Int)\n\n fun copyUser(user: User): User {\n return user.copy(name = \"John\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinDeprecation", + "shortDescription": { + "text": "Usage of redundant or deprecated syntax or deprecated symbols" + }, + "fullDescription": { + "text": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (Code | Code Cleanup). A quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax. It also replaces deprecated symbols with their proposed substitutions.", + "markdown": "Reports obsolete language features and unnecessarily verbose code constructs during the code cleanup operation (**Code \\| Code Cleanup** ).\n\n\nA quick-fix automatically replaces usages of obsolete language features or unnecessarily verbose code constructs with compact and up-to-date syntax.\n\n\nIt also replaces deprecated symbols with their proposed substitutions." + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceSubstringWithTake", + "shortDescription": { + "text": "'substring' call should be replaced with 'take' call" + }, + "fullDescription": { + "text": "Reports calls like 's.substring(0, x)' that can be replaced with 's.take(x)'. Using 'take()' makes your code simpler. The quick-fix replaces the 'substring' call with 'take()'. Example: 'fun foo(s: String) {\n s.substring(0, 10)\n }' After the quick-fix is applied: 'fun foo(s: String) {\n s.take(10)\n }'", + "markdown": "Reports calls like `s.substring(0, x)` that can be replaced with `s.take(x)`.\n\nUsing `take()` makes your code simpler.\n\nThe quick-fix replaces the `substring` call with `take()`.\n\n**Example:**\n\n\n fun foo(s: String) {\n s.substring(0, 10)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(s: String) {\n s.take(10)\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertCallChainIntoSequence", + "shortDescription": { + "text": "Call chain on collection could be converted into 'Sequence' to improve performance" + }, + "fullDescription": { + "text": "Reports call chain on a 'Collection' that should be converted into Sequence. Each 'Collection' transforming function (such as 'map()' or 'filter()') creates a new 'Collection' (typically 'List' or 'Set') under the hood. In case of multiple consequent calls, and a huge number of items in 'Collection', memory traffic might be significant. In such a case, using 'Sequence' is preferred. Example: 'class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }' A quick-fix wraps call chain into 'asSequence()' and 'toList()': 'class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()'", + "markdown": "Reports call chain on a `Collection` that should be converted into **Sequence** .\n\nEach `Collection` transforming function (such as `map()` or `filter()`) creates a new\n`Collection` (typically `List` or `Set`) under the hood.\nIn case of multiple consequent calls, and a huge number of items in `Collection`, memory traffic might be significant.\nIn such a case, using `Sequence` is preferred.\n\n**Example:**\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n\nA quick-fix wraps call chain into `asSequence()` and `toList()`:\n\n\n class Entity(val key: String, val value: String)\n\n fun getValues(lines: List) = lines\n .asSequence()\n .filter { it.isNotEmpty() }\n .map { it.split(',', limit = 2) }\n .filter { it.size == 2 }\n .map { Entity(it[0], it[1]) }\n .toList()\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AddOperatorModifier", + "shortDescription": { + "text": "Function should have 'operator' modifier" + }, + "fullDescription": { + "text": "Reports a function that matches one of the operator conventions but lacks the 'operator' keyword. By adding the 'operator' modifier, you might allow function consumers to write idiomatic Kotlin code. Example: 'class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }' A quick-fix adds the 'operator' modifier keyword: 'class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }'", + "markdown": "Reports a function that matches one of the operator conventions but lacks the `operator` keyword.\n\nBy adding the `operator` modifier, you might allow function consumers to write idiomatic Kotlin code.\n\n**Example:**\n\n\n class Complex(val real: Double, val imaginary: Double) {\n fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a.plus(b)\n }\n\nA quick-fix adds the `operator` modifier keyword:\n\n\n class Complex(val real: Double, val imaginary: Double) {\n operator fun plus(other: Complex) =\n Complex(real + other.real, imaginary + other.imaginary)\n }\n\n fun usage(a: Complex, b: Complex) {\n a + b\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MayBeConstant", + "shortDescription": { + "text": "Might be 'const'" + }, + "fullDescription": { + "text": "Reports top-level 'val' properties in objects that might be declared as 'const' for better performance and Java interoperability. Example: 'object A {\n val foo = 1\n }' After the quick-fix is applied: 'object A {\n const val foo = 1\n }'", + "markdown": "Reports top-level `val` properties in objects that might be declared as `const` for better performance and Java interoperability.\n\n**Example:**\n\n\n object A {\n val foo = 1\n }\n\nAfter the quick-fix is applied:\n\n\n object A {\n const val foo = 1\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceIsEmptyWithIfEmpty", + "shortDescription": { + "text": "'if' condition can be replaced with lambda call" + }, + "fullDescription": { + "text": "Reports 'isEmpty', 'isBlank', 'isNotEmpty', or 'isNotBlank' calls in an 'if' statement to assign a default value. The quick-fix replaces the 'if' condition with 'ifEmpty' or 'ifBlank' calls. Example: 'fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }' After the quick-fix is applied: 'fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }' This inspection only reports if the Kotlin language version of the project or module is 1.3 or higher.", + "markdown": "Reports `isEmpty`, `isBlank`, `isNotEmpty`, or `isNotBlank` calls in an `if` statement to assign a default value.\n\nThe quick-fix replaces the `if` condition with `ifEmpty` or `ifBlank` calls.\n\n**Example:**\n\n\n fun test(list: List): List {\n return if (list.isEmpty()) {\n println()\n foo()\n } else {\n list\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List): List {\n return list.ifEmpty {\n println()\n foo()\n }\n }\n\nThis inspection only reports if the Kotlin language version of the project or module is 1.3 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithImportAlias", + "shortDescription": { + "text": "Fully qualified name can be replaced with existing import alias" + }, + "fullDescription": { + "text": "Reports fully qualified names that can be replaced with an existing import alias. Example: 'import foo.Foo as Bar\nfun main() {\n foo.Foo()\n}' After the quick-fix is applied: 'import foo.Foo as Bar\nfun main() {\n Bar()\n}'", + "markdown": "Reports fully qualified names that can be replaced with an existing import alias.\n\n**Example:**\n\n\n import foo.Foo as Bar\n fun main() {\n foo.Foo()\n }\n\nAfter the quick-fix is applied:\n\n\n import foo.Foo as Bar\n fun main() {\n Bar()\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyBooleanWithConstants", + "shortDescription": { + "text": "Boolean expression can be simplified" + }, + "fullDescription": { + "text": "Reports boolean expression parts that can be reduced to constants. The quick-fix simplifies the condition. Example: 'fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }' After the quick-fix is applied: 'fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }'", + "markdown": "Reports boolean expression parts that can be reduced to constants.\n\nThe quick-fix simplifies the condition.\n\n**Example:**\n\n\n fun use(arg: Boolean) {\n if (false == arg) {\n\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun use(arg: Boolean) {\n if (!arg) {\n\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantModalityModifier", + "shortDescription": { + "text": "Redundant modality modifier" + }, + "fullDescription": { + "text": "Reports the modality modifiers that match the default modality of an element ('final' for most elements, 'open' for members with an 'override'). Example: 'final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }' After the quick-fix is applied: 'class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }'", + "markdown": "Reports the modality modifiers that match the default modality of an element (`final` for most elements, `open` for members with an `override`).\n\n**Example:**\n\n\n final class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }\n\nAfter the quick-fix is applied:\n\n\n class Foo\n\n open class Bar : Comparable {\n open override fun compareTo(other: Bar): Int = 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyAssertNotNull", + "shortDescription": { + "text": "'assert' call can be replaced with '!!' or '?:'" + }, + "fullDescription": { + "text": "Reports 'assert' calls that check a not null value of the declared variable. Using '!!' or '?:' makes your code simpler. The quick-fix replaces 'assert' with '!!' or '?:' operator in the variable initializer. Example: 'fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }' After the quick-fix is applied: 'fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }'", + "markdown": "Reports `assert` calls that check a not null value of the declared variable.\n\nUsing `!!` or `?:` makes your code simpler.\n\nThe quick-fix replaces `assert` with `!!` or `?:` operator in the variable initializer.\n\n**Example:**\n\n\n fun foo(p: Array) {\n val v = p[0]\n assert(v != null, { \"Should be not null\" })\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(p: Array) {\n val v = p[0] ?: error(\"Should be not null\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertNaNEquality", + "shortDescription": { + "text": "Convert equality check with 'NaN' to 'isNaN' call" + }, + "fullDescription": { + "text": "Reports an equality check with 'Float.NaN' or 'Double.NaN' that should be replaced with an 'isNaN()' check. According to IEEE 754, equality check against NaN always returns 'false', even for 'NaN == NaN'. Therefore, such a check is likely to be a mistake. A quick-fix replaces comparison with 'isNaN()' check that uses a different comparison technique and handles 'NaN' values correctly. Example: 'fun check(value: Double): Boolean {\n return Double.NaN == value\n }' After the fix is applied: 'fun check(value: Double): Boolean {\n return value.isNaN()\n }'", + "markdown": "Reports an equality check with `Float.NaN` or `Double.NaN` that should be replaced with an `isNaN()` check.\n\n\nAccording to IEEE 754, equality check against NaN always returns `false`, even for `NaN == NaN`.\nTherefore, such a check is likely to be a mistake.\n\nA quick-fix replaces comparison with `isNaN()` check that uses a different comparison technique and handles `NaN` values correctly.\n\n**Example:**\n\n\n fun check(value: Double): Boolean {\n return Double.NaN == value\n }\n\nAfter the fix is applied:\n\n\n fun check(value: Double): Boolean {\n return value.isNaN()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceManualRangeWithIndicesCalls", + "shortDescription": { + "text": "Range can be converted to indices or iteration" + }, + "fullDescription": { + "text": "Reports 'until' and 'rangeTo' operators that can be replaced with 'Collection.indices' or iteration over collection inside 'for' loop. Using syntactic sugar makes your code simpler. The quick-fix replaces the manual range with the corresponding construction. Example: 'fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }' After the quick-fix is applied: 'fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }'", + "markdown": "Reports `until` and `rangeTo` operators that can be replaced with `Collection.indices` or iteration over collection inside `for` loop.\n\nUsing syntactic sugar makes your code simpler.\n\nThe quick-fix replaces the manual range with the corresponding construction.\n\n**Example:**\n\n\n fun main(args: Array) {\n for (index in 0..args.size - 1) {\n println(args[index])\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun main(args: Array) {\n for (element in args) {\n println(element)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinLoggerInitializedWithForeignClass", + "shortDescription": { + "text": "Logger initialized with foreign class" + }, + "fullDescription": { + "text": "Reports 'Logger' instances initialized with a class literal other than the class the 'Logger' resides in. This can happen when copy-pasting from another class. It may result in logging events under an unexpected category and incorrect filtering. Use the inspection options to specify the logger factory classes and methods recognized by this inspection. Example: 'class AnotherService\nclass MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n}' After the quick-fix is applied: 'class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n}'", + "markdown": "Reports `Logger` instances initialized with a class literal other than the class the `Logger` resides in.\n\n\nThis can happen when copy-pasting from another class.\nIt may result in logging events under an unexpected category and incorrect filtering.\n\n\nUse the inspection options to specify the logger factory classes and methods recognized by this inspection.\n\n**Example:**\n\n\n class AnotherService\n class MyService {\n private val logger = LoggerFactory.getLogger(AnotherService::class.java)\n }\n\nAfter the quick-fix is applied:\n\n\n class MyService {\n private val logger = LoggerFactory.getLogger(MyService::class.java)\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Logging", + "index": 158, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantAsSequence", + "shortDescription": { + "text": "Redundant 'asSequence' call" + }, + "fullDescription": { + "text": "Reports redundant 'asSequence()' call that can never have a positive performance effect. 'asSequence()' speeds up collection processing that includes multiple operations because it performs operations lazily and doesn't create intermediate collections. However, if a terminal operation (such as 'toList()') is used right after 'asSequence()', this doesn't give you any positive performance effect. Example: 'fun test(list: List) {\n list.asSequence().last()\n }' After the quick-fix is applied: 'fun test(list: List) {\n list.last()\n }'", + "markdown": "Reports redundant `asSequence()` call that can never have a positive performance effect.\n\n\n`asSequence()` speeds up collection processing that includes multiple operations because it performs operations lazily\nand doesn't create intermediate collections.\n\n\nHowever, if a terminal operation (such as `toList()`) is used right after `asSequence()`, this doesn't give\nyou any positive performance effect.\n\n**Example:**\n\n\n fun test(list: List) {\n list.asSequence().last()\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n list.last()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveToStringInStringTemplate", + "shortDescription": { + "text": "Redundant call to 'toString()' in string template" + }, + "fullDescription": { + "text": "Reports calls to 'toString()' in string templates that can be safely removed. Example: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }'", + "markdown": "Reports calls to `toString()` in string templates that can be safely removed.\n\n**Example:**\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4).toString()}\" // 'toString()' is redundant\n }\n\nAfter the quick-fix is applied:\n\n fun foo(a: Int, b: Int) = a + b\n\n fun test(): String {\n return \"Foo: ${foo(0, 4)}\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinUnusedImport", + "shortDescription": { + "text": "Unused import directive" + }, + "fullDescription": { + "text": "Reports redundant 'import' statements. Default and unused imports can be safely removed. Example: 'import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }'", + "markdown": "Reports redundant `import` statements.\n\nDefault and unused imports can be safely removed.\n\n**Example:**\n\n\n import kotlin.*\n import kotlin.collections.*\n import kotlin.comparisons.*\n import kotlin.io.*\n import kotlin.ranges.*\n import kotlin.sequences.*\n import kotlin.text.*\n\n // jvm specific\n import java.lang.*\n import kotlin.jvm.*\n\n // js specific\n import kotlin.js.*\n\n import java.io.* // this import is unused and could be removed\n import java.util.*\n\n fun foo(list: ArrayList) {\n list.add(\"\")\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBePrimaryConstructorProperty", + "shortDescription": { + "text": "Property is explicitly assigned to constructor parameter" + }, + "fullDescription": { + "text": "Reports properties that are explicitly assigned to primary constructor parameters. Properties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability. Example: 'class User(name: String) {\n val name = name\n }' A quick-fix joins the parameter and property declaration into a primary constructor parameter: 'class User(val name: String) {\n }'", + "markdown": "Reports properties that are explicitly assigned to primary constructor parameters.\n\nProperties can be declared directly in the primary constructor, reducing the amount of code and increasing code readability.\n\n**Example:**\n\n\n class User(name: String) {\n val name = name\n }\n\nA quick-fix joins the parameter and property declaration into a primary constructor parameter:\n\n\n class User(val name: String) {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "JavaMapForEach", + "shortDescription": { + "text": "Java Map.forEach method call should be replaced with Kotlin's forEach" + }, + "fullDescription": { + "text": "Reports a Java Map.'forEach' method call that can be replaced with Kotlin's forEach. Example: 'fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}' The quick fix removes parentheses: 'fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}'", + "markdown": "Reports a Java Map.`forEach` method call that can be replaced with Kotlin's **forEach** .\n\n**Example:**\n\n\n fun test(map: HashMap) {\n map.forEach { (key, value) ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n\nThe quick fix removes parentheses:\n\n\n fun test(map: HashMap) {\n map.forEach { key, value ->\n foo(key, value)\n }\n }\n\n fun foo(i: Int, s: String) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantObjectTypeCheck", + "shortDescription": { + "text": "Non-idiomatic 'is' type check for an object" + }, + "fullDescription": { + "text": "Reports non-idiomatic 'is' type checks for an object. It's recommended to replace such checks with reference comparison. Example: 'object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }' After the quick-fix is applied: 'object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }'", + "markdown": "Reports non-idiomatic `is` type checks for an object.\n\nIt's recommended to replace such checks with reference comparison.\n\n**Example:**\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg is Foo -> ...\n arg !is Foo -> ...\n }\n\nAfter the quick-fix is applied:\n\n\n object Foo\n\n fun foo(arg: Any) = when {\n arg === Foo -> ...\n arg !== Foo -> ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspendFunctionOnCoroutineScope", + "shortDescription": { + "text": "Ambiguous coroutineContext due to CoroutineScope receiver of suspend function" + }, + "fullDescription": { + "text": "Reports calls and accesses of 'CoroutineScope' extensions or members inside suspend functions with 'CoroutineScope' receiver. When a function is 'suspend' and has 'CoroutineScope' receiver, it has ambiguous access to 'CoroutineContext' via 'kotlin.coroutines.coroutineContext' and via 'CoroutineScope.coroutineContext', and two these contexts are different in general. To improve this situation, one can wrap suspicious call inside 'coroutineScope { ... }' or get rid of 'CoroutineScope' function receiver.", + "markdown": "Reports calls and accesses of `CoroutineScope` extensions or members inside suspend functions with `CoroutineScope` receiver.\n\nWhen a function is `suspend` and has `CoroutineScope` receiver,\nit has ambiguous access to `CoroutineContext` via `kotlin.coroutines.coroutineContext` and via `CoroutineScope.coroutineContext`,\nand two these contexts are different in general.\n\n\nTo improve this situation, one can wrap suspicious call inside `coroutineScope { ... }` or\nget rid of `CoroutineScope` function receiver." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DifferentMavenStdlibVersion", + "shortDescription": { + "text": "Library and maven plugin versions are different" + }, + "fullDescription": { + "text": "Reports different Kotlin stdlib and compiler versions. Using different versions of the Kotlin compiler and the standard library can lead to unpredictable runtime problems and should be avoided.", + "markdown": "Reports different Kotlin stdlib and compiler versions.\n\nUsing different versions of the Kotlin compiler and the standard library can lead to unpredictable\nruntime problems and should be avoided." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin", + "index": 2, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ImplicitNullableNothingType", + "shortDescription": { + "text": "Implicit `Nothing?` type" + }, + "fullDescription": { + "text": "Reports variables and functions with the implicit Nothing? type. Example: 'fun foo() = null' The quick fix specifies the return type explicitly: 'fun foo(): Nothing? = null'", + "markdown": "Reports variables and functions with the implicit **Nothing?** type.\n\n**Example:**\n\n\n fun foo() = null\n\nThe quick fix specifies the return type explicitly:\n\n\n fun foo(): Nothing? = null\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceAssociateFunction", + "shortDescription": { + "text": "'associate' can be replaced with 'associateBy' or 'associateWith'" + }, + "fullDescription": { + "text": "Reports calls to 'associate()' and 'associateTo()' that can be replaced with 'associateBy()' or 'associateWith()'. Both functions accept a transformer function applied to elements of a given sequence or collection (as a receiver). The pairs are then used to build the resulting 'Map'. Given the transformer refers to 'it', the 'associate[To]()' call can be replaced with more performant 'associateBy()' or 'associateWith()'. Examples: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }' After the quick-fix is applied: 'fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }'", + "markdown": "Reports calls to `associate()` and `associateTo()` that can be replaced with `associateBy()` or `associateWith()`.\n\n\nBoth functions accept a transformer function applied to elements of a given sequence or collection (as a receiver).\nThe pairs are then used to build the resulting `Map`.\n\n\nGiven the transformer refers to `it`, the `associate[To]()` call can be replaced with more performant `associateBy()`\nor `associateWith()`.\n\n**Examples:**\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associate { getKey(it) to it } // replaceable 'associate()'\n listOf(1).associate { it to getValue(it) } // replaceable 'associate()'\n }\n\nAfter the quick-fix is applied:\n\n fun getKey(i: Int) = 1L\n fun getValue(i: Int) = 1L\n\n fun test() {\n arrayOf(1).associateBy { getKey(it) }\n listOf(1).associateWith { getValue(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObsoleteExperimentalCoroutines", + "shortDescription": { + "text": "Experimental coroutines usages are deprecated since 1.3" + }, + "fullDescription": { + "text": "Reports code that uses experimental coroutines. Such usages are incompatible with Kotlin 1.3+ and should be updated.", + "markdown": "Reports code that uses experimental coroutines.\n\nSuch usages are incompatible with Kotlin 1.3+ and should be updated." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LiftReturnOrAssignment", + "shortDescription": { + "text": "Return or assignment can be lifted out" + }, + "fullDescription": { + "text": "Reports 'if', 'when', and 'try' statements that can be converted to expressions by lifting the 'return' statement or an assignment out. Example: 'fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }' After the quick-fix is applied: 'fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }'", + "markdown": "Reports `if`, `when`, and `try` statements that can be converted to expressions by lifting the `return` statement or an assignment out.\n\n**Example:**\n\n\n fun foo(arg: Int): String {\n when (arg) {\n 0 -> return \"Zero\"\n 1 -> return \"One\"\n else -> return \"Multiple\"\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(arg: Int): String {\n return when (arg) {\n 0 -> \"Zero\"\n 1 -> \"One\"\n else -> \"Multiple\"\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyWhenWithBooleanConstantCondition", + "shortDescription": { + "text": "Simplifiable 'when'" + }, + "fullDescription": { + "text": "Reports 'when' expressions with the constant 'true' or 'false' branches. Simplify \"when\" quick-fix can be used to amend the code automatically. Examples: 'fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }'", + "markdown": "Reports `when` expressions with the constant `true` or `false` branches.\n\n**Simplify \"when\"** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun redundant() {\n when { // <== redundant, quick-fix simplifies the when expression to \"println(\"true\")\"\n true -> println(\"true\")\n else -> println(\"false\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinConstantConditions", + "shortDescription": { + "text": "Constant conditions" + }, + "fullDescription": { + "text": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable 'when' branches and some expressions that are statically known to fail always. Examples: 'fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n}\nfun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n}' New in 2021.3", + "markdown": "Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable `when` branches and some expressions that are statically known to fail always.\n\nExamples:\n\n\n fun process(x: Int?) {\n val isNull = x == null\n if (!isNull) {\n if (x != null) {} // condition is always true\n require(x!! < 0 && x > 10) // condition is always false\n } else {\n println(x!!) // !! operator will always fail\n }\n }\n fun process(v: Any) {\n when(v) {\n is CharSequence -> println(v as Int) // cast will always fail\n is String -> println(v) // branch is unreachable\n }\n }\n\nNew in 2021.3" + }, + "defaultConfiguration": { + "enabled": false, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ForEachParameterNotUsed", + "shortDescription": { + "text": "Iterated elements are not used in forEach" + }, + "fullDescription": { + "text": "Reports 'forEach' loops that do not use iterable values. Example: 'listOf(1, 2, 3).forEach { }' The quick fix introduces anonymous parameter in the 'forEach' section: 'listOf(1, 2, 3).forEach { _ -> }'", + "markdown": "Reports `forEach` loops that do not use iterable values.\n\n**Example:**\n\n\n listOf(1, 2, 3).forEach { }\n\nThe quick fix introduces anonymous parameter in the `forEach` section:\n\n\n listOf(1, 2, 3).forEach { _ -> }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LeakingThis", + "shortDescription": { + "text": "Leaking 'this' in constructor" + }, + "fullDescription": { + "text": "Reports unsafe operations with 'this' during object construction including: Accessing a non-final property during class initialization: from a constructor or property initialization Calling a non-final function during class initialization Using 'this' as a function argument in a constructor of a non-final class If other classes inherit from the given class, they may not be fully initialized at the moment when an unsafe operation is carried out. Example: 'abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }'", + "markdown": "Reports unsafe operations with `this` during object construction including:\n\n* Accessing a non-final property during class initialization: from a constructor or property initialization\n* Calling a non-final function during class initialization\n* Using `this` as a function argument in a constructor of a non-final class\n\n\nIf other classes inherit from the given class,\nthey may not be fully initialized at the moment when an unsafe operation is carried out.\n\n**Example:**\n\n\n abstract class Base {\n val code = calculate()\n abstract fun calculate(): Int\n }\n\n class Derived(private val x: Int) : Base() {\n override fun calculate() = x\n }\n\n fun testIt() {\n println(Derived(42).code) // Expected: 42, actual: 0\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "AddVarianceModifier", + "shortDescription": { + "text": "Type parameter can have 'in' or 'out' variance" + }, + "fullDescription": { + "text": "Reports type parameters that can have 'in' or 'out' variance. Using 'in' and 'out' variance provides more precise type inference in Kotlin and clearer code semantics. Example: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }' A quick-fix adds the matching variance modifier: 'class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }'", + "markdown": "Reports type parameters that can have `in` or `out` variance.\n\nUsing `in` and `out` variance provides more precise type inference in Kotlin and clearer code semantics.\n\n**Example:**\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) {\n consumeString(box)\n consumeCharSequence(box) // Compilation error\n }\n\nA quick-fix adds the matching variance modifier:\n\n\n class Box(val obj: T)\n\n fun consumeString(box: Box) {}\n fun consumeCharSequence(box: Box) {}\n\n fun usage(box: Box) ++{\n consumeString(box)\n consumeCharSequence(box) // OK\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveForLoopIndices", + "shortDescription": { + "text": "Unused loop index" + }, + "fullDescription": { + "text": "Reports 'for' loops iterating over a collection using the 'withIndex()' function and not using the index variable. Use the \"Remove indices in 'for' loop\" quick-fix to clean up the code. Examples: 'fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }' After the quick-fix is applied: 'fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }'", + "markdown": "Reports `for` loops iterating over a collection using the `withIndex()` function and not using the index variable.\n\nUse the \"Remove indices in 'for' loop\" quick-fix to clean up the code.\n\n**Examples:**\n\n\n fun foo(bar: List) {\n for ((index : Int, value: String) in bar.withIndex()) { // <== 'index' is unused\n println(value)\n }\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(bar: List) {\n for (value: String in bar) { // <== '.withIndex()' and 'index' are removed\n println(value)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantSuspendModifier", + "shortDescription": { + "text": "Redundant 'suspend' modifier" + }, + "fullDescription": { + "text": "Reports 'suspend' modifier as redundant if no other suspending functions are called inside.", + "markdown": "Reports `suspend` modifier as redundant if no other suspending functions are called inside." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousAsDynamic", + "shortDescription": { + "text": "Suspicious 'asDynamic' member invocation" + }, + "fullDescription": { + "text": "Reports usages of 'asDynamic' function on a receiver of dynamic type. 'asDynamic' function has no effect for expressions of dynamic type. 'asDynamic' function on a receiver of dynamic type can lead to runtime problems because 'asDynamic' will be executed in JavaScript environment, and such function may not be present at runtime. The intended way is to use this function on usual Kotlin type. Remove \"asDynamic\" invocation quick-fix can be used to amend the code automatically. Example: 'fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }'", + "markdown": "Reports usages of `asDynamic` function on a receiver of dynamic type.\n\n`asDynamic` function has no effect for expressions of dynamic type.\n\n`asDynamic` function on a receiver of dynamic type can lead to runtime problems because `asDynamic`\nwill be executed in JavaScript environment, and such function may not be present at runtime.\nThe intended way is to use this function on usual Kotlin type.\n\n**Remove \"asDynamic\" invocation** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun wrongUsage(d: Dynamic) {\n d.asDynamic().foo() // <== redundant, quick-fix simplifies the call expression to \"d.foo()\"\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "FromClosedRangeMigration", + "shortDescription": { + "text": "MIN_VALUE step in fromClosedRange() since 1.3" + }, + "fullDescription": { + "text": "Reports 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. It is prohibited to call 'IntProgression.fromClosedRange()' and 'LongProgression.fromClosedRange()' with 'MIN_VALUE' step. All such calls should be checked during migration to Kotlin 1.3+. Example: 'IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)' To fix the problem change the step of the progression.", + "markdown": "Reports `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with `MIN_VALUE` step.\n\n\nIt is prohibited to call `IntProgression.fromClosedRange()` and `LongProgression.fromClosedRange()` with\n`MIN_VALUE` step. All such calls should be checked during migration to Kotlin 1.3+.\n\n**Example:**\n\n\n IntProgression.fromClosedRange(12, 143, Int.MIN_VALUE)\n\nTo fix the problem change the step of the progression." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveRedundantBackticks", + "shortDescription": { + "text": "Redundant backticks" + }, + "fullDescription": { + "text": "Reports redundant backticks in references. Some of the Kotlin keywords are valid identifiers in Java, for example: 'in', 'object', 'is'. If a Java library uses a Kotlin keyword for a method, you can still call the method escaping it with the backtick character ('`'), for example, 'foo.`is`(bar)'. Sometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is paired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code. Examples: 'fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks'", + "markdown": "Reports redundant backticks in references.\n\n\nSome of the Kotlin keywords are valid identifiers in Java, for example: `in`, `object`, `is`.\nIf a Java library uses a Kotlin keyword for a method, you can still call the method escaping it\nwith the backtick character (`````), for example, ``foo.`is`(bar)``.\nSometimes this escaping is redundant and can be safely omitted. The inspection discovers and reports such cases and is\npaired with the 'Remove redundant backticks' quick-fix, which allows you to amend the highlighted code.\n\n**Examples:**\n\n\n fun `is`(x: String) {}\n fun foo() {\n `is`(\"bar\") // 'is' is a keyword, backticks are required\n }\n\n fun `test that smth works as designed`() {} // OK, complex identifier for readability improvement\n\n val `a` = 1 // no need for backticks\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SimplifyNestedEachInScopeFunction", + "shortDescription": { + "text": "Scope function with nested forEach can be simplified" + }, + "fullDescription": { + "text": "Reports 'forEach' functions in the scope functions such as 'also' or 'apply' that can be simplified. Convert forEach call to onEach quick-fix can be used to amend the code automatically. Examples: 'fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }' After the quick-fix is applied: 'fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }'", + "markdown": "Reports `forEach` functions in the scope functions such as `also` or `apply` that can be simplified.\n\n**Convert forEach call to onEach** quick-fix can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(list: List) {\n val x = list.also { it.forEach { it + 4 } }.toString()\n val y = list.apply { forEach { println(it) } }\n }\n\nAfter the quick-fix is applied:\n\n\n fun test(list: List) {\n val x = list.onEach { it + 4 }.toString()\n val y = list.onEach { println(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnsafeCastFromDynamic", + "shortDescription": { + "text": "Implicit (unsafe) cast from dynamic type" + }, + "fullDescription": { + "text": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type.", + "markdown": "Reports expressions with a dynamic type in the specified inspection scope that are implicitly cast to another type." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PublicApiImplicitType", + "shortDescription": { + "text": "Public API declaration with implicit return type" + }, + "fullDescription": { + "text": "Reports 'public' and 'protected' functions and properties that have an implicit return type. For API stability reasons, it's recommended to specify such types explicitly. Example: 'fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()' After the quick-fix is applied: 'fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()'", + "markdown": "Reports `public` and `protected` functions and properties that have an implicit return type.\nFor API stability reasons, it's recommended to specify such types explicitly.\n\n**Example:**\n\n\n fun publicFunctionWhichAbusesTypeInference() =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n\nAfter the quick-fix is applied:\n\n\n fun publicFunctionWhichAbusesTypeInference(): Api =\n otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceMapIndexedWithListGenerator", + "shortDescription": { + "text": "Replace 'mapIndexed' with List generator" + }, + "fullDescription": { + "text": "Reports a 'mapIndexed' call that can be replaced by 'List' generator. Example: 'val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }' After the quick-fix is applied: 'val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }'", + "markdown": "Reports a `mapIndexed` call that can be replaced by `List` generator.\n\n**Example:**\n\n\n val a = listOf(1, 2, 3).mapIndexed { i, _ ->\n i + 42\n }\n\nAfter the quick-fix is applied:\n\n\n val a = List(listOf(1, 2, 3).size) { i ->\n i + 42\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ControlFlowWithEmptyBody", + "shortDescription": { + "text": "Control flow with empty body" + }, + "fullDescription": { + "text": "Reports 'if', 'while', 'do' or 'for' statements with empty bodies. While occasionally intended, this construction is confusing and often the result of a typo. A quick-fix removes a statement. Example: 'if (a > b) {}'", + "markdown": "Reports `if`, `while`, `do` or `for` statements with empty bodies.\n\nWhile occasionally intended, this construction is confusing and often the result of a typo.\n\nA quick-fix removes a statement.\n\n**Example:**\n\n\n if (a > b) {}\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "LoopToCallChain", + "shortDescription": { + "text": "Loop can be replaced with stdlib operations" + }, + "fullDescription": { + "text": "Reports 'for' loops that can be replaced with a sequence of stdlib operations (like 'map', 'filter', and so on). Example: 'fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n}' After the quick-fix is applied: 'fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n}'", + "markdown": "Reports `for` loops that can be replaced with a sequence of stdlib operations (like `map`, `filter`, and so on).\n\n**Example:**\n\n\n fun foo(list: List): List {\n val result = ArrayList()\n for (s in list) {\n if (s.length > 0)\n result.add(s.hashCode())\n }\n return result\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(list: List): List {\n val result = list\n .filter { it.length > 0 }\n .map { it.hashCode() }\n return result\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RemoveEmptyClassBody", + "shortDescription": { + "text": "Replace empty class body" + }, + "fullDescription": { + "text": "Reports declarations of classes and objects with an empty body. Use the 'Remove redundant empty class body' quick-fix to clean up the code. Examples: 'class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }' After the quick fix is applied: 'class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }'", + "markdown": "Reports declarations of classes and objects with an empty body.\n\nUse the 'Remove redundant empty class body' quick-fix to clean up the code.\n\n**Examples:**\n\n\n class EmptyA() {} // <== empty body\n\n class EmptyB {\n companion object {} // <== empty body\n }\n\n fun emptyC() {\n object {} // <== anonymous object, it's ok (not reported)\n }\n\nAfter the quick fix is applied:\n\n\n class EmptyA()\n\n class EmptyB {\n companion object\n }\n\n fun emptyC() {\n object {}\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CanBeParameter", + "shortDescription": { + "text": "Constructor parameter is never used as a property" + }, + "fullDescription": { + "text": "Reports primary constructor parameters that can have 'val' or 'var' removed. Class properties declared in the constructor increase memory consumption. If the parameter value is only used in the constructor, you can omit them. Note that the referenced object might be garbage-collected earlier. Example: 'class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }' A quick-fix removes the extra 'val' or 'var' keyword: 'class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }'", + "markdown": "Reports primary constructor parameters that can have `val` or `var` removed.\n\n\nClass properties declared in the constructor increase memory consumption.\nIf the parameter value is only used in the constructor, you can omit them.\n\nNote that the referenced object might be garbage-collected earlier.\n\n**Example:**\n\n\n class Task(val name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n\nA quick-fix removes the extra `val` or `var` keyword:\n\n\n class Task(name: String) {\n init {\n print(\"Task created: $name\")\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantReturnLabel", + "shortDescription": { + "text": "Redundant 'return' label" + }, + "fullDescription": { + "text": "Reports redundant return labels outside of lambda expressions. Example: 'fun test() {\n return@test\n }' After the quick-fix is applied: 'fun test() {\n return\n }'", + "markdown": "Reports redundant return labels outside of lambda expressions.\n\n**Example:**\n\n\n fun test() {\n return@test\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n return\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PackageName", + "shortDescription": { + "text": "Package naming convention" + }, + "fullDescription": { + "text": "Reports package names that do not follow the naming conventions. You can specify the required pattern in the inspection options. Recommended naming conventions: names of packages are always lowercase and should not contain underscores. Example: 'org.example.project' Using multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case Example: 'org.example.myProject'", + "markdown": "Reports package names that do not follow the naming conventions.\n\nYou can specify the required pattern in the inspection options.\n\n[Recommended naming conventions](https://kotlinlang.org/docs/coding-conventions.html#naming-rules): names of packages are always lowercase and should not contain underscores.\n\n**Example:**\n`org.example.project`\n\nUsing multi-word names is generally discouraged, but if you do need to use multiple words, you can either just concatenate them together or use camel case\n\n**Example:**\n`org.example.myProject`" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitUseSiteTargetAnnotationsOnSuperTypesMigration", + "shortDescription": { + "text": "Meaningless annotations targets on superclass" + }, + "fullDescription": { + "text": "Reports meaningless annotation targets on superclasses since Kotlin 1.4. Annotation targets such as '@get:' are meaningless on superclasses and are prohibited. Example: 'interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo' After the quick-fix is applied: 'interface Foo\n\n annotation class Ann\n\n class E : Foo' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports meaningless annotation targets on superclasses since Kotlin 1.4.\n\nAnnotation targets such as `@get:` are meaningless on superclasses and are prohibited.\n\n**Example:**\n\n\n interface Foo\n\n annotation class Ann\n\n class E : @field:Ann @get:Ann @set:Ann @setparam:Ann Foo\n\nAfter the quick-fix is applied:\n\n\n interface Foo\n\n annotation class Ann\n\n class E : Foo\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceWithEnumMap", + "shortDescription": { + "text": "'HashMap' can be replaced with 'EnumMap'" + }, + "fullDescription": { + "text": "Reports 'hashMapOf' function or 'HashMap' constructor calls that can be replaced with an 'EnumMap' constructor call. Using 'EnumMap' constructor makes your code simpler. The quick-fix replaces the function call with the 'EnumMap' constructor call. Example: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()' After the quick-fix is applied: 'enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)'", + "markdown": "Reports `hashMapOf` function or `HashMap` constructor calls that can be replaced with an `EnumMap` constructor call.\n\nUsing `EnumMap` constructor makes your code simpler.\n\nThe quick-fix replaces the function call with the `EnumMap` constructor call.\n\n**Example:**\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = hashMapOf()\n\nAfter the quick-fix is applied:\n\n\n enum class E {\n A, B\n }\n\n fun getMap(): Map = EnumMap(E::class.java)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousCollectionReassignment", + "shortDescription": { + "text": "Augmented assignment creates a new collection under the hood" + }, + "fullDescription": { + "text": "Reports augmented assignment ('+=') expressions on read-only 'Collection'. Augment assignment ('+=') expression on read-only 'Collection' doesn't modify the target collection, it creates a new one under the hood which can be misleading and lead to performance issues. Change type to mutable quick-fix can be used to amend the code automatically. Example: 'fun test() {\n var list = listOf(0)\n list += 42 // new list is created, variable 'list' still contains only '0'\n }' After the quick-fix is applied: 'fun test() {\n val list = mutableListOf(0)\n list += 42\n }'", + "markdown": "Reports augmented assignment (`+=`) expressions on read-only `Collection`.\n\nAugment assignment (`+=`) expression on read-only `Collection` doesn't modify the target collection,\nit creates a new one under the hood which can be misleading and lead to performance issues.\n\n**Change type to mutable** quick-fix can be used to amend the code automatically.\n\nExample:\n\n\n fun test() {\n var list = listOf(0)\n list += 42 // new list is created, variable 'list' still contains only '0'\n }\n\nAfter the quick-fix is applied:\n\n\n fun test() {\n val list = mutableListOf(0)\n list += 42\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantNotNullExtensionReceiverOfInline", + "shortDescription": { + "text": "'inline fun' extension receiver can be explicitly nullable until Kotlin 1.2" + }, + "fullDescription": { + "text": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable. Before Kotlin 1.2, calls of 'inline fun' with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899). Thus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's recommended to make such functions to have nullable receiver. Example: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' After the quick-fix is applied: 'inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }' This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.", + "markdown": "Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable.\n\n\nBefore Kotlin 1.2, calls of `inline fun` with flexible nullable extension receiver (a platform type with an unknown\nnullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode\n(see [KT-12899](https://youtrack.jetbrains.com/issue/KT-12899)).\n\n\nThus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's\nrecommended to make such functions to have nullable receiver.\n\n**Example:**\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nAfter the quick-fix is applied:\n\n\n inline fun String.greet() {\n println(\"Hello, $this!\")\n }\n\n fun main() {\n // `System.getProperty` returns not denotable `String!` type\n val user = System.getProperty(\"user.name\")\n user.greet()\n }\n\nThis inspection only reports if the Kotlin language level of the project or module is lower than 1.2." + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Java interop issues", + "index": 54, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantElvisReturnNull", + "shortDescription": { + "text": "Redundant '?: return null'" + }, + "fullDescription": { + "text": "Reports redundant '?: return null' Example: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }' After the quick-fix is applied: 'fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }'", + "markdown": "Reports redundant `?: return null`\n\n**Example:**\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo() ?: return null\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(): Int? {\n ...\n }\n\n fun test() : Int? {\n return foo()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "PrivatePropertyName", + "shortDescription": { + "text": "Private property naming convention" + }, + "fullDescription": { + "text": "Reports private property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, private property names should start with a lowercase letter and use camel case. Optionally, underscore prefix is allowed but only for private properties. It is possible to introduce other naming rules by changing the \"Pattern\" regular expression. Example: 'val _My_Cool_Property = \"\"' A quick-fix renames the class according to the Kotlin naming conventions: 'val _myCoolProperty = \"\"'", + "markdown": "Reports private property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#naming-rules),\nprivate property names should start with a lowercase letter and use camel case.\nOptionally, underscore prefix is allowed but only for **private** properties.\n\nIt is possible to introduce other naming rules by changing the \"Pattern\" regular expression.\n\n**Example:**\n\n\n val _My_Cool_Property = \"\"\n\nA quick-fix renames the class according to the Kotlin naming conventions:\n\n\n val _myCoolProperty = \"\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ObsoleteKotlinJsPackages", + "shortDescription": { + "text": "'kotlin.browser' and 'kotlin.dom' packages are deprecated since 1.4" + }, + "fullDescription": { + "text": "Reports usages of 'kotlin.dom' and 'kotlin.browser' packages. These packages were moved to 'kotlinx.dom' and 'kotlinx.browser' respectively in Kotlin 1.4+.", + "markdown": "Reports usages of `kotlin.dom` and `kotlin.browser` packages.\n\nThese packages were moved to `kotlinx.dom` and `kotlinx.browser`\nrespectively in Kotlin 1.4+." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "CascadeIf", + "shortDescription": { + "text": "Cascade if can be replaced with when" + }, + "fullDescription": { + "text": "Reports 'if' statements with three or more branches that can be replaced with the 'when' expression. Example: 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }' A quick-fix converts the 'if' expression to 'when': 'fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }'", + "markdown": "Reports `if` statements with three or more branches that can be replaced with the `when` expression.\n\n**Example:**\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n if (id.isEmpty()) {\n print(\"Identifier is empty\")\n } else if (!id.first().isIdentifierStart()) {\n print(\"Identifier should start with a letter\")\n } else if (!id.subSequence(1, id.length).all(Char::isIdentifierPart)) {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n\nA quick-fix converts the `if` expression to `when`:\n\n\n fun checkIdentifier(id: String) {\n fun Char.isIdentifierStart() = this in 'A'..'z'\n fun Char.isIdentifierPart() = isIdentifierStart() || this in '0'..'9'\n\n when {\n id.isEmpty() -> {\n print(\"Identifier is empty\")\n }\n !id.first().isIdentifierStart() -> {\n print(\"Identifier should start with a letter\")\n }\n !id.subSequence(1, id.length).all(Char::isIdentifierPart) -> {\n print(\"Identifier should contain only letters and numbers\")\n }\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EmptyRange", + "shortDescription": { + "text": "Range with start greater than endInclusive is empty" + }, + "fullDescription": { + "text": "Reports ranges that are empty because the 'start' value is greater than the 'endInclusive' value. Example: 'val range = 2..1' The quick-fix changes the '..' operator to 'downTo': 'val range = 2 downTo 1'", + "markdown": "Reports ranges that are empty because the `start` value is greater than the `endInclusive` value.\n\n**Example:**\n\n\n val range = 2..1\n\nThe quick-fix changes the `..` operator to `downTo`:\n\n\n val range = 2 downTo 1\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "OptionalExpectation", + "shortDescription": { + "text": "Optionally expected annotation has no actual annotation" + }, + "fullDescription": { + "text": "Reports optionally expected annotations without actual annotation in some platform modules. Example: '// common code\n@OptionalExpectation\nexpect annotation class JvmName(val name: String)\n\n@JvmName(name = \"JvmFoo\")\nfun foo() { }\n\n// jvm code\nactual annotation class JvmName(val name: String)' The inspection also reports cases when 'actual annotation class JvmName' is omitted for non-JVM platforms (for example, Native).", + "markdown": "Reports optionally expected annotations without actual annotation in some platform modules.\n\n**Example:**\n\n // common code\n @OptionalExpectation\n expect annotation class JvmName(val name: String)\n\n @JvmName(name = \"JvmFoo\")\n fun foo() { }\n\n // jvm code\n actual annotation class JvmName(val name: String)\n\nThe inspection also reports cases when `actual annotation class JvmName` is omitted for non-JVM platforms (for example, Native)." + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFORMATION", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DestructuringWrongName", + "shortDescription": { + "text": "Variable in destructuring declaration uses name of a wrong data class property" + }, + "fullDescription": { + "text": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class. Example: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }' The quick-fix changes variable's name to match the name of the corresponding class field: 'data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }'", + "markdown": "Reports entries of destructuring declarations that match the name of a different property of the destructured data class.\n\n**Example:**\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, c) = f\n }\n\nThe quick-fix changes variable's name to match the name of the corresponding class field:\n\n\n data class Foo(val a: String, val b: Int, val c: String)\n\n fun bar(f: Foo) {\n val (a, b) = f\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "IfThenToSafeAccess", + "shortDescription": { + "text": "If-Then foldable to '?.'" + }, + "fullDescription": { + "text": "Reports 'if-then' expressions that can be folded into safe-access ('?.') expressions. Example: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }' The quick fix converts the 'if-then' expression into a safe-access ('?.') expression: 'fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }'", + "markdown": "Reports `if-then` expressions that can be folded into safe-access (`?.`) expressions.\n\n**Example:**\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n if (a != null) bar(a) else null\n }\n\nThe quick fix converts the `if-then` expression into a safe-access (`?.`) expression:\n\n\n fun bar(x: String) = \"\"\n\n fun foo(a: String?) {\n a?.let { bar(it) }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RestrictReturnStatementTargetMigration", + "shortDescription": { + "text": "Target label does not denote a function since 1.4" + }, + "fullDescription": { + "text": "Reports labels that don't points to a functions. It's forbidden to declare a target label that does not denote a function. The quick-fix removes the label. Example: 'fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }' After the quick-fix is applied: 'fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }' This inspection only reports if the language level of the project or module is 1.4 or higher.", + "markdown": "Reports labels that don't points to a functions.\n\nIt's forbidden to declare a target label that does not denote a function.\n\nThe quick-fix removes the label.\n\n**Example:**\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return@L }\n fn()\n }\n\nAfter the quick-fix is applied:\n\n\n fun testValLabelInReturn() {\n L@ val fn = { return }\n fn()\n }\n\nThis inspection only reports if the language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MigrateDiagnosticSuppression", + "shortDescription": { + "text": "Diagnostic name should be replaced" + }, + "fullDescription": { + "text": "Reports suppressions with old diagnostic names, for example '@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")'. Some of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant. Example: '@Suppress(\"HEADER_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}' After the quick-fix is applied: '@Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\nexpect fun connection() {\n // ...\n}'", + "markdown": "Reports suppressions with old diagnostic names, for example `@Suppress(\"HEADER_WITHOUT_IMPLEMENTATION\")`.\n\n\nSome of diagnostics from Kotlin 1.2 and earlier are now obsolete, making such suppressions redundant.\n\n**Example:**\n\n\n @Suppress(\"HEADER_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n\nAfter the quick-fix is applied:\n\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n expect fun connection() {\n // ...\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Other problems", + "index": 148, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "DeferredResultUnused", + "shortDescription": { + "text": "'@Deferred' result is unused" + }, + "fullDescription": { + "text": "Reports function calls with the 'Deferred' result type if the return value is not used. If the 'Deferred' return value is not used, the call site would not wait to complete this function. Example: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }' A quick-fix provides a variable with the 'Deferred' initializer: 'fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }'", + "markdown": "Reports function calls with the `Deferred` result type if the return value is not used.\n\nIf the `Deferred` return value is not used, the call site would not wait to complete this function.\n\n**Example:**\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n calcEverythingAsync()\n }\n\nA quick-fix provides a variable with the `Deferred` initializer:\n\n\n fun calcEverythingAsync() = CompletableDeferred(42)\n\n fun usage() {\n val answer = calcEverythingAsync()\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SelfReferenceConstructorParameter", + "shortDescription": { + "text": "Constructor can never be complete" + }, + "fullDescription": { + "text": "Reports constructors with a non-null self-reference parameter. Such constructors never instantiate a class. The quick-fix converts the parameter type to nullable. Example: 'class SelfRef(val ref: SelfRef)' After the quick-fix is applied: 'class SelfRef(val ref: SelfRef?)'", + "markdown": "Reports constructors with a non-null self-reference parameter.\n\nSuch constructors never instantiate a class.\n\nThe quick-fix converts the parameter type to nullable.\n\n**Example:**\n\n\n class SelfRef(val ref: SelfRef)\n\nAfter the quick-fix is applied:\n\n\n class SelfRef(val ref: SelfRef?)\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "MainFunctionReturnUnit", + "shortDescription": { + "text": "Entry point function should return Unit" + }, + "fullDescription": { + "text": "Reports entry point functions with an incorrect return type (should be 'Unit'). Example: 'fun main() = \"Hello world!\"'", + "markdown": "Reports entry point functions with an incorrect return type (should be `Unit`).\n\n**Example:**\n`fun main() = \"Hello world!\"`" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "SuspiciousCallableReferenceInLambda", + "shortDescription": { + "text": "Suspicious callable reference used as lambda result" + }, + "fullDescription": { + "text": "Reports lambda expressions with one callable reference. It is a common error to replace a lambda with a callable reference without changing curly braces to parentheses. Example: 'listOf(1,2,3).map { it::toString }' After the quick-fix is applied: 'listOf(1,2,3).map(Int::toString)'", + "markdown": "Reports lambda expressions with one callable reference.\n\nIt is a common error to replace a lambda with a callable reference without changing curly braces to parentheses.\n\n**Example:**\n\n listOf(1,2,3).map { it::toString }\n\nAfter the quick-fix is applied:\n\n listOf(1,2,3).map(Int::toString)\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertSecondaryConstructorToPrimary", + "shortDescription": { + "text": "Convert to primary constructor" + }, + "fullDescription": { + "text": "Reports a secondary constructor that can be replaced with a more concise primary constructor. Example: 'class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }' A quick-fix converts code automatically: 'class User(val name: String) {\n }'", + "markdown": "Reports a secondary constructor that can be replaced with a more concise primary constructor.\n\n**Example:**\n\n\n class User {\n val name: String\n\n constructor(name: String) {\n this.name = name\n }\n }\n\nA quick-fix converts code automatically:\n\n\n class User(val name: String) {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceGetOrSet", + "shortDescription": { + "text": "Explicit 'get' or 'set' call" + }, + "fullDescription": { + "text": "Reports explicit calls to 'get' or 'set' functions which can be replaced by an indexing operator '[]'. Kotlin allows custom implementations for the predefined set of operators on types. To overload an operator, you can mark the corresponding function with the 'operator' modifier: 'operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}' The functions above correspond to the indexing operator. Example: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }' After the quick-fix is applied: 'class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }'", + "markdown": "Reports explicit calls to `get` or `set` functions which can be replaced by an indexing operator `[]`.\n\n\nKotlin allows custom implementations for the predefined set of operators on types.\nTo overload an operator, you can mark the corresponding function with the `operator` modifier:\n\n\n operator fun get(index: Int) {}\n operator fun set(index: Int, value: Int) {}\n \nThe functions above correspond to the indexing operator.\n\n**Example:**\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test().get(0) // replaceable 'get()'\n }\n\nAfter the quick-fix is applied:\n\n class Test {\n operator fun get(i: Int): Int = 0\n }\n\n fun test() {\n Test()[0]\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ProhibitRepeatedUseSiteTargetAnnotationsMigration", + "shortDescription": { + "text": "Repeated annotation which is not marked as '@Repeatable'" + }, + "fullDescription": { + "text": "Reports the repeated use of a non-'@Repeatable' annotation on property accessors. As a result of using non-'@Repeatable' annotation multiple times, both annotation usages will appear in the bytecode leading to an ambiguity in reflection calls. Since Kotlin 1.4 it's mandatory to either mark annotation as '@Repeatable' or not repeat the annotation, otherwise it will lead to compilation error. Example: 'annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable' This inspection only reports if the Kotlin language level of the project or module is 1.4 or higher.", + "markdown": "Reports the repeated use of a non-`@Repeatable` annotation on property accessors.\n\n\nAs a result of using non-`@Repeatable` annotation multiple times, both annotation usages\nwill appear in the bytecode leading to an ambiguity in reflection calls.\n\n\nSince Kotlin 1.4 it's mandatory to either mark annotation as `@Repeatable` or not\nrepeat the annotation, otherwise it will lead to compilation error.\n\n**Example:**\n\n\n annotation class Foo(val x: Int)\n\n @get:Foo(10)\n val a: String\n @Foo(20) get() = \"foo\" // annotation repeated twice but not marked as @Repeatable\n\nThis inspection only reports if the Kotlin language level of the project or module is 1.4 or higher." + }, + "defaultConfiguration": { + "enabled": false, + "level": "error", + "parameters": { + "ideaSeverity": "ERROR", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Migration", + "index": 118, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "Destructure", + "shortDescription": { + "text": "Use destructuring declaration" + }, + "fullDescription": { + "text": "Reports declarations that can be destructured. Example: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }' The quick-fix destructures the declaration and introduces new variables with names from the corresponding class: 'data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }'", + "markdown": "Reports declarations that can be destructured.\n\n**Example:**\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { my ->\n println(my.second)\n println(my.third)\n }\n }\n\nThe quick-fix destructures the declaration and introduces new variables with names from the corresponding class:\n\n\n data class My(val first: String, val second: Int, val third: Boolean)\n\n fun foo(list: List) {\n list.forEach { (_, second, third) ->\n println(second)\n println(third)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": false, + "level": "note", + "parameters": { + "ideaSeverity": "INFO", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UnusedReceiverParameter", + "shortDescription": { + "text": "Unused receiver parameter" + }, + "fullDescription": { + "text": "Reports receiver parameter of extension functions and properties that is not used. Remove redundant receiver parameter can be used to amend the code automatically.", + "markdown": "Reports receiver parameter of extension functions and properties that is not used.\n\n**Remove redundant receiver parameter** can be used to amend the code automatically." + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConvertTryFinallyToUseCall", + "shortDescription": { + "text": "Convert try / finally to use() call" + }, + "fullDescription": { + "text": "Reports a 'try-finally' block with 'resource.close()' in 'finally' which can be converted to a 'resource.use()' call. 'use()' is easier to read and less error-prone as there is no need in explicit 'close()' call. Example: 'fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }' After the quick-fix applied: 'fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }'", + "markdown": "Reports a `try-finally` block with `resource.close()` in `finally` which can be converted to a `resource.use()` call.\n\n`use()` is easier to read and less error-prone as there is no need in explicit `close()` call.\n\n**Example:**\n\n\n fun example() {\n val reader = File(\"file.txt\").bufferedReader()\n try {\n reader.lineSequence().forEach(::print)\n } finally {\n reader.close()\n }\n }\n\nAfter the quick-fix applied:\n\n\n fun example() {\n File(\"file.txt\").bufferedReader().use { reader ->\n reader.lineSequence().forEach(::print)\n }\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "KotlinRedundantOverride", + "shortDescription": { + "text": "Redundant overriding method" + }, + "fullDescription": { + "text": "Reports redundant overriding declarations. An override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility. Example: 'open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }' After the quick-fix is applied: 'class Bar : Foo() {\n }'", + "markdown": "Reports redundant overriding declarations.\n\n\nAn override can be omitted if it does not modify the inherited signature semantics, for example, by changing visibility.\n\n**Example:**\n\n\n open class Foo {\n open fun singleExpression() {\n }\n }\n\n class Bar : Foo() {\n override fun singleExpression() = super.singleExpression()\n }\n\nAfter the quick-fix is applied:\n\n\n class Bar : Foo() {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceArrayOfWithLiteral", + "shortDescription": { + "text": "'arrayOf' call can be replaced with array literal [...]" + }, + "fullDescription": { + "text": "Reports 'arrayOf' calls that can be replaced with array literals '[...]'. Examples: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass' After the quick-fix is applied: 'annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass'", + "markdown": "Reports `arrayOf` calls that can be replaced with array literals `[...]`.\n\n**Examples:**\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation(arrayOf(\"alpha\", \"beta\", \"omega\")) // replaceable 'arrayOf()'\n class MyClass\n\nAfter the quick-fix is applied:\n\n annotation class MyAnnotation(val strings: Array)\n\n @MyAnnotation([\"alpha\", \"beta\", \"omega\"])\n class MyClass\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ReplaceToWithInfixForm", + "shortDescription": { + "text": "'to' call should be replaced with infix form" + }, + "fullDescription": { + "text": "Reports 'to' function calls that can be replaced with the infix form. Using the infix form makes your code simpler. The quick-fix replaces 'to' with the infix form. Example: 'fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }' After the quick-fix is applied: 'fun foo(a: Int, b: Int) {\n val pair = a to b\n }'", + "markdown": "Reports `to` function calls that can be replaced with the infix form.\n\nUsing the infix form makes your code simpler.\n\nThe quick-fix replaces `to` with the infix form.\n\n**Example:**\n\n\n fun foo(a: Int, b: Int) {\n val pair = a.to(b)\n }\n\nAfter the quick-fix is applied:\n\n\n fun foo(a: Int, b: Int) {\n val pair = a to b\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Style issues", + "index": 3, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "ConstPropertyName", + "shortDescription": { + "text": "Const property naming convention" + }, + "fullDescription": { + "text": "Reports 'const' property names that do not follow the recommended naming conventions. Consistent naming allows for easier code reading and understanding. According to the Kotlin official style guide, 'const' properties should use uppercase underscore-separated names. Example: 'const val Planck: Double = 6.62607015E-34' A quick-fix renames the property: 'const val PLANCK: Double = 6.62607015E-34'", + "markdown": "Reports `const` property names that do not follow the recommended naming conventions.\n\n\nConsistent naming allows for easier code reading and understanding.\nAccording to the [Kotlin official style guide](https://kotlinlang.org/docs/coding-conventions.html#property-names),\n`const` properties should use uppercase underscore-separated names.\n\n**Example:**\n\n\n const val Planck: Double = 6.62607015E-34\n\nA quick-fix renames the property:\n\n\n const val PLANCK: Double = 6.62607015E-34\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "note", + "parameters": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Naming conventions", + "index": 47, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RedundantNullableReturnType", + "shortDescription": { + "text": "Redundant nullable return type" + }, + "fullDescription": { + "text": "Reports functions and variables with nullable return type which never return or become 'null'. Example: 'fun greeting(user: String): String? = \"Hello, $user!\"' After the quick-fix is applied: 'fun greeting(user: String): String = \"Hello, $user!\"'", + "markdown": "Reports functions and variables with nullable return type which never return or become `null`.\n\n**Example:**\n\n\n fun greeting(user: String): String? = \"Hello, $user!\"\n\nAfter the quick-fix is applied:\n\n\n fun greeting(user: String): String = \"Hello, $user!\"\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Redundant constructs", + "index": 4, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "UselessCallOnNotNull", + "shortDescription": { + "text": "Useless call on not-null type" + }, + "fullDescription": { + "text": "Reports calls on not-null receiver that make sense only for nullable receiver. Several functions from the standard library such as 'orEmpty()' or 'isNullOrEmpty' have sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same. Remove redundant call and Change call to … quick-fixes can be used to amend the code automatically. Examples: 'fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }'", + "markdown": "Reports calls on not-null receiver that make sense only for nullable receiver.\n\nSeveral functions from the standard library such as `orEmpty()` or `isNullOrEmpty`\nhave sense only when they are called on receivers of nullable types. Otherwise, they can be omitted or simplified as the result will be the same.\n\n**Remove redundant call** and **Change call to ...** quick-fixes can be used to amend the code automatically.\n\nExamples:\n\n\n fun test(s: String) {\n val x = s.orEmpty() // quick-fix simplifies to 's'\n val y = s.isNullOrEmpty() // quick-fix simplifies to 's.isEmpty()'\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "RiderSolutionErrorsInspection", + "shortDescription": { + "text": "Rider toolset and environment errors" + }, + "fullDescription": { + "text": "Reports toolset and environment errors detected by Rider.", + "markdown": "Reports toolset and environment errors detected by Rider." + }, + "defaultConfiguration": { + "enabled": true, + "level": "error", + "parameters": { + "suppressToolId": "RiderSolutionErrorsInspection", + "ideaSeverity": "ERROR", + "qodanaSeverity": "Critical" + } + }, + "relationships": [ + { + "target": { + "id": "Rider/General", + "index": 134, + "toolComponent": { + "name": "QDNET" + } + }, + "kinds": [ + "superset" + ] + } + ] + }, + { + "id": "EqualsOrHashCode", + "shortDescription": { + "text": "'equals()' and 'hashCode()' not paired" + }, + "fullDescription": { + "text": "Reports classes that override 'equals()' but do not override 'hashCode()', or vice versa. It also reports object declarations that override either 'equals()' or 'hashCode()'. This can lead to undesired behavior when a class is added to a 'Collection' Example: 'class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }' The quick-fix overrides 'equals()' or 'hashCode()' for classes and deletes these methods for objects: 'class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }'", + "markdown": "Reports classes that override `equals()` but do not override `hashCode()`, or vice versa. It also reports object declarations that override either `equals()` or `hashCode()`.\n\nThis can lead to undesired behavior when a class is added to a `Collection`\n\n**Example:**\n\n\n class C1 {\n override fun equals(other: Any?) = true\n }\n\n class C2 {\n override fun hashCode() = 0\n }\n\n object O1 {\n override fun equals(other: Any?) = true\n }\n\n object O2 {\n override fun hashCode() = 0\n }\n\nThe quick-fix overrides `equals()` or `hashCode()` for classes and deletes these methods for objects:\n\n\n class C1 {\n override fun equals(other: Any?) = true\n override fun hashCode(): Int {\n return javaClass.hashCode()\n }\n }\n\n class C2 {\n override fun hashCode() = 0\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (javaClass != other?.javaClass) return false\n return true\n }\n }\n\n object O1 {\n }\n\n object O2 {\n }\n" + }, + "defaultConfiguration": { + "enabled": true, + "level": "warning", + "parameters": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + "relationships": [ + { + "target": { + "id": "Kotlin/Probable bugs", + "index": 24, + "toolComponent": { + "name": "QDJVM" + } + }, + "kinds": [ + "superset" + ] + } + ] + } + ], + "language": "en-US", + "contents": [ + "localizedData", + "nonLocalizedData" + ], + "isComprehensive": false + } + ] + }, + "invocations": [ + { + "exitCode": 0, + "toolExecutionNotifications": [], + "executionSuccessful": true + } + ], + "language": "en-US", + "results": [ + { + "ruleId": "ControlFlowWithEmptyBody", + "kind": "fail", + "level": "error", + "message": { + "text": "'while' has empty body", + "markdown": "'while' has empty body" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "dokker/src/main/kotlin/io/github/tiulpin/Dokker.kt", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 271, + "startColumn": 5, + "charOffset": 6917, + "charLength": 5, + "snippet": { + "text": "while" + }, + "sourceLanguage": "kotlin" + }, + "contextRegion": { + "startLine": 269, + "startColumn": 1, + "charOffset": 6885, + "charLength": 71, + "snippet": { + "text": " println(null)\n }\n while (false) {\n }\n if (update) {" + } + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "dokker.dokker.main", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "f0b3b16328b5e11f45afdc0ae3fe79aa989b8909330a81d810ae499b347aca32" + }, + "baselineState": "new", + "properties": { + "ideaSeverity": "WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + { + "ruleId": "ConstantConditionIf", + "kind": "fail", + "level": "warning", + "message": { + "text": "Condition is always 'true'", + "markdown": "Condition is always 'true'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "dokker/src/main/kotlin/io/github/tiulpin/Dokker.kt", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 268, + "startColumn": 9, + "charOffset": 6877, + "charLength": 4, + "snippet": { + "text": "true" + }, + "sourceLanguage": "kotlin" + }, + "contextRegion": { + "startLine": 266, + "startColumn": 1, + "charOffset": 6685, + "charLength": 227, + "snippet": { + "text": " val installPackages = packages.joinToString(INSTALL_SEP)\n var command = \"DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $INSTALL_SEP$installPackages\"\n if (true) {\n println(null)\n }" + } + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "dokker.dokker.main", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "eba2d761291ee6bda42bf3ff0a3856509e0140a940f297ba99450b51d0f7905e" + }, + "baselineState": "new", + "properties": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + { + "ruleId": "RiderSolutionErrorsInspection", + "kind": "fail", + "level": "warning", + "message": { + "text": "[NU1101] Unable to find package PrivatePackage. No packages exist with this id in source(s): github at (0:0) Target: ResolvePackageAssets Task: ResolvePackageAssets", + "markdown": "\\[[NU1101](http://www.google.com/search?q=NU1101)\\] Unable to find package PrivatePackage. No packages exist with this id in source(s): github at (0:0) \n\nTarget: ResolvePackageAssets \nTask: ResolvePackageAssets" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "LibraryReferencingPackage/LibraryReferencingPackage.csproj", + "uriBaseId": "SRCROOT" + } + } + } + ], + "partialFingerprints": { + "equalIndicator/v1": "2eb5998cec5651ad1ad36262cf210caa653ab138d3c22e4338d3eea704104bf6" + }, + "baselineState": "new", + "properties": { + "ideaSeverity": "WARNING", + "qodanaSeverity": "High" + } + }, + { + "ruleId": "MayBeConstant", + "kind": "fail", + "level": "note", + "message": { + "text": "Might be 'const'", + "markdown": "Might be 'const'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "dokker/src/main/kotlin/io/github/tiulpin/Dokker.kt", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 283, + "startColumn": 5, + "charOffset": 7206, + "charLength": 4, + "snippet": { + "text": "help" + }, + "sourceLanguage": "kotlin" + }, + "contextRegion": { + "startLine": 281, + "startColumn": 1, + "charOffset": 7199, + "charLength": 17, + "snippet": { + "text": "}\n\nval help = \"\"\n" + } + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "dokker.dokker.main", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "54ac5fc68d708d7ae0f4fc0732dc3173126a76a86ec9f429bd133a5fb9a8f8fa" + }, + "baselineState": "new", + "properties": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + { + "ruleId": "ConstantConditionIf", + "kind": "fail", + "level": "warning", + "message": { + "text": "Condition is always 'true'", + "markdown": "Condition is always 'true'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "dokker/src/main/kotlin/io/github/tiulpin/Dokker.kt", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 269, + "startColumn": 11, + "charOffset": 6911, + "charLength": 4, + "snippet": { + "text": "true" + }, + "sourceLanguage": "kotlin" + }, + "contextRegion": { + "startLine": 269, + "startColumn": 11, + "charOffset": 6911, + "charLength": 38, + "snippet": { + "text": "if (true) {\n println(null)\n }" + } + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "dokker.dokker.main", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "eba2d761291ee6bda42bf3ff0a3856000e0140a940f297ba99450b51d0f7905e" + }, + "baselineState": "absent", + "properties": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + }, + { + "ruleId": "ConstantConditionIf", + "kind": "fail", + "level": "warning", + "message": { + "text": "Condition is always 'true'", + "markdown": "Condition is always 'true'" + }, + "locations": [ + { + "physicalLocation": { + "artifactLocation": { + "uri": "dokker/src/main/kotlin/io/github/tiulpin/Dokker.kt", + "uriBaseId": "SRCROOT" + }, + "region": { + "startLine": 270, + "startColumn": 13, + "charOffset": 6943, + "charLength": 4, + "snippet": { + "text": "true" + }, + "sourceLanguage": "kotlin" + }, + "contextRegion": { + "startLine": 270, + "startColumn": 13, + "charOffset": 6943, + "charLength": 38, + "snippet": { + "text": "if (true) {\n println(null)\n }" + } + } + }, + "logicalLocations": [ + { + "fullyQualifiedName": "dokker.dokker.main", + "kind": "module" + } + ] + } + ], + "partialFingerprints": { + "equalIndicator/v1": "eba2d761291ab4bda42bf3ff0a3856000e0140a940f297ba99450b51d0f7905e" + }, + "baselineState": "unchanged", + "properties": { + "ideaSeverity": "WEAK WARNING", + "tags": [ + "ideaSeverity" + ] + } + } + ], + "automationDetails": { + "id": "project - 12/13/21, 3:48 PM", + "guid": "d0a57b70-6936-41ab-bf04-97c58449a43d" + }, + "newlineSequences": [ + "\r\n", + "\n" + ], + "properties": { + "qodanaFailureConditions": { + "testCoverageThresholds": { + "totalCoverage": 40, + "freshCoverage": 40 + } + }, + "coverage": { + "totalCoverage": 45.0, + "totalLines": 124.0, + "totalCoveredLines": 56.0 + } + } + } + ] +} \ No newline at end of file diff --git a/vsts/__tests__/main.test.ts b/vsts/__tests__/main.test.ts new file mode 100644 index 00000000..cd39308d --- /dev/null +++ b/vsts/__tests__/main.test.ts @@ -0,0 +1,147 @@ +import {expect, test} from '@jest/globals' +import {parseSarif} from '../src/utils' +import {getSummary, ProblemDescriptor} from '../../common/output' +import {DEPENDENCY_CHARS_LIMIT, VIEW_REPORT_OPTIONS} from '../src/output' + +test('test typical summary output', () => { + const result = getSummary( + 'Qodana for JS', + 'frontend', + 'web', + problemDescriptorsDefaultFixture().reverse(), // reversed for testing the correct sorting in output + '', + 0, + 'There is no licenses information available', + 'https://example.com/report', + true, + DEPENDENCY_CHARS_LIMIT, + VIEW_REPORT_OPTIONS + ) + expect(result).toEqual(markdownSummaryFixture()) +}) + +test('test empty summary output', () => { + const result = getSummary( + 'Qodana for JS', + '', + '', + outputEmptyFixture(), + '', + 0, + '', + '', + false, + DEPENDENCY_CHARS_LIMIT, + VIEW_REPORT_OPTIONS + ) + expect(result).toEqual(markdownEmptySummaryFixture()) +}) + +test('test sarif with problems to output annotations', () => { + const output = problemDescriptorsDefaultFixture() + const result = parseSarif('__tests__/data/some.sarif.json') + expect(result.problemDescriptions).toEqual(output) +}) + +test('test sarif with problems and baseline to output annotations', () => { + const output = problemDescriptorsDefaultFixture() + const result = parseSarif('__tests__/data/with.baseline.sarif.json') + expect(result.problemDescriptions).toEqual(output) +}) + +test('test sarif with no problems to output annotations', () => { + const output = outputEmptyFixture() + const result = parseSarif('__tests__/data/empty.sarif.json') + expect(result.problemDescriptions).toEqual(output) +}) + +export function problemDescriptorsDefaultFixture(): ProblemDescriptor[] { + return [ + { + level: 'failure', + title: 'Control flow with empty body' + }, + { + level: 'warning', + title: "Condition of 'if' expression is constant" + }, + { + level: 'warning', + title: 'Rider toolset and environment errors' + }, + { + level: 'notice', + title: "Might be 'const'" + } + ] +} + +export function outputEmptyFixture(): ProblemDescriptor[] { + return [] +} + +export function markdownSummaryFixture(): string { + return `# [Qodana](https://example.com/report) for JS +Analyzed project: \`frontend/\` +Analyzed directory: \`web/\` + +**4 new problems** were found + +| Inspection name | Severity | Problems | +| --- | --- | --- | +| \`Control flow with empty body\` | πŸ”΄ Failure | 1 | +| \`Rider toolset and environment errors\` | πŸ”Ά Warning | 1 | +| \`Condition of 'if' expression is constant\` | πŸ”Ά Warning | 1 | +| \`Might be 'const'\` | ◽️ Notice | 1 | + + +πŸ’‘ Qodana analysis was run in the pull request mode: only the changed files were checked +☁️ [View the detailed Qodana report](https://example.com/report) +
+Detected 0 dependencies + +There is no licenses information available +
+
+Contact Qodana team + +Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com) + - Or via our issue tracker: https://jb.gg/qodana-issue + - Or share your feedback: https://jb.gg/qodana-discussions +
` +} + +export function markdownEmptySummaryFixture(): string { + return `# Qodana for JS + +**It seems all right πŸ‘Œ** + +No new problems were found according to the checks applied + + +
+View the detailed Qodana report + +To be able to view the detailed Qodana report, you can either: + - Register at [Qodana Cloud](https://qodana.cloud/) and [configure the task](https://www.jetbrains.com/help/qodana/qodana-azure-pipelines.html#Qodana+Cloud) + - Use [SARIF SAST Scans Tab](https://marketplace.visualstudio.com/items?itemName=sariftools.scans) extension to display report summary in Azure DevOps UI in 'Scans' tab + - Inspect and use \`qodana.sarif.json\` (see [the Qodana SARIF format](https://www.jetbrains.com/help/qodana/qodana-sarif-output.html#Report+structure) for details) + +To get \`*.log\` files or any other Qodana artifacts, run the task with \`uploadResult\` option set to \`true\`, +so that the action will upload the files as the job artifacts: +\`\`\`yaml + - task: QodanaScan@2024.3.4 + inputs: + uploadResult: true +\`\`\` + +
+ +
+Contact Qodana team + +Contact us at [qodana-support@jetbrains.com](mailto:qodana-support@jetbrains.com) + - Or via our issue tracker: https://jb.gg/qodana-issue + - Or share your feedback: https://jb.gg/qodana-discussions +
` +} diff --git a/vsts/jest.config.js b/vsts/jest.config.js new file mode 100644 index 00000000..1c8d3139 --- /dev/null +++ b/vsts/jest.config.js @@ -0,0 +1,31 @@ +/* + * Copyright 2021-2024 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = { + clearMocks: true, + moduleFileExtensions: ['js', 'ts'], + testMatch: ['**/*.test.ts'], + transform: { + '^.+\\.ts$': 'ts-jest' + }, + verbose: false, + testTimeout: 400000, + // TODO: add more tests + // collectCoverage: true, + // collectCoverageFrom: ['src/**/*.ts'], + // coverageReporters: ['html', ['lcovonly', { projectRoot: '../' }], 'text-summary'], + // coveragePathIgnorePatterns: ['node_modules', 'src/utils.ts', 'src/main.ts'], +} \ No newline at end of file diff --git a/vsts/package.json b/vsts/package.json index fe9e61fd..481dc3ba 100644 --- a/vsts/package.json +++ b/vsts/package.json @@ -5,6 +5,7 @@ "main": "azure.js", "scripts": { "lint": "prettier --write '**/*.ts' && eslint --fix **/*.ts -c ../.github/linters/.eslintrc.yml", + "test": "jest --config jest.config.js", "bump-dev": "jq '.version |= (split(\".\") | .[2] = (. [2]| tonumber + 1 | tostring) | join(\".\"))' vss-extension.dev.json > tmp.json && mv tmp.json vss-extension.dev.json\n", "package": "npm run bump-dev && cd QodanaScan && npm ci && cd .. && ../node_modules/.bin/esbuild lib/main.js --platform=node --bundle --outfile=QodanaScan/index.js --target=node16 --external:shelljs --external:azure-pipelines-task-lib", "readme": "cp ../.github/md/azure.md README.md && curl -sS https://raw.githubusercontent.com/JetBrains/Qodana/2022.2/topics/azure-pipelines.md >> README.md && cat ../.github/md/tracker.md >> README.md", @@ -24,9 +25,11 @@ "author": "JetBrains", "license": "Apache-2.0", "dependencies": { + "azure-devops-node-api": "^14.1.0", "azure-pipelines-task-lib": "^4.17.3", "azure-pipelines-tasks-utility-common": "^3.246.0", - "azure-pipelines-tool-lib": "^2.0.8" + "azure-pipelines-tool-lib": "^2.0.8", + "@types/sarif": "^2.1.7" }, "devDependencies": { "@types/node": "^22.10.5", diff --git a/vsts/src/gitApiProvider.ts b/vsts/src/gitApiProvider.ts new file mode 100644 index 00000000..e822cca4 --- /dev/null +++ b/vsts/src/gitApiProvider.ts @@ -0,0 +1,24 @@ +import {GitApi} from 'azure-devops-node-api/GitApi' +import * as azdev from 'azure-devops-node-api' +import {getVariable} from './utils' + +let gitApi: GitApi | null = null + +async function initApi(): Promise { + const orgUrl = getVariable('System.TeamFoundationCollectionUri') + const token = getVariable('System.AccessToken') + const authHandler = azdev.getPersonalAccessTokenHandler(token) + const webApi = new azdev.WebApi(orgUrl, authHandler) + const api = await webApi.getGitApi() + gitApi = api + return api +} + +export async function getGitApi(): Promise { + const api = gitApi + if (!api) { + return await initApi() + } else { + return api + } +} diff --git a/vsts/src/main.ts b/vsts/src/main.ts index 95b8f4b7..07eab0bc 100644 --- a/vsts/src/main.ts +++ b/vsts/src/main.ts @@ -18,16 +18,19 @@ import * as tl from 'azure-pipelines-task-lib/task' import { FAIL_THRESHOLD_OUTPUT, QodanaExitCode, - isExecutionSuccessful + isExecutionSuccessful, + extractArg } from '../../common/qodana' import { getInputs, prepareAgent, + pushQuickFixes, qodana, setFailed, uploadArtifacts, uploadSarif } from './utils' +import {publishOutput} from './output' // Catch and log any unhandled exceptions. These exceptions can leak out in // azure-pipelines-task-lib when a failed upload closes the file descriptor causing any in-process reads to @@ -41,11 +44,22 @@ async function main(): Promise { tl.mkdirP(inputs.cacheDir) await prepareAgent(inputs.args, inputs.useNightly) const exitCode = (await qodana()) as QodanaExitCode - await uploadArtifacts( - inputs.resultsDir, - inputs.artifactName, - inputs.uploadResult - ) + await Promise.all([ + pushQuickFixes(inputs.pushFixes, inputs.commitMessage), + uploadArtifacts( + inputs.resultsDir, + inputs.artifactName, + inputs.uploadResult + ), + publishOutput( + extractArg('-i', '--project-dir', inputs.args), + extractArg('-d', '--source-directory', inputs.args), + inputs.resultsDir, + inputs.postComment, + inputs.prMode, + isExecutionSuccessful(exitCode) + ) + ]) uploadSarif(inputs.resultsDir, inputs.uploadSarif) if (!isExecutionSuccessful(exitCode)) { setFailed(`qodana scan failed with exit code ${exitCode}`) diff --git a/vsts/src/output.ts b/vsts/src/output.ts new file mode 100644 index 00000000..4e9df655 --- /dev/null +++ b/vsts/src/output.ts @@ -0,0 +1,125 @@ +/* + * Copyright 2021-2024 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as tl from 'azure-pipelines-task-lib/task' +import { + getCoverageFromSarif, + QODANA_SARIF_NAME, + QODANA_SHORT_SARIF_NAME, + VERSION +} from '../../common/qodana' +import {parseSarif, postResultsToPRComments, postSummary} from './utils' +import { + getCoverageStats, + getLicenseInfo, + getReportURL, + getSummary, + QODANA_CHECK_NAME +} from '../../common/output' + +export const DEPENDENCY_CHARS_LIMIT = 150000 // 150k chars is the Azure DevOps limit for a comment +export const VIEW_REPORT_OPTIONS = `To be able to view the detailed Qodana report, you can either: + - Register at [Qodana Cloud](https://qodana.cloud/) and [configure the task](https://www.jetbrains.com/help/qodana/qodana-azure-pipelines.html#Qodana+Cloud) + - Use [SARIF SAST Scans Tab](https://marketplace.visualstudio.com/items?itemName=sariftools.scans) extension to display report summary in Azure DevOps UI in 'Scans' tab + - Inspect and use \`qodana.sarif.json\` (see [the Qodana SARIF format](https://www.jetbrains.com/help/qodana/qodana-sarif-output.html#Report+structure) for details) + +To get \`*.log\` files or any other Qodana artifacts, run the task with \`uploadResult\` option set to \`true\`, +so that the action will upload the files as the job artifacts: +\`\`\`yaml + - task: QodanaScan@${VERSION} + inputs: + uploadResult: true +\`\`\` +` + +/** + * Publish Qodana results to Azure: comment, job summary. + * @param projectDir The path to the project. + * @param sourceDir The path to the analyzed directory inside the project. + * @param resultsDir The path to the results. + * @param postComment whether to post a PR comment or not. + * @param isPrMode + * @param execute whether to execute the promise or not. + */ +export async function publishOutput( + projectDir: string, + sourceDir: string, + resultsDir: string, + postComment: boolean, + isPrMode: boolean, + execute: boolean +): Promise { + if (!execute) { + return + } + try { + const problems = parseSarif(`${resultsDir}/${QODANA_SARIF_NAME}`) + const reportUrl = getReportURL(resultsDir) + const coverageInfo = getCoverageStats( + getCoverageFromSarif(`${resultsDir}/${QODANA_SHORT_SARIF_NAME}`) + ) + + const licensesInfo = getLicenseInfo(resultsDir) + + const problemsDescriptions = problems.problemDescriptions ?? [] + const toolName = problems.title.split('found by ')[1] ?? QODANA_CHECK_NAME + problems.summary = getSummary( + toolName, + projectDir, + sourceDir, + problemsDescriptions, + coverageInfo, + licensesInfo.packages, + licensesInfo.licenses, + reportUrl, + isPrMode, + DEPENDENCY_CHARS_LIMIT, + VIEW_REPORT_OPTIONS + ) + + postSummary(problems.summary) + await postResultsToPRComments( + toolName, + sourceDir, + problems.summary, + problemsDescriptions.length != 0, + postComment + ) + } catch (error) { + tl.warning( + `Qodana has problems with publishing results to Azure – ${ + (error as Error).message + }` + ) + } +} + +/* + * The pull request with quick-fixes body template. + */ +export function prFixesBody(jobUrl: string): string { + return ` πŸ– Hey there! + +This pull request has been auto-generated by the [Qodana Scan task](<${jobUrl}>) configured in your repository. +It has performed code analysis and applied some suggested fixes to improve your code quality 🧹✨ + +> **Warning** +> It's crucial to review these changes to ensure everything shipshape manually. Please take a moment to examine the changes here. Remember to run your integration tests against this PR to validate the fixes and ensure everything's functioning as expected. + +_πŸ’»πŸ” Happy reviewing and testing! +Best, +[Qodana Scan πŸ€–](https://marketplace.visualstudio.com/items?itemName=JetBrains.qodana)_` +} diff --git a/vsts/src/utils.ts b/vsts/src/utils.ts index 63cc065f..6198db4a 100644 --- a/vsts/src/utils.ts +++ b/vsts/src/utils.ts @@ -16,7 +16,15 @@ import * as tl from 'azure-pipelines-task-lib/task' import * as tool from 'azure-pipelines-tool-lib' +import {IExecOptions} from 'azure-pipelines-task-lib/toolrunner' +import {Writable} from 'node:stream' +import type {Log} from 'sarif' +import fs from 'fs' +import path from 'path' +import * as GitInterfaces from 'azure-devops-node-api/interfaces/GitInterfaces' + import { + BRANCH, compressFolder, EXECUTABLE, getProcessArchName, @@ -28,14 +36,23 @@ import { getQodanaUrl, Inputs, isNativeMode, + NONE, + PULL_REQUEST, + PushFixesType, sha256sum, + validateBranchName, VERSION } from '../../common/qodana' - -// eslint-disable-next-line @typescript-eslint/no-require-imports -import path = require('path') -import {IExecOptions} from 'azure-pipelines-task-lib/toolrunner' -import {Writable} from 'node:stream' +import { + COMMIT_EMAIL, + COMMIT_USER, + getProblemPlural, + parseResult, + ProblemDescriptor +} from '../../common/output' +import {parseRules} from '../../common/utils' +import {getGitApi} from './gitApiProvider' +import {prFixesBody} from './output' export function setFailed(message: string): void { tl.setResult(tl.TaskResult.Failed, message) @@ -56,17 +73,18 @@ export function getInputs(): Inputs { uploadSarif: tl.getBoolInput('uploadSarif', false), artifactName: tl.getInput('artifactName', false) || 'qodana-report', useNightly: tl.getBoolInput('useNightly', false), - prMode: tl.getBoolInput('prMode', false), + prMode: tl.getBoolInput('prMode', true), + postComment: tl.getBoolInput('postPrComment', false), + pushFixes: tl.getInput('pushFixes', false) || 'none', + commitMessage: + tl.getInput('commitMessage', false) || 'πŸ€– Apply quick-fixes by Qodana', // Not used by the Azure task - postComment: false, additionalCacheKey: '', primaryCacheKey: '', useAnnotations: false, useCaches: false, cacheDefaultBranchOnly: false, - githubToken: '', - pushFixes: 'none', - commitMessage: '' + githubToken: '' } } @@ -208,10 +226,7 @@ async function getPrSha(): Promise { } ) if (output.exitCode === 0) { - const lines = output.stdout.trim().split('\n') - if (lines.length > 1) { - return lines[1].trim() - } + return output.stdout.trim() } } return '' @@ -224,6 +239,12 @@ async function git( return (await gitOutput(args, options)).exitCode } +/** + * Returns trimmed output of git command omitting the command itself + * i.e., if gitOutput(['status']) is called the "/usr/bin/git status" will be omitted + * @param args git arguments + * @param options options for azure-pipelines-task-lib/task exec + */ async function gitOutput( args: string[], options: IExecOptions = {} @@ -252,6 +273,279 @@ async function gitOutput( options.outStream = outStream options.errStream = errStream - result.exitCode = await tl.execAsync('git', args, options) + result.exitCode = await tl.execAsync('git', args, options).catch(error => { + tl.warning(`Failed to run git command with arguments: ${args.join(' ')}`) + throw error + }) + result.stdout = result.stdout + .replace('[command]/usr/bin/git ' + args.join(' '), '') + .trim() + return result +} + +export interface Output { + title: string + summary: string + text: string + problemDescriptions: ProblemDescriptor[] +} + +function getQodanaHelpString(): string { + return `This result was published with [Qodana Task](<${getWorkflowRunUrl()}>)` +} + +export function parseSarif(path: string): Output { + const sarif: Log = JSON.parse( + fs.readFileSync(path, {encoding: 'utf8'}) + ) as Log + const run = sarif.runs[0] + const rules = parseRules(run.tool) + let title = 'No new problems found by ' + let problemDescriptions: ProblemDescriptor[] = [] + if (run.results?.length) { + title = `${run.results.length} ${getProblemPlural( + run.results.length + )} found by ` + problemDescriptions = run.results + .filter( + result => + result.baselineState !== 'unchanged' && + result.baselineState !== 'absent' + ) + .map(result => parseResult(result, rules)) + .filter((a): a is ProblemDescriptor => a !== null && a !== undefined) + } + const name = run.tool.driver.fullName || 'Qodana' + title += name + return { + title, + text: getQodanaHelpString(), + summary: title, + problemDescriptions + } +} + +/** + * Returns the URL to the current pipeline run. + */ +export function getWorkflowRunUrl(): string { + const serverUri = process.env.SYSTEM_TEAMFOUNDATIONSERVERURI + const projectName = process.env.SYSTEM_TEAMPROJECT + const buildId = process.env.BUILD_BUILDID + return `${serverUri}${projectName}/_build/results?buildId=${buildId}` +} + +/** + * Post a new comment to the pull request. + * @param toolName The name of the tool to mention in comment. + * @param sourceDir The analyzed directory inside project + * @param content The comment to post. + * @param hasIssues Indicates whether Qodana found any problems + * @param postComment Whether to post a comment or not. + */ +export async function postResultsToPRComments( + toolName: string, + sourceDir: string, + content: string, + hasIssues: boolean, + postComment: boolean +): Promise { + try { + if (!postComment) { + return + } + // source dir needed in case of monorepo with projects analyzed by the same tool + const comment_tag_pattern = `` + const body = `${content}\n${comment_tag_pattern}` + + const pullRequestId = parseInt( + getVariable('System.PullRequest.PullRequestId'), + 10 + ) + const project = getVariable('System.TeamProject') + const repoId = getVariable('Build.Repository.Id') + const gitApi = await getGitApi() + const {thread, comment} = await findCommentByTag(comment_tag_pattern) + const newComment = { + content: body + } + + if (comment?.id === undefined || thread?.id === undefined) { + const thread: GitInterfaces.CommentThread = { + comments: [newComment], + status: hasIssues + ? GitInterfaces.CommentThreadStatus.Active + : GitInterfaces.CommentThreadStatus.ByDesign + } + await gitApi.createThread(thread, repoId, pullRequestId, project) + } else { + const threadStatusUpdated: GitInterfaces.CommentThread = { + status: hasIssues + ? GitInterfaces.CommentThreadStatus.Active + : GitInterfaces.CommentThreadStatus.ByDesign + } + await gitApi.updateThread( + threadStatusUpdated, + repoId, + pullRequestId, + thread.id, + project + ) + await gitApi.updateComment( + newComment, + repoId, + pullRequestId, + thread.id, + comment.id, + project + ) + } + } catch (error) { + tl.warning(`Failed to post results to comment: ${(error as Error).message}`) + } +} + +/** + * Asynchronously finds a comment on the Azure pull request and returns its ID based on the provided tag. + * + * @param tag The string to be searched for in the comments' body. + * @returns A Promise resolving to the comment and containing thread if found, or undefined for both if not found or an error occurs. + */ +export async function findCommentByTag(tag: string): Promise<{ + thread: GitInterfaces.CommentThread | undefined + comment: GitInterfaces.Comment | undefined +}> { + try { + const gitApi = await getGitApi() + const project = getVariable('System.TeamProject') + const repoId = getVariable('Build.Repository.Id') + const pullRequestId = parseInt( + getVariable('System.PullRequest.PullRequestId'), + 10 + ) + const threads = await gitApi.getThreads(repoId, pullRequestId, project) + for (const thread of threads) { + const comment = thread.comments?.find(comment => + comment.content?.includes(tag) + ) + if (comment != undefined) { + return {thread: thread, comment: comment} + } + } + return {thread: undefined, comment: undefined} + } catch (error) { + tl.debug(`Failed to find comment by tag – ${(error as Error).message}`) + return {thread: undefined, comment: undefined} + } +} + +export function getVariable(name: string): string { + const result = tl.getVariable(name) + if (!result) { + throw new Error(`Variable ${name} is not set`) + } return result } + +export function postSummary(summary: string): void { + const tempDir = getVariable('Agent.TempDirectory') + const filePath = path.join(tempDir, 'Qodana Task Summary.md') + fs.writeFileSync(filePath, summary) + tl.uploadSummary(filePath) +} + +export async function pushQuickFixes( + mode: PushFixesType, + commitMessage: string +): Promise { + if (mode === NONE) { + return + } + try { + const pullRequest = tl.getVariable('Build.Reason') === 'PullRequest' + let currentBranch + if (pullRequest) { + currentBranch = getVariable('System.PullRequest.SourceBranch') + } else { + currentBranch = getVariable('Build.SourceBranch') + } + currentBranch = currentBranch.replace('refs/heads/', '') + currentBranch = validateBranchName(currentBranch) + + const currentCommit = (await gitOutput(['rev-parse', 'HEAD'])).stdout.trim() + await git(['config', 'user.name', COMMIT_USER]) + await git(['config', 'user.email', COMMIT_EMAIL]) + await git(['add', '.']) + let exitCode = await git(['commit', '-m', commitMessage], { + ignoreReturnCode: true + }) + if (exitCode !== 0) { + return + } + exitCode = await git(['pull', '--rebase', 'origin', currentBranch]) + if (exitCode !== 0) { + return + } + if (mode === BRANCH) { + if (pullRequest) { + const commitToCherryPick = ( + await gitOutput(['rev-parse', 'HEAD']) + ).stdout.trim() + await git(['checkout', currentBranch]) + await git(['cherry-pick', commitToCherryPick]) + } + await gitPush(currentBranch) + } else if (mode === PULL_REQUEST) { + const newBranch = `qodana/quick-fixes-${currentCommit.slice(0, 7)}` + await git(['checkout', '-b', newBranch]) + await gitPush(newBranch) + await createPr(commitMessage, currentBranch, newBranch) + } + } catch (error) { + tl.warning(`Failed to push quick fixes – ${(error as Error).message}`) + } +} + +async function gitPush(branch: string): Promise { + const output = await gitOutput(['push', 'origin', branch], { + ignoreReturnCode: true + }) + if (output.exitCode == 1) { + tl.warning( + `Branch ${branch} already exists. Push of quick-fixes was skipped.` + ) + } else if (output.exitCode !== 0) { + tl.warning(`Failed to push branch ${branch}: ${output.stderr}`) + } +} + +async function createPr( + title: string, + base: string, + head: string +): Promise { + // in azure pull request needs refs/heads/ + if (!head.startsWith('refs/heads/')) { + head = 'refs/heads/' + head + } + if (!base.startsWith('refs/heads/')) { + base = 'refs/heads/' + base + } + const description = prFixesBody(getWorkflowRunUrl()) + const gitApi = await getGitApi() + const project = getVariable('System.TeamProject') + const repoId = getVariable('Build.Repository.Id') + const pr: GitInterfaces.GitPullRequest = { + sourceRefName: head, + targetRefName: base, + title: title, + description: description + } + try { + await gitApi.createPullRequest(pr, repoId, project) + } catch (error) { + tl.warning( + `Failed to create pull request ${head} -> ${base}: ${(error as Error).message}` + ) + } +} diff --git a/vsts/vss-extension.dev.json b/vsts/vss-extension.dev.json index c926d6d4..706cf37f 100644 --- a/vsts/vss-extension.dev.json +++ b/vsts/vss-extension.dev.json @@ -2,7 +2,7 @@ "manifestVersion": 1, "id": "qodana-dev", "name": "Qodana (Dev)", - "version": "2024.3.156", + "version": "2024.3.192", "publisher": "JetBrains", "targets": [ {