Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a77e4a1

Browse files
committed
Force using braces if the block is within the predicate of a ternary.
1 parent cd2e354 commit a77e4a1

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
5353
- Allow `IfMod` and `UnlessMod` to know about heredocs moving their bounds.
5454
- Properly handle breaking parameters when there are no parentheses.
5555
- Properly handle trailing operators in call chains with attached comments.
56+
- Force using braces if the block is within the predicate of a ternary.
5657

5758
### Removed
5859

lib/syntax_tree.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2789,7 +2789,7 @@ def forced_do_end_bounds?(q)
27892789
# to go with the {..} bounds.
27902790
def forced_brace_bounds?(q)
27912791
parent, grandparent, = q.parents.to_a
2792-
[If, IfMod, Unless, UnlessMod, While, WhileMod, Until, UntilMod].include?(grandparent.class) && parent == grandparent.predicate
2792+
[If, IfMod, IfOp, Unless, UnlessMod, While, WhileMod, Until, UntilMod].include?(grandparent.class) && parent == grandparent.predicate
27932793
end
27942794

27952795
def format_break(q, opening, closing)

0 commit comments

Comments
 (0)