Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Matthias Balke
    @matthiasbalke
    Thanks, your feedback means a lot to me!
    Yannis Koutras
    @jokogr_twitter
    Hello, I'm on Gradle 5.6.2 and trying to run spotless on a Java project with the prettier formatter
    The first time I'm running spotlessCheck it fails, any idea why?
    1 reply
    (after a clean, that is without a build directory)
    Brandon Ward
    @Bwvolleyball
    Does anybody know if there is a way to export formatting rules from IntelliJ for use in spotless? We have some custom formats already declared and socialized in the form of IntelliJ settings distributions, and I'd love to somehow use those formatting rules in spotless as well.
    Ned Twigg
    @nedtwigg
    Not yet. Here's the issue tracking this: diffplug/spotless#200
    rompic
    @rompic
    is anyone using spotlessCheck on Jenkins and annotates Github Pullrequests with the results?
    context: i have some eclipese formatter rules that i want to have checked automatically
    Ned Twigg
    @nedtwigg
    I think a lot of users use spotlessCheck in CI, and use that to put a green check or red x on GitHub PRs. Do you have something more elaborate in mind when you say "annotate"?
    rompic
    @rompic
    I meant using https://github.com/jenkinsci/violation-comments-to-github-plugin or something similar to add comments where format issues were found
    Ned Twigg
    @nedtwigg
    That's a great idea, tracking it here: diffplug/spotless#655
    rompic
    @rompic
    Thanks for looking into it ;)
    Drew Taylor
    @drewctaylor
    When configuring the maven plugin, can the file in <eclipse><file>path</file></eclipse> reference a file in a jar, such as a dependency added to the maven plugin itself? If so, how - I've tried a few variations ("/path/to/file", "classpath:///path/to/file", etc.) and it seems none of them work.
    Ned Twigg
    @nedtwigg
    I think "path/to/file" works
    Here's an example:
    Drew Taylor
    @drewctaylor
    That seems to work - thanks!
    Starlight220
    @Starlight220
    Is it possible for spotless (gradle for kotlin/java) to print a list of formatting errors (or even better: fix them)?
    rompic
    @rompic
    @Starlight220 maybe https://medium.com/@aruny3/improve-code-formatting-on-every-commit-7fbb0cdfdab6 helps. it discusses spotlessCheck (which prints the problems found) and spotlessApply (which fixes them)
    Ned Twigg
    @nedtwigg
    @Starlight220l TLDR, yes, it is possible to print a list (spotlessCheck) and to fix them (spotlessApply)
    Starlight220
    @Starlight220
    I ran spotless on a Java Gradle project, failed because it couldn't find an npm executable. where should such an executable be located, or how should I fix this?
    Ned Twigg
    @nedtwigg
    You must be using the prettier() step. It's npm requirements are documented here: https://github.com/diffplug/spotless/blob/main/plugin-gradle/README.md#npm-detection
    Starlight220
    @Starlight220
    Thanks. Is there a point in running multiple formatters on the same language?
    Ned Twigg
    @nedtwigg
    Generally not.
    it seems like you're probably looking at the full api reference, and using that as a quickstart
    Isaac Vargas
    @I-Vargas
    image.png
    I'm getting an exception because I'm not setting the target
    image.png
    when I was trying it out before it was working without setting the target, what am I missing now
    I'm using spotless 4.4
    Ned Twigg
    @nedtwigg
    Based on the snippet you posted, you are not applying the java plugin. You should have gotten the same error in earlier versions of Spotless too, if you weren't applying the java plugin then either. Is it possible there were more changes in your buildscript than just the spotless version? There could also be other plugins which used to apply the java plugin, but now don't (I'm speculating, but maybe something like kotlin-multiplatform might apply the java plugin, and then stop doing that in a future version, I don't know.
    It's easy to fix with target/src/**/*.kt
    correction: target 'src/**/*.kt'
    Isaac Vargas
    @I-Vargas
    yeah I know I can fix it with using target but I wanted to understand what was happening.
    Ah it's the general gradle plugin java that is missing.
    Yeah adding it to the plugins worked.
    I was thinking that it was something internal to spotless that I was missing that I needed to do.
    Thank you.
    Dan Hartman
    @dphart

    Hey there, I'm trying to upgrade from 3.X version to the latest and copying when I see in the https://plugins.gradle.org/plugin/com.diffplug.spotless

        classpath 'com.diffplug.spotless:spotless-plugin-gradle:5.6.1'

    I just get an error
    Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'com.diffplug.gradle.spotless'.
    Caused by: org.gradle.api.GradleException: We have moved from 'com.diffplug.gradle.spotless'

    Ned Twigg
    @nedtwigg
    You need to find-replace com.diffplug.gradle.spotless with com.diffplug.spotless across your *.gradle files. See this changelog entry for more info.
    Jonathan Bluett-Duncan
    @jbduncan
    @nedtwigg You got there before me, right as I was about to post a response! ;)
    Ned Twigg
    @nedtwigg
    😂
    Oleh
    @Oleh-M
    Hi all
    Is there any way to format C++ string by using java API?
    without any plugin?
    or somehow call formatting step on file from java API?
    Ned Twigg
    @nedtwigg
    Yes
    Then these as an example:
    Oleh
    @Oleh-M
    Thank you very much
    Will try