Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    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
    Rogier Hofboer
    @rogierhofboer
    Hi not sure if this has been asked before.. But for some reason on openHAB spotless wants Unix line endings on Windows, even with .gitattributes defined
    It can be reproduced on Windows by cloning https://github.com/openhab/openhab-core and running mvn -DskipTests=true clean install
    See also openhab/openhab-addons#8712 (the issue is about openhab-addons, but the same happens with openhab-core)
    Nowhere LINUX seems to be defined in the project, so I am totally lost as to why it happens.
    Any idea's or suggestions are very welcome. Thanks in advance!
    Radek Ježdík
    @redhead
    hi, I am having sudden issues formatting a project which uses spotless for a year already.. suddenly I get exception:
    12:46:03.345 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
    Execution failed for task ':server-backend-spi:spotlessJava'.
    > java.io.EOFException
    
    * Try:
    Run with --scan to get full insights.
    
    * Exception is:
    ....
    Caused by: com.diffplug.common.base.Errors$WrappedAsRuntimeException: java.io.EOFException
    at com.diffplug.common.base.Errors.asRuntime(Errors.java:408)
    at com.diffplug.gradle.spotless.SerializableMisc.fromStream(SerializableMisc.java:65)
    at com.diffplug.gradle.spotless.SerializableMisc.fromFile(SerializableMisc.java:44)
    .....
    Caused by: java.io.EOFException
    at com.diffplug.gradle.spotless.SerializableMisc.fromStream(SerializableMisc.java:60)
    ... 92 more
    but I can't figure out what's wrong, is there some debug option that would print the name of the file which is making troubles for spotless?
    on jenkins build, however, it works fine
    Radek Ježdík
    @redhead
    ok I needed to remove the whole folder and git checkout it again, now it works.. dunno where the issue was..
    Ned Twigg
    @nedtwigg
    Thanks @fvgh for the 4.18 lockfiles! Looks ready to ship to me, anything else you'd like before I cut a release?
    Frank Vennemeyer
    @fvgh
    Please go ahead with the release, @nedtwigg . Think that Groovy Eclipse will not finish their release for 4.18 this year. The commit message has a minor typo, but I didn't want to force push on main.
    Chris Serra
    @chris-serra
    is it possible to prevent the ratchetFrom feature from adding a year-range to the licenseHeaderFile step?
    Without adding the ratchetFrom step, it will not add the range -- if the year is already present, it leaves it alone.
    Ned Twigg
    @nedtwigg
    So you want it to just show the latest year?
    Or not touch the year at all?
    Chris Serra
    @chris-serra
    We have a license already in most files, although the company name has changed so we don't mind having that being replaced. But it is changing e.g. 2017 to 2017-2021
    Ned Twigg
    @nedtwigg
    You can use .updateYearWithLatest(false) to disable the year update
    Chris Serra
    @chris-serra
    Thank you. I was trying to access the Javadoc pages, but I kept getting Access Denied pages
    Ned Twigg
    @nedtwigg
    You can also just not have a $YEAR, and instead have 2017
    Yeah, javadoc works for 5.6.0 and previous, broken after, haven't figured out why
    Chris Serra
    @chris-serra
    beautiful, thank you!
    Ned Twigg
    @nedtwigg
    Also, if you are making changes, then I think your lawyers will want it to be (year created)-(year last modified). At least that's what Google's lawyers want
    Chris Serra
    @chris-serra
    haha we (us developers) were unsure of that as well, so maybe we DO want that. Although the changes made to most of those files were because I replaced the previous format toggle (JIndent's) with Spotless's
    Chris Serra
    @chris-serra

    @nedtwigg I may be having an issue related to: diffplug/spotless#746

    but it's not a git-submodule (I don't believe, not explicitly), but is a module of the project. This is only occurring on Jenkins, however.

    `

    • What went wrong:
      Could not determine the dependencies of task ':integrity:spotlessApply'.

      Could not create task ':integrity:spotlessJavaApply'.
      Could not create task ':integrity:spotlessJava'.
      No such reference 'origin/master'

    • Try:
      Run with --debug option to get more log output. Run with --scan to get full insights.

    • Exception is:
      org.gradle.api.internal.tasks.TaskDependencyResolveException: Could not determine the dependencies of task ':integrity:spotlessApply'.
      at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:69)
      `

    we have spotlessApply task depend on javaCompile. maybe it could be disabled for the pipeline, or just force people to explicitly run spotlessApply target when formatting code.
    Ned Twigg
    @nedtwigg
    Also, with apply dependsOn javaCompile, CI will pass even if people commit badly formatted code, because the CI server will fix it with local changes. So it is a good idea to disable this on CI, and I think also a bad idea to do in general. SpotlessApply can be a destructive change, best if it is always deliberate imo
    Chris Serra
    @chris-serra
    ah I see, thanks. and since the CI doesn't commit the build to our repo, it doesn't make sense for it to run on the CI.
    so either remove it as a dependency for javaCompile, or find a way to bypass that for the CI server.
    Ned Twigg
    @nedtwigg
    Right
    Chris Serra
    @chris-serra
    is it at all common to configure spotless outside of your build script? something you'd run explicitly locally but I don't want it be loaded up on the CI server at all.
    Chris Serra
    @chris-serra
    hmm, even when I apply the spotless plugin within a task, it still seems like spotlessJava is occurring. any way to prevent that from happening on build?
    Ned Twigg
    @nedtwigg
    You can check for CI environment variable.
    spotlessJava calculates, it doesn't do anything. spotlessJavaApply and spotlessJavaCheck depend on it, and they are the tasks which actually do something. By default, check -> spotlessCheck -> spotlessJavaCheck -> spotlessJava
    Chris Serra
    @chris-serra
    but if using ratchetFrom, spotlessJava would still use that, correct? So even if it only calculates, it's still attempting to look up that Git reference (where it fails)