Skip to content

Commit

Permalink
Update lint issue documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tnorbye committed Jan 26, 2024
1 parent 01703ae commit e0ad65f
Show file tree
Hide file tree
Showing 354 changed files with 9,773 additions and 4,292 deletions.
152 changes: 152 additions & 0 deletions docs/checks/ActivityIconColor.md.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
<meta charset="utf-8">
(#) Ongoing activity icon is not white

!!! WARNING: Ongoing activity icon is not white
This is a warning.

Id
: `ActivityIconColor`
Summary
: Ongoing activity icon is not white
Severity
: Warning
Category
: Usability: Icons
Platform
: Android
Vendor
: Android Open Source Project
Feedback
: https://issuetracker.google.com/issues/new?component=192708
Affects
: Kotlin and Java files, binary resource files and resource files
Editing
: This check can *not* run live in the IDE editor
See
: https://developer.android.com/training/wearables/ongoing-activity#best-practices
Implementation
: [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)
Tests
: [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)
Copyright Year
: 2022

The resources passed to `setAnimatedIcon` and `setStaticIcon` should be
white with a transparent background, preferably a VectorDrawable or
AnimatedVectorDrawable.

(##) Example

Here is an example of lint warnings produced by this check:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
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)
------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here is the source file referenced above:

`src/test/pkg/ForegroundOnlyWalkingWorkoutService.kt`:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~kotlin linenumbers
package test.pkg;

import androidx.wear.ongoing.OngoingActivity

class ForegroundOnlyWalkingWorkoutService {
private fun generateNotification(mainText: String) {
val ongoingActivity =
OngoingActivity.Builder()
.setAnimatedIcon(R.drawable.animated_walk)
.setStaticIcon(R.drawable.ic_walk)
.build()
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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/ActivityIconColorDetectorTest.kt)
for the unit tests for this check to see additional scenarios.

(##) Suppressing

You can suppress false positives using one of the following mechanisms:

* Using a suppression annotation like this on the enclosing
element:

```kt
// Kotlin
@Suppress("ActivityIconColor")
fun method() {
setAnimatedIcon(...)
}
```

or

```java
// Java
@SuppressWarnings("ActivityIconColor")
void method() {
setAnimatedIcon(...);
}
```

* Using a suppression comment like this on the line above:

```kt
//noinspection ActivityIconColor
problematicStatement()
```

* Adding the suppression attribute `tools:ignore="ActivityIconColor"`
on the problematic XML element (or one of its enclosing elements).
You may also need to add the following namespace declaration on the
root element in the XML file if it's not already there:
`xmlns:tools="http://schemas.android.com/tools"`.

* Using a special `lint.xml` file in the source tree which turns off
the check in that folder and any sub folder. A simple file might look
like this:
```xml
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;lint&gt;
&lt;issue id="ActivityIconColor" severity="ignore" /&gt;
&lt;/lint&gt;
```
Instead of `ignore` you can also change the severity here, for
example from `error` to `warning`. You can find additional
documentation on how to filter issues by path, regular expression and
so on
[here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html).

* In Gradle projects, using the DSL syntax to configure lint. For
example, you can use something like
```gradle
lintOptions {
disable 'ActivityIconColor'
}
```
In Android projects this should be nested inside an `android { }`
block.

* For manual invocations of `lint`, using the `--ignore` flag:
```
$ lint --ignore ActivityIconColor ...`
```

* Last, but not least, using baselines, as discussed
[here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).

<!-- 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>
47 changes: 6 additions & 41 deletions docs/checks/AlertDialogUsage.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,56 +19,21 @@
Feedback
: https://github.com/vanniktech/lint-rules/issues
Min
: Lint 7.3 and 7.4
: Lint 8.0 and 8.1
Compiled
: Lint 7.3 and 7.4
: Lint 8.0 and 8.1
Artifact
: [com.vanniktech:lint-rules-android](com_vanniktech_lint-rules-android.md.html)

Affects
: 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/java/com/vanniktech/lintrules/android/AlertDialogUsageDetector.kt)
Tests
: [Source Code](https://github.com/vanniktech/lint-rules/tree/master/lint-rules-android-lint/src/test/java/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/java/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 All @@ -78,25 +43,25 @@

```
// build.gradle.kts
lintChecks("com.vanniktech:lint-rules-android:0.24.0")
lintChecks("com.vanniktech:lint-rules-android:0.25.0")

// build.gradle
lintChecks 'com.vanniktech:lint-rules-android:0.24.0'
lintChecks 'com.vanniktech:lint-rules-android:0.25.0'

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

# libs.versions.toml
[versions]
lint-rules-android = "0.24.0"
lint-rules-android = "0.25.0"
[libraries]
lint-rules-android = {
module = "com.vanniktech:lint-rules-android",
version.ref = "lint-rules-android"
}
```

0.24.0 is the version this documentation was generated from;
0.25.0 is the version this documentation was generated from;
there may be newer versions available.

[Additional details about com.vanniktech:lint-rules-android](com_vanniktech_lint-rules-android.md.html).
Expand Down
2 changes: 1 addition & 1 deletion docs/checks/AndroidGradlePluginVersion.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
[AndroidGradlePluginVersion]

classpath 'com.android.tools.build:gradle:3.4.0-alpha3'
-------------------------------------------------------
---------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here is the source file referenced above:
Expand Down
14 changes: 8 additions & 6 deletions docs/checks/AppLinkUrlError.md.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<meta charset="utf-8">
(#) URL not supported by app for Firebase App Indexing
(#) URI invalid

!!! ERROR: URL not supported by app for Firebase App Indexing
!!! ERROR: URI invalid
This is an error.

Id
: `AppLinkUrlError`
Summary
: URL not supported by app for Firebase App Indexing
: URI invalid
Severity
: Error
Category
: Usability
: Correctness
Platform
: Android
Vendor
Expand All @@ -23,6 +23,8 @@
Editing
: This check runs on the fly in the IDE editor
See
: https://developer.android.com/training/app-links
See
: https://g.co/AppIndexing/AndroidStudio
Implementation
: [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)
Expand All @@ -31,8 +33,8 @@
Copyright Year
: 2017

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

!!! Tip
This lint check has an associated quickfix available in the IDE.
Expand Down
Loading

0 comments on commit e0ad65f

Please sign in to comment.