See Go
06/22/2024, 10:27 AMEmil Kantis
06/22/2024, 10:09 PMAdam S
06/22/2024, 10:16 PMAdam S
06/22/2024, 10:17 PMOliver.O
06/22/2024, 10:25 PMEmil Kantis
06/22/2024, 10:27 PMEmil Kantis
06/22/2024, 10:28 PMOliver.O
06/22/2024, 10:29 PMI don't think Ktlint would block you from running any tests, ever.Yeah, as long as we don't make the
check
or other test task depend on it, we're safe.Adam S
06/22/2024, 10:30 PMfun foo(): Int {
return 1 + 1 // I add this early return, just to see if it breaks
// [ actual function ...]
}
and ktlint would blow up and say "you can't write code like that!!!" and prevent me from running testsEmil Kantis
06/22/2024, 10:33 PMOliver.O
06/22/2024, 10:35 PMEmil Kantis
06/22/2024, 10:35 PMAdam S
06/22/2024, 10:37 PMSee Go
06/23/2024, 9:57 AMSee Go
06/23/2024, 9:57 AMEmil Kantis
06/23/2024, 10:23 AMAdam S
06/23/2024, 11:13 AMOliver.O
06/23/2024, 11:37 AMBlack is the uncompromising Python code formatter. By using it, you agree to cede control over minutiae of hand-formatting. In return, Black gives you speed, determinism, and freedom fromnagging about formatting. You will save time and mental energy for more important matters.pycodestyle
Blackened code looks the same regardless of the project you're reading. Formatting becomes transparent after a while and you can focus on the content instead.
Black makes code review faster by producing the smallest diffs possible.I found the reasoning behind it solid and the experience positive throughout. Ktlint can operate the same way. Along with the IntelliJ plugin, we can write code as sloppily as we like and get consistency immediately on save (or reformat, however we want). If we then want minimal diffs in PRs, we can just mandate a Gradle-based ktlint check like we do with apiCheck.
See Go
06/24/2024, 12:19 PMOliver.O
06/24/2024, 1:01 PMformatKotlin
and lintKotlin
. And there's the IntelliJ Ktlint plugin which operates like IJ's integrated formatter, but in a more consistent way.
My priorities in this regard would be:
1. Everyone is sufficiently happy with the way auto-formatting works,
2. avoiding manual formatting (and discussing it) saves us time and allows us to focus on what's more valuable,
3. consistent formatting and consistent diffs help with PR reviews.
So I'd suggest:
• For an accommodation phase (can be quite a while), we'll try a workflow with a properly configured Ktlint and the Ktlint IntelliJ plugin, so that formatting happens in a distraction-free way (e.g. when saving).
• If we're happy with how that works, we'll reformat the entire code base once via ./gradlew formatKotlin
.
• If we're still happy, we'll have a CI check ./gradlew lintKotlin
, which operates along with apiCheck
as a requirement (and quality gate) to merge PRs.
Does that make sense?See Go
06/24/2024, 3:48 PMSee Go
06/24/2024, 3:59 PMAlex Kuznetsov
06/25/2024, 6:21 PMAlex Kuznetsov
06/25/2024, 6:22 PMSee Go
06/26/2024, 1:20 AMktlintFormat
on git commit and git push
2. activate ktlintFormat
on push
second option can cause conflict issue so... I think first option is betterEmil Kantis
06/26/2024, 5:04 AMEmil Kantis
06/26/2024, 5:05 AMSee Go
06/26/2024, 6:47 AMcommit
and push
Alex Kuznetsov
06/26/2024, 2:27 PMAlex Kuznetsov
06/26/2024, 2:48 PMEmil Kantis
06/26/2024, 2:52 PMEmil Kantis
06/26/2024, 2:58 PMAlex Kuznetsov
06/26/2024, 3:39 PMSee Go
06/26/2024, 3:42 PMcommit
or push
you may don't like way which formatting works so I suggest as little formatting as possibleOliver.O
06/26/2024, 3:43 PM