Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Benjamin Marwell
    @bmarwell
    it is not intended by either, but lets see
    Nope, files are still untouched.
    Benjamin Marwell
    @bmarwell
    @nedtwigg I pushed the changes to https://github.com/scms/scms/tree/72-spotless-xml. The config is in the main pom.xml. I would have expected spotless to fail on the pom.xml file
    Ned Twigg
    @nedtwigg
    Sorry, not gonna have time to dig in. My advice is to read the “how spotlesss works section” https://github.com/diffplug/spotless/blob/main/CONTRIBUTING.md#how-spotless-works
    Benjamin Marwell
    @bmarwell
    @nedtwigg sadly that is not helpful. It says how to add a formatter step, but the maven plugin is supposed to do that for you. And I followed the readme of the maven plugin.
    Benjamin Marwell
    @bmarwell
    @bmhm
    Can anyone help me with this please?
    diffplug/spotless#792
    I already tried mvn -X but couldn’t find anything useful. Seems the debug switch does not get promoted to spotless, and there is no debug option for spotless in the maven-plugin’s readme.
    Benjamin Marwell
    @bmarwell
    The best thing I get is the HEADING of XML files:
    [ERROR]     pom.xml
    [ERROR]         @@ -1,7 +1,9 @@
    [ERROR]         -<?xml·version="1.0"·encoding="UTF-8"?>
    [ERROR]         -<project·xmlns="http://maven.apache.org/POM/4.0.0"
    [ERROR]         -·········xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    [ERROR]         -·········xsi:schemaLocation="http://maven.apache.org/POM/4.0.0·http://maven.apache.org/xsd/maven-4.0.0.xsd">
    [ERROR]         +<?xml·version="1.0"·encoding="UTF-8"·?>
    [ERROR]         +<project
    [ERROR]         +··xmlns="http://maven.apache.org/POM/4.0.0"
    [ERROR]         +··xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    [ERROR]         +··xsi:schemaLocation="http://maven.apache.org/POM/4.0.0·http://maven.apache.org/xsd/maven-4.0.0.xsd"
    [ERROR]         +>
    [ERROR]          ··<modelVersion>4.0.0</modelVersion>
    Ned Twigg
    @nedtwigg
    That means the bug is probably inside the prettier-xml-formatter.
    Spotless is a switchboard for other formatters. You shot above indicates that it’s all wired up right, but the xml formatter isn’t doing very much.
    Benjamin Marwell
    @bmarwell
    How can I see which files it is touching? Any debug option I can enable in Maven which will make the node process more verbose?
    Ned Twigg
    @nedtwigg
    I don’t know how to make node more verbose
    But you can double-check which files are being touched with https://github.com/diffplug/spotless/blob/main/PADDEDCELL.md
    Benjamin Marwell
    @bmarwell
    That doc does not really help me
    Benjamin Marwell
    @bmarwell
    @nedtwigg I would like to push that issue forward. Anything else where to start looking? It would be really useful if we could make node.js more chatty…
    Scott Sue
    @scott.sue_gitlab

    Hi all, what is the general best practice for integrating spotless into a project? I currently see two scenarios:
    1) Perform a one time hit to format every file within the project across all branches. This will ensure that any subsequent commits won't have any major formatting changes bundled with 'real' code changes. This seems to be discouraged and hence the ratchetFrom was created? Activities like code reviews are then easier to perform as the reviewer can disregard any formatting changes
    2) Utilise ratchetFrom to only change the files that have been modified. This however seems to suggest that formatting changes are bundled in with 'real' code changes making code reviews more difficult.

    I would have thought 1) would have been the best practice, but it seems to be discouraged within the documentation.

    Can anyone share any experiences with how best to integrate spotless into a project?

    Ned Twigg
    @nedtwigg
    @bmarwell I've lost context. GitHub issue would be better, but the bottom line is that I think everything is working as intended, but you don't like what the formatter is doing. I linked you to CONTRIBUTING.md so that you could submit a PR to change what a formatter does if you want. I don't have time to help past that.
    1 reply
    @scott.sue_gitlab When it comes to first turning-on, Spotless has no opinion on "format-the-world" vs "incremental". I think "format-the-world" is better, but incremental is fine too.
    But there's also the issue of day-to-day updates. Languages add new features, and formatters change their defaults over time. Easy to say "the format should never change", but after maintaining this thing for years, every formatter has changed its settings over time. This means that just updating your build dependencies can lead to ){ becoming ) { all over the project, noise like that.
    So once you are using Spotless, I think ratchetFrom is helpful to limit that noise. It's also a lot faster, and if you want actually-correct copyright headers on every file, then it's the only option.
    Scott Sue
    @scott.sue_gitlab
    Thanks Ned for the insight. I was leaning towards "format the world" as well. The documentation that I was referring to where this seemed to be (or at least the way I understood it) was at https://github.com/diffplug/spotless/tree/main/plugin-gradle#ratchet. Maybe our conversation can be incorporated into this to avoid any further potential confusion?
    Ned Twigg
    @nedtwigg
    Happy to take any PRs! The general Spotless philosophy is that we are not opinionated, and just try to facilitate whatever opinions the user has. We appreciate new users contibuting back to the docs to reduce stick points!
    Isaac Vargas
    @I-Vargas
    Saw that ktfml had a new release last week adding a new style (facebookincubator/ktfmt@7fbc9d9)
    I was playing around a little bit and created a PR (diffplug/spotless#810), was just me playing a bit around
    Rob Oxspring
    @roxspring
    I'm starting to play with generating reviewdog json reports, and it's clearly gonna take more than SimpleJsonWriter can cope with. Do we want to expand the home grown code to cope with arrays and richer tree structures, or is it time to embrace a JSON library? (and any preference of JSON library?)
    Ned Twigg
    @nedtwigg
    Awesome! Feel free to pick a Json lib of your choice. I’ve been happy with Moshi, Gson, and Jsoniter, but happy to use something new that you like.
    Timur
    @timkabot
    Can you advice where the spotless or ktlint stores reports, cant find them(
    8 replies
    image.png
    Alexey Kotlyarov
    @koterpillar
    Does spotless (for Gradle) add jcenter repository to the build?
    Ned Twigg
    @nedtwigg
    Spotless uses, but does not modify, the buildscript repositories. In older versions of Gradle, I think the buildscript repository defaults includes jcenter
    Frank Vennemeyer
    @fvgh
    @nedtwigg , please have a look at the latest : eclipse-groovy:changelogPush . Looks like a ⭕ setup problem to me.
    Ned Twigg
    @nedtwigg
    @fvgh I think it's a deeper issue from the jcenter sunset. We have always published via jcenter -> mavencentral, but jcenter stopped accepting new uploads. I promise I'll have it resolved by end of the week, hopefully sooner.
    Jonathan Bluett-Duncan
    @jbduncan
    @nedtwigg If there's anything we can do to help, please let us know. :)
    Ned Twigg
    @nedtwigg
    @fvgh the ⭕problem is fixed, ext deploy works again, groovy 4.0 is published now: diffplug/spotless@6e40b41
    Frank Vennemeyer
    @fvgh
    Thanks Ned. Will provide the Eclipse updates this weekend.
    gmmurugan
    @gmmurugan
    intellij plugin or pre-commit hook ideas?
    1 reply
    Chris Serra
    @chris-serra
    Has anyone created a Golang formatter for Spotless?
    1 reply
    Rajeev Kumar kallempudi
    @rajeevprasanna

    i have integrated spotless gradle plugin in springboot application. build is successful in localmachine. But it is failing in aws code build.

    Error i get

    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Could not determine the dependencies of task ':spotlessApply'.
    > Could not create task ':spotlessJavaApply'.
       > Could not create task ':spotlessJava'.
          > Cannot find git repository in any parent directory
    
    * Try:
    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
    
    BUILD FAILED in 25s
    @nedtwigg any help
    Ned Twigg
    @nedtwigg
    You are using ratchetFrom
    But your CI is doing a bare checkout
    Search our GitHub isssues for bare checkout
    Chris Serra
    @chris-serra
    hi @nedtwigg -- we're looking to package up Spotless for Gradle as (to start) a Java formatter for internal Java projects. We'd like to limit the setup, so want to package it with an Eclipse XML, and other properties configured so that a Java project could just apply <our-wrapped-spotless> gradle plugin. I'm new to Gradle plugin development, so wondering if you had tips on this? As simple as possible -- just package up Eclipse XML, license header, and the spotless { ... } gradle task configurations so it's hands-off. Thanks!
    Ned Twigg
    @nedtwigg
    1 reply
    Chris Serra
    @chris-serra
    cool, thanks!
    Ned Twigg
    @nedtwigg
    Frank Vennemeyer
    @fvgh
    Looking at the ⭕ CI history, it seems to me that the tests have sporadic problems to resolve / store Maven dependencies. The dependencies themselves and the repost configuration look fine to me. Is it a known problem? For different jobs and different dependencies (guava, slf4j,...) a NoSuchFileException occurs in the Gradle cache.
    Ned Twigg
    @nedtwigg
    It has seemed flaky to me too (I very occasionally have to restart a test on a PR to fix a transient failure)
    I have no guesses re: cause
    David Smiley
    @dsmiley
    Hello. I'm investigating how best to forbid my Java source code from using C-style array declarations. I first went to the Google Java Formatter plugin and filed an issue -- google/google-java-format#615 but it's just a formatter so it was rejected. Error-Prone is another option but it seems more error oriented and less style oriented. Spotless seems like a sensible spot to add such a check maybe? Can someone suggest where/how the check might be added?