Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle ktlint check should display the violated rule name #1551

Closed
4 tasks done
gotson opened this issue Feb 2, 2023 · 1 comment
Closed
4 tasks done

Gradle ktlint check should display the violated rule name #1551

gotson opened this issue Feb 2, 2023 · 1 comment

Comments

@gotson
Copy link

gotson commented Feb 2, 2023

  • gradle version: 7.6
  • spotless version: 6.14.0
  • operating system and version: macOS 13.2
  • copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible

When running spotlessCheck, the violated rules are not mentioned.

Here is the output of spotlessCheck:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':komga:spotlessKotlinCheck'.
> The following files had format violations:
      src/main/kotlin/org/gotson/komga/application/tasks/TaskEmitter.kt
          @@ -63,10 +63,11 @@
           ··}
           
           ··fun·hashBooksWithoutHash(library:·Library)·{
          -····if·(library.hashFiles)
          +····if·(library.hashFiles)·{
           ······bookRepository.findAllByLibraryIdAndWithEmptyHash(library.id).forEach·{
           ········submitTask(Task.HashBook(it.id,·LOWEST_PRIORITY,·it.seriesId))
           ······}
          +····}
           ··}
           
           ··fun·findBooksWithMissingPageHash(library:·Library,·priority:·Int·=·DEFAULT_PRIORITY)·{
          @@ -86,10 +87,11 @@
           ··}
           
           ··fun·repairExtensions(library:·Library,·priority:·Int·=·DEFAULT_PRIORITY)·{
          -····if·(library.repairExtensions)
          +····if·(library.repairExtensions)·{
           ······bookConverter.getMismatchedExtensionBooks(library).forEach·{
           ········submitTask(Task.RepairExtension(it.id,·priority,·it.seriesId))
           ······}
          +····}
           ··}
           
           ··fun·findDuplicatePagesToDelete(library:·Library,·priority:·Int·=·DEFAULT_PRIORITY)·{
  Run './gradlew :komga:spotlessApply' to fix these violations.

In comparison, here is the output of the ktlint command line:

/Users/groebroeck/Dev/komga/komga/src/main/kotlin/org/gotson/komga/application/tasks/TaskEmitter.kt:67:7: Missing { ... } (multiline-if-else)
/Users/groebroeck/Dev/komga/komga/src/main/kotlin/org/gotson/komga/application/tasks/TaskEmitter.kt:90:7: Missing { ... } (multiline-if-else)

Notice how the rule multiline-if-else is mentioned in there.

In addition, when running in IntelliJ, the filenames in the output of spotless are not links, and thus not clickable. It would be great to be able to click on the file names so i can open them directly.
image

In comparison, the command line output of ktlint is clickable.
image

Configuration:

configure<com.diffplug.gradle.spotless.SpotlessExtension> {
    kotlin {
      targetExclude("**/db/migration/**")
      ktlint("0.48.2")
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants