Commit Graph

5 Commits

Author SHA1 Message Date
JP Simard b83e0991b9 Remove all file headers
The MIT license doesn't require that all files be prepended with this
licensing or copyright information. Realm confirmed that they're ok with this
change. This will enable some companies to contribute to SwiftLint and the
date & authorship information will remain accessible via git source control.
2018-05-04 13:42:02 -07:00
Ornithologist Coder d387532929 Filters out parameters within parameters
For a function that takes a closure as default value, the array of
parameter reported by sourcekit also includes the parameters of that
closure.

In other words, a function like

func foo(param1: Int,
         param2: Bool,
         param3: (Int) -> Void = { (x: Int) in }) { }

reports 4 parameters (param 1, param2, param3, and x).

This commit uses the bounds of the method/function parameters to filter
out parameters within parameters. Below, a 1, a 2, and a 3 would be
filtered out since they're inside parameter 3.

----------------------------------------------------------------|
|        |---------| |---------| |----------------------------| |
|        | param 1 | | param 2 | | param 3: |a 1| |a 2| |a 3| | |
|        |---------| |---------| |----------------------------| |
----------------------------------------------------------------|
2017-10-21 10:58:10 +02:00
Ornithologist Coder f6dc900400 Adds more examples with closures 2017-10-21 10:58:10 +02:00
Ornithologist Coder d356fbb8cf Fix false positive in multiline_parameters rule
when parameter is a closure has default value. Fixes #1912.
2017-10-21 10:58:03 +02:00
Ornithologist Coder 48bb6c77d4 Adds multiline method definition rule
Parameters of methods and functions should be either on the same line,
or one per line.
2017-05-26 14:54:01 +02:00