diff --git a/OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/ui/selectline/SelectLineView.kt b/OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/ui/selectline/SelectLineView.kt index 5620c12797..c67afd2964 100644 --- a/OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/ui/selectline/SelectLineView.kt +++ b/OCH/charter/passenger/src/main/java/com/mogo/och/charter/passenger/ui/selectline/SelectLineView.kt @@ -46,8 +46,6 @@ import org.greenrobot.eventbus.EventBus */ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallback { - private val TAG = "OrderInfoView" - constructor(context: Context) : super(context) constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet) @@ -101,7 +99,7 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb rlv_line_list.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) rlv_line_list.addItemDecoration( - com.mogo.och.charter.passenger.ui.selectline.layoutmanage.BottomDecoration( + BottomDecoration( AutoSizeUtils.dp2px(context, 60f) ) ) @@ -110,7 +108,7 @@ class SelectLineView : ConstraintLayout, SelectLineViewModel.SelectLineViewCallb rv_site_list.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) rv_site_list.addItemDecoration( - com.mogo.och.charter.passenger.ui.selectline.layoutmanage.BottomDecoration( + BottomDecoration( AutoSizeUtils.dp2px(context, 90f) ) ) diff --git a/OCH/taxi/passenger/src/main/java/com/mogo/och/taxi/passenger/ui/video/InfoVideoView.kt b/OCH/taxi/passenger/src/main/java/com/mogo/och/taxi/passenger/ui/video/InfoVideoView.kt index d8212bac16..e521cfbc50 100644 --- a/OCH/taxi/passenger/src/main/java/com/mogo/och/taxi/passenger/ui/video/InfoVideoView.kt +++ b/OCH/taxi/passenger/src/main/java/com/mogo/och/taxi/passenger/ui/video/InfoVideoView.kt @@ -61,7 +61,7 @@ internal class InfoVideoView @JvmOverloads constructor( "蘑菇车联之红旗车队" )) add( - com.mogo.och.taxi.passenger.bean.TaxiPassengerVideoPlay( + TaxiPassengerVideoPlay( "https://img.zhidaohulian.com/fileServer/online_car_hailing/1655708499497/大运会合作解说版.m4v", "https://img.zhidaohulian.com/fileServer/online_car_hailing/1655969536177/大运会.png", "蘑菇车联牵手成都大运会" @@ -79,7 +79,7 @@ internal class InfoVideoView @JvmOverloads constructor( fun exitFullScreenMode(resetVideoPlayer: Boolean) { val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager - val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager) + val (_: Int, player) = getPlayer(carouselLayoutManager) player?.let { it.exitFullScreenMode() it.onVideoPause() @@ -100,7 +100,7 @@ internal class InfoVideoView @JvmOverloads constructor( return } val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager - val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager) + val (_: Int, player) = getPlayer(carouselLayoutManager) when (visibility) { View.VISIBLE -> { player?.let { @@ -218,7 +218,7 @@ internal class InfoVideoView @JvmOverloads constructor( override fun onWindowFocusChanged(hasWindowFocus: Boolean) { super.onWindowFocusChanged(hasWindowFocus) val carouselLayoutManager = rvVideoPlaylist?.layoutManager as CarouselLayoutManager - val (centerItemPosition: Int, player) = getPlayer(carouselLayoutManager) + val (_: Int, player) = getPlayer(carouselLayoutManager) player?.let { if(it.isInPlayingState&&!it.isIfCurrentIsFullscreen&&!hasWindowFocus){ player.onVideoPause() diff --git a/app/src/main/java/com/mogo/launcher/lancet/MainBlockCheck.kt b/app/src/main/java/com/mogo/launcher/lancet/MainBlockCheck.kt index 8fd39e4280..14b4401f1a 100644 --- a/app/src/main/java/com/mogo/launcher/lancet/MainBlockCheck.kt +++ b/app/src/main/java/com/mogo/launcher/lancet/MainBlockCheck.kt @@ -19,7 +19,6 @@ import com.mogo.eagle.core.block.runtime.config.recorder.* import com.mogo.eagle.core.block.runtime.utils.TimeUtils.Companion.now import com.mogo.eagle.core.function.call.devatools.* import com.mogo.eagle.core.utilcode.util.* -import kotlinx.coroutines.* import kotlinx.coroutines.Runnable import java.lang.ref.WeakReference import java.util.LinkedList diff --git a/build.gradle b/build.gradle index 190f5f0714..40ba76905b 100644 --- a/build.gradle +++ b/build.gradle @@ -74,14 +74,14 @@ allprojects { } if (isCodeInspectEnable ) { - def basePath = new File(codequality, 'code_inspect_increment.gradle').path - apply from: "$basePath" - def pmdPath = new File(codequality, 'pmd.gradle').path - apply from: "$pmdPath" +// def basePath = new File(codequality, 'code_inspect_increment.gradle').path +// apply from: "$basePath" +// def pmdPath = new File(codequality, 'pmd.gradle').path +// apply from: "$pmdPath" def detektPath = new File(codequality, 'detekt.gradle').path apply from: "$detektPath" - def codeInspectPath = new File(codequality, 'code_inspect.gradle').path - apply from: "$codeInspectPath" +// def codeInspectPath = new File(codequality, 'code_inspect.gradle').path +// apply from: "$codeInspectPath" } } diff --git a/codequality/code_inspect.gradle b/codequality/code_inspect.gradle index ab96a4c056..2853f3d1f0 100644 --- a/codequality/code_inspect.gradle +++ b/codequality/code_inspect.gradle @@ -1,6 +1,6 @@ task runCodeInspect { group = "codeInspect" - description = "静态代码检查,统一触发pmd detekt lint任务" + description = "静态代码检查,统一触发pmd detekt任务" } project.afterEvaluate { diff --git a/codequality/custom-pmd-ruleset.xml b/codequality/custom-pmd-ruleset.xml index 835269cdce..884a4702e7 100644 --- a/codequality/custom-pmd-ruleset.xml +++ b/codequality/custom-pmd-ruleset.xml @@ -25,8 +25,6 @@ - - @@ -44,9 +42,7 @@ - - - + diff --git a/codequality/detekt.gradle b/codequality/detekt.gradle index dffe686e12..1129174a38 100644 --- a/codequality/detekt.gradle +++ b/codequality/detekt.gradle @@ -4,20 +4,18 @@ def pmdConfigPath = rootProject.file("codequality").path detekt { toolVersion = "1.15.0" - input = objects.fileCollection().from( - "src/main/kotlin", + input = files( "src/main/java", "src/jinlvvan/java", - "src/jinlvvan/kotlin", - "src/driverm1/java", - "src/driverm1/kotlin" + "src/driverm1/java" ) + //将配置文件应用于detekt的默认配置文件之上 + buildUponDefaultConfig = true //规则集 config.setFrom("${pmdConfigPath}/detekt.yml") //指定基准文件。在detekt的后续运行中,所有发现都存储在此文件中 - baseline = file("${pmdConfigPath}/baseline.xml") - //将配置文件应用于detekt的默认配置文件之上 - buildUponDefaultConfig = true +// baseline = file("${pmdConfigPath}/baseline.xml") + // Android: Don't create tasks for the specified build types (e.g. "release") // ignoredBuildTypes = ["release"] @@ -27,13 +25,15 @@ detekt { // ignoredVariants = ["productionRelease"] } -tasks.detekt.jvmTarget = "1.8" +tasks.detekt.jvmTarget = "1.11" tasks.named("detekt").configure { reports { // Enable/Disable HTML report (default: true) - def destination = new File(new File("${project.rootProject.buildDir.path}/reports/detekt"), "${project.name}-detekt.html") -// html.required.set(true) -// html.outputLocation.set(destination) + html { + enabled = true + // Path where HTML report will be stored (default: `build/reports/detekt/detekt.html`) + destination = new File(new File("${project.rootProject.buildDir.path}/reports/detekt"), "${project.name}-detekt.html") + } } } diff --git a/codequality/detekt.yml b/codequality/detekt.yml index 73af812f49..492f87f811 100644 --- a/codequality/detekt.yml +++ b/codequality/detekt.yml @@ -4,9 +4,9 @@ build: config: validation: true warningsAsErrors: false - checkExhaustiveness: false +# checkExhaustiveness: false # when writing own rules with new properties, exclude the property path e.g.: 'my_rule_set,.*>.*>[my_property]' - excludes: '' + excludes: 'custom-checks.*' processors: active: true @@ -49,24 +49,24 @@ comments: AbsentOrWrongFileLicense: #报告每个没有所需许可证标头的Kotlin源文件 active: false licenseTemplateFile: 'license.template' - licenseTemplateIsRegex: false +# licenseTemplateIsRegex: false CommentOverPrivateFunction: #报告private函数的注释和文档 active: false CommentOverPrivateProperty: #报告私有属性的注释和文档 active: false - DeprecatedBlockTag: #报告注释中使用@deprecated块标记,可以使用@ReplaceWith annotations - active: false +# DeprecatedBlockTag: #报告注释中使用@deprecated块标记,可以使用@ReplaceWith annotations +# active: false EndOfSentenceFormat: #验证KDoc注释的第一句话的结尾 active: false endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)' - KDocReferencesNonPublicProperty: #报告任何引用类的非公共属性的KDoc注释 - active: false +# KDocReferencesNonPublicProperty: #报告任何引用类的非公共属性的KDoc注释 +# active: false excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] - OutdatedDocumentation: #报告任何具有与声明签名不匹配的KDoc的类、函数或构造函数 - active: false - matchTypeParameters: true - matchDeclarationsOrder: true - allowParamOnConstructorProperties: false +# OutdatedDocumentation: #报告任何具有与声明签名不匹配的KDoc的类、函数或构造函数 +# active: false +# matchTypeParameters: true +# matchDeclarationsOrder: true +# allowParamOnConstructorProperties: false UndocumentedPublicClass: #报告没有所需文档的公共类、对象和接口 active: false excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] @@ -74,101 +74,101 @@ comments: searchInInnerClass: true searchInInnerObject: true searchInInnerInterface: true - searchInProtectedClass: false +# searchInProtectedClass: false UndocumentedPublicFunction: #报告任何没有所需文档的公共方法 active: false excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] - searchProtectedFunction: false +# searchProtectedFunction: false UndocumentedPublicProperty: #报告任何没有所需文档的公共字段 active: false excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] - searchProtectedProperty: false +# searchProtectedProperty: false complexity: active: true - CognitiveComplexMethod: #报告复杂方法 - active: false - allowedComplexity: 15 +# CognitiveComplexMethod: #报告复杂方法 +# active: false +# allowedComplexity: 15 ComplexCondition: #报告复杂条件 active: false - allowedConditions: 4 +# allowedConditions: 4 ComplexInterface: #包含太多函数和/或属性的复杂接口表明该接口一次处理太多事情。接口应该遵循单一责任原则,以鼓励该接口的实现不要同时处理太多事情 active: false - allowedDefinitions: 10 +# allowedDefinitions: 10 includeStaticDeclarations: false includePrivateDeclarations: false - ignoreOverloaded: false +# ignoreOverloaded: false #该规则使用McCabe的循环复杂性(MCC)度量来测量函数源代码中线性独立路径的数量{https://www.ndepend.com/docs/code-metrics#CC} - CyclomaticComplexMethod: #复杂的方法很难理解和阅读。复杂方法的副作用可能并不明显。更喜欢把复杂的方法分解成更小的方法,这样更容易理解。较小的方法也可以命名得更清晰,从而提高代码的可读性。 - active: true - allowedComplexity: 14 - ignoreSingleWhenExpression: false - ignoreSimpleWhenEntries: false - ignoreNestingFunctions: false - ignoreLocalFunctions: false - nestingFunctions: - - 'also' - - 'apply' - - 'forEach' - - 'isNotNull' - - 'ifNull' - - 'let' - - 'run' - - 'use' - - 'with' +# CyclomaticComplexMethod: #复杂的方法很难理解和阅读。复杂方法的副作用可能并不明显。更喜欢把复杂的方法分解成更小的方法,这样更容易理解。较小的方法也可以命名得更清晰,从而提高代码的可读性。 +# active: true +# allowedComplexity: 14 +# ignoreSingleWhenExpression: false +# ignoreSimpleWhenEntries: false +# ignoreNestingFunctions: false +# ignoreLocalFunctions: false +# nestingFunctions: +# - 'also' +# - 'apply' +# - 'forEach' +# - 'isNotNull' +# - 'ifNull' +# - 'let' +# - 'run' +# - 'use' +# - 'with' LabeledExpression: #报告已标记的表达式 active: false ignoredLabels: [] LargeClass: #报告大型类 active: true - allowedLines: 600 +# allowedLines: 600 LongMethod: #报告大方法 active: true - allowedLines: 60 +# allowedLines: 60 LongParameterList: #报告参数超过特定阈值的函数和构造函数。 active: true - allowedFunctionParameters: 6 - allowedConstructorParameters: 15 +# allowedFunctionParameters: 6 +# allowedConstructorParameters: 15 ignoreDefaultParameters: false ignoreDataClasses: true - ignoreAnnotatedParameter: [] +# ignoreAnnotatedParameter: [] MethodOverloading: #报告经常重载的方法 active: false - allowedOverloads: 6 +# allowedOverloads: 6 NamedArguments: #报告参数超过某个阈值且全部未命名的函数调用。参数过多的调用更难理解,因此命名参数会有所帮助。 active: false - allowedArguments: 3 - ignoreArgumentsMatchingNames: false +# allowedArguments: 3 +# ignoreArgumentsMatchingNames: false NestedBlockDepth: #报告函数中嵌套深度过大 active: true - allowedDepth: 4 - NestedScopeFunctions: #避免嵌套作用域函数 - active: false - allowedDepth: 1 - functions: - - 'kotlin.apply' - - 'kotlin.run' - - 'kotlin.with' - - 'kotlin.let' - - 'kotlin.also' +# allowedDepth: 4 +# NestedScopeFunctions: #避免嵌套作用域函数 +# active: false +# allowedDepth: 1 +# functions: +# - 'kotlin.apply' +# - 'kotlin.run' +# - 'kotlin.with' +# - 'kotlin.let' +# - 'kotlin.also' ReplaceSafeCallChainWithRun: #不可为null的类型上的安全调用链是冗余的,可以通过将冗余的安全调用封装在run{}块中来删除 {xxx?.run} active: false StringLiteralDuplication: #规则检测并报告重复的字符串文字 active: false excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] - allowedDuplications: 2 +# allowedDuplications: 2 ignoreAnnotation: true - allowedWithLengthLessThan: 5 +# allowedWithLengthLessThan: 5 ignoreStringsRegex: '$^' TooManyFunctions: #此规则报告包含过多函数的文件、类、接口、对象和枚举。每个元素可以配置有不同的阈值。 active: true excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] - allowedFunctionsPerFile: 11 - allowedFunctionsPerClass: 11 - allowedFunctionsPerInterface: 11 - allowedFunctionsPerObject: 11 - allowedFunctionsPerEnum: 11 +# allowedFunctionsPerFile: 11 +# allowedFunctionsPerClass: 11 +# allowedFunctionsPerInterface: 11 +# allowedFunctionsPerObject: 11 +# allowedFunctionsPerEnum: 11 ignoreDeprecated: false ignorePrivate: false ignoreOverridden: false @@ -178,20 +178,20 @@ coroutines: active: true GlobalCoroutineUsage: active: false - InjectDispatcher: #始终使用依赖项注入来注入调度器,以便于测试 - active: true - dispatcherNames: - - 'IO' - - 'Default' - - 'Unconfined' +# InjectDispatcher: #始终使用依赖项注入来注入调度器,以便于测试 +# active: true +# dispatcherNames: +# - 'IO' +# - 'Default' +# - 'Unconfined' RedundantSuspendModifier: #suspend修饰符只能在需要的地方使用,否则该函数只能从其他挂起函数中使用。这不必要地限制了函数的使用,应该通过删除不需要的suspend修饰符来避免 active: true - SleepInsteadOfDelay: #报告Thread.sleep在挂起函数和协同程序块中的使用情况。由于协程的轻量级性质,一个线程可以同时包含多个协程,因此如果一个协程调用thread.sleep,它可能会停止执行不相关的协程,并导致不可预测的行为。 - active: true - SuspendFunSwallowedCancellation: #不应在runCatching的lambda块内部调用suspend函数 - active: false - SuspendFunWithCoroutineScopeReceiver: #将CoroutineScope用作接收器的挂起函数不应标记为挂起。 - active: false +# SleepInsteadOfDelay: #报告Thread.sleep在挂起函数和协同程序块中的使用情况。由于协程的轻量级性质,一个线程可以同时包含多个协程,因此如果一个协程调用thread.sleep,它可能会停止执行不相关的协程,并导致不可预测的行为。 +# active: true +# SuspendFunSwallowedCancellation: #不应在runCatching的lambda块内部调用suspend函数 +# active: false +# SuspendFunWithCoroutineScopeReceiver: #将CoroutineScope用作接收器的挂起函数不应标记为挂起。 +# active: false SuspendFunWithFlowReturnType: #从kotlin.coroutines.Flow返回Flow的函数不应标记为挂起,简单地调用一个返回Flow的函数的行为不应该有任何副作用。只有当针对返回的Flow开始收集时,才应该实际完成工作。 active: true @@ -220,8 +220,8 @@ empty-blocks: active: true EmptyInitBlock: #报告为空的init块。空代码块没有任何作用,应该删除 active: true - EmptyKotlinFile: #报告为空的kotlin文件。空代码块没有任何作用,应该删除 - active: true +# EmptyKotlinFile: #报告为空的kotlin文件。空代码块没有任何作用,应该删除 +# active: true EmptySecondaryConstructor: #报告为空的辅助构造函数。空代码块没有任何作用,应该删除 active: true EmptyTryBlock: #报告为空的try块。空代码块没有任何作用,应该删除 @@ -245,8 +245,8 @@ exceptions: excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] NotImplementedDeclaration: #此规则报告引发的所有NotImplementedError类型的异常。它还报告所有TODO(..)函数。这表明功能仍在开发中,无法正常工作。这两种声明都只能作为临时声明,不应放入生产环境中 active: false - ObjectExtendsThrowable: #避免抛出单例Throwable - active: false +# ObjectExtendsThrowable: #避免抛出单例Throwable +# active: false PrintStackTrace: #打印堆栈 active: true RethrowCaughtException: #重新抛出异常 @@ -304,9 +304,9 @@ exceptions: naming: active: true - BooleanPropertyNaming: - active: false - allowedPattern: '^(is|has|are)' +# BooleanPropertyNaming: +# active: false +# allowedPattern: '^(is|has|are)' ClassNaming: active: true classPattern: '[A-Z][a-zA-Z0-9]*' @@ -321,12 +321,12 @@ naming: ForbiddenClassName: active: false forbiddenName: [] - FunctionNameMaxLength: - active: false - maximumFunctionNameLength: 30 - FunctionNameMinLength: - active: false - minimumFunctionNameLength: 3 +# FunctionNameMaxLength: +# active: false +# maximumFunctionNameLength: 30 +# FunctionNameMinLength: +# active: false +# minimumFunctionNameLength: 3 FunctionNaming: active: true excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] @@ -339,29 +339,29 @@ naming: InvalidPackageDeclaration: active: true rootPackage: '' - requireRootInDeclaration: false - LambdaParameterNaming: - active: false - parameterPattern: '[a-z][A-Za-z0-9]*|_' +# requireRootInDeclaration: false +# LambdaParameterNaming: +# active: false +# parameterPattern: '[a-z][A-Za-z0-9]*|_' MatchingDeclarationName: active: true mustBeFirst: true - multiplatformTargets: - - 'ios' - - 'android' - - 'js' - - 'jvm' - - 'native' - - 'iosArm64' - - 'iosX64' - - 'macosX64' - - 'mingwX64' - - 'linuxX64' +# multiplatformTargets: +# - 'ios' +# - 'android' +# - 'js' +# - 'jvm' +# - 'native' +# - 'iosArm64' +# - 'iosX64' +# - 'macosX64' +# - 'mingwX64' +# - 'linuxX64' MemberNameEqualsClassName: active: true ignoreOverridden: true - NoNameShadowing: - active: true +# NoNameShadowing: +# active: true NonBooleanPropertyPrefixedWithIs: active: false ObjectPropertyNaming: @@ -393,58 +393,58 @@ performance: active: true ArrayPrimitive: #使用Array<Primitive>会导致隐含拳击和性能打击。更喜欢使用Kotlin专用的数组实例 active: true - CouldBeSequence: #由于每个调用都会创建一个新的列表,因此长链的收集操作将带来性能损失。请考虑使用序列 - active: false - allowedOperations: 2 +# CouldBeSequence: #由于每个调用都会创建一个新的列表,因此长链的收集操作将带来性能损失。请考虑使用序列 +# active: false +# allowedOperations: 2 ForEachOnRange: #在一个范围内使用forEach可能会产生巨大的性能成本。因此,在大多数情况下,应该使用简单的for循环 (for example: {(1..10).forEach}) active: true excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] SpreadOperator: #在大多数情况下,使用排列运算符会导致在调用方法之前创建数组的完整副本。这会带来非常高的性能损失 active: true excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] - UnnecessaryPartOfBinaryExpression: #仅在表达式仅使用以下运算符之一||或&&的情况下验证二进制表达式 - active: false +# UnnecessaryPartOfBinaryExpression: #仅在表达式仅使用以下运算符之一||或&&的情况下验证二进制表达式 +# active: false UnnecessaryTemporaryInstantiation: #将基元类型转换为字符串时,请避免使用临时对象。与直接使用基元类型相比,这会降低性能。若要解决此问题,请删除包装类型 active: true #潜在错误规则集提供了检测潜在错误的规则。 potential-bugs: active: true - AvoidReferentialEquality: #检查平等 - active: true - forbiddenTypePatterns: - - 'kotlin.String' - CastNullableToNonNullableType: #可空强转null - active: false - ignorePlatformTypes: true - CastToNullableType: #将不安全的强制转换报告为可为null的类型。作为字符串?未填充,可能被误用为安全类型转换(如?字符串) - active: false - CharArrayToStringCall: - active: false +# AvoidReferentialEquality: #检查平等 +# active: true +# forbiddenTypePatterns: +# - 'kotlin.String' +# CastNullableToNonNullableType: #可空强转null +# active: false +# ignorePlatformTypes: true +# CastToNullableType: #将不安全的强制转换报告为可为null的类型。作为字符串?未填充,可能被误用为安全类型转换(如?字符串) +# active: false +# CharArrayToStringCall: +# active: false Deprecation: active: false - DontDowncastCollectionTypes: #检查集合向下类型转换,建议方法转换({list as MutableList} convert : {list.toMutableList()}) - active: false - DoubleMutabilityForCollection: #MutableState可变var,不可变建议val - active: true - mutableTypes: - - 'kotlin.collections.MutableList' - - 'kotlin.collections.MutableMap' - - 'kotlin.collections.MutableSet' - - 'java.util.ArrayList' - - 'java.util.LinkedHashSet' - - 'java.util.HashSet' - - 'java.util.LinkedHashMap' - - 'java.util.HashMap' - ElseCaseInsteadOfExhaustiveWhen: #当表达式包含else大小写时,即使它们有一组详尽的大小写,该规则也会报告 - active: false - ignoredSubjectTypes: [] +# DontDowncastCollectionTypes: #检查集合向下类型转换,建议方法转换({list as MutableList} convert : {list.toMutableList()}) +# active: false +# DoubleMutabilityForCollection: #MutableState可变var,不可变建议val +# active: true +# mutableTypes: +# - 'kotlin.collections.MutableList' +# - 'kotlin.collections.MutableMap' +# - 'kotlin.collections.MutableSet' +# - 'java.util.ArrayList' +# - 'java.util.LinkedHashSet' +# - 'java.util.HashSet' +# - 'java.util.LinkedHashMap' +# - 'java.util.HashMap' +# ElseCaseInsteadOfExhaustiveWhen: #当表达式包含else大小写时,即使它们有一组详尽的大小写,该规则也会报告 +# active: false +# ignoredSubjectTypes: [] EqualsAlwaysReturnsTrueOrFalse: #报告始终返回true或false的equals()方法。 active: true EqualsWithHashCodeExist: #当一个类重写equals()方法时,它也应该重写hashCode()方法 active: true - ExitOutsideMain: #报告主函数之外使用System.exit()、Runtime.exit()、Runtime.holt()和Kotlin的exitProcess()时的使用情况 - active: false +# ExitOutsideMain: #报告主函数之外使用System.exit()、Runtime.exit()、Runtime.holt()和Kotlin的exitProcess()时的使用情况 +# active: false ExplicitGarbageCollectionCall: #报告所有显式触发垃圾回收器的调用。代码应该独立于垃圾收集器工作,并且不应该要求在某些时间点触发GC。 active: true HasPlatformType: #必须在公共API中显式声明平台类型,以防止出现意外错误 @@ -452,21 +452,21 @@ potential-bugs: #此规则对使用@CheckReturnValue或@CheckResult注释的函数返回值但未以任何方式使用该值的实例发出警告Kotlin编译器通常不会对这种情况发出警告,所以这就是该规则背后的基本原理。 IgnoredReturnValue: - active: true - restrictToConfig: true + active: false +# restrictToConfig: true returnValueAnnotations: - 'CheckResult' - '*.CheckResult' - 'CheckReturnValue' - '*.CheckReturnValue' - ignoreReturnValueAnnotations: - - 'CanIgnoreReturnValue' - - '*.CanIgnoreReturnValue' - returnValueTypes: - - 'kotlin.sequences.Sequence' - - 'kotlinx.coroutines.flow.*Flow' - - 'java.util.stream.*Stream' - ignoreFunctionCall: [] +# ignoreReturnValueAnnotations: +# - 'CanIgnoreReturnValue' +# - '*.CanIgnoreReturnValue' +# returnValueTypes: +# - 'kotlin.sequences.Sequence' +# - 'kotlinx.coroutines.flow.*Flow' +# - 'java.util.stream.*Stream' +# ignoreFunctionCall: [] ImplicitDefaultLocale: #格式化字符串或执行大小写转换时,更喜欢显式传递[java.util.Locale],而不是使用隐式默认值 active: false ImplicitUnitReturnType: #使用表达式语句的函数具有隐式返回类型 @@ -484,25 +484,25 @@ potential-bugs: ignoreOnClassesPattern: '' MapGetWithNotNullAssertionOperator: #使用非null断言运算符报告对map访问方法map[]或map.get()的调用!!。这可能会导致NullPointerException active: true - MissingPackageDeclaration: #当缺少包声明时报告 - active: false - excludes: ['**/*.kts'] - NullCheckOnMutableProperty: #报告对可变属性的null检查,因为这些属性的值可以在执行if语句后更改,从而使null检查无效 - active: false +# MissingPackageDeclaration: #当缺少包声明时报告 +# active: false +# excludes: ['**/*.kts'] +# NullCheckOnMutableProperty: #报告对可变属性的null检查,因为这些属性的值可以在执行if语句后更改,从而使null检查无效 +# active: false NullableToStringCall: #使用可能返回字符串“null”的可为null的接收器报告toString()调用 active: false - PropertyUsedBeforeDeclaration: #报告在声明之前使用的属性 - active: false +# PropertyUsedBeforeDeclaration: #报告在声明之前使用的属性 +# active: false UnconditionalJumpStatementInLoop: #报告包含跳转语句的循环,这些语句在任何条件下都会跳转 active: false - UnnecessaryNotNullCheck: #使用requireNotNull或checkNotNull报告用户可以删除的不必要的非null检查。 - active: false +# UnnecessaryNotNullCheck: #使用requireNotNull或checkNotNull报告用户可以删除的不必要的非null检查。 +# active: false UnnecessaryNotNullOperator: #报告用户可以删除的不必要的非null运算符用法(!!) active: true UnnecessarySafeCall: #报告用户可以删除的不必要的非null运算符用法(?) active: true - UnreachableCatchBlock: #报告无法访问的捕获块。如果在上面的块中已经捕获到异常,则捕获块可能无法访问(Exception or Throwable)catch顺序 - active: true +# UnreachableCatchBlock: #报告无法访问的捕获块。如果在上面的块中已经捕获到异常,则捕获块可能无法访问(Exception or Throwable)catch顺序 +# active: true UnreachableCode: #报告无法访问的代码。代码可能无法访问,因为它位于return、throw、continue或break表达式后面 active: true UnsafeCallOnNullableType: #报告对可为null的类型的不安全调用 @@ -510,8 +510,8 @@ potential-bugs: excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] UnsafeCast: #报告不安全的强制转换 active: true - UnusedUnaryOperator: #检测未使用的一元运算符 - active: true +# UnusedUnaryOperator: #检测未使用的一元运算符 +# active: true UselessPostfixExpression: #报告未使用因而不必要的后缀表达式(++,--) active: true WrongEqualsTypeParameter: #报告接受错误类型参数的equals()方法 @@ -520,25 +520,25 @@ potential-bugs: #{link https://detekt.dev/docs/rules/style#explicititlambdaparameter} style: active: true - AbstractClassCanBeConcreteClass: - active: true - AbstractClassCanBeInterface: - active: true - AlsoCouldBeApply: - active: false - BracesOnIfStatements: - active: false - singleLine: 'never' - multiLine: 'always' - BracesOnWhenStatements: - active: false - singleLine: 'necessary' - multiLine: 'consistent' - CanBeNonNullable: - active: false - CascadingCallWrapping: - active: false - includeElvis: true +# AbstractClassCanBeConcreteClass: +# active: true +# AbstractClassCanBeInterface: +# active: true +# AlsoCouldBeApply: +# active: false +# BracesOnIfStatements: +# active: false +# singleLine: 'never' +# multiLine: 'always' +# BracesOnWhenStatements: +# active: false +# singleLine: 'necessary' +# multiLine: 'consistent' +# CanBeNonNullable: +# active: false +# CascadingCallWrapping: +# active: false +# includeElvis: true ClassOrdering: active: false CollapsibleIfStatements: @@ -547,22 +547,22 @@ style: active: false conversionFunctionPrefix: - 'to' - allowOperators: false +# allowOperators: false DataClassShouldBeImmutable: active: false - DestructuringDeclarationWithTooManyEntries: - active: false - maxDestructuringEntries: 3 - DoubleNegativeLambda: - active: false - negativeFunctions: - - reason: 'Use `takeIf` instead.' - value: 'takeUnless' - - reason: 'Use `all` instead.' - value: 'none' - negativeFunctionNameParts: - - 'not' - - 'non' +# DestructuringDeclarationWithTooManyEntries: +# active: false +# maxDestructuringEntries: 3 +# DoubleNegativeLambda: +# active: false +# negativeFunctions: +# - reason: 'Use `takeIf` instead.' +# value: 'takeUnless' +# - reason: 'Use `all` instead.' +# value: 'none' +# negativeFunctionNameParts: +# - 'not' +# - 'non' EqualsNullCall: active: true EqualsOnSignatureLine: @@ -574,32 +574,32 @@ style: ExpressionBodySyntax: active: false includeLineWrapping: false - ForbiddenAnnotation: - active: false - annotations: - - reason: 'it is a java annotation. Use `Suppress` instead.' - value: 'java.lang.SuppressWarnings' - - reason: 'it is a java annotation. Use `kotlin.Deprecated` instead.' - value: 'java.lang.Deprecated' - - reason: 'it is a java annotation. Use `kotlin.annotation.MustBeDocumented` instead.' - value: 'java.lang.annotation.Documented' - - reason: 'it is a java annotation. Use `kotlin.annotation.Target` instead.' - value: 'java.lang.annotation.Target' - - reason: 'it is a java annotation. Use `kotlin.annotation.Retention` instead.' - value: 'java.lang.annotation.Retention' - - reason: 'it is a java annotation. Use `kotlin.annotation.Repeatable` instead.' - value: 'java.lang.annotation.Repeatable' - - reason: 'Kotlin does not support @Inherited annotation, see https://youtrack.jetbrains.com/issue/KT-22265' - value: 'java.lang.annotation.Inherited' +# ForbiddenAnnotation: +# active: false +# annotations: +# - reason: 'it is a java annotation. Use `Suppress` instead.' +# value: 'java.lang.SuppressWarnings' +# - reason: 'it is a java annotation. Use `kotlin.Deprecated` instead.' +# value: 'java.lang.Deprecated' +# - reason: 'it is a java annotation. Use `kotlin.annotation.MustBeDocumented` instead.' +# value: 'java.lang.annotation.Documented' +# - reason: 'it is a java annotation. Use `kotlin.annotation.Target` instead.' +# value: 'java.lang.annotation.Target' +# - reason: 'it is a java annotation. Use `kotlin.annotation.Retention` instead.' +# value: 'java.lang.annotation.Retention' +# - reason: 'it is a java annotation. Use `kotlin.annotation.Repeatable` instead.' +# value: 'java.lang.annotation.Repeatable' +# - reason: 'Kotlin does not support @Inherited annotation, see https://youtrack.jetbrains.com/issue/KT-22265' +# value: 'java.lang.annotation.Inherited' ForbiddenComment: active: false - comments: - - reason: 'Forbidden FIXME todo marker in comment, please fix the problem.' - value: 'FIXME:' - - reason: 'Forbidden STOPSHIP todo marker in comment, please address the problem before shipping the code.' - value: 'STOPSHIP:' - - reason: 'Forbidden TODO todo marker in comment, please do the changes.' - value: 'TODO:' +# comments: +# - reason: 'Forbidden FIXME todo marker in comment, please fix the problem.' +# value: 'FIXME:' +# - reason: 'Forbidden STOPSHIP todo marker in comment, please address the problem before shipping the code.' +# value: 'STOPSHIP:' +# - reason: 'Forbidden TODO todo marker in comment, please do the changes.' +# value: 'TODO:' allowedPatterns: '' ForbiddenImport: active: false @@ -612,9 +612,9 @@ style: value: 'kotlin.io.print' - reason: 'println does not allow you to configure the output stream. Use a logger instead.' value: 'kotlin.io.println' - ForbiddenSuppress: - active: false - rules: [] +# ForbiddenSuppress: +# active: false +# rules: [] ForbiddenVoid: active: true ignoreOverridden: false @@ -622,7 +622,7 @@ style: FunctionOnlyReturningConstant: active: true ignoreOverridableFunction: true - ignoreActualFunction: true +# ignoreActualFunction: true excludedFunctions: [] LoopWithTooManyJumpStatements: active: true @@ -644,41 +644,41 @@ style: ignoreNamedArgument: true ignoreEnums: false ignoreRanges: false - ignoreExtensionFunctions: true +# ignoreExtensionFunctions: true MandatoryBracesLoops: active: false - MaxChainedCallsOnSameLine: - active: false - maxChainedCalls: 5 +# MaxChainedCallsOnSameLine: +# active: false +# maxChainedCalls: 5 MaxLineLength: active: true maxLineLength: 120 excludePackageStatements: true excludeImportStatements: true excludeCommentStatements: false - excludeRawStrings: true - MayBeConstant: - active: true +# excludeRawStrings: true +# MayBeConstant: +# active: true ModifierOrder: active: true - MultilineLambdaItParameter: - active: false - MultilineRawStringIndentation: - active: false - indentSize: 4 - trimmingMethods: - - 'trimIndent' - - 'trimMargin' +# MultilineLambdaItParameter: +# active: false +# MultilineRawStringIndentation: +# active: false +# indentSize: 4 +# trimmingMethods: +# - 'trimIndent' +# - 'trimMargin' NestedClassesVisibility: #嵌套类从父类继承其可见性,通常用于实现嵌套在其中的类的本地功能。这些嵌套类的可见性不能高于其父类 active: true NewLineAtEndOfFile: active: true NoTabs: active: false - NullableBooleanCheck: - active: false - ObjectLiteralToLambda: #除了实现单个方法之外什么都不做的匿名对象可以用作lambda。 - active: true +# NullableBooleanCheck: +# active: false +# ObjectLiteralToLambda: #除了实现单个方法之外什么都不做的匿名对象可以用作lambda。 +# active: true OptionalAbstractKeyword: active: true OptionalUnit: @@ -687,8 +687,8 @@ style: active: false ProtectedMemberInFinalClass: active: true - RangeUntilInsteadOfRangeTo: - active: false +# RangeUntilInsteadOfRangeTo: +# active: false RedundantExplicitType: active: false RedundantHigherOrderMapUsage: @@ -707,61 +707,61 @@ style: active: true SerialVersionUIDInSerializableClass: active: true - SpacingAfterPackageDeclaration: - active: false - StringShouldBeRawString: - active: false - maxEscapedCharacterCount: 2 - ignoredCharacters: [] +# SpacingAfterPackageDeclaration: +# active: false +# StringShouldBeRawString: +# active: false +# maxEscapedCharacterCount: 2 +# ignoredCharacters: [] ThrowsCount: #限制函数中抛出语句的数量,函数应该有明确的throw语句 active: true max: 2 - excludeGuardClauses: false +# excludeGuardClauses: false TrailingWhitespace: active: false - TrimMultilineRawString: - active: false - trimmingMethods: - - 'trimIndent' - - 'trimMargin' +# TrimMultilineRawString: +# active: false +# trimmingMethods: +# - 'trimIndent' +# - 'trimMargin' UnderscoresInNumericLiterals: active: false - acceptableLength: 4 - allowNonStandardGrouping: false +# acceptableLength: 4 +# allowNonStandardGrouping: false UnnecessaryAnnotationUseSiteTarget: active: false UnnecessaryApply: active: true - UnnecessaryBackticks: - active: false - UnnecessaryBracesAroundTrailingLambda: - active: false - UnnecessaryFilter: - active: true +# UnnecessaryBackticks: +# active: false +# UnnecessaryBracesAroundTrailingLambda: +# active: false +# UnnecessaryFilter: +# active: true UnnecessaryInheritance: #此规则报告不必要的超类型 active: true - UnnecessaryInnerClass: - active: false +# UnnecessaryInnerClass: +# active: false UnnecessaryLet: active: false UnnecessaryParentheses: active: false - allowForUnclearPrecedence: false - UnusedImport: - active: false - UnusedParameter: - active: true - allowedNames: 'ignored|expected' +# allowForUnclearPrecedence: false +# UnusedImport: +# active: false +# UnusedParameter: +# active: true +# allowedNames: 'ignored|expected' UnusedPrivateClass: active: true UnusedPrivateMember: active: true allowedNames: '' - UnusedPrivateProperty: - active: true - allowedNames: '_|ignored|expected|serialVersionUID' - UseAnyOrNoneInsteadOfFind: - active: true +# UnusedPrivateProperty: +# active: true +# allowedNames: '_|ignored|expected|serialVersionUID' +# UseAnyOrNoneInsteadOfFind: +# active: true UseArrayLiteralsInAnnotations: active: true UseCheckNotNull: @@ -777,26 +777,26 @@ style: active: false UseIfInsteadOfWhen: active: false - ignoreWhenContainingVariableDeclaration: false - UseIsNullOrEmpty: - active: true - UseLet: - active: false - UseOrEmpty: - active: true +# ignoreWhenContainingVariableDeclaration: false +# UseIsNullOrEmpty: +# active: true +# UseLet: +# active: false +# UseOrEmpty: +# active: true UseRequire: active: true UseRequireNotNull: active: true - UseSumOfInsteadOfFlatMapSize: - active: false +# UseSumOfInsteadOfFlatMapSize: +# active: false UselessCallOnNotNull: active: true UtilityClassWithPublicConstructor: active: true VarCouldBeVal: active: true - ignoreLateinitVar: false +# ignoreLateinitVar: false WildcardImport: active: true excludeImports: diff --git a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleVideoPlayer.kt b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleVideoPlayer.kt index 5aece47920..c89a65f341 100644 --- a/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleVideoPlayer.kt +++ b/core/mogo-core-res/src/main/java/com/mogo/eagle/core/widget/media/video/NoticeSimpleVideoPlayer.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.widget.media.video +import android.annotation.SuppressLint import android.content.Context import android.os.Build import android.util.AttributeSet @@ -212,6 +213,7 @@ class NoticeSimpleVideoPlayer : StandardGSYVideoPlayer { } } + @SuppressLint("ObsoleteSdkInt") override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { super.onSizeChanged(w, h, oldw, oldh) if (!mIfCurrentIsFullscreen) { diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/koom/KoomInitTask.kt b/foudations/mogo-commons/src/main/java/com/mogo/commons/koom/KoomInitTask.kt index f442e7e573..1d0a46ea0c 100644 --- a/foudations/mogo-commons/src/main/java/com/mogo/commons/koom/KoomInitTask.kt +++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/koom/KoomInitTask.kt @@ -1,5 +1,6 @@ package com.mogo.commons.koom +import android.annotation.SuppressLint import android.app.Application import android.os.Build import com.kwai.koom.base.CommonConfig @@ -8,6 +9,7 @@ import com.kwai.koom.base.MonitorManager object KoomInitTask : InitTask { + @SuppressLint("ObsoleteSdkInt") override fun init(application: Application) { val config = CommonConfig.Builder() .setApplication(application) // Set application diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b850a7a179..050b1a2bf7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri Sep 22 11:53:55 CST 2023 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME