ktlint
ktlint copied to clipboard
Whitespace after opening brace in composable breaks function-literal rule
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
- Version of ktlint used: 1.0.1, also experienced in 1.1.1
- Relevant parts of the
.editorconfigsettings - Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): plugin: 'com.diffplug.spotless' version 6.23.3
- Version of Gradle used (if applicable): 7.2.2
- Operating System and version: macOS Sonoma Version 14.2.1
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.
@ktaylor-fetch Can you provide me with a reproducer?
Closed as no reproducer has been added. Issue will be reopened once reproducer has been added.