pinterest / ktlint

An anti-bikeshedding Kotlin linter with built-in formatter
https://pinterest.github.io/ktlint/
MIT License
6.07k stars 504 forks source link

Whitespace after opening brace in composable breaks function-literal rule #2563

Closed ktaylor-fetch closed 4 months ago

ktaylor-fetch commented 4 months ago

Expected Behavior

Whitespace should be removed

Observed Behavior

Ran: ./gradlew spotlessApply --log-level=debug

Output:

Pinging Gradle Cache
Error pinging gradle cache: Connect timed out
Remote Gradle Cache Enabled: false

> Configure project :app
WARNING:The option setting 'android.enableBuildConfigAsBytecode=true' is experimental.
The current default is 'false'.
WARNING:The option setting 'android.jetifier.ignorelist=android-base-common,common' is experimental.
WARNING:BuildType(codeCoverage): buildConfigField 'AUTOMATION_BUILD' value is being replaced.
WARNING:BuildType(automation): buildConfigField 'AUTOMATION_BUILD' value is being replaced.
WARNING:Using flatDir should be avoided because it doesn't support any meta-data formats.
WARNING:Ambiguous default build type: 'codeCoverage', 'debug'.
Please only set `isDefault = true` for one build type.

0 problems were found storing the configuration cache.

See the complete report at file:///Users/kyletaylor/AndroidStudioProjects/android-fetch-rewards/build/reports/configuration-cache/7jh36ryjnsmmp6jwlwr2nnmt6/20eh7k18qvleugjdbe7n8463m/configuration-cache-report.html

FAILURE: Build failed with an exception.

* What went wrong:
Problem configuring task :spotlessApply from command line.
> Unknown command-line option '--log-level'.

* Try:
> Run gradlew help --task :spotlessApply to get task usage details.
> 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.6.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 3s
5 actionable tasks: 5 up-to-date
Configuration cache entry stored.

Steps to Reproduce

`package com.fetchrewards.fetchrewards

import androidx.compose.material.Button import androidx.compose.material.Text import androidx.compose.runtime.Composable

@Composable fun ShouldNotBreak() { Button(onClick = {}) { Text(text = "The space in front of the brace is causing a ktlint rule to throw an exception") } }`

Your Environment

paul-dingemans commented 4 months ago

I can not reproduce this problem with Ktlint CLI version. The problem might be caused by Spotless, or by any configuration that you have not mentioned above. Please add stacktrace of exception, and your .editorconfig settings. Please also fix the indentation of your code sample if that is relevant for reproducing the problem.

Goooler commented 4 months ago

@ktaylor-fetch Can you provide me with a reproducer?

paul-dingemans commented 4 months ago

Closed as no reproducer has been added. Issue will be reopened once reproducer has been added.