GithubHelp home page GithubHelp logo

Comments (9)

sgrimm avatar sgrimm commented on July 27, 2024 1

Google's Kotlin style guide for Android says arguments should be split across multiple lines if the function signature doesn't fit on one line. JetBrains' official Kotlin style guide is fuzzier; it says "closely related" arguments should be placed on the same line, but obviously ktfmt can't determine that.

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024
  1. Are you missing 2 spaces before private fun…?

I'd expect the output to be:

  private fun getMethodsOrderedImplementationsWithMethods(
      metaData: JsonNode, interfaceIdex: Int, registryIdex: Int
  ): ArrayNode? {
  1. The parameters fit in one line, so ktfmt doesn't break them. Should it break? do you prefer the first version? are you aware of a style guide that mandates it? how should ktfmt decide whether to break the parameter list or not?

from ktfmt.

Trigon avatar Trigon commented on July 27, 2024

@cgrushko
Sorry, the 2 spaces are my issue, the output is the same as what you expect.
After ktfmt makes the parameters be in the same line, the lint on phabricator complains about that.
I think the style guide should be consistent between ktfmt and the lint in phabricator

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024

ktfmt and detekct/ktlint disagree, so some friction between the linters is expected (we plan to disable detekt's formatting on files that ktfmt formats).

Again, we could change this formatting decision. I don't have a good sense of what's right to do.
cc @strulovich

from ktfmt.

strulovich avatar strulovich commented on July 27, 2024

I think I agree with Carmi's expected style. We should disable some of Detekt's checks to match with this.

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024

from ktfmt.

Trigon avatar Trigon commented on July 27, 2024

I agree with being similar to java. Would the detekct changes the rule OR ktfmt replace detekct as the lint in diff tool?

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024

from ktfmt.

cgrushko avatar cgrushko commented on July 27, 2024

I'll close this for now. We can revisit this if we run into examples where it's very clearly better to break before each parameter.

from ktfmt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.