Diff formatting shows weird whitespace characters on Windows 10 (� and ╖ instead of ·)
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- build-system, tooling
Research direction
Start by reproducing gradlew spotlessCheck with the shown Spotless 5.5.1 configuration on Windows 10 and compare its console output with macOS. Trace the diff-formatting entry point used by the Kotlin target; done means whitespace markers render consistently as · in the Windows Command Prompt and IDE consoles.
Written by the indexing model from the issue text.
Description
Summary of problem
When outputting the details of what lines have format violations, the · characters representing whitespace are not rendering correctly in the Command Prompt, Android Studio & Intellij's console output on Windows 10. I tried the same project with the same IDEs and Gradle files on Mac OS Catalina and don't see the issue.
I use defaults fonts on Windows and in the IDEs. I tried other monospaced fonts and character encoding thinking it's something on my end. Didn't seem to have any effect. I'm suspecting something in the library is possibly using an encoding that isn't translating back to UTF-8 correctly.
Android Studio & Intellij's output (Windows 10)
Execution failed for task ':app:spotlessKotlinCheck'.
> The following files had format violations:
app\src\main\java\com\corwinjv\postmodernandroid\common\di\NetworkModule.kt
@@ -6,15 +6,14 @@
import�dagger.Provides
import�dagger.hilt.InstallIn
import�dagger.hilt.android.components.ApplicationComponent
+import�javax.inject.Singleton
import�okhttp3.OkHttpClient
import�retrofit2.Retrofit
import�retrofit2.converter.gson.GsonConverterFactory
-import�javax.inject.Singleton
@InstallIn(ApplicationComponent::class)
@Module
-class�NetworkModule
-{
+class�NetworkModule�{
����@Provides
����@Singleton
����fun�provideOkHttpClient():�OkHttpClient�{
@@ -24,7 +23,7 @@
����@Provides
����@Singleton
-����fun�provideProgrammingQuotesApi(okHttpClient:�OkHttpClient)�:�ProgrammingQuotesApi�{
+����fun�provideProgrammingQuotesApi(okHttpClient:�OkHttpClient):�ProgrammingQuotesApi�{
��������return�Retrofit.Builder()
... (8 more lines that didn't fit)
Command Prompt's output (Windows 10)
Execution failed for task ':app:spotlessKotlinCheck'.
> The following files had format violations:
app\src\main\java\com\corwinjv\postmodernandroid\common\di\NetworkModule.kt
@@ -6,15 +6,14 @@
import╖dagger.Provides
import╖dagger.hilt.InstallIn
import╖dagger.hilt.android.components.ApplicationComponent
+import╖javax.inject.Singleton
import╖okhttp3.OkHttpClient
import╖retrofit2.Retrofit
import╖retrofit2.converter.gson.GsonConverterFactory
-import╖javax.inject.Singleton
@InstallIn(ApplicationComponent::class)
@Module
-class╖NetworkModule
-{
+class╖NetworkModule╖{
╖╖╖╖@Provides
╖╖╖╖@Singleton
╖╖╖╖fun╖provideOkHttpClient():╖OkHttpClient╖{
@@ -24,7 +23,7 @@
╖╖╖╖@Provides
╖╖╖╖@Singleton
-╖╖╖╖fun╖provideProgrammingQuotesApi(okHttpClient:╖OkHttpClient)╖:╖ProgrammingQuotesApi╖{
+╖╖╖╖fun╖provideProgrammingQuotesApi(okHttpClient:╖OkHttpClient):╖ProgrammingQuotesApi╖{
╖╖╖╖╖╖╖╖return╖Retrofit.Builder()
... (8 more lines that didn't fit)
Android Studio 4.0's output (Mac OS Catalina)
Execution failed for task ':app:spotlessKotlinCheck'.
> The following files had format violations:
app/src/androidTest/java/com/corwinjv/postmodernandroid/ExampleInstrumentedTest.kt
@@ -1,13 +1,11 @@
package·com.corwinjv.postmodernandroid
+import·androidx.test.ext.junit.runners.AndroidJUnit4
import·androidx.test.platform.app.InstrumentationRegistry
-import·androidx.test.ext.junit.runners.AndroidJUnit4
-
+import·org.junit.Assert.assertEquals
import·org.junit.Test
import·org.junit.runner.RunWith
-import·org.junit.Assert.assertEquals
-
/**
·*·Instrumented·test,·which·will·execute·on·an·Android·device.
·*
app/src/main/java/com/corwinjv/postmodernandroid/App.kt
@@ -4,4 +4,4 @@
import·dagger.hilt.android.HiltAndroidApp
@HiltAndroidApp
-class·App·:·Application()
+class·App·:·Application()
app/src/main/java/com/corwinjv/postmodernandroid/common/di/NetworkModule.kt
@@ -6,15 +6,14 @@
import·dagger.Provides
import·dagger.hilt.InstallIn
import·dagger.hilt.android.components.ApplicationComponent
+import·javax.inject.Singleton
import·okhttp3.OkHttpClient
import·retrofit2.Retrofit
import·retrofit2.converter.gson.GsonConverterFactory
-import·javax.inject.Singleton
@InstallIn(ApplicationComponent::class)
@Module
-class·NetworkModule
-{
+class·NetworkModule·{
····@Provides
····@Singleton
····fun·provideOkHttpClient():·OkHttpClient·{
@@ -24,7 +23,7 @@
····@Provides
····@Singleton
-····fun·provideProgrammingQuotesApi(okHttpClient:·OkHttpClient)·:·ProgrammingQuotesApi·{
+····fun·provideProgrammingQuotesApi(okHttpClient:·OkHttpClient):·ProgrammingQuotesApi·{
········return·Retrofit.Builder()
... (8 more lines that didn't fit)
gradle or maven version
Gradle - 6.1.1
spotless version
5.5.1
operating system and version
- Windows 10 Pro (19041.508)
- Android Studio 4.0
- Intellij IDEA 2019.3.4
copy-paste your full Spotless configuration block(s)
Root project Gradle file
buildscript {
repositories {
// ...
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
// ...
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.0"
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.5.1"
}
}
apply plugin: "com.diffplug.spotless"
// ...
Subproject (app)'s Gradle file
// ...
apply plugin: "com.diffplug.spotless"
spotless {
kotlin {
target 'src/*/java/**/*.kt'
ktlint()
}
}
// ...
copy-paste the full content of any console errors emitted by gradlew spotless[Apply/Check] --stacktrace
See summary
- Dominant language
- Java
- Stars
- 5.7k
- Forks
- 560
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 43
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from diffplug/spotless
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 66/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
All issues in diffplug/spotless
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
elastic/gradle-plugins#157 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
cryptomator/hub#497 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
johanhaleby/occurrent#1120 ·