aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Fraschilla <fraschilla@google.com>2019-11-01 13:58:55 -0700
committerandroid-build-prod (mdb) <android-build-team-robot@google.com>2020-02-11 06:17:51 +0000
commitf153eeff9d8c148930310f52369fbb38401e496f (patch)
tree08ad5e0c750efaccc3b8dc3d2a05fd3809cc3b97
parent46dcaa787ab35cef9d31a873f49f091ce423423d (diff)
downloadsupport-f153eeff9d8c148930310f52369fbb38401e496f.tar.gz
Fix incorrect lint explanation string formats
Test: all tests pass Change-Id: I8d0c7c3899d1450747159f399ce611e479aaccf0 (cherry picked from commit eca0ef75dd1a099c44df776f3d01fac262c2f7d5)
-rw-r--r--fragment/fragment-lint/src/main/java/androidx/fragment/lint/FragmentTagDetector.kt10
-rw-r--r--fragment/fragment-lint/src/main/java/androidx/fragment/lint/UnsafeFragmentLifecycleObserverDetector.kt26
-rw-r--r--fragment/fragment-testing-lint/src/main/java/androidx/fragment/testing/lint/GradleConfigurationDetector.kt8
3 files changed, 22 insertions, 22 deletions
diff --git a/fragment/fragment-lint/src/main/java/androidx/fragment/lint/FragmentTagDetector.kt b/fragment/fragment-lint/src/main/java/androidx/fragment/lint/FragmentTagDetector.kt
index 7730d755f11..2c31fb911fd 100644
--- a/fragment/fragment-lint/src/main/java/androidx/fragment/lint/FragmentTagDetector.kt
+++ b/fragment/fragment-lint/src/main/java/androidx/fragment/lint/FragmentTagDetector.kt
@@ -39,11 +39,11 @@ class FragmentTagDetector : ResourceXmlDetector() {
val ISSUE = Issue.create(
id = "FragmentTagUsage",
briefDescription = "Use FragmentContainerView instead of the <fragment> tag",
- explanation = """FragmentContainerView replaces the <fragment> tag as the preferred way
- | of adding fragments via XML. Unlike the <fragment> tag, FragmentContainerView uses
- | a normal `FragmentTransaction` under the hood to add the initial fragment,
- | allowing further FragmentTransaction operations on the FragmentContainerView
- | and providing a consistent timing for lifecycle events.""",
+ explanation = """FragmentContainerView replaces the <fragment> tag as the preferred \
+ way of adding fragments via XML. Unlike the <fragment> tag, FragmentContainerView \
+ uses a normal `FragmentTransaction` under the hood to add the initial fragment, \
+ allowing further FragmentTransaction operations on the FragmentContainerView \
+ and providing a consistent timing for lifecycle events.""",
category = Category.CORRECTNESS,
severity = Severity.WARNING,
implementation = Implementation(
diff --git a/fragment/fragment-lint/src/main/java/androidx/fragment/lint/UnsafeFragmentLifecycleObserverDetector.kt b/fragment/fragment-lint/src/main/java/androidx/fragment/lint/UnsafeFragmentLifecycleObserverDetector.kt
index e8ad725daf9..447a8b664d0 100644
--- a/fragment/fragment-lint/src/main/java/androidx/fragment/lint/UnsafeFragmentLifecycleObserverDetector.kt
+++ b/fragment/fragment-lint/src/main/java/androidx/fragment/lint/UnsafeFragmentLifecycleObserverDetector.kt
@@ -49,12 +49,12 @@ class UnsafeFragmentLifecycleObserverDetector : Detector(), SourceCodeScanner {
id = "FragmentLiveDataObserve",
briefDescription = "Use getViewLifecycleOwner() as the LifecycleOwner instead of " +
"a Fragment instance when observing a LiveData object.",
- explanation = """When observing a LiveData object from a fragment's onCreateView,
- | onViewCreated, onActivityCreated, or onViewStateRestored method
- | getViewLifecycleOwner() should be used as the LifecycleOwner rather than the
- | Fragment instance. The Fragment lifecycle can result in the Fragment being
- | active longer than its view. This can lead to unexpected behavior from
- | LiveData objects being observed longer than the Fragment's view is active.""",
+ explanation = """When observing a LiveData object from a fragment's onCreateView, \
+ onViewCreated, onActivityCreated, or onViewStateRestored method \
+ getViewLifecycleOwner() should be used as the LifecycleOwner rather than the \
+ Fragment instance. The Fragment lifecycle can result in the Fragment being \
+ active longer than its view. This can lead to unexpected behavior from \
+ LiveData objects being observed longer than the Fragment's view is active.""",
category = Category.CORRECTNESS,
severity = Severity.ERROR,
implementation = Implementation(
@@ -67,13 +67,13 @@ class UnsafeFragmentLifecycleObserverDetector : Detector(), SourceCodeScanner {
id = "FragmentBackPressedCallback",
briefDescription = "Use getViewLifecycleOwner() as the LifecycleOwner instead of " +
"a Fragment instance.",
- explanation = """The Fragment lifecycle can result in a Fragment being active
- | longer than its view. This can lead to unexpected behavior from lifecycle aware
- | objects remaining active longer than the Fragment's view. To solve this issue,
- | getViewLifecycleOwner() should be used as a LifecycleOwner rather than the
- | Fragment instance once it is safe to access the view lifecycle in a
- | Fragment's onCreateView, onViewCreated, onActivityCreated, or
- | onViewStateRestored methods.""",
+ explanation = """The Fragment lifecycle can result in a Fragment being active \
+ longer than its view. This can lead to unexpected behavior from lifecycle aware \
+ objects remaining active longer than the Fragment's view. To solve this issue, \
+ getViewLifecycleOwner() should be used as a LifecycleOwner rather than the \
+ Fragment instance once it is safe to access the view lifecycle in a \
+ Fragment's onCreateView, onViewCreated, onActivityCreated, or \
+ onViewStateRestored methods.""",
category = Category.CORRECTNESS,
severity = Severity.ERROR,
implementation = Implementation(
diff --git a/fragment/fragment-testing-lint/src/main/java/androidx/fragment/testing/lint/GradleConfigurationDetector.kt b/fragment/fragment-testing-lint/src/main/java/androidx/fragment/testing/lint/GradleConfigurationDetector.kt
index f7320a825bd..4ad3dec84da 100644
--- a/fragment/fragment-testing-lint/src/main/java/androidx/fragment/testing/lint/GradleConfigurationDetector.kt
+++ b/fragment/fragment-testing-lint/src/main/java/androidx/fragment/testing/lint/GradleConfigurationDetector.kt
@@ -35,10 +35,10 @@ class GradleConfigurationDetector : Detector(), GradleScanner {
id = "FragmentGradleConfiguration",
briefDescription = "Include the fragment-testing library using the " +
"debugImplementation configuration.",
- explanation = """The fragment-testing library contains a FragmentScenario class that
- | creates an Activity that must exist in the runtime APK. To include the
- | fragment-testing library in the runtime APK it must be added using the
- | debugImplementation configuration.""",
+ explanation = """The fragment-testing library contains a FragmentScenario class that \
+ creates an Activity that must exist in the runtime APK. To include the \
+ fragment-testing library in the runtime APK it must be added using the \
+ debugImplementation configuration.""",
category = Category.CORRECTNESS,
severity = Severity.ERROR,
implementation = Implementation(