-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable "respectsExistingLineBreaks" in .swift-format for more consistent styling #230
Comments
Would disabling this rule remove all unnecessary line breaks? E.g. would func foo() {
let bar = try makeBar()
let baz = process(bar)
baz.doSomething()
} become the following? func foo() {
let bar = try makeBar()
let baz = process(bar)
baz.doSomething()
} |
No, it leaves those alone. It only reformats line breaks around source code, it seems: #231 |
Oh that seems reasonable then. Saying that, from the diff I'm not convinced this makes the code any easier to read. In fact some places it worsens readability. Perhaps other rules need tweaking when enabling this as well. A few examples: } catch {
XCTFail(error.localizedDescription, file: file, line: line)
} changed to } catch { XCTFail(error.localizedDescription, file: file, line: line) } and public static func error(
message: String,
location: Location? = nil,
context: [String: String] = [:]
) -> Diagnostic {
.init(severity: .error, message: message, location: location, context: context)
} changed to public static func error(message: String, location: Location? = nil, context: [String: String] = [:]) -> Diagnostic
{ .init(severity: .error, message: message, location: location, context: context) } |
Yeah I don't love the bias towards single line scopes either. I'll take a look at the rules if we can't opt out of that. |
Hello, I would be interested in working on this issue if it's available |
Sure @PARAIPAN9, although it might result in a big diff, so maybe you could look into landing this one first? #188 |
Sure, thanks!! |
…tent styling (#23) ### Motivation - Relates to [#230](apple/swift-openapi-generator#230) ### Modifications - Disable respectsExistingLineBreaks .swift-format rule and address changes requested ### Result - One of the .swift-format rules will be disabled ### Test Plan - Run Tests
…tent styling (#20) ### Motivation - Relates to [#230](apple/swift-openapi-generator#230) ### Modifications - Disable respectsExistingLineBreaks .swift-format rule and address changes requested ### Result - One of the .swift-format rules will be disabled ### Test Plan - Run Tests Co-authored-by: Honza Dvorsky <[email protected]>
Disable "respectsExistingLineBreaks" in .swift-format for more consistent styling.
Today,
respectsExistingLineBreaks
is enabled, which means that it depends on how you write the code before running the formatter, and it affects the output. That's not ideal, and is different than the setting we have for formatted code, so affects #40.This should be done as a single PR, as it'll cause some churn.
The text was updated successfully, but these errors were encountered: