question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

One parameter per line if function prototype doesn't fit entirely in one line

See original GitHub issue
private fun someMethod(
      metaData: JsonNode,
      interfaceIdex: Int,
      registryIdex: Int
  ): ArrayNode? {

For this one, it should be the right format, but after I use ktfmt, it changes to

private fun getMethodsOrderedImplementationsWithMethods(
      metaData: JsonNode, interfaceIdex: Int, registryIdex: Int
  ): ArrayNode? {

Free feel to talk to me directly via workchat wyl@fb

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
sgrimmcommented, Jan 2, 2020

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.

0reactions
cgrushkocommented, Mar 4, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

clang-format: always break all parameters, one per line
I would like my function prototypes / definitions to ...
Read more >
Break long function declarations into one parameter per line
It should be doable only by modifying individual domains. A domain is given a node to render a signature into. That node is...
Read more >
5.5 Function Prototypes
A function prototype is a function declaration that specifies the data types of its arguments in the parameter list. The compiler uses the...
Read more >
C Programming Course Notes - Functions
Under the pass-by-value mechanism, the parameter variables within a function receive a copy of the variables ( data ) passed to them. Any...
Read more >
C++ void Functions, Value and Reference Parameters, Local ...
Step 1: Add a new function "DrawCircle" to the program by writing the function definition and the function prototype. This function draws a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found