|
123 | 123 |
|
124 | 124 | it 'registers an offense for a method without parentheses on multiple lines' do
|
125 | 125 | expect_offense(<<~RUBY)
|
126 |
| - def resolve_inheritance_from_gems(hash) |
127 |
| - gems = hash.delete('inherit_gem') |
128 |
| - (gems || {}).each_pair do |gem_name, config_path| |
129 |
| - if gem_name == 'rubocop' |
130 |
| - raise ArgumentError, |
131 |
| - ^^^^^^^^^^^^^^^^^^^^ Redundant line break detected. |
132 |
| - "can't inherit configuration from the rubocop gem" |
133 |
| - end |
134 |
| -
|
135 |
| - hash['inherit_from'] = Array(hash['inherit_from']) |
136 |
| - Array(config_path).reverse_each do |path| |
137 |
| - # Put gem configuration first so local configuration overrides it. |
138 |
| - hash['inherit_from'].unshift gem_config_path(gem_name, path) |
139 |
| - end |
140 |
| - end |
141 |
| - end |
| 126 | + def resolve_inheritance_from_gems(hash) |
| 127 | + gems = hash.delete('inherit_gem') |
| 128 | + (gems || {}).each_pair do |gem_name, config_path| |
| 129 | + if gem_name == 'rubocop' |
| 130 | + raise ArgumentError, |
| 131 | + ^^^^^^^^^^^^^^^^^^^^ Redundant line break detected. |
| 132 | + "can't inherit configuration from the rubocop gem" |
| 133 | + end |
| 134 | +
|
| 135 | + hash['inherit_from'] = Array(hash['inherit_from']) |
| 136 | + Array(config_path).reverse_each do |path| |
| 137 | + # Put gem configuration first so local configuration overrides it. |
| 138 | + hash['inherit_from'].unshift gem_config_path(gem_name, path) |
| 139 | + end |
| 140 | + end |
| 141 | + end |
142 | 142 | RUBY
|
143 | 143 |
|
144 | 144 | expect_correction(<<~RUBY)
|
145 |
| - def resolve_inheritance_from_gems(hash) |
146 |
| - gems = hash.delete('inherit_gem') |
147 |
| - (gems || {}).each_pair do |gem_name, config_path| |
148 |
| - if gem_name == 'rubocop' |
149 |
| - raise ArgumentError, "can't inherit configuration from the rubocop gem" |
150 |
| - end |
151 |
| -
|
152 |
| - hash['inherit_from'] = Array(hash['inherit_from']) |
153 |
| - Array(config_path).reverse_each do |path| |
154 |
| - # Put gem configuration first so local configuration overrides it. |
155 |
| - hash['inherit_from'].unshift gem_config_path(gem_name, path) |
156 |
| - end |
157 |
| - end |
158 |
| - end |
| 145 | + def resolve_inheritance_from_gems(hash) |
| 146 | + gems = hash.delete('inherit_gem') |
| 147 | + (gems || {}).each_pair do |gem_name, config_path| |
| 148 | + if gem_name == 'rubocop' |
| 149 | + raise ArgumentError, "can't inherit configuration from the rubocop gem" |
| 150 | + end |
| 151 | +
|
| 152 | + hash['inherit_from'] = Array(hash['inherit_from']) |
| 153 | + Array(config_path).reverse_each do |path| |
| 154 | + # Put gem configuration first so local configuration overrides it. |
| 155 | + hash['inherit_from'].unshift gem_config_path(gem_name, path) |
| 156 | + end |
| 157 | + end |
| 158 | + end |
159 | 159 | RUBY
|
160 | 160 | end
|
161 | 161 | end
|
|
0 commit comments