diff --git a/app/build.gradle b/app/build.gradle index 47df812..81a6717 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,11 +63,11 @@ tasks.whenTaskAdded { task -> dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation "androidx.preference:preference:1.1.0-rc01" - implementation 'com.github.shadowsocks:plugin:1.3.1' - implementation 'com.takisoft.preferencex:preferencex-simplemenu:1.0.0' + implementation 'androidx.preference:preference:1.1.0' + implementation 'com.github.shadowsocks:plugin:1.3.3' + implementation 'com.takisoft.preferencex:preferencex-simplemenu:1.1.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" - testImplementation 'junit:junit:4.12' + testImplementation 'junit:junit:4.13' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' } diff --git a/app/src/main/go/v2ray-plugin b/app/src/main/go/v2ray-plugin index c7017f4..ca36119 160000 --- a/app/src/main/go/v2ray-plugin +++ b/app/src/main/go/v2ray-plugin @@ -1 +1 @@ -Subproject commit c7017f45bb1e12cf1e4b739bcb8f42f3eb8b22cd +Subproject commit ca361195f584f3904c9440ac012bd4e8611f7b52 diff --git a/build.gradle b/build.gradle index 1cbc68e..3009a20 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'com.github.ben-manes.versions' buildscript { ext { - kotlinVersion = '1.3.50' + kotlinVersion = '1.3.61' minSdkVersion = 21 } repositories { @@ -12,8 +12,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' - classpath 'com.github.ben-manes:gradle-versions-plugin:0.22.0' + classpath 'com.android.tools.build:gradle:3.5.3' + classpath 'com.github.ben-manes:gradle-versions-plugin:0.27.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" } } diff --git a/detekt.yml b/detekt.yml index da4088d..857213e 100644 --- a/detekt.yml +++ b/detekt.yml @@ -1,5 +1,4 @@ -# https://github.com/arturbosch/detekt/blob/RC9.2/detekt-cli/src/main/resources/default-detekt-config.yml -autoCorrect: true +# https://github.com/arturbosch/detekt/blob/1.3.1/detekt-cli/src/main/resources/default-detekt-config.yml comments: active: false @@ -15,16 +14,20 @@ complexity: includeStaticDeclarations: false ComplexMethod: active: true - threshold: 10 + threshold: 15 ignoreSingleWhenExpression: false + ignoreSimpleWhenEntries: false + ignoreNestingFunctions: false + nestingFunctions: run,let,apply,with,also,use,forEach,isNotNull,ifNull LabeledExpression: active: false + ignoredLabels: "" LargeClass: active: true - threshold: 150 + threshold: 600 LongMethod: active: true - threshold: 20 + threshold: 60 LongParameterList: active: true threshold: 6 @@ -36,12 +39,14 @@ complexity: threshold: 4 StringLiteralDuplication: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" threshold: 3 ignoreAnnotation: true excludeStringsWithLessThan5Characters: true ignoreStringsRegex: '$^' TooManyFunctions: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" thresholdInFiles: 11 thresholdInClasses: 11 thresholdInInterfaces: 11 @@ -49,6 +54,7 @@ complexity: thresholdInEnums: 11 ignoreDeprecated: true ignorePrivate: false + ignoreOverridden: true empty-blocks: active: true @@ -69,7 +75,7 @@ empty-blocks: active: true EmptyFunctionBlock: active: true - ignoreOverriddenFunctions: false + ignoreOverriddenFunctions: true EmptyIfBlock: active: true EmptyInitBlock: @@ -89,7 +95,7 @@ exceptions: active: true methodNames: 'toString,hashCode,equals,finalize' InstanceOfCheckForException: - active: true + active: false NotImplementedDeclaration: active: true PrintStackTrace: @@ -98,8 +104,11 @@ exceptions: active: false ReturnFromFinally: active: true + ignoreLabeled: true SwallowedException: active: true + ignoredExceptionTypes: 'InterruptedException,NumberFormatException,ParseException,MalformedURLException' + allowedExceptionNameRegex: "^(_|(ignore|expected).*)" ThrowingExceptionFromFinally: active: false ThrowingExceptionInMain: @@ -111,6 +120,7 @@ exceptions: active: true TooGenericExceptionCaught: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" exceptionNames: - ArrayIndexOutOfBoundsException - Error @@ -133,6 +143,9 @@ formatting: active: true android: true autoCorrect: true + AnnotationOnSeparateLine: + active: true + autoCorrect: true ChainWrapping: active: true autoCorrect: true @@ -155,6 +168,9 @@ formatting: ModifierOrdering: active: true autoCorrect: true + MultiLineIfElse: + active: true + autoCorrect: true NoBlankLineBeforeRbrace: active: true autoCorrect: true @@ -164,8 +180,6 @@ formatting: NoEmptyClassBody: active: true autoCorrect: true - NoItParamInMultilineLambda: - active: true NoLineBreakAfterElse: active: true autoCorrect: true @@ -188,6 +202,9 @@ formatting: autoCorrect: true NoWildcardImports: active: false + PackageName: + active: true + autoCorrect: true ParameterListWrapping: active: false SpacingAroundColon: @@ -199,12 +216,18 @@ formatting: SpacingAroundCurly: active: true autoCorrect: true + SpacingAroundDot: + active: true + autoCorrect: true SpacingAroundKeyword: active: true autoCorrect: true SpacingAroundOperators: active: true autoCorrect: true + SpacingAroundParens: + active: true + autoCorrect: true SpacingAroundRangeOperator: active: true autoCorrect: true @@ -217,56 +240,74 @@ naming: ClassNaming: active: true classPattern: '[A-Z$][a-zA-Z0-9$]*' + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" ConstructorParameterNaming: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" parameterPattern: '[a-z][A-Za-z0-9]*' privateParameterPattern: '[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' + ignoreOverridden: true EnumNaming: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*' ForbiddenClassName: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" forbiddenName: '' FunctionMaxLength: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" maximumFunctionNameLength: 30 FunctionMinLength: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" minimumFunctionNameLength: 3 FunctionNaming: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$' excludeClassPattern: '$^' ignoreOverridden: true FunctionParameterNaming: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" parameterPattern: '[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' + ignoreOverriddenFunctions: true + InvalidPackageDeclaration: + active: true + rootPackage: '' MatchingDeclarationName: active: true MemberNameEqualsClassName: active: false ObjectPropertyNaming: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" constantPattern: '[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: active: true - packagePattern: '^[a-z]+(\.[a-z][a-z0-9]*)*$' + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" + packagePattern: '^[a-z]+(\.[a-z][A-Za-z0-9]*)*$' TopLevelPropertyNaming: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" constantPattern: '[A-Z][_A-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: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" maximumVariableNameLength: 64 VariableMinLength: active: false VariableNaming: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" variablePattern: '[a-z][A-Za-z0-9]*' privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' @@ -274,15 +315,21 @@ naming: performance: active: true + ArrayPrimitive: + active: true ForEachOnRange: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" SpreadOperator: active: true + excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt" UnnecessaryTemporaryInstantiation: active: true potential-bugs: active: true + Deprecation: + active: true DuplicateCaseInWhenExpression: active: true EqualsAlwaysReturnsTrueOrFalse: @@ -291,6 +338,10 @@ potential-bugs: active: true ExplicitGarbageCollectionCall: active: true + HasPlatformType: + active: true + ImplicitDefaultLocale: + active: true InvalidRange: active: true IteratorHasNextCallsNextMethod: @@ -299,12 +350,18 @@ potential-bugs: active: true LateinitUsage: active: false + MapGetWithNotNullAssertionOperator: + active: true + MissingWhenCase: + active: false + RedundantElseInWhen: + active: true UnconditionalJumpStatementInLoop: active: true UnreachableCode: active: true UnsafeCallOnNullableType: - active: false + active: true UnsafeCast: active: false UselessPostfixExpression: @@ -318,23 +375,42 @@ style: active: true DataClassContainsFunctions: active: false + DataClassShouldBeImmutable: + active: false EqualsNullCall: active: true + EqualsOnSignatureLine: + active: true + ExplicitItLambdaParameter: + active: true ExpressionBodySyntax: active: true includeLineWrapping: false ForbiddenComment: active: true values: 'TODO:,FIXME:,STOPSHIP:' + allowedPatterns: "" ForbiddenImport: active: true imports: '' + forbiddenPatterns: "" + ForbiddenMethodCall: + active: true + methods: '' + ForbiddenPublicDataClass: + active: true + ignorePackages: '*.internal,*.internal.*' ForbiddenVoid: active: true + ignoreOverridden: true + ignoreUsageInGenerics: false FunctionOnlyReturningConstant: active: true ignoreOverridableFunction: true excludedFunctions: 'describeContents' + excludeAnnotatedFunction: "dagger.Provides" + LibraryCodeMustSpecifyReturnType: + active: true LoopWithTooManyJumpStatements: active: true maxJumpCount: 1 @@ -363,11 +439,13 @@ style: OptionalUnit: active: true OptionalWhenBraces: - active: true + active: false PreferToOverPairSyntax: active: false ProtectedMemberInFinalClass: active: true + RedundantExplicitType: + active: true RedundantVisibilityModifierRule: active: true ReturnCount: @@ -383,9 +461,15 @@ style: max: 2 TrailingWhitespace: active: true + UnderscoresInNumericLiterals: + active: false UnnecessaryAbstractClass: active: true excludeAnnotatedClasses: "dagger.Module" + UnnecessaryAnnotationUseSiteTarget: + active: true + UnnecessaryApply: + active: true UnnecessaryInheritance: active: true UnnecessaryLet: @@ -396,14 +480,26 @@ style: active: true UnusedImports: active: true + UnusedPrivateClass: + active: true UnusedPrivateMember: active: true allowedNames: "(_|ignored|expected|serialVersionUID)" + UseArrayLiteralsInAnnotations: + active: true + UseCheckOrError: + active: true UseDataClass: active: false + UseIfInsteadOfWhen: + active: false + UseRequire: + active: true + UselessCallOnNotNull: + active: true UtilityClassWithPublicConstructor: active: true VarCouldBeVal: - active: false + active: true WildcardImport: active: false diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf..cc4fdc2 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8d58bda..31a0802 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index b0d6d0a..2fe81a7 100755 --- a/gradlew +++ b/gradlew @@ -7,7 +7,7 @@ # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -125,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` @@ -154,19 +154,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -175,14 +175,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 15e1ee3..24467a1 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -5,7 +5,7 @@ @rem you may not use this file except in compliance with the License. @rem You may obtain a copy of the License at @rem -@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem https://www.apache.org/licenses/LICENSE-2.0 @rem @rem Unless required by applicable law or agreed to in writing, software @rem distributed under the License is distributed on an "AS IS" BASIS,