diff --git a/.gitignore b/.gitignore index 775172ba3e9e2b286aa0f357b00726ecbe482b87..32c05826db786662d41f3dd63f2699ab9fdcdc95 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ testdata/ local.properties uninstall.bat +lint-results.txt diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8957a8239a16b55152967df64441fd1556b2b1b5..56486fe598936afca1e0d92bb4db29b8224c4f65 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest" stages: - update-from-upstream + - lint - build before_script: @@ -9,6 +10,12 @@ before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle - chmod +x ./gradlew +lint: + stage: lint + script: + - chmod +x check_lint.sh + - ./check_lint.sh + cache: key: ${CI_PROJECT_ID} paths: diff --git a/check_lint.sh b/check_lint.sh new file mode 100755 index 0000000000000000000000000000000000000000..e2b3df9719ff817f11725ff15130aa310bbad5de --- /dev/null +++ b/check_lint.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +./gradlew lint > lint-results.txt + +# Check if "Multiple substitutions specified" or "StringFormatMatches" exist in the lint results +grep -qE "Multiple substitutions specified|StringFormatMatches" lint-results.txt + +GREP_STATUS=$? + +if [ $GREP_STATUS -eq 0 ]; then + echo "Test Failed: Lint issues found (Multiple substitutions or String format match)" + exit 1 +else + echo "Test Passed: No lint issues found" + exit 0 +fi