Skip to content

Commit e0ad65f

Browse files
committed
Update lint issue documentation
1 parent 01703ae commit e0ad65f

File tree

354 files changed

+9773
-4292
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

354 files changed

+9773
-4292
lines changed

docs/checks/ActivityIconColor.md.html

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
<meta charset="utf-8">
2+
(#) Ongoing activity icon is not white
3+
4+
!!! WARNING: Ongoing activity icon is not white
5+
This is a warning.
6+
7+
Id
8+
: `ActivityIconColor`
9+
Summary
10+
: Ongoing activity icon is not white
11+
Severity
12+
: Warning
13+
Category
14+
: Usability: Icons
15+
Platform
16+
: Android
17+
Vendor
18+
: Android Open Source Project
19+
Feedback
20+
: https://issuetracker.google.com/issues/new?component=192708
21+
Affects
22+
: Kotlin and Java files, binary resource files and resource files
23+
Editing
24+
: This check can *not* run live in the IDE editor
25+
See
26+
: https://developer.android.com/training/wearables/ongoing-activity#best-practices
27+
Implementation
28+
: [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/ActivityIconColorDetector.kt)
29+
Tests
30+
: [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/ActivityIconColorDetectorTest.kt)
31+
Copyright Year
32+
: 2022
33+
34+
The resources passed to `setAnimatedIcon` and `setStaticIcon` should be
35+
white with a transparent background, preferably a VectorDrawable or
36+
AnimatedVectorDrawable.
37+
38+
(##) Example
39+
40+
Here is an example of lint warnings produced by this check:
41+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
42+
src/test/pkg/ForegroundOnlyWalkingWorkoutService.kt:9:Warning: The
43+
animated icon for an ongoing activity should be white with a transparent
44+
background [ActivityIconColor]
45+
46+
.setAnimatedIcon(R.drawable.animated_walk)
47+
------------------------
48+
49+
50+
src/test/pkg/ForegroundOnlyWalkingWorkoutService.kt:10:Warning: The
51+
static icon for an ongoing activity should be white with a transparent
52+
background [ActivityIconColor]
53+
54+
.setStaticIcon(R.drawable.ic_walk)
55+
------------------
56+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57+
58+
Here is the source file referenced above:
59+
60+
`src/test/pkg/ForegroundOnlyWalkingWorkoutService.kt`:
61+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~kotlin linenumbers
62+
package test.pkg;
63+
64+
import androidx.wear.ongoing.OngoingActivity
65+
66+
class ForegroundOnlyWalkingWorkoutService {
67+
private fun generateNotification(mainText: String) {
68+
val ongoingActivity =
69+
OngoingActivity.Builder()
70+
.setAnimatedIcon(R.drawable.animated_walk)
71+
.setStaticIcon(R.drawable.ic_walk)
72+
.build()
73+
}
74+
}
75+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76+
77+
You can also visit the
78+
[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/ActivityIconColorDetectorTest.kt)
79+
for the unit tests for this check to see additional scenarios.
80+
81+
(##) Suppressing
82+
83+
You can suppress false positives using one of the following mechanisms:
84+
85+
* Using a suppression annotation like this on the enclosing
86+
element:
87+
88+
```kt
89+
// Kotlin
90+
@Suppress("ActivityIconColor")
91+
fun method() {
92+
setAnimatedIcon(...)
93+
}
94+
```
95+
96+
or
97+
98+
```java
99+
// Java
100+
@SuppressWarnings("ActivityIconColor")
101+
void method() {
102+
setAnimatedIcon(...);
103+
}
104+
```
105+
106+
* Using a suppression comment like this on the line above:
107+
108+
```kt
109+
//noinspection ActivityIconColor
110+
problematicStatement()
111+
```
112+
113+
* Adding the suppression attribute `tools:ignore="ActivityIconColor"`
114+
on the problematic XML element (or one of its enclosing elements).
115+
You may also need to add the following namespace declaration on the
116+
root element in the XML file if it's not already there:
117+
`xmlns:tools="http://schemas.android.com/tools"`.
118+
119+
* Using a special `lint.xml` file in the source tree which turns off
120+
the check in that folder and any sub folder. A simple file might look
121+
like this:
122+
```xml
123+
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
124+
&lt;lint&gt;
125+
&lt;issue id="ActivityIconColor" severity="ignore" /&gt;
126+
&lt;/lint&gt;
127+
```
128+
Instead of `ignore` you can also change the severity here, for
129+
example from `error` to `warning`. You can find additional
130+
documentation on how to filter issues by path, regular expression and
131+
so on
132+
[here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html).
133+
134+
* In Gradle projects, using the DSL syntax to configure lint. For
135+
example, you can use something like
136+
```gradle
137+
lintOptions {
138+
disable 'ActivityIconColor'
139+
}
140+
```
141+
In Android projects this should be nested inside an `android { }`
142+
block.
143+
144+
* For manual invocations of `lint`, using the `--ignore` flag:
145+
```
146+
$ lint --ignore ActivityIconColor ...`
147+
```
148+
149+
* Last, but not least, using baselines, as discussed
150+
[here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).
151+
152+
<!-- Markdeep: --><style class="fallback">body{visibility:hidden;white-space:pre;font-family:monospace}</style><script src="markdeep.min.js" charset="utf-8"></script><script src="https://morgan3d.github.io/markdeep/latest/markdeep.min.js" charset="utf-8"></script><script>window.alreadyProcessedMarkdeep||(document.body.style.visibility="visible")</script>

docs/checks/AlertDialogUsage.md.html

+6-41
Original file line numberDiff line numberDiff line change
@@ -19,56 +19,21 @@
1919
Feedback
2020
: https://github.com/vanniktech/lint-rules/issues
2121
Min
22-
: Lint 7.3 and 7.4
22+
: Lint 8.0 and 8.1
2323
Compiled
24-
: Lint 7.3 and 7.4
24+
: Lint 8.0 and 8.1
2525
Artifact
2626
: [com.vanniktech:lint-rules-android](com_vanniktech_lint-rules-android.md.html)
2727

2828
Affects
2929
: Kotlin and Java files
3030
Editing
3131
: This check runs on the fly in the IDE editor
32-
Implementation
33-
: [Source Code](https://github.com/vanniktech/lint-rules/tree/master/lint-rules-android-lint/src/main/java/com/vanniktech/lintrules/android/AlertDialogUsageDetector.kt)
34-
Tests
35-
: [Source Code](https://github.com/vanniktech/lint-rules/tree/master/lint-rules-android-lint/src/test/java/com/vanniktech/lintrules/android/AlertDialogUsageDetectorTest.kt)
3632

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

41-
(##) Example
42-
43-
Here is an example of lint warnings produced by this check:
44-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
45-
src/Test.java:4:Warning: Should not be using android.app.AlertDialog
46-
[AlertDialogUsage]
47-
48-
public Test(AlertDialog dialog) { }
49-
------------------
50-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51-
52-
Here is the source file referenced above:
53-
54-
`src/Test.java`:
55-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~java linenumbers
56-
import android.app.AlertDialog;
57-
58-
class Test {
59-
public Test(AlertDialog dialog) { }
60-
}
61-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62-
63-
You can also visit the
64-
[source code](https://github.com/vanniktech/lint-rules/tree/master/lint-rules-android-lint/src/test/java/com/vanniktech/lintrules/android/AlertDialogUsageDetectorTest.kt)
65-
for the unit tests for this check to see additional scenarios.
66-
67-
The above example was automatically extracted from the first unit test
68-
found for this lint check, `AlertDialogUsageDetector.constructorParameterInJava`.
69-
To report a problem with this extracted sample, visit
70-
https://github.com/vanniktech/lint-rules/issues.
71-
7237
(##) Including
7338

7439
!!!
@@ -78,25 +43,25 @@
7843

7944
```
8045
// build.gradle.kts
81-
lintChecks("com.vanniktech:lint-rules-android:0.24.0")
46+
lintChecks("com.vanniktech:lint-rules-android:0.25.0")
8247

8348
// build.gradle
84-
lintChecks 'com.vanniktech:lint-rules-android:0.24.0'
49+
lintChecks 'com.vanniktech:lint-rules-android:0.25.0'
8550

8651
// build.gradle.kts with version catalogs:
8752
lintChecks(libs.lint-rules-android)
8853

8954
# libs.versions.toml
9055
[versions]
91-
lint-rules-android = "0.24.0"
56+
lint-rules-android = "0.25.0"
9257
[libraries]
9358
lint-rules-android = {
9459
module = "com.vanniktech:lint-rules-android",
9560
version.ref = "lint-rules-android"
9661
}
9762
```
9863

99-
0.24.0 is the version this documentation was generated from;
64+
0.25.0 is the version this documentation was generated from;
10065
there may be newer versions available.
10166

10267
[Additional details about com.vanniktech:lint-rules-android](com_vanniktech_lint-rules-android.md.html).

docs/checks/AndroidGradlePluginVersion.md.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
[AndroidGradlePluginVersion]
4949

5050
classpath 'com.android.tools.build:gradle:3.4.0-alpha3'
51-
-------------------------------------------------------
51+
---------------------------------------------
5252
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5353

5454
Here is the source file referenced above:

docs/checks/AppLinkUrlError.md.html

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<meta charset="utf-8">
2-
(#) URL not supported by app for Firebase App Indexing
2+
(#) URI invalid
33

4-
!!! ERROR: URL not supported by app for Firebase App Indexing
4+
!!! ERROR: URI invalid
55
This is an error.
66

77
Id
88
: `AppLinkUrlError`
99
Summary
10-
: URL not supported by app for Firebase App Indexing
10+
: URI invalid
1111
Severity
1212
: Error
1313
Category
14-
: Usability
14+
: Correctness
1515
Platform
1616
: Android
1717
Vendor
@@ -23,6 +23,8 @@
2323
Editing
2424
: This check runs on the fly in the IDE editor
2525
See
26+
: https://developer.android.com/training/app-links
27+
See
2628
: https://g.co/AppIndexing/AndroidStudio
2729
Implementation
2830
: [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-main:lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/AppLinksValidDetector.kt)
@@ -31,8 +33,8 @@
3133
Copyright Year
3234
: 2017
3335

34-
Ensure the URL is supported by your app, to get installs and traffic to
35-
your app from Google Search.
36+
Ensure your intent filter has the documented elements for deep links,
37+
web links, or Android App Links.
3638

3739
!!! Tip
3840
This lint check has an associated quickfix available in the IDE.

0 commit comments

Comments
 (0)