Improve lint configuration

This commit is contained in:
Benoit Marty 2019-04-03 12:04:24 +02:00
parent 6830957d31
commit 87c9f6b2a0
5 changed files with 78 additions and 35 deletions

View File

@ -58,6 +58,10 @@ android {
adbOptions {
installOptions "-g"
}

lintOptions {
lintConfig file("lint.xml")
}
}

static def gitRevision() {

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Modify some severity -->

<!-- Resource -->
<issue id="MissingTranslation" severity="warning" />
<issue id="TypographyEllipsis" severity="error" />
<issue id="ImpliedQuantity" severity="warning" />

<!-- UX -->
<issue id="ButtonOrder" severity="error" />

<!-- Layout -->
<issue id="UnknownIdInLayout" severity="error" />
<issue id="StringFormatCount" severity="error" />
<issue id="HardcodedText" severity="error" />
<issue id="SpUsage" severity="error" />
<issue id="ObsoleteLayoutParam" severity="error" />
<issue id="InefficientWeight" severity="error" />
<issue id="DisableBaselineAlignment" severity="error" />
<issue id="ScrollViewSize" severity="error" />

<!-- RTL -->
<issue id="RtlEnabled" severity="error" />
<issue id="RtlHardcoded" severity="error" />
<issue id="RtlSymmetry" severity="error" />

<!-- Code -->
<issue id="SetTextI18n" severity="error" />
<issue id="ViewConstructor" severity="error" />
<issue id="UseValueOf" severity="error" />

</lint>

View File

@ -1,20 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:orientation="horizontal" >
android:paddingBottom="10dp">

<ImageView
android:id="@+id/imageView_icon_and_text"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_gravity="center_vertical"
android:src="@drawable/matrix_user"/>
android:src="@drawable/matrix_user" />

<TextView
android:id="@+id/textView_icon_and_text"
@ -24,7 +25,7 @@
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:singleLine="true"
android:text = "A text here"
android:textColor="@android:color/white"/>
android:textColor="@android:color/white"
tools:text="A text here" />

</LinearLayout>

View File

@ -107,35 +107,7 @@ android {
}

lintOptions {
warning 'MissingTranslation'

// Treat some warnings as errors
// Resources
error 'TypographyEllipsis'
warning 'ImpliedQuantity'

// UX
error 'ButtonOrder'

// Layout
error 'UnknownIdInLayout'
error 'StringFormatCount'
error 'HardcodedText'
error 'SpUsage'
error 'ObsoleteLayoutParam'
error 'InefficientWeight'
error 'DisableBaselineAlignment'
error 'ScrollViewSize'

// RTL
error 'RtlEnabled'
error 'RtlHardcoded'
error 'RtlSymmetry'

// Code
error 'SetTextI18n'
error 'ViewConstructor'
error 'UseValueOf'
lintConfig file("lint.xml")
}

compileOptions {

33
vector/lint.xml Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Modify some severity -->

<!-- Resource -->
<issue id="MissingTranslation" severity="warning" />
<issue id="TypographyEllipsis" severity="error" />
<issue id="ImpliedQuantity" severity="warning" />

<!-- UX -->
<issue id="ButtonOrder" severity="error" />

<!-- Layout -->
<issue id="UnknownIdInLayout" severity="error" />
<issue id="StringFormatCount" severity="error" />
<issue id="HardcodedText" severity="error" />
<issue id="SpUsage" severity="error" />
<issue id="ObsoleteLayoutParam" severity="error" />
<issue id="InefficientWeight" severity="error" />
<issue id="DisableBaselineAlignment" severity="error" />
<issue id="ScrollViewSize" severity="error" />

<!-- RTL -->
<issue id="RtlEnabled" severity="error" />
<issue id="RtlHardcoded" severity="error" />
<issue id="RtlSymmetry" severity="error" />

<!-- Code -->
<issue id="SetTextI18n" severity="error" />
<issue id="ViewConstructor" severity="error" />
<issue id="UseValueOf" severity="error" />

</lint>