I'm trying to set up blankLinesAtStartOfScope to do the following (see the two comments):
i.e., a blank line to start non-nested scopes, and no blank line for nested scopes.
import Foundation
class TabBarController: UITabBarController, UITabBarControllerDelegate {
// I want a blank line here...
override func viewDidLoad() {
// But not here
super.viewDidLoad()
}
}
This isn't currently supported. I'll consider adding more config options for this rule.
Nice, thank you :) Apologies for being a picky sod ;)
I don't think it's picky at all, I was stumbling upon this as well. 馃槃
@nicklockwood Is there any interest in a PR for this?
I was thinking of a slightly different approach than the original request. Rather than based on the top level / nested scopes, it would be based on what scope it is. "Type like" scopes (classes, structs, etc) would be one setting, and the rest would be another.
Given this input:
class SomeClass {
func someFunction() {
let someArray = [
"value1",
"value2",
]
}
}
Removing blanks lines for all (equivalent to current behaviour when the rule is enabled):
class SomeClass {
func someFunction() {
let someArray = [
"value1",
"value2",
]
}
}
Removing blanks lines for "type like" scopes:
class SomeClass {
func someFunction() {
let someArray = [
"value1",
"value2",
]
}
}
Removing blanks lines for "other" scopes:
class SomeClass {
func someFunction() {
let someArray = [
"value1",
"value2",
]
}
}
No removing of blank lines (same as original input, equivalent to current behaviour when the rule is disabled):
class SomeClass {
func someFunction() {
let someArray = [
"value1",
"value2",
]
}
}
The naming of these settings would need to be improved for sure. This could potentially be done in non-breaking way if the current disabled and enabled settings can be mapped to the none and all settings. I'm definitely looking for input on the best approach for the configuration of it.
I would also take this and use it for blankLinesAtEndOfScope. Let me know what you think.
CC @lukecharman in case you have any thoughts.
@jwutke that's exactly the sort of solution I had in mind. A PR would be amazing 馃檹
Sounds good. I'll open up a draft PR sometime soon and we can continue discussion there.
Amazing. You are my heroes :)
Most helpful comment
Sounds good. I'll open up a draft PR sometime soon and we can continue discussion there.