Hi did someone work with spotless. I'm not sure if...
# detekt
l
Hi did someone work with spotless. I'm not sure if I should go with spotless or detekt (both have ktlint integrated, while spotless has also ktfmt and diktat on board). Can someone give me an advice?
b
I tried using spotless with ktlint, but it never formatted my files...
j
I am using detekt for code analysis, spotless with ktfmt for code formatting. There is a dedicated gradle plugin for ktfmt too https://github.com/cortinico/ktfmt-gradle.
❤️ 1
if you plan to use ktlint for formatting, I would go with detekt only
g
Spotless is useful if you happen to have other languages to format also
2
l
I'm not sure if I set it up correctly but I don't like the reporter of spotless. Sometimes it's not clear why it's complaining, for example it has complained about every line in one file. It might be better to use each of the integrated tools separately (ktfmt, diktat + ktlint)
@gammax I currently noticed you are the maintainer of ktfmt gradle plugin. Could you please bump the version of kmt to 0.28. That would be pleasant. There is also an issue about that.
j
Not sure what you mean, spotlessApply should fix all problems excepts bugs, so if your CI run spotlessCheck and it fails, you only have to update your PR running spotlessApply
last ktfmt version is 0.28, I thought indeed that should be great to have a nightly checker which update the ktfmt dependency
something like dependabot
l
I'm just playing around with the stuff. I mean the task
spotlessCheck
. I tend to have a look what problems it catches before I run the formatter and the output was confusing. So for now I will test the specific tools in isolation without spotless and check what I get there
I have edited my answer. It's now 0.28. 0.25 seems to be the first version that supports Gradle 7.2
g
Please keep the discussion related to ktfmt inside #ktfmt. As a side note: 0.28 was released 2 days ago. Feel free to send a PR and if everything is green, I can definitely merge it 👍
j
PR created, can you enable GitHub Actions for me in your repo?
g
Done, but it’s red. Is not as easy as just bumping the version sadly
j
Ah, I will take a look this afternoon then, I created it via GitHub web
Locally
preMerge
task is passing
CI error:
Copy code
* What went wrong:
'java.lang.String org.jetbrains.kotlin.cli.common.PropertiesKt.getKOTLIN_COMPILER_ENVIRONMENT_KEEPALIVE_PROPERTY()'
Classical it works on my machine XD
l
@gammax As an advice for improvement: please ditch
buildSrc
for gradle version catalog.
buildSrc
ist just a pain in the ass + redundant work
j
he is using buildSrc for more things, not only deps
Ah, I thought there were multiple ore compiled plugins for publishing and so on
l
I guess
buildSrc
is fine for the rest. I'm not so deep into gradle stuff
g
Thanks for your suggestion, I’ll stick with buildSrc for now 👍
j
@gammax can be a problem related to JDK? All issues I see in Google are mentioning changing the jdk should fix the problem
g
FYI
560 Views