https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
ktfmt
  • g

    gammax

    12/24/2020, 3:42 PM
    Also, if you’re on Kotlin 1.4 it won’t work right now. I’ll release a new version later today. Due to how ktfmt loads the AST viewer, you also need to be on Gradle 6.8+ to make everything work 😓
    j
    • 2
    • 10
  • j

    Javier

    12/24/2020, 3:59 PM
    Really I was thinking to create a feature request about this in the ktfmt repo because the problems I had with spotless, so it is great to it just exists already :)
    g
    • 2
    • 5
  • j

    Javier

    12/24/2020, 4:00 PM
    Another question, I like the strict formatting of ktfmt but I want to keep Detekt to find code smell, do you know if some ktfmt formats can do problems with Detekt?
    g
    • 2
    • 3
  • j

    Javier

    12/24/2020, 4:35 PM
    One question,
    gradlew build
    run check and/or format tasks?
    g
    • 2
    • 4
  • j

    Javier

    12/24/2020, 10:51 PM
    I am having the same problem I have with Spotless where it doesn’t work the second time I run it, I tried even using the macOS terminal instead of the AS terminal, do you know where can be this problem? I think it is cached somewhere…
    • 1
    • 1
  • g

    gammax

    12/24/2020, 10:52 PM
    what’s the problem?
    j
    • 2
    • 41
  • j

    Javier

    02/22/2021, 10:36 AM
    Hey @gammax, do you think we should add this Slack channel to the README of the project?
    g
    • 2
    • 4
  • g

    gammax

    02/22/2021, 10:36 AM
    You mean to
    ktfmt-gradle
    ?
    j
    • 2
    • 3
  • g

    gammax

    02/22/2021, 10:43 AM
    Also @Javier, on the issue tracker you mentioned:
    Yeah, I am using dropbox-style. But currently, there is no way to use it with any Gradle plugin no?
    I’m not sure I follow you there? 🤔 Isn’t that supported with the Gradle plugin?
    j
    • 2
    • 13
  • c

    Carmi Grushko

    02/26/2021, 10:44 AM
    I published v0.21 to maven central, which has a new —kotlinlang-style format, if you want to give it a try. I haven’t had the time to create a proper release on GitHub with examples and all, or to integrate it with the IJ plugin. (Paternity leave :) )
    g
    j
    • 3
    • 2
  • g

    gammax

    02/27/2021, 12:30 PM
    I’ve just published v0.4.0 of the Gradle plugin that contains the
    kotlinLangStyle()
    function: https://github.com/cortinico/ktfmt-gradle/releases/tag/0.4.0
    ❤️ 1
    j
    c
    • 3
    • 15
  • c

    Colton Idle

    05/01/2021, 6:01 PM
    Trying to use ktfmt with spotless. In my root I added the plugin
    id("com.diffplug.spotless") version "5.12.4"
    then I added this block in my root build.gradle.kts
    spotless {
        kotlin {
            ktfmt("0.24").dropboxStyle() // version and dropbox style are optional
        }
    }
    When I try to run
    ./gradlew spotlessCheck
    I get
    Could not determine the dependencies of task ':spotlessCheck'.
    > Could not create task ':spotlessKotlinCheck'.
       > Could not create task ':spotlessKotlin'.
          > You must either specify 'target' manually or apply a kotlin plugin.
    Any ideas?
    j
    • 2
    • 12
  • g

    gammax

    05/02/2021, 8:34 AM
    Hey @Colton Idle, following up what you wrote here: https://twitter.com/ColtonIdle/status/1388540306979708928 Do you need any support?
    c
    • 2
    • 3
  • c

    Colton Idle

    05/07/2021, 12:11 AM
    Does anyone use the ktfmt intellij plugin? It doesn't seem to work and just curious what people are doing in the meantime while that gets resolved. Does no one else hit cmd ctrl L all the time like me? 😄
    j
    c
    • 3
    • 31
  • c

    Carmi Grushko

    05/07/2021, 2:35 PM
    Heads up: ktfmt 0.25 is released with Kotlin 1.5.0 support, but Maven Central is having a high load so I'm unable to deploy a new version. I'll try again once the 2nd graph on https://status.maven.org/ goes down under 300s.
    j
    • 2
    • 2
  • c

    Colton Idle

    05/08/2021, 2:29 AM
    I know I can run the ktfmt jar to format code, but can I run it on CI as a "test" to see if code was already formatted correctly? Essentially, if ktfmt has to make a change -- then it fails.
    g
    c
    • 3
    • 3
  • c

    Colton Idle

    05/08/2021, 9:32 PM
    Curious if this is worth filing a bug. https://facebookincubator.github.io/ktfmt/ under gradle the docs say:
    # build.gradle.kts
    plugins { id("com.diffplug.spotless") }
        
    // version and style are optional
    spotless { kotlin { ktfmt('0.25').kotlinlangStyle() } }
    but spotless docs say:
    spotless { // if you are using build.gradle.kts, instead of 'spotless {' use:
               // configure<com.diffplug.gradle.spotless.SpotlessExtension> {
    
    ...
    So should it be
    spotless {
    or
    configure<com.diffplug.gradle.spotless.SpotlessExtension> {
    for kts files? Are the spotless docs wrong/out of date? Or should the ktfmt website show the proper api for applying to a kts file? (this is a super small detail but as someone that just felt like they jumped through a bunch of hoops to get this working with kts build files on Android, I want to make sure the docs are up to date) 😄
    j
    • 2
    • 3
  • c

    Colton Idle

    08/12/2021, 5:11 PM
    Anyone using the ktfmt IJ plugin and working on compose code? It's not usable because it completely breaks things on reformat. Trying to get more eyes on this to see if it's just me OR if it's a local issue. Cheers https://github.com/facebookincubator/ktfmt/issues/249
    j
    • 2
    • 4
  • c

    Colton Idle

    09/24/2021, 6:24 PM
    Does anyone use ktfmt with spotless? https://github.com/diffplug/spotless/blob/main/plugin-gradle/README.md#ktfmt I'm curious if anyone knows a way to just use latest ktfmt instead of updating the string manually in this config block
    j
    • 2
    • 15
  • c

    Colton Idle

    09/25/2021, 1:42 PM
    Note that 
    ktfmt
     still has some rough edges which we're constantly working on fixing.
    Does it? I'd say in general it works really well. 😄 I've had a way better experience than ktlint. Should the docs highlight any of these rough edges so that it's easier (from the maintainers POV) what is still a rough experience?
    j
    • 2
    • 11
  • c

    Colton Idle

    10/12/2021, 1:42 PM
    // version and style are optional
    spotless { kotlin { ktfmt('0.29').kotlinlangStyle() } }
    From the ktfmt website ^ Does that mean that if I omit the ktfmt version, it will always use the latest?
    j
    • 2
    • 2
  • c

    Colton Idle

    10/12/2021, 9:33 PM
    Note: There is no configurability as to the formatter's algorithm for formatting (apart from 
    --dropbox-style
    ). This is a deliberate design decision to unify our code formatting on a single format.
    It looks like when using spotless there are four styles? 1. default (no style selected) 2. dropbox 3. google 4. kotlin Should those be added to the readme, or are they the same or something?
    👀 1
    j
    • 2
    • 1
  • c

    Colton Idle

    12/15/2021, 5:10 AM
    If anyone has any free time, do you mind seeing if you can reproduce this bug? https://github.com/facebookincubator/ktfmt/issues/249 It's been going on for months and it drives me absolutely insane. Calling reformat code with the ktfmt plugin literally breaks my code. 😭
    j
    • 2
    • 37
  • p

    pablisco

    06/14/2022, 10:05 AM
    We have ktfmt enabled in our project using spotless. I found a problem with the check. It complains when using factory functions with UpperCamelCase naming. However, this is valid under Kotlin lang rules: https://kotlinlang.org/docs/coding-conventions.html#function-names Is there a way to change this? Or shall I open a PR for this? Thank you 🙏
    ✅ 1
    j
    • 2
    • 6
  • a

    Aaron Shakibpanah

    08/01/2022, 2:34 PM
    Hello 👋 Is there a way to replace the standard intellij formatter with ktfmt? It looks like my IDE and the formatter keep fighting
  • j

    Javier

    08/01/2022, 3:02 PM
    there is a IDE plugin available at the marketplace
  • a

    Aaron Shakibpanah

    08/01/2022, 3:11 PM
    followed the instructions on that, still appears to be different
  • j

    Javier

    08/01/2022, 3:17 PM
    have you selected the correct formatter? By default it uses facebook one, maybe you are using kotlinlang
  • a

    Aaron Shakibpanah

    08/01/2022, 7:13 PM
    I turned it off and then back on
  • a

    Aaron Shakibpanah

    08/01/2022, 7:13 PM
    seemed to have fixed it, thanks ya'll
Powered by Linen
Title
a

Aaron Shakibpanah

08/01/2022, 7:13 PM
seemed to have fixed it, thanks ya'll
View count: 7