Commit a12d0b0a authored by Mygod's avatar Mygod

Refine code style

parent 871c83d9
...@@ -10,7 +10,7 @@ buildscript { ...@@ -10,7 +10,7 @@ buildscript {
sdkVersion = 29 sdkVersion = 29
compileSdkVersion = 29 compileSdkVersion = 29
lifecycleVersion = '2.2.0' lifecycleVersion = '2.2.0'
desugarLibsVersion = '1.0.4' desugarLibsVersion = '1.0.5'
junitVersion = '4.13' junitVersion = '4.13'
androidTestVersion = '1.2.0' androidTestVersion = '1.2.0'
androidEspressoVersion = '3.2.0' androidEspressoVersion = '3.2.0'
......
...@@ -24,8 +24,6 @@ import android.app.NotificationChannel ...@@ -24,8 +24,6 @@ import android.app.NotificationChannel
import android.app.NotificationManager import android.app.NotificationManager
import android.app.PendingIntent import android.app.PendingIntent
import android.app.Service import android.app.Service
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.IntentFilter import android.content.IntentFilter
import android.os.IBinder import android.os.IBinder
...@@ -35,7 +33,6 @@ import androidx.annotation.RequiresApi ...@@ -35,7 +33,6 @@ import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import com.crashlytics.android.Crashlytics
import com.github.shadowsocks.Core import com.github.shadowsocks.Core
import com.github.shadowsocks.Core.app import com.github.shadowsocks.Core.app
import com.github.shadowsocks.core.R import com.github.shadowsocks.core.R
......
# https://github.com/arturbosch/detekt/blob/1.5.0/detekt-cli/src/main/resources/default-detekt-config.yml # https://github.com/arturbosch/detekt/blob/1.7.1/detekt-cli/src/main/resources/default-detekt-config.yml
comments: comments:
active: false active: false
...@@ -12,6 +12,7 @@ complexity: ...@@ -12,6 +12,7 @@ complexity:
active: true active: true
threshold: 10 threshold: 10
includeStaticDeclarations: false includeStaticDeclarations: false
includePrivateDeclarations: false
ComplexMethod: ComplexMethod:
active: true active: true
threshold: 15 threshold: 15
...@@ -21,7 +22,7 @@ complexity: ...@@ -21,7 +22,7 @@ complexity:
nestingFunctions: run,let,apply,with,also,use,forEach,isNotNull,ifNull nestingFunctions: run,let,apply,with,also,use,forEach,isNotNull,ifNull
LabeledExpression: LabeledExpression:
active: false active: false
ignoredLabels: "" ignoredLabels: ''
LargeClass: LargeClass:
active: true active: true
threshold: 600 threshold: 600
...@@ -30,8 +31,10 @@ complexity: ...@@ -30,8 +31,10 @@ complexity:
threshold: 60 threshold: 60
LongParameterList: LongParameterList:
active: true active: true
threshold: 6 functionThreshold: 6
constructorThreshold: 7
ignoreDefaultParameters: true ignoreDefaultParameters: true
ignoreDataClasses: true
MethodOverloading: MethodOverloading:
active: false active: false
NestedBlockDepth: NestedBlockDepth:
...@@ -39,14 +42,14 @@ complexity: ...@@ -39,14 +42,14 @@ complexity:
threshold: 4 threshold: 4
StringLiteralDuplication: StringLiteralDuplication:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
threshold: 3 threshold: 3
ignoreAnnotation: true ignoreAnnotation: true
excludeStringsWithLessThan5Characters: true excludeStringsWithLessThan5Characters: true
ignoreStringsRegex: '$^' ignoreStringsRegex: '$^'
TooManyFunctions: TooManyFunctions:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
thresholdInFiles: 11 thresholdInFiles: 11
thresholdInClasses: 11 thresholdInClasses: 11
thresholdInInterfaces: 11 thresholdInInterfaces: 11
...@@ -67,7 +70,7 @@ empty-blocks: ...@@ -67,7 +70,7 @@ empty-blocks:
active: true active: true
EmptyCatchBlock: EmptyCatchBlock:
active: true active: true
allowedExceptionNameRegex: "^(_|(ignore|expected).*)" allowedExceptionNameRegex: '^(_|(ignore|expected).*)'
EmptyClassBlock: EmptyClassBlock:
active: true active: true
EmptyDefaultConstructor: EmptyDefaultConstructor:
...@@ -91,6 +94,8 @@ empty-blocks: ...@@ -91,6 +94,8 @@ empty-blocks:
active: true active: true
EmptySecondaryConstructor: EmptySecondaryConstructor:
active: true active: true
EmptyTryBlock:
active: true
EmptyWhenBlock: EmptyWhenBlock:
active: true active: true
EmptyWhileBlock: EmptyWhileBlock:
...@@ -115,7 +120,7 @@ exceptions: ...@@ -115,7 +120,7 @@ exceptions:
SwallowedException: SwallowedException:
active: true active: true
ignoredExceptionTypes: 'InterruptedException,NumberFormatException,ParseException,MalformedURLException' ignoredExceptionTypes: 'InterruptedException,NumberFormatException,ParseException,MalformedURLException'
allowedExceptionNameRegex: "^(_|(ignore|expected).*)" allowedExceptionNameRegex: '^(_|(ignore|expected).*)'
ThrowingExceptionFromFinally: ThrowingExceptionFromFinally:
active: false active: false
ThrowingExceptionInMain: ThrowingExceptionInMain:
...@@ -127,7 +132,7 @@ exceptions: ...@@ -127,7 +132,7 @@ exceptions:
active: true active: true
TooGenericExceptionCaught: TooGenericExceptionCaught:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
exceptionNames: exceptionNames:
- ArrayIndexOutOfBoundsException - ArrayIndexOutOfBoundsException
- Error - Error
...@@ -137,7 +142,7 @@ exceptions: ...@@ -137,7 +142,7 @@ exceptions:
- IndexOutOfBoundsException - IndexOutOfBoundsException
- RuntimeException - RuntimeException
- Throwable - Throwable
allowedExceptionNameRegex: "^(_|(ignore|expected).*)" allowedExceptionNameRegex: '^(_|(ignore|expected).*)'
TooGenericExceptionThrown: TooGenericExceptionThrown:
active: true active: true
exceptionNames: exceptionNames:
...@@ -166,6 +171,7 @@ formatting: ...@@ -166,6 +171,7 @@ formatting:
FinalNewline: FinalNewline:
active: true active: true
autoCorrect: true autoCorrect: true
insertFinalNewLine: true
ImportOrdering: ImportOrdering:
active: false active: false
Indentation: Indentation:
...@@ -253,37 +259,37 @@ naming: ...@@ -253,37 +259,37 @@ naming:
ClassNaming: ClassNaming:
active: true active: true
classPattern: '[A-Z$][a-zA-Z0-9$]*' classPattern: '[A-Z$][a-zA-Z0-9$]*'
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
ConstructorParameterNaming: ConstructorParameterNaming:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
parameterPattern: '[a-z][A-Za-z0-9]*' parameterPattern: '[a-z][A-Za-z0-9]*'
privateParameterPattern: '[a-z][A-Za-z0-9]*' privateParameterPattern: '[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^' excludeClassPattern: '$^'
ignoreOverridden: true ignoreOverridden: true
EnumNaming: EnumNaming:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*' enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*'
ForbiddenClassName: ForbiddenClassName:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
forbiddenName: '' forbiddenName: ''
FunctionMaxLength: FunctionMaxLength:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
maximumFunctionNameLength: 30 maximumFunctionNameLength: 30
FunctionMinLength: FunctionMinLength:
active: false active: false
FunctionNaming: FunctionNaming:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$' functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
excludeClassPattern: '$^' excludeClassPattern: '$^'
ignoreOverridden: true ignoreOverridden: true
FunctionParameterNaming: FunctionParameterNaming:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
parameterPattern: '[a-z][A-Za-z0-9]*' parameterPattern: '[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^' excludeClassPattern: '$^'
ignoreOverridden: true ignoreOverridden: true
...@@ -292,33 +298,34 @@ naming: ...@@ -292,33 +298,34 @@ naming:
rootPackage: '' rootPackage: ''
MatchingDeclarationName: MatchingDeclarationName:
active: true active: true
mustBeFirst: true
MemberNameEqualsClassName: MemberNameEqualsClassName:
active: false active: false
ObjectPropertyNaming: ObjectPropertyNaming:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
constantPattern: '[A-Za-z][_A-Za-z0-9]*' constantPattern: '[A-Za-z][_A-Za-z0-9]*'
propertyPattern: '[A-Za-z][_A-Za-z0-9]*' propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*' privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*'
PackageNaming: PackageNaming:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
packagePattern: '^[a-z]+(\.[a-z][A-Za-z0-9]*)*$' packagePattern: '^[a-z]+(\.[a-z][A-Za-z0-9]*)*$'
TopLevelPropertyNaming: TopLevelPropertyNaming:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
constantPattern: '[A-Z][_A-Z0-9]*' constantPattern: '[A-Z][_A-Z0-9]*'
propertyPattern: '[A-Za-z][_A-Za-z0-9]*' propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*'
VariableMaxLength: VariableMaxLength:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
maximumVariableNameLength: 64 maximumVariableNameLength: 64
VariableMinLength: VariableMinLength:
active: false active: false
VariableNaming: VariableNaming:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
variablePattern: '[a-z][A-Za-z0-9]*' variablePattern: '[a-z][A-Za-z0-9]*'
privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^' excludeClassPattern: '$^'
...@@ -330,10 +337,10 @@ performance: ...@@ -330,10 +337,10 @@ performance:
active: true active: true
ForEachOnRange: ForEachOnRange:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
SpreadOperator: SpreadOperator:
active: true active: true
excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" excludes: '**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt'
UnnecessaryTemporaryInstantiation: UnnecessaryTemporaryInstantiation:
active: true active: true
...@@ -402,11 +409,11 @@ style: ...@@ -402,11 +409,11 @@ style:
ForbiddenComment: ForbiddenComment:
active: true active: true
values: 'TODO:,FIXME:,STOPSHIP:' values: 'TODO:,FIXME:,STOPSHIP:'
allowedPatterns: "" allowedPatterns: ''
ForbiddenImport: ForbiddenImport:
active: true active: true
imports: '' imports: []
forbiddenPatterns: "" forbiddenPatterns: ''
ForbiddenMethodCall: ForbiddenMethodCall:
active: true active: true
methods: '' methods: ''
...@@ -421,7 +428,7 @@ style: ...@@ -421,7 +428,7 @@ style:
active: true active: true
ignoreOverridableFunction: true ignoreOverridableFunction: true
excludedFunctions: 'describeContents' excludedFunctions: 'describeContents'
excludeAnnotatedFunction: "dagger.Provides" excludeAnnotatedFunction: 'dagger.Provides'
LibraryCodeMustSpecifyReturnType: LibraryCodeMustSpecifyReturnType:
active: true active: true
LoopWithTooManyJumpStatements: LoopWithTooManyJumpStatements:
...@@ -477,8 +484,7 @@ style: ...@@ -477,8 +484,7 @@ style:
UnderscoresInNumericLiterals: UnderscoresInNumericLiterals:
active: false active: false
UnnecessaryAbstractClass: UnnecessaryAbstractClass:
active: true active: false
excludeAnnotatedClasses: "dagger.Module"
UnnecessaryAnnotationUseSiteTarget: UnnecessaryAnnotationUseSiteTarget:
active: true active: true
UnnecessaryApply: UnnecessaryApply:
...@@ -497,7 +503,7 @@ style: ...@@ -497,7 +503,7 @@ style:
active: true active: true
UnusedPrivateMember: UnusedPrivateMember:
active: true active: true
allowedNames: "(_|ignored|expected|serialVersionUID)" allowedNames: '(_|ignored|expected|serialVersionUID)'
UseArrayLiteralsInAnnotations: UseArrayLiteralsInAnnotations:
active: true active: true
UseCheckOrError: UseCheckOrError:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment