[3.4.0-map-sdk] rules change
This commit is contained in:
@@ -245,16 +245,16 @@ exceptions:
|
|||||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
|
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
|
||||||
NotImplementedDeclaration: #此规则报告引发的所有NotImplementedError类型的异常。它还报告所有TODO(..)函数。这表明功能仍在开发中,无法正常工作。这两种声明都只能作为临时声明,不应放入生产环境中
|
NotImplementedDeclaration: #此规则报告引发的所有NotImplementedError类型的异常。它还报告所有TODO(..)函数。这表明功能仍在开发中,无法正常工作。这两种声明都只能作为临时声明,不应放入生产环境中
|
||||||
active: false
|
active: false
|
||||||
ObjectExtendsThrowable: #
|
ObjectExtendsThrowable: #避免抛出单例Throwable
|
||||||
active: false
|
active: false
|
||||||
PrintStackTrace:
|
PrintStackTrace: #打印堆栈
|
||||||
active: true
|
active: true
|
||||||
RethrowCaughtException:
|
RethrowCaughtException: #重新抛出异常
|
||||||
active: true
|
active: true
|
||||||
ReturnFromFinally:
|
ReturnFromFinally: # finally return
|
||||||
active: true
|
active: true
|
||||||
ignoreLabeled: false
|
ignoreLabeled: false
|
||||||
SwallowedException:
|
SwallowedException: #报告所有捕获异常且未正确传递(例如作为原因)到新引发异常的实例
|
||||||
active: true
|
active: true
|
||||||
ignoredExceptionTypes:
|
ignoredExceptionTypes:
|
||||||
- 'InterruptedException'
|
- 'InterruptedException'
|
||||||
@@ -262,11 +262,11 @@ exceptions:
|
|||||||
- 'NumberFormatException'
|
- 'NumberFormatException'
|
||||||
- 'ParseException'
|
- 'ParseException'
|
||||||
allowedExceptionNameRegex: '_|(ignore|expected).*'
|
allowedExceptionNameRegex: '_|(ignore|expected).*'
|
||||||
ThrowingExceptionFromFinally:
|
ThrowingExceptionFromFinally: #报告从finally块抛出异常
|
||||||
active: true
|
active: true
|
||||||
ThrowingExceptionInMain:
|
ThrowingExceptionInMain: #报告在主方法中引发的所有异常。只有当异常可以由“更高”的函数处理时,才应该抛出异常
|
||||||
active: false
|
active: false
|
||||||
ThrowingExceptionsWithoutMessageOrCause:
|
ThrowingExceptionsWithoutMessageOrCause: #报告在没有参数或进一步描述的情况下抛出的所有异常
|
||||||
active: true
|
active: true
|
||||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
|
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
|
||||||
exceptions:
|
exceptions:
|
||||||
@@ -279,9 +279,9 @@ exceptions:
|
|||||||
- 'NullPointerException'
|
- 'NullPointerException'
|
||||||
- 'RuntimeException'
|
- 'RuntimeException'
|
||||||
- 'Throwable'
|
- 'Throwable'
|
||||||
ThrowingNewInstanceOfSameException:
|
ThrowingNewInstanceOfSameException: #异常不应封装在同一异常类型中,然后重新抛出。更喜欢用更有意义的异常类型包装异常
|
||||||
active: true
|
active: true
|
||||||
TooGenericExceptionCaught:
|
TooGenericExceptionCaught: #规则为类型过于通用的异常报告捕获块。最好捕获当前处理的案例的特定异常,避免扩大区域
|
||||||
active: true
|
active: true
|
||||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
|
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
|
||||||
exceptionNames:
|
exceptionNames:
|
||||||
@@ -294,7 +294,7 @@ exceptions:
|
|||||||
- 'RuntimeException'
|
- 'RuntimeException'
|
||||||
- 'Throwable'
|
- 'Throwable'
|
||||||
allowedExceptionNameRegex: '_|(ignore|expected).*'
|
allowedExceptionNameRegex: '_|(ignore|expected).*'
|
||||||
TooGenericExceptionThrown:
|
TooGenericExceptionThrown: #规则报告类型过于通用的抛出异常。对于当前发生的情况,最好抛出特定的异常
|
||||||
active: true
|
active: true
|
||||||
exceptionNames:
|
exceptionNames:
|
||||||
- 'Error'
|
- 'Error'
|
||||||
@@ -391,29 +391,30 @@ naming:
|
|||||||
|
|
||||||
performance:
|
performance:
|
||||||
active: true
|
active: true
|
||||||
ArrayPrimitive:
|
ArrayPrimitive: #使用Array<Primitive>会导致隐含拳击和性能打击。更喜欢使用Kotlin专用的数组实例
|
||||||
active: true
|
active: true
|
||||||
CouldBeSequence:
|
CouldBeSequence: #由于每个调用都会创建一个新的列表,因此长链的收集操作将带来性能损失。请考虑使用序列
|
||||||
active: false
|
active: false
|
||||||
allowedOperations: 2
|
allowedOperations: 2
|
||||||
ForEachOnRange:
|
ForEachOnRange: #在一个范围内使用forEach可能会产生巨大的性能成本。因此,在大多数情况下,应该使用简单的for循环 (for example: {(1..10).forEach})
|
||||||
active: true
|
active: true
|
||||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
|
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
|
||||||
SpreadOperator:
|
SpreadOperator: #在大多数情况下,使用排列运算符会导致在调用方法之前创建数组的完整副本。这会带来非常高的性能损失
|
||||||
active: true
|
active: true
|
||||||
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
|
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
|
||||||
UnnecessaryPartOfBinaryExpression:
|
UnnecessaryPartOfBinaryExpression: #仅在表达式仅使用以下运算符之一||或&&的情况下验证二进制表达式
|
||||||
active: false
|
active: false
|
||||||
UnnecessaryTemporaryInstantiation:
|
UnnecessaryTemporaryInstantiation: #将基元类型转换为字符串时,请避免使用临时对象。与直接使用基元类型相比,这会降低性能。若要解决此问题,请删除包装类型
|
||||||
active: true
|
active: true
|
||||||
|
|
||||||
|
#潜在错误规则集提供了检测潜在错误的规则。
|
||||||
potential-bugs:
|
potential-bugs:
|
||||||
active: true
|
active: true
|
||||||
AvoidReferentialEquality:
|
AvoidReferentialEquality: #检查平等
|
||||||
active: true
|
active: true
|
||||||
forbiddenTypePatterns:
|
forbiddenTypePatterns:
|
||||||
- 'kotlin.String'
|
- 'kotlin.String'
|
||||||
CastNullableToNonNullableType:
|
CastNullableToNonNullableType: #可空强转null
|
||||||
active: false
|
active: false
|
||||||
ignorePlatformTypes: true
|
ignorePlatformTypes: true
|
||||||
CastToNullableType:
|
CastToNullableType:
|
||||||
|
|||||||
Reference in New Issue
Block a user