Skip to content

Improve missing_empty_line Rule#99

Merged
Tomusm merged 1 commit intomasterfrom
feature/improve_missing_empty_line
Nov 12, 2019
Merged

Improve missing_empty_line Rule#99
Tomusm merged 1 commit intomasterfrom
feature/improve_missing_empty_line

Conversation

@kmeinh
Copy link
Copy Markdown
Contributor

@kmeinh kmeinh commented Nov 12, 2019

Remove Rule:

multiline_arguments

Reason:

This Rule was triggered for the following example:

UIView.animate(withDuration: 0.3, animations: {
	print("...")
}, completion: { (success: Bool) in
	print("---")
})

Rule intended to format the code like:

UIView.animate(
	withDuration: 0.3, 
	animations: {
		print("...")
	},
	completion: { (success: Bool) in
		print("---")
	}
)

Might be more logical but is not (yet) intended to be.

Modified Rule:

missing_empty_line

What has been modified:

This Rule was triggered whenever a closing Bracket was not followed by one of the following characters: \n, ., }, \t or . Since we opened up our rules on so-called one-liners (let map = [1, 2].map { "\($0)" }), this Rule needs modification.

Modification:

This Rule is now just triggering if there are empty lines between two closing curly Brackets (} ).

will trigger at:

class ABC {

	func test() {
		print("something")
	}

}

but not for:

let map = [1, 2].map { "\($0)" }
let map2 = [1, 2].map { "\($0)" }

@kmeinh kmeinh requested review from Tomusm and proth November 12, 2019 10:29
@Tomusm Tomusm merged commit 9ed78f4 into master Nov 12, 2019
@proth proth deleted the feature/improve_missing_empty_line branch November 19, 2019 08:46
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.

3 participants