Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Diff formatting shows weird whitespace characters on Windows 10 (� and ╖ instead of ·)

未关闭
#695 7 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
java, kotlin

调研方向

首先,在 Windows 10 上使用所示的 Spotless 5.5.1 配置重现 gradlew spotlessCheck,并将其控制台输出与 macOS 进行比较。跟踪 Kotlin 使用的差异格式化入口点;当空白标记在 Windows Command Prompt 和 IDE 控制台中都一致呈现为 · 时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

bug

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

主要语言
Java
星标
5.7k
派生
560
平均合并
1 天 13 小时
30 天内合并 PR
43

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

diffplug/spotless 的其他 Issue

查看 diffplug/spotless 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。