Skip to content

ExcessiveMethodLength counts "{" and "}" as part of the function length #54

@insha

Description

@insha

If I have a method like:

func init
{
  let something = 1
  let another = somethingElse(start: 0,
                                end: 1)
  let anArray = [
    "1",
    "2",
    "3"
  ]
  
  if something == 1
  {
    dosomething()
  }
}

What should be the length for this function? 5 or 14?

My code style is that the { and } are on a line by itself for all keywords that require it, so this is causing false positives in my code. Functions that are really under 20 lines are being flagged due to brace being on a line by itself and some function calls that have their arguments stacked (as in the above).

Also when an array literal is defined, see above, all of the lines are counted as part of the function. While the lines are part of the function, they are not individual lines. The declaration of an array is a single line that is split into multiple lines.

Note: I would love to help out with this project. How can I help?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions