[3.4.0-map-sdk] rules

This commit is contained in:
zhongchao
2023-09-25 19:02:30 +08:00
parent ac5a88aee7
commit 6f96d612c6

View File

@@ -417,15 +417,15 @@ potential-bugs:
CastNullableToNonNullableType: #可空强转null
active: false
ignorePlatformTypes: true
CastToNullableType:
CastToNullableType: #将不安全的强制转换报告为可为null的类型。作为字符串未填充可能被误用为安全类型转换字符串
active: false
CharArrayToStringCall:
active: false
Deprecation:
active: false
DontDowncastCollectionTypes:
DontDowncastCollectionTypes: #检查集合向下类型转换,建议方法转换({list as MutableList} convert : {list.toMutableList()})
active: false
DoubleMutabilityForCollection:
DoubleMutabilityForCollection: #MutableState可变var,不可变建议val
active: true
mutableTypes:
- 'kotlin.collections.MutableList'
@@ -436,19 +436,21 @@ potential-bugs:
- 'java.util.HashSet'
- 'java.util.LinkedHashMap'
- 'java.util.HashMap'
ElseCaseInsteadOfExhaustiveWhen:
ElseCaseInsteadOfExhaustiveWhen: #当表达式包含else大小写时即使它们有一组详尽的大小写该规则也会报告
active: false
ignoredSubjectTypes: []
EqualsAlwaysReturnsTrueOrFalse:
EqualsAlwaysReturnsTrueOrFalse: #报告始终返回true或false的equals方法。
active: true
EqualsWithHashCodeExist:
EqualsWithHashCodeExist: #当一个类重写equals方法时它也应该重写hashCode方法
active: true
ExitOutsideMain:
ExitOutsideMain: #报告主函数之外使用System.exit、Runtime.exit、Runtime.holt和Kotlin的exitProcess时的使用情况
active: false
ExplicitGarbageCollectionCall:
ExplicitGarbageCollectionCall: #报告所有显式触发垃圾回收器的调用。代码应该独立于垃圾收集器工作并且不应该要求在某些时间点触发GC。
active: true
HasPlatformType:
HasPlatformType: #必须在公共API中显式声明平台类型以防止出现意外错误
active: true
#此规则对使用@CheckReturnValue或@CheckResult注释的函数返回值但未以任何方式使用该值的实例发出警告Kotlin编译器通常不会对这种情况发出警告所以这就是该规则背后的基本原理。
IgnoredReturnValue:
active: true
restrictToConfig: true
@@ -465,31 +467,31 @@ potential-bugs:
- 'kotlinx.coroutines.flow.*Flow'
- 'java.util.stream.*Stream'
ignoreFunctionCall: []
ImplicitDefaultLocale:
active: true
ImplicitUnitReturnType:
ImplicitDefaultLocale: #格式化字符串或执行大小写转换时,更喜欢显式传递[java.util.Locale],而不是使用隐式默认值
active: false
ImplicitUnitReturnType: #使用表达式语句的函数具有隐式返回类型
active: false
allowExplicitReturnType: true
InvalidRange:
InvalidRange: #报告为空的范围
active: true
IteratorHasNextCallsNextMethod:
IteratorHasNextCallsNextMethod: #验证Iterator接口的实现。Iterator实现的hasNext方法不应该有任何副作用
active: true
IteratorNotThrowingNoSuchElementException:
IteratorNotThrowingNoSuchElementException: #报告在next方法的实现中不抛出NoSuchElementException的Iterator接口的实现。当没有更多的元素要返回时迭代器应该抛出NoSuchElementException
active: true
LateinitUsage:
LateinitUsage: #报告Late-init修饰符的用法。
active: false
excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
ignoreOnClassesPattern: ''
MapGetWithNotNullAssertionOperator:
MapGetWithNotNullAssertionOperator: #使用非null断言运算符报告对map访问方法map[]或map.get的调用。这可能会导致NullPointerException
active: true
MissingPackageDeclaration:
MissingPackageDeclaration: #当缺少包声明时报告
active: false
excludes: ['**/*.kts']
NullCheckOnMutableProperty:
NullCheckOnMutableProperty: #规则已弃用,因为编译器默认执行此检查,当主题是枚举或密封类时,以及当表达式用作语句时,启用此规则可标记未检查是否覆盖所有事例的表达式
active: false
NullableToStringCall:
NullableToStringCall: #报告对可变属性的null检查因为这些属性的值可以在执行if语句后更改从而使null检查无效
active: false
PropertyUsedBeforeDeclaration:
PropertyUsedBeforeDeclaration: #
active: false
UnconditionalJumpStatementInLoop:
active: false