Commit c189653b448c54cd60f71855b08dc7965474abc8
1 parent
abfb95da
Exists in
master
and in
1 other branch
Rubocop: replace "unless/else" with "if/else" with reversed bodies
Humans tend to be easily confused by the unless/else construct, so banning it.
Showing
2 changed files
with
6 additions
and
11 deletions
Show diff stats
.rubocop_todo.yml
... | ... | @@ -284,8 +284,3 @@ Style/SymbolProc: |
284 | 284 | - 'app/controllers/users/omniauth_callbacks_controller.rb' |
285 | 285 | - 'app/models/deploy.rb' |
286 | 286 | - 'spec/models/deploy_spec.rb' |
287 | - | |
288 | -# Offense count: 2 | |
289 | -Style/UnlessElse: | |
290 | - Exclude: | |
291 | - - 'app/controllers/problems_searcher.rb' | ... | ... |
app/controllers/problems_searcher.rb
... | ... | @@ -6,18 +6,18 @@ module ProblemsSearcher |
6 | 6 | |
7 | 7 | included do |
8 | 8 | expose(:params_sort) { |
9 | - unless %w{app message last_notice_at last_deploy_at count}.member?(params[:sort]) | |
10 | - "last_notice_at" | |
11 | - else | |
9 | + if %w{app message last_notice_at last_deploy_at count}.member?(params[:sort]) | |
12 | 10 | params[:sort] |
11 | + else | |
12 | + "last_notice_at" | |
13 | 13 | end |
14 | 14 | } |
15 | 15 | |
16 | 16 | expose(:params_order) { |
17 | - unless %w{asc desc}.member?(params[:order]) | |
18 | - 'desc' | |
19 | - else | |
17 | + if %w{asc desc}.member?(params[:order]) | |
20 | 18 | params[:order] |
19 | + else | |
20 | + 'desc' | |
21 | 21 | end |
22 | 22 | } |
23 | 23 | ... | ... |