Skip to content

Conversation

@will-molloy
Copy link
Owner

@will-molloy will-molloy commented Jan 4, 2025

ktfmt seems better than ktlint (more deterministic/consistent output). Furthermore, using spotless more for formatting than linting.

However, ktfmt has some weird output with Gradle scripts, so keeping ktlint for that.

Have been finding inconsistent results with `ktlint`. I.e. it preserves
custom formatting, which you do not want. It should have deterministic
output.

`ktfmt` was made to solve that: https://github.com/facebook/ktfmt?tab=readme-ov-file#faq

I think they should work together? Need to use for a bit to make sure.
Still want `ktlint` as it handles some bits better like space between
methods.
@codecov
Copy link

codecov bot commented Jan 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (a37cd10) to head (18f2078).
Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##                main      #245   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity         5         5           
===========================================
  Files              2         2           
  Lines              6         6           
===========================================
  Hits               6         6           
Flag Coverage Δ
integration-tests-macos-latest 100.00% <ø> (ø)
integration-tests-ubuntu-latest 100.00% <ø> (ø)
integration-tests-windows-latest 100.00% <ø> (ø)
unit-tests-macos-latest 100.00% <ø> (ø)
unit-tests-ubuntu-latest 100.00% <ø> (ø)
unit-tests-windows-latest 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

will-molloy added a commit to will-molloy/coding-practice-java that referenced this pull request Jan 6, 2025
… (#233)

Seems like this is the way to go...?

Related: will-molloy/java-template#245
GitOrigin-RevId: 65b15a6b34bff8a4072558e718b2ed055c44ecf6
* @author <a href=https://willmolloy.com>Will Molloy</a>
*/
class HelloWorld {

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ktlint removes this space... but not always ???

@will-molloy will-molloy changed the title Add ktfmt Swap to ktfmt (googleStyle) for Kotlin code, but keep ktlint for Gradle scripts Jan 6, 2025
@will-molloy will-molloy marked this pull request as ready for review January 6, 2025 09:59
@will-molloy will-molloy merged commit 158acaf into main Jan 13, 2025
6 checks passed
@will-molloy will-molloy deleted the ktfmt branch January 13, 2025 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant