-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Is there an existing issue for this?
- I have searched the existing issues
Is there a StackOverflow question about this issue?
- I have searched StackOverflow
What happened?
Our CI build runs the following command:
./gradlew spotlessCheck --init-script gradle/init.gradle.kts --no-configuration-cache (source),
however, running the same command locally results in failures.
$ ./gradlew spotlessCheck --init-script gradle/init.gradle.kts --no-configuration-cache
Type-safe project accessors is an incubating feature.
> Task :app-nia-catalog:spotlessKotlinCheck FAILED
> Task :lint:spotlessKotlinCheck FAILED
> Task :benchmarks:spotlessKotlinCheck FAILED
> Task :core:analytics:spotlessKotlinCheck FAILED
FAILURE: Build completed with 4 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app-nia-catalog:spotlessKotlinCheck'.
> The following files had format violations:
src/main/kotlin/com/google/samples/apps/niacatalog/NiaCatalogActivity.kt
@@ -23,11 +23,11 @@
import·com.google.samples.apps.niacatalog.ui.NiaCatalog
class·NiaCatalogActivity·:·ComponentActivity()·{
-····override·fun·onCreate(savedInstanceState:·Bundle?)·{
-········super.onCreate(savedInstanceState)
+\toverride·fun·onCreate(savedInstanceState:·Bundle?)·{
+\t\tsuper.onCreate(savedInstanceState)
-········WindowCompat.setDecorFitsSystemWindows(window,·false)
+\t\tWindowCompat.setDecorFitsSystemWindows(window,·false)
-········setContent·{·NiaCatalog()·}
-····}
+\t\tsetContent·{·NiaCatalog()·}
+\t}
}
src/main/kotlin/com/google/samples/apps/niacatalog/ui/Catalog.kt
@@ -58,316 +58,316 @@
@OptIn(ExperimentalLayoutApi::class)
@Composable
fun·NiaCatalog()·{
-····NiaTheme·{
-········Surface·{
-············val·contentPadding·=·WindowInsets
-················.systemBars
-················.add(WindowInsets(left·=·16.dp,·top·=·16.dp,·right·=·16.dp,·bottom·=·16.dp))
-················.asPaddingValues()
-············LazyColumn(
-················modifier·=·Modifier.fillMaxSize(),
-················contentPadding·=·contentPadding,
-················verticalArrangement·=·Arrangement.spacedBy(16.dp),
-············)·{
-················item·{
-····················Text(
-························text·=·"NiA·Catalog",
-························style·=·MaterialTheme.typography.headlineSmall,
-····················)
-················}
-················item·{·Text("Buttons",·Modifier.padding(top·=·16.dp))·}
-················item·{
-····················FlowRow(horizontalArrangement·=·Arrangement.spacedBy(16.dp))·{
-························NiaButton(onClick·=·{})·{
-····························Text(text·=·"Enabled")
-························}
-························NiaOutlinedButton(onClick·=·{})·{
-····························Text(text·=·"Enabled")
-························}
-························NiaTextButton(onClick·=·{})·{
... (598 more lines that didn't fit)
Run './gradlew :app-nia-catalog:spotlessApply' to fix these violations.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':lint:spotlessKotlinCheck'.
> The following files had format violations:
src/main/kotlin/com/google/samples/apps/nowinandroid/lint/designsystem/DesignSystemDetector.kt
@@ -34,87 +34,87 @@
·*/
class·DesignSystemDetector·:·Detector(),·Detector.UastScanner·{
-····override·fun·getApplicableUastTypes():·List<Class<out·UElement>>·{
-········return·listOf(
-············UCallExpression::class.java,
-············UQualifiedReferenceExpression::class.java,
-········)
-····}
+\toverride·fun·getApplicableUastTypes():·List<Class<out·UElement>>·{
+\t\treturn·listOf(
+\t\t\tUCallExpression::class.java,
+\t\t\tUQualifiedReferenceExpression::class.java,
+\t\t)
+\t}
-····override·fun·createUastHandler(context:·JavaContext):·UElementHandler·{
-········return·object·:·UElementHandler()·{
-············override·fun·visitCallExpression(node:·UCallExpression)·{
-················val·name·=·node.methodName·?:·return
-················val·preferredName·=·METHOD_NAMES[name]·?:·return
-················reportIssue(context,·node,·name,·preferredName)
-············}
+\toverride·fun·createUastHandler(context:·JavaContext):·UElementHandler·{
+\t\treturn·object·:·UElementHandler()·{
+\t\t\toverride·fun·visitCallExpression(node:·UCallExpression)·{
+\t\t\t\tval·name·=·node.methodName·?:·return
+\t\t\t\tval·preferredName·=·METHOD_NAMES[name]·?:·return
+\t\t\t\treportIssue(context,·node,·name,·preferredName)
+\t\t\t}
-············override·fun·visitQualifiedReferenceExpression(node:·UQualifiedReferenceExpression)·{
-················val·name·=·node.receiver.asRenderString()
-················val·preferredName·=·RECEIVER_NAMES[name]·?:·return
-················reportIssue(context,·node,·name,·preferredName)
-············}
-········}
-····}
+\t\t\toverride·fun·visitQualifiedReferenceExpression(node:·UQualifiedReferenceExpression)·{
+\t\t\t\tval·name·=·node.receiver.asRenderString()
+\t\t\t\tval·preferredName·=·RECEIVER_NAMES[name]·?:·return
+\t\t\t\treportIssue(context,·node,·name,·preferredName)
+\t\t\t}
+\t\t}
+\t}
-····companion·object·{
-········@JvmField
... (117 more lines that didn't fit)
Violations also present in:
src/main/kotlin/com/google/samples/apps/nowinandroid/lint/designsystem/DesignSystemIssueRegistry.kt
Run './gradlew :lint:spotlessApply' to fix these violations.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':benchmarks:spotlessKotlinCheck'.
> The following files had format violations:
src/main/kotlin/androidx/test/uiautomator/UiAutomatorHelpers.kt
@@ -27,22 +27,22 @@
·*·Condition·will·be·satisfied·if·given·element·has·specified·count·of·children
·*/
fun·untilHasChildren(
-····childCount:·Int·=·1,
-····op:·HasChildrenOp·=·AT_LEAST,
+\tchildCount:·Int·=·1,
+\top:·HasChildrenOp·=·AT_LEAST,
):·UiObject2Condition<Boolean>·{
-····return·object·:·UiObject2Condition<Boolean>()·{
-········override·fun·apply(element:·UiObject2):·Boolean·{
-············return·when·(op)·{
-················AT_LEAST·->·element.childCount·>=·childCount
-················EXACTLY·->·element.childCount·==·childCount
-················AT_MOST·->·element.childCount·<=·childCount
-············}
-········}
-····}
+\treturn·object·:·UiObject2Condition<Boolean>()·{
+\t\toverride·fun·apply(element:·UiObject2):·Boolean·{
+\t\t\treturn·when·(op)·{
+\t\t\t\tAT_LEAST·->·element.childCount·>=·childCount
+\t\t\t\tEXACTLY·->·element.childCount·==·childCount
+\t\t\t\tAT_MOST·->·element.childCount·<=·childCount
+\t\t\t}
+\t\t}
+\t}
}
enum·class·HasChildrenOp·{
-····AT_LEAST,
-····EXACTLY,
-····AT_MOST,
+\tAT_LEAST,
+\tEXACTLY,
+\tAT_MOST,
}
src/main/kotlin/com/google/samples/apps/nowinandroid/GeneralActions.kt
@@ -37,8 +37,8 @@
·*·-·or·(preferred)·executing·the·grant·command·on·the·target·package.
·*/
fun·MacrobenchmarkScope.allowNotifications()·{
-····if·(SDK_INT·>=·TIRAMISU)·{
-········val·command·=·"pm·grant·$packageName·${permission.POST_NOTIFICATIONS}"
-········device.executeShellCommand(command)
-····}
+\tif·(SDK_INT·>=·TIRAMISU)·{
+\t\tval·command·=·"pm·grant·$packageName·${permission.POST_NOTIFICATIONS}"
+\t\tdevice.executeShellCommand(command)
... (2 more lines that didn't fit)
Violations also present in 10 other files.
Run './gradlew :benchmarks:spotlessApply' to fix these violations.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':core:analytics:spotlessKotlinCheck'.
> The following files had format violations:
src/demo/kotlin/com/google/samples/apps/nowinandroid/core/analytics/AnalyticsModule.kt
@@ -24,6 +24,6 @@
@Module
@InstallIn(SingletonComponent::class)
abstract·class·AnalyticsModule·{
-····@Binds
-····abstract·fun·bindsAnalyticsHelper(analyticsHelperImpl:·StubAnalyticsHelper):·AnalyticsHelper
+\t@Binds
+\tabstract·fun·bindsAnalyticsHelper(analyticsHelperImpl:·StubAnalyticsHelper):·AnalyticsHelper
}
src/main/kotlin/com/google/samples/apps/nowinandroid/core/analytics/AnalyticsEvent.kt
@@ -27,32 +27,32 @@
·*·@param·extras·-·list·of·parameters·which·supply·additional·context·to·the·event.·See·`Param`.
·*/
data·class·AnalyticsEvent(
-····val·type:·String,
-····val·extras:·List<Param>·=·emptyList(),
+\tval·type:·String,
+\tval·extras:·List<Param>·=·emptyList(),
)·{
-····//·Standard·analytics·types.
-····class·Types·{
-········companion·object·{
-············const·val·SCREEN_VIEW·=·"screen_view"·//·(extras:·SCREEN_NAME)
-········}
-····}
+\t//·Standard·analytics·types.
+\tclass·Types·{
+\t\tcompanion·object·{
+\t\t\tconst·val·SCREEN_VIEW·=·"screen_view"·//·(extras:·SCREEN_NAME)
+\t\t}
+\t}
-····/**
-·····*·A·key-value·pair·used·to·supply·extra·context·to·an·analytics·event.
-·····*
-·····*·@param·key·-·the·parameter·key.·Wherever·possible·use·one·of·the·standard·`ParamKeys`,
-·····*·however,·if·no·suitable·key·is·available·you·can·define·your·own·as·long·as·it·is·configured
-·····*·in·your·backend·analytics·system·(for·example,·by·creating·a·Firebase·Analytics·custom
-·····*·parameter).
-·····*
-·····*·@param·value·-·the·parameter·value.
-·····*/
-····data·class·Param(val·key:·String,·val·value:·String)
+\t/**
+\t·*·A·key-value·pair·used·to·supply·extra·context·to·an·analytics·event.
+\t·*
+\t·*·@param·key·-·the·parameter·key.·Wherever·possible·use·one·of·the·standard·`ParamKeys`,
+\t·*·however,·if·no·suitable·key·is·available·you·can·define·your·own·as·long·as·it·is·configured
+\t·*·in·your·backend·analytics·system·(for·example,·by·creating·a·Firebase·Analytics·custom
... (19 more lines that didn't fit)
Violations also present in:
src/main/kotlin/com/google/samples/apps/nowinandroid/core/analytics/AnalyticsHelper.kt
src/main/kotlin/com/google/samples/apps/nowinandroid/core/analytics/NoOpAnalyticsHelper.kt
src/main/kotlin/com/google/samples/apps/nowinandroid/core/analytics/StubAnalyticsHelper.kt
src/main/kotlin/com/google/samples/apps/nowinandroid/core/analytics/UiHelpers.kt
src/prod/kotlin/com/google/samples/apps/nowinandroid/core/analytics/AnalyticsModule.kt
src/prod/kotlin/com/google/samples/apps/nowinandroid/core/analytics/FirebaseAnalyticsHelper.kt
Run './gradlew :core:analytics:spotlessApply' to fix these violations.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
==============================================================================
BUILD FAILED in 2s
23 actionable tasks: 4 executed, 1 from cache, 18 up-to-date```
### Relevant logcat output
_No response_
### Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working