From bd69fd5815ca253c664d7ae2ec2bee3e569689b7 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 8 Oct 2020 14:42:44 +0200 Subject: [PATCH] Check copyright mention SDK side: we need Matrix copyright and not Element copyright on SDK source files. Next step should be to ensure that the copyright is present --- tools/check/check_code_quality.sh | 11 ++++++- tools/check/forbidden_strings_in_code_sdk.txt | 29 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 tools/check/forbidden_strings_in_code_sdk.txt diff --git a/tools/check/check_code_quality.sh b/tools/check/check_code_quality.sh index 8f850734fc..e855440e81 100755 --- a/tools/check/check_code_quality.sh +++ b/tools/check/check_code_quality.sh @@ -75,6 +75,15 @@ ${searchForbiddenStringsScript} ./tools/check/forbidden_strings_in_code.txt \ resultForbiddenStringInCode=$? +echo +echo "Search for forbidden patterns specific for SDK code..." + +${searchForbiddenStringsScript} ./tools/check/forbidden_strings_in_code_sdk.txt \ + ./matrix-sdk-android/src \ + ./matrix-sdk-android-rx/src + +resultForbiddenStringInCodeSdk=$? + echo echo "Search for forbidden patterns in resources..." @@ -148,7 +157,7 @@ fi echo -if [[ ${resultNbOfDrawable} -eq 0 ]] && [[ ${resultForbiddenStringInCode} -eq 0 ]] && [[ ${resultForbiddenStringInResource} -eq 0 ]] && [[ ${resultLongFiles} -eq 0 ]] && [[ ${resultPngInDrawable} -eq 0 ]]; then +if [[ ${resultNbOfDrawable} -eq 0 ]] && [[ ${resultForbiddenStringInCode} -eq 0 ]] && [[ ${resultForbiddenStringInCodeSdk} -eq 0 ]] && [[ ${resultForbiddenStringInResource} -eq 0 ]] && [[ ${resultLongFiles} -eq 0 ]] && [[ ${resultPngInDrawable} -eq 0 ]]; then echo "MAIN OK" else echo "❌ MAIN ERROR" diff --git a/tools/check/forbidden_strings_in_code_sdk.txt b/tools/check/forbidden_strings_in_code_sdk.txt new file mode 100644 index 0000000000..9907c68080 --- /dev/null +++ b/tools/check/forbidden_strings_in_code_sdk.txt @@ -0,0 +1,29 @@ +# +# Copyright 2020 New Vector Ltd +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# 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 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This file list String which are not allowed in source code. +# Use Perl regex to write forbidden strings +# Note: line cannot start with a space. Use \s instead. +# It is possible to specify an authorized number of occurrence with === suffix. Default is 0 +# Example: +# AuthorizedStringThreeTimes===3 + +# Extension:java +# Extension:kt + +### "The Matrix.org Foundation C.I.C." copyright is required on this file, and not "New Vector Ltd" +New Vector Ltd +