[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] enable useful lint checks, which will fail the build



commit b2c7bf0d7bf319dd0af3019acf09ef54d132c015
Author: Hans-Christoph Steiner <hans@xxxxxxx>
Date:   Wed Dec 18 13:47:05 2019 +0100

    enable useful lint checks, which will fail the build
---
 .gitlab-ci.yml            |  2 +-
 app/build.gradle          | 10 +++++++---
 lint.xml                  | 40 ++++++++++++++++++++++++++++++++++++++++
 orbotservice/build.gradle |  9 ++++++++-
 4 files changed, 56 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index e1b5f0d1..5885626b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -33,7 +33,7 @@ stages:
 assembleDebug:
   stage: build
   script:
-    - ./gradlew assembleDebug
+    - ./gradlew assembleDebug lint
   artifacts:
     paths:
     - app/build/outputs/
diff --git a/app/build.gradle b/app/build.gradle
index d0602012..b7210836 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -52,9 +52,13 @@ android {
     }
     lintOptions {
         checkReleaseBuilds false
-        // Or, if you prefer, you can continue to check for errors in release builds,
-        // but continue the build even when errors are found:
-        abortOnError false
+        abortOnError true
+
+        htmlReport true
+        xmlReport false
+        textReport false
+
+        lintConfig file("../lint.xml")
     }
     buildTypes {
         release {
diff --git a/lint.xml b/lint.xml
new file mode 100644
index 00000000..4d732fdb
--- /dev/null
+++ b/lint.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<lint>
+    <!-- Our translations are crowd-sourced -->
+    <issue id="MissingTranslation" severity="ignore"/>
+
+    <!-- These could be fixed, then warning can be error -->
+    <issue id="HardcodedText" severity="warning"/>
+    <issue id="InlinedApi" severity="warning"/>
+    <issue id="LongLogTag" severity="warning"/>
+    <issue id="RtlEnabled" severity="warning"/>
+    <issue id="UnusedResources" severity="warning"/>
+    <issue id="WrongConstant" severity="warning"/>
+
+    <!-- These are important to us, so promote from warning to error -->
+    <issue id="AppCompatMethod" severity="error"/>
+    <issue id="DefaultLocale" severity="error"/>
+    <issue id="GetInstance" severity="error"/>
+    <issue id="HardwareIds" severity="error"/>
+    <issue id="ImpliedQuantity" severity="error"/>
+    <issue id="InvalidPackage" severity="error"/>
+    <issue id="NestedScrolling" severity="error"/>
+    <issue id="NewApi" severity="error"/>
+    <issue id="PackageManagerGetSignatures" severity="error"/>
+    <issue id="PluralsCandidate" severity="error"/>
+    <issue id="ProtectedPermissions" severity="error"/>
+    <issue id="RtlCompat" severity="error"/>
+    <issue id="SetWorldReadable" severity="error"/>
+    <issue id="SimpleDateFormat" severity="error"/>
+    <issue id="StringFormatCount" severity="error"/>
+    <issue id="TrustAllX509TrustManager" severity="error"/>
+    <issue id="Typos" severity="error"/>
+    <issue id="UnsafeProtectedBroadcastReceiver" severity="error"/>
+
+    <!-- both the correct and deprecated locales need to be present for
+         them to be recognized on all devices -->
+    <issue id="LocaleFolder" severity="error">
+        <ignore path="src/main/res/values-he"/>
+        <ignore path="src/main/res/values-id"/>
+    </issue>
+</lint>
diff --git a/orbotservice/build.gradle b/orbotservice/build.gradle
index 3a3e1adc..d44ef0d8 100644
--- a/orbotservice/build.gradle
+++ b/orbotservice/build.gradle
@@ -31,7 +31,14 @@ android {
     }
 
     lintOptions {
-        abortOnError false
+        checkReleaseBuilds false
+        abortOnError true
+
+        htmlReport true
+        xmlReport false
+        textReport false
+
+        lintConfig file("../lint.xml")
     }
 
     packagingOptions {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits