Skip to content

Commit

Permalink
SONARKT-348 - Update linter bindings (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaufco authored Jul 17, 2023
1 parent e429d6c commit 194fe73
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 21 deletions.
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ dependencyResolutionManagement {
}

create("utilLibs") {
val detekt = version("detekt", "1.22.0")
val detekt = version("detekt", "1.23.0")
val jcommander = version("jcommander", "1.81")
val ktlint = version("ktlint", "0.49.0")
val ktlint = version("ktlint", "0.49.1")

library("detekt-api", "io.gitlab.arturbosch.detekt", "detekt-api").versionRef(detekt)
library("detekt-cli", "io.gitlab.arturbosch.detekt", "detekt-cli").versionRef(detekt)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,30 @@
"severity": "MAJOR",
"constantDebtMinutes": 5
},
{
"key": "BracesOnIfStatements",
"name": "Braces On If Statements",
"description": "Braces do not comply with the specified policy",
"url": "https://detekt.github.io/detekt/style.html#bracesonifstatements",
"tags": [
"style"
],
"type": "CODE_SMELL",
"severity": "INFO",
"constantDebtMinutes": 5
},
{
"key": "BracesOnWhenStatements",
"name": "Braces On When Statements",
"description": "Braces do not comply with the specified policy",
"url": "https://detekt.github.io/detekt/style.html#bracesonwhenstatements",
"tags": [
"style"
],
"type": "CODE_SMELL",
"severity": "INFO",
"constantDebtMinutes": 5
},
{
"key": "CanBeNonNullable",
"name": "Can Be Non Nullable",
Expand All @@ -83,10 +107,22 @@
"severity": "INFO",
"constantDebtMinutes": 5
},
{
"key": "CastNullableToNonNullableType",
"name": "Cast Nullable To Non Nullable Type",
"description": "Nullable type to non-null type cast is found. Consider using two assertions, `null` assertions and type cast",
"url": "https://detekt.github.io/detekt/potential-bugs.html#castnullabletononnullabletype",
"tags": [
"defect"
],
"type": "CODE_SMELL",
"severity": "CRITICAL",
"constantDebtMinutes": 5
},
{
"key": "CastToNullableType",
"name": "Cast To Nullable Type",
"description": "Disallow to cast to nullable types.",
"description": "Use safe cast instead of unsafe cast to nullable types.",
"url": "https://detekt.github.io/detekt/potential-bugs.html#casttonullabletype",
"tags": [
"defect"
Expand Down Expand Up @@ -311,6 +347,18 @@
"severity": "MAJOR",
"constantDebtMinutes": 5
},
{
"key": "DoubleNegativeLambda",
"name": "Double Negative Lambda",
"description": "Double negative from a function name expressed in the negative (like `takeUnless`) with a lambda block that also contains negation. This is more readable when rewritten using a positive form of the function (like `takeIf`).",
"url": "https://detekt.github.io/detekt/style.html#doublenegativelambda",
"tags": [
"style"
],
"type": "CODE_SMELL",
"severity": "INFO",
"constantDebtMinutes": 5
},
{
"key": "DuplicateCaseInWhenExpression",
"name": "Duplicate Case In When Expression",
Expand Down Expand Up @@ -671,6 +719,18 @@
"severity": "CRITICAL",
"constantDebtMinutes": 5
},
{
"key": "ForbiddenAnnotation",
"name": "Forbidden Annotation",
"description": "Avoid using this annotation.",
"url": "https://detekt.github.io/detekt/style.html#forbiddenannotation",
"tags": [
"style"
],
"type": "CODE_SMELL",
"severity": "INFO",
"constantDebtMinutes": 5
},
{
"key": "ForbiddenClassName",
"name": "Forbidden Class Name",
Expand Down Expand Up @@ -1041,18 +1101,6 @@
"severity": "INFO",
"constantDebtMinutes": 10
},
{
"key": "MandatoryBracesIfStatements",
"name": "Mandatory Braces If Statements",
"description": "Multi-line if statement was found that does not have braces. These braces should be added to improve readability.",
"url": "https://detekt.github.io/detekt/style.html#mandatorybracesifstatements",
"tags": [
"style"
],
"type": "CODE_SMELL",
"severity": "INFO",
"constantDebtMinutes": 5
},
{
"key": "MandatoryBracesLoops",
"name": "Mandatory Braces Loops",
Expand Down Expand Up @@ -1344,7 +1392,7 @@
{
"key": "NullableToStringCall",
"name": "Nullable To String Call",
"description": "This call may return the string \u0026quot;null\u0026quot;",
"description": "`toString()` on nullable receiver may return the string \u0026quot;null\u0026quot;",
"url": "https://detekt.github.io/detekt/potential-bugs.html#nullabletostringcall",
"tags": [
"defect"
Expand Down Expand Up @@ -1473,6 +1521,18 @@
"severity": "MAJOR",
"constantDebtMinutes": 20
},
{
"key": "PropertyUsedBeforeDeclaration",
"name": "Property Used Before Declaration",
"description": "Properties before declaration should not be used.",
"url": "https://detekt.github.io/detekt/potential-bugs.html#propertyusedbeforedeclaration",
"tags": [
"defect"
],
"type": "CODE_SMELL",
"severity": "CRITICAL",
"constantDebtMinutes": 5
},
{
"key": "ProtectedMemberInFinalClass",
"name": "Protected Member In Final Class",
Expand Down Expand Up @@ -1607,7 +1667,7 @@
{
"key": "SerialVersionUIDInSerializableClass",
"name": "Serial Version UIDIn Serializable Class",
"description": "A class which implements the Serializable interface does not define a correct serialVersionUID field. The serialVersionUID field should be a constant long value inside a companion object.",
"description": "A class which implements the Serializable interface does not define a correct serialVersionUID field. The serialVersionUID field should be a private constant long value inside a companion object.",
"url": "https://detekt.github.io/detekt/style.html#serialversionuidinserializableclass",
"tags": [
"warning"
Expand Down Expand Up @@ -1663,6 +1723,29 @@
"severity": "MAJOR",
"constantDebtMinutes": 5
},
{
"key": "StringShouldBeRawString",
"name": "String Should Be Raw String",
"description": "The string can be converted to raw string.",
"url": "https://detekt.github.io/detekt/style.html#stringshouldberawstring",
"tags": [
"style"
],
"type": "CODE_SMELL",
"severity": "INFO",
"constantDebtMinutes": 5
},
{
"key": "SuspendFunSwallowedCancellation",
"name": "Suspend Fun Swallowed Cancellation",
"description": "`runCatching` does not propagate `CancellationException`, don\u0027t use it with `suspend` lambda blocks.",
"tags": [
"minor"
],
"type": "CODE_SMELL",
"severity": "MINOR",
"constantDebtMinutes": 10
},
{
"key": "SuspendFunWithCoroutineScopeReceiver",
"name": "Suspend Fun With Coroutine Scope Receiver",
Expand Down Expand Up @@ -1937,6 +2020,17 @@
"severity": "INFO",
"constantDebtMinutes": 5
},
{
"key": "UnnecessaryBracesAroundTrailingLambda",
"name": "Unnecessary Braces Around Trailing Lambda",
"description": "Braces around trailing lambda is unnecessary.",
"tags": [
"style"
],
"type": "CODE_SMELL",
"severity": "INFO",
"constantDebtMinutes": 5
},
{
"key": "UnnecessaryFilter",
"name": "Unnecessary Filter",
Expand Down Expand Up @@ -2129,6 +2223,18 @@
"severity": "INFO",
"constantDebtMinutes": 5
},
{
"key": "UnusedParameter",
"name": "Unused Parameter",
"description": "Function parameter is unused and should be removed.",
"url": "https://detekt.github.io/detekt/style.html#unusedparameter",
"tags": [
"maintainability"
],
"type": "CODE_SMELL",
"severity": "MAJOR",
"constantDebtMinutes": 5
},
{
"key": "UnusedPrivateClass",
"name": "Unused Private Class",
Expand All @@ -2144,7 +2250,7 @@
{
"key": "UnusedPrivateMember",
"name": "Unused Private Member",
"description": "Private member is unused and should be removed.",
"description": "Private function is unused and should be removed.",
"url": "https://detekt.github.io/detekt/style.html#unusedprivatemember",
"tags": [
"maintainability"
Expand All @@ -2153,6 +2259,18 @@
"severity": "MAJOR",
"constantDebtMinutes": 5
},
{
"key": "UnusedPrivateProperty",
"name": "Unused Private Property",
"description": "Property is unused and should be removed.",
"url": "https://detekt.github.io/detekt/style.html#unusedprivateproperty",
"tags": [
"maintainability"
],
"type": "CODE_SMELL",
"severity": "MAJOR",
"constantDebtMinutes": 5
},
{
"key": "UnusedUnaryOperator",
"name": "Unused Unary Operator",
Expand Down Expand Up @@ -2273,10 +2391,22 @@
"severity": "INFO",
"constantDebtMinutes": 5
},
{
"key": "UseLet",
"name": "Use Let",
"description": "Use `?.let {}` instead of if/else with a null block when checking for nullable values",
"url": "https://detekt.github.io/detekt/style.html#uselet",
"tags": [
"style"
],
"type": "CODE_SMELL",
"severity": "INFO",
"constantDebtMinutes": 5
},
{
"key": "UseOrEmpty",
"name": "Use Or Empty",
"description": "Use `orEmpty()` call instead of `?: emptyList()`",
"description": "Use `orEmpty()` call instead of `?:` with empty collection factory methods",
"url": "https://detekt.github.io/detekt/style.html#useorempty",
"tags": [
"style"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,18 @@
"severity": "MAJOR",
"constantDebtMinutes": 0
},
{
"key": "standard:no-single-line-block-comment",
"name": "No Single Line Block Comment",
"url": "https://ktlint.github.io/#rules",
"tags": [
"ktlint",
"style"
],
"type": "CODE_SMELL",
"severity": "MAJOR",
"constantDebtMinutes": 0
},
{
"key": "standard:no-trailing-spaces",
"name": "No Trailing Spaces",
Expand Down Expand Up @@ -1415,6 +1427,18 @@
"severity": "MAJOR",
"constantDebtMinutes": 0
},
{
"key": "standard:no-single-line-block-comment",
"name": "No Single Line Block Comment",
"url": "https://ktlint.github.io/#rules",
"tags": [
"ktlint",
"style"
],
"type": "CODE_SMELL",
"severity": "MAJOR",
"constantDebtMinutes": 0
},
{
"key": "standard:no-trailing-spaces",
"name": "No Trailing Spaces",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal class DetektRulesDefinitionTest {
assertThat(repository!!.name()).isEqualTo("detekt")
assertThat(repository.language()).isEqualTo("kotlin")
assertThat(repository.isExternal).isTrue
assertThat(repository.rules().size).isEqualTo(204)
assertThat(repository.rules().size).isEqualTo(215)

val classNaming = repository.rule("ClassNaming")
assertThat(classNaming).isNotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class KtlintRulesDefinitionTest {
assertThat(repository.name()).isEqualTo("ktlint")
assertThat(repository.language()).isEqualTo("kotlin")
assertThat(repository.isExternal).isTrue
assertThat(repository.rules().size).isEqualTo(77)
assertThat(repository.rules().size).isEqualTo(78)
val modifierOrder = repository.rule("standard:modifier-order")!!
assertThat(modifierOrder).isNotNull
assertThat(modifierOrder.name()).isEqualTo("Modifier Order")
Expand Down

0 comments on commit 194fe73

Please sign in to comment.