Closed jlnbuiles closed 2 years ago
also noticed it on a guard statement.
I had this:
guard let cell = tableView.dequeueReusableCell(withIdentifier: CryptoListsTableViewCell.identifier, for: indexPath) as? CryptoListsTableViewCell else {fatalError("Unable to create cell.")}
and it was formatted tot this:
guard let cell = tableView.dequeueReusableCell(withIdentifier: CryptoListsTableViewCell.identifier,
for: indexPath) as? CryptoListsTableViewCell else
{
fatalError("Unable to create cell.")
}
@jlnbuiles this behavior is caused by the wrapMultilineStatementBraces
rule. You can disable it as follows:
--disable wrapMultilineStatementBraces
So i went ahead and did this and it does implement it in some cases, but not in others.
Worked for this one: initial format
guard let cell = tableView.dequeueReusableCell(withIdentifier: CryptoListsTableViewCell.identifier,
for: indexPath) as? CryptoListsTableViewCell else
{
fatalError("Unable to create cell.")
}
resulting format
guard let cell = tableView.dequeueReusableCell(withIdentifier: CryptoListsTableViewCell.identifier,
for: indexPath) as? CryptoListsTableViewCell else {
fatalError("Unable to create cell.")
}
For these 2 it did not apply applied any formatting and left them as is:
func application(_: UIApplication,
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
// Override point for customization after application launch.
return true
}
and this one:
func application(_: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options _: UIScene.ConnectionOptions) -> UISceneConfiguration
{
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
¿is there a specific reason why that is?
Additionally, maybe it'd be helpful to add a small section within the rules md that lists explicitly rules NOT applied by default? it seems like most are enabled by default, but this wasn't that clear to me unless I went one by one and read their respective values.
Doing this would probably lead people to simpler configuration .swiftformat
files. As they should only deal with rules they want to disable, or modify the default behavior or, right?
@jlnbuiles fixed in 0.49.5
dopeness! thanks brother!
I noticed that the
allman
formatting is not being applied to multi-line functions. e.g.:For this guy it works beautifully 🌸:
But for this guy it doesn't:
Is this intended behavior? if so maybe we should mention it in the docs? how could I accomplish consistent opening brace formatting for all methods?
What i'm setting on the config file:
Attaching the complete config file for reference as well. It could be that I have conflicting configuration. swiftformat 2.txt
Versions for all the stuffs