Atelier Clockwork

Fixing Minor Annoyances

Hopefully by Improving the Tools of the Trade

For reasons involving cleaner comparisons using diff tools, the current Raizlabs Swift style guide includes the a deviation from standard Swift style, and that’s avoiding using “cuddled” else statements.

For anyone who isn’t a programmer, that’s wanting to use:

if foo {
  return bar
}
else {
  return baz
}

Instead of:

if foo {
  return bar
} else {
  return baz
}

We also use SwiftLint to help maintain our code style, and it’s been a minor annoyance to me that we turn off the current statement position rule, which enforces well formatted “cuddled” else statements, but doesn’t offer any way to enforce a properly formatted “un-cuddled” else statement. With a bit of extra time to spare this sprint, I managed to put together a first pass at an cuddled else linter and have a pull request against SwiftLint to try to add the rule.