Skip to content

Conversation

@lordzsolt
Copy link
Contributor

Implements #1921

I kept the option disabled, to keep the old behavior.

Note: Indentation is not validated, similar to the old if, guard and while behavior.

@SwiftLintBot
Copy link

SwiftLintBot commented Feb 3, 2020

12 Messages
📖 Linting Aerial with this PR took 1.95s vs 1.94s on master (0% slower)
📖 Linting Alamofire with this PR took 2.76s vs 2.73s on master (1% slower)
📖 Linting Firefox with this PR took 9.3s vs 9.28s on master (0% slower)
📖 Linting Kickstarter with this PR took 15.65s vs 15.43s on master (1% slower)
📖 Linting Moya with this PR took 1.37s vs 1.41s on master (2% faster)
📖 Linting Nimble with this PR took 1.35s vs 1.35s on master (0% slower)
📖 Linting Quick with this PR took 0.62s vs 0.61s on master (1% slower)
📖 Linting Realm with this PR took 4.42s vs 4.46s on master (0% faster)
📖 Linting SourceKitten with this PR took 1.02s vs 1.04s on master (1% faster)
📖 Linting Sourcery with this PR took 7.14s vs 7.18s on master (0% faster)
📖 Linting Swift with this PR took 11.01s vs 11.04s on master (0% faster)
📖 Linting WordPress with this PR took 17.52s vs 17.59s on master (0% faster)

Generated by 🚫 Danger

@lordzsolt lordzsolt force-pushed the restrict-opening-brace branch 3 times, most recently from 84a7697 to 10aa6a6 Compare February 3, 2020 09:45
@lordzsolt lordzsolt force-pushed the restrict-opening-brace branch from 10aa6a6 to d3cd371 Compare February 18, 2020 20:12
@julsh
Copy link

julsh commented May 14, 2020

I would love to see this merged!!

@weakfl
Copy link

weakfl commented Aug 14, 2020

This would be great, especially since SwiftFormat has introduced a wrapMultilineStatementBraces rule.

@lordzsolt lordzsolt force-pushed the restrict-opening-brace branch from d3cd371 to 1e0a254 Compare August 17, 2020 09:00
@codecov-commenter
Copy link

codecov-commenter commented Aug 17, 2020

Codecov Report

Merging #3068 into master will decrease coverage by 0.01%.
The diff coverage is 97.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3068      +/-   ##
==========================================
- Coverage   90.59%   90.58%   -0.02%     
==========================================
  Files         416      418       +2     
  Lines       20351    20436      +85     
==========================================
+ Hits        18438    18512      +74     
- Misses       1913     1924      +11     
Impacted Files Coverage Δ
...tFrameworkTests/AutomaticRuleTests.generated.swift 100.00% <ø> (ø)
...RuleConfigurations/OpeningBraceConfiguration.swift 80.00% <80.00%> (ø)
...ftLintFramework/Rules/Style/OpeningBraceRule.swift 94.11% <100.00%> (+2.75%) ⬆️
...wiftLintFrameworkTests/OpeningBraceRuleTests.swift 100.00% <100.00%> (ø)
...ramework/Rules/Style/NoSpaceInMethodCallRule.swift 84.21% <0.00%> (-15.79%) ⬇️
...mework/Rules/Idiomatic/NoFallthroughOnlyRule.swift 98.07% <0.00%> (-1.93%) ⬇️
...tFramework/Rules/Lint/ValidIBInspectableRule.swift 98.64% <0.00%> (-1.36%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update af2837e...1e0a254. Read the comment docs.

@jpsim jpsim force-pushed the restrict-opening-brace branch from 1e0a254 to ed3add8 Compare November 7, 2020 20:37
@jpsim
Copy link
Collaborator

jpsim commented Nov 7, 2020

Thanks for this PR and for your patience, I'm slowly making my way through old PRs. I just rebased this and will be merging when CI passes.

@jpsim jpsim merged commit ac2c5e4 into realm:master Nov 7, 2020
@lordzsolt lordzsolt deleted the restrict-opening-brace branch November 8, 2020 21:01
@weakfl
Copy link

weakfl commented Nov 9, 2020

Thanks for merging @jpsim. But imho the config option should be applied for init(...) as well. Or alternatively introduce a separate config option for initializers.

@jpsim
Copy link
Collaborator

jpsim commented Nov 9, 2020

Agreed, we use this style at work but for all multi line declarations, not just functions.

@lordzsolt
Copy link
Contributor Author

lordzsolt commented Nov 9, 2020

@weakfl Yeah, it was my bad 😞
I only realized about init after I made the PR. I can look into it to see if it's just as simple as adding a new keyword.

And now that I think about it, I wonder if throws is supported or not 😟

@weakfl
Copy link

weakfl commented Nov 9, 2020

I can look into it to see if it's just as simple as adding a new keyword.

That would be great, thanks @lordzsolt

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.

6 participants