I have a coding standard that suggests that the initial argument to a ternary should always be inside parenthesis, regardless of the expression.
foo = (thing.baz?) ?  : thing.bar
foo = thing.baz? ?  : thing.bar
I saw your question, so I went ahead and implemented the cop for you. The name is
Style/TernaryParentheses, and the
EnforcedStyle option you want is
require_parentheses (not the default.)
# .rubocop.yml Style/TernaryParentheses: Enabled: true EnforcedStyle: require_parentheses
You can start using it right now, by putting this in your
gem 'rubocop', git: 'git://github.com/bbatsov/rubocop.git'
or you can wait for the