Skip to content

Commit

Permalink
Update lint checks documentation snapshot
Browse files Browse the repository at this point in the history
The issue documentation extraction code was improved;
it now removes more stub files, cleans up the output,
handles more corner cases in finding test examples, etc.
  • Loading branch information
tnorbye committed Jul 18, 2024
1 parent 7730fe9 commit ae66c5b
Show file tree
Hide file tree
Showing 788 changed files with 15,214 additions and 8,512 deletions.
1 change: 0 additions & 1 deletion docs/checks/AaptCrash.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
aapt during a build. Change @+id/titlebar to @id/titlebar and define the
id explicitly using <item type="id" name="titlebar"/> instead.
[AaptCrash]

&lt;item name="android:id"&gt;@+id/titlebar&lt;/item&gt;
--------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
9 changes: 4 additions & 5 deletions docs/checks/AcceptsUserCertificates.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
: 2016

Allowing user certificates could allow eavesdroppers to intercept data
sent by your app, 'which could impact the privacy of your users.
Consider nesting your app's `trust-anchors` inside a `<debug-overrides>`
element to make sure they are only available when `android:debuggable`
is set to `"true"`.
sent by your app, which could impact the privacy of your users. Consider
nesting your app's `trust-anchors` inside a `<debug-overrides>` element
to make sure they are only available when `android:debuggable` is set to
`true`.

(##) Example

Expand All @@ -46,7 +46,6 @@
res/xml/network_config.xml:6:Warning: The Network Security Configuration
allows the use of user certificates in the release version of your app
[AcceptsUserCertificates]

&lt;certificates src="user"/&gt;
--------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 0 additions & 1 deletion docs/checks/AccessibilityFocus.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
src/com/my/app/MyView.kt:12:Warning: Do not force accessibility focus,
as this interferes with screen readers and gives an inconsistent user
experience, especially across apps [AccessibilityFocus]

performAccessibilityAction(AccessibilityNodeInfo.ACTION_ACCESSIBILITY_FOCUS, null)
----------------------------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 0 additions & 1 deletion docs/checks/AccessibilityScrollActions.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
and support ACTION_SCROLL_{FORWARD,BACKWARD} should also support
ACTION_SCROLL_{LEFT,RIGHT} and/or ACTION_SCROLL_{UP,DOWN}
[AccessibilityScrollActions]

override fun onInitializeAccessibilityNodeInfo(info: AccessibilityNodeInfo) {
^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
7 changes: 0 additions & 7 deletions docs/checks/AccessibilityWindowStateChangedEvent.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,22 @@
View.onInitializeAccessibilityNodeInfo, Activity.setTitle,
ViewCompat.setAccessibilityPaneTitle, etc. to inform users of crucial
changes to the UI. [AccessibilityWindowStateChangedEvent]

sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED)
--------------------------------------------------------------------


src/com/my/app/MyView.kt:16:Warning: Manually populating or sending
TYPE_WINDOW_STATE_CHANGED events should be avoided. They may be ignored
on certain versions of Android. Prefer setting UI metadata using
View.onInitializeAccessibilityNodeInfo, Activity.setTitle,
ViewCompat.setAccessibilityPaneTitle, etc. to inform users of crucial
changes to the UI. [AccessibilityWindowStateChangedEvent]

if (event.eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
-------------------------


src/com/my/app/MyView.kt:23:Warning: Manually populating or sending
TYPE_WINDOW_STATE_CHANGED events should be avoided. They may be ignored
on certain versions of Android. Prefer setting UI metadata using
View.onInitializeAccessibilityNodeInfo, Activity.setTitle,
ViewCompat.setAccessibilityPaneTitle, etc. to inform users of crucial
changes to the UI. [AccessibilityWindowStateChangedEvent]

if (event.eventType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
-------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 0 additions & 1 deletion docs/checks/AccidentalOctal.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
build.gradle:13:Error: The leading 0 turns this number into octal which
is probably not what was intended (interpreted as 8) [AccidentalOctal]

versionCode 010
---
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 0 additions & 4 deletions docs/checks/ActivityIconColor.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,11 @@
src/test/pkg/ForegroundOnlyWalkingWorkoutService.kt:9:Warning: The
animated icon for an ongoing activity should be white with a transparent
background [ActivityIconColor]

.setAnimatedIcon(R.drawable.animated_walk)
------------------------


src/test/pkg/ForegroundOnlyWalkingWorkoutService.kt:10:Warning: The
static icon for an ongoing activity should be white with a transparent
background [ActivityIconColor]

.setStaticIcon(R.drawable.ic_walk)
------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 0 additions & 1 deletion docs/checks/AdapterViewChildren.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
res/layout/has_children.xml:1:Warning: A list/grid should have no
children declared in XML [AdapterViewChildren]

&lt;ListView
--------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
4 changes: 0 additions & 4 deletions docs/checks/AddJavascriptInterface.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,12 @@
WebView.addJavascriptInterface should not be called with minSdkVersion <
17 for security reasons: JavaScript can use reflection to manipulate
application [AddJavascriptInterface]

webView.addJavascriptInterface(object, string);
----------------------


src/test/pkg/AddJavascriptInterfaceTest.java:23:Warning:
WebView.addJavascriptInterface should not be called with minSdkVersion <
17 for security reasons: JavaScript can use reflection to manipulate
application [AddJavascriptInterface]

webView.addJavascriptInterface(object, string);
----------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
40 changes: 37 additions & 3 deletions docs/checks/AlertDialogUsage.md.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<meta charset="utf-8">
(#) Use the support library AlertDialog instead of android.app.AlertDialog.
(#) Use the support library AlertDialog instead of android.app.AlertDialog

!!! WARNING: Use the support library AlertDialog instead of android.app.AlertDialog.
!!! WARNING: Use the support library AlertDialog instead of android.app.AlertDialog
This is a warning.

Id
: `AlertDialogUsage`
Summary
: Use the support library AlertDialog instead of android.app.AlertDialog.
: Use the support library AlertDialog instead of android.app.AlertDialog
Severity
: Warning
Category
Expand All @@ -29,11 +29,45 @@
: Kotlin and Java files
Editing
: This check runs on the fly in the IDE editor
Implementation
: [Source Code](https://github.com/vanniktech/lint-rules/tree/master/lint-rules-android-lint/src/main/kotlin/com/vanniktech/lintrules/android/AlertDialogUsageDetector.kt)
Tests
: [Source Code](https://github.com/vanniktech/lint-rules/tree/master/lint-rules-android-lint/src/test/kotlin/com/vanniktech/lintrules/android/AlertDialogUsageDetectorTest.kt)

Support library AlertDialog is much more powerful and plays better
together with the new theming / styling than the AlertDialog built into
the framework.

(##) Example

Here is an example of lint warnings produced by this check:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
src/Test.java:4:Warning: Should not be using android.app.AlertDialog
[AlertDialogUsage]
public Test(AlertDialog dialog) { }
------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here is the source file referenced above:

`src/Test.java`:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~java linenumbers
import android.app.AlertDialog;

class Test {
public Test(AlertDialog dialog) { }
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can also visit the
[source code](https://github.com/vanniktech/lint-rules/tree/master/lint-rules-android-lint/src/test/kotlin/com/vanniktech/lintrules/android/AlertDialogUsageDetectorTest.kt)
for the unit tests for this check to see additional scenarios.

The above example was automatically extracted from the first unit test
found for this lint check, `AlertDialogUsageDetector.constructorParameterInJava`.
To report a problem with this extracted sample, visit
https://github.com/vanniktech/lint-rules/issues.

(##) Including

!!!
Expand Down
11 changes: 9 additions & 2 deletions docs/checks/AllCaps.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,11 @@
res/layout/constraint.xml:12:Warning: Using textAllCaps with a string
(has_markup) that contains markup; the markup will be dropped by the
caps conversion [AllCaps]

android:textAllCaps="true"
--------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here is the source file referenced above:
Here are the relevant source files:

`res/layout/constraint.xml`:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~xml linenumbers
Expand Down Expand Up @@ -78,6 +77,14 @@
&lt;/merge&gt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

`res/values/strings.xml`:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~xml linenumbers
&lt;resources&gt;
&lt;string name="plain"&gt;Home Sample&lt;/string&gt;
&lt;string name="has_markup"&gt;This is &lt;b&gt;bold&lt;/b&gt;&lt;/string&gt;
&lt;/resources&gt;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can also visit the
[source code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/AllCapsDetectorTest.kt)
for the unit tests for this check to see additional scenarios.
Expand Down
4 changes: 0 additions & 4 deletions docs/checks/AllowAllHostnameVerifier.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,13 @@
returns true, which could cause insecure network traffic due to trusting
TLS/SSL server certificates for wrong hostnames
[AllowAllHostnameVerifier]

connection.setHostnameVerifier(new AllowAllHostnameVerifier());
------------------------------


src/test/pkg/InsecureHostnameVerifier.java:23:Warning: Using the
ALLOW_ALL_HOSTNAME_VERIFIER HostnameVerifier is unsafe because it always
returns true, which could cause insecure network traffic due to trusting
TLS/SSL server certificates for wrong hostnames
[AllowAllHostnameVerifier]

connection.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
--------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 0 additions & 1 deletion docs/checks/AlwaysShowAction.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
res/menu-land/actions.xml:6:Warning: Prefer "ifRoom" instead of "always"
[AlwaysShowAction]

android:showAsAction="always|collapseActionView"
------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
65 changes: 43 additions & 22 deletions docs/checks/AndroidGradlePluginVersion.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,40 +43,61 @@

Here is an example of lint warnings produced by this check:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
build.gradle:7:Warning: A newer version of
com.android.tools.build:gradle than 3.4.0-alpha3 is available: 3.5.0
../gradle/libs.versions.toml:8:Warning: A newer version of
com.android.application than 8.0.0 is available: 8.0.2
[AndroidGradlePluginVersion]

classpath 'com.android.tools.build:gradle:3.4.0-alpha3'
---------------------------------------------
gradlePlugins-agp = "8.0.0"
-------
../gradle/libs.versions.toml:9:Warning: A newer version of
com.android.application than 8.1.0-alpha01 is available: 8.1.0-rc01
[AndroidGradlePluginVersion]
gradlePlugins-agp-alpha = "8.1.0-alpha01"
---------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here is the source file referenced above:

`build.gradle`:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~groovy linenumbers
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0-alpha3'
}
}
dependencies {
compile 'org.apache.httpcomponents:httpcomponents-core:4.2'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.google.firebase:firebase-messaging:10.2.1'
}
`../gradle/libs.versions.toml`:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~toml linenumbers
[versions]
guavaVersion = "11.0.2"
appCompatVersion="13.0.0"
wearableVersion=" 1.2.0 "
# Test comment suppression:
#noinspection GradleDependency
multi-dex="1.0.0"
gradlePlugins-agp = "8.0.0"
gradlePlugins-agp-alpha = "8.1.0-alpha01"
gradlePlugins-agp-dev = "8.2.0-dev"
gradlePlugins-crashlytics = "2.9.2"
gradlePlugins-dependency-analysis = "1.0.0"

[libraries]
com-google-guava = { module = "com.google.guava:guava", version.ref = "guavaVersion"}
appcompat = { module = "com.android.support:appcompat-v7", version.ref = "appCompatVersion" }
wearable-support = { group = " com.google.android.support ", name =" wearable ", version.ref = " wearableVersion " }
multidex-lib = { module = "com.android.support:multidex", version.ref = "multi-dex" }

[bundles]
misc = [
"com-google-guava",
"appcompat",
]

[plugins]
android-application = { id = "com.android.application", version.ref = "gradlePlugins-agp" }
android-application2 = { id = "com.android.application", version.ref = "gradlePlugins-agp-alpha" }
android-application3 = { id = "com.android.application", version.ref = "gradlePlugins-agp-dev" }
crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "gradlePlugins-crashlytics" }
dependency-analysis = { id = "com.autonomousapps.dependency-analysis", version.ref = "gradlePlugins-dependency-analysis" }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can also visit the
[source code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/GradleDetectorTest.kt)
for the unit tests for this check to see additional scenarios.

The above example was automatically extracted from the first unit test
found for this lint check, `GradleDetector.testVersionsFromGradleCache`.
found for this lint check, `GradleDetector.testTomlVersionCatalogFile`.
To report a problem with this extracted sample, visit
https://issuetracker.google.com/issues/new?component=192708.

Expand Down
Loading

0 comments on commit ae66c5b

Please sign in to comment.