summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2025-04-11 09:21:17 +0000
committerGo MAEDA <maeda@farend.jp>2025-04-11 09:21:17 +0000
commit08ea4e0323d24d55632771a86eead4a78663b4f3 (patch)
tree1b4a61a3451b5e9e9f801bbc25b75960b51f63e5
parent5668aa651f76e5bb084b8c78c58d975e09560dcb (diff)
downloadredmine-08ea4e0323d24d55632771a86eead4a78663b4f3.tar.gz
redmine-08ea4e0323d24d55632771a86eead4a78663b4f3.zip
Fix RuboCop Style/RedundantCondition (#41884).
git-svn-id: https://svn.redmine.org/redmine/trunk@23627 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--.rubocop_todo.yml7
-rw-r--r--app/controllers/messages_controller.rb2
-rw-r--r--app/controllers/previews_controller.rb6
-rw-r--r--app/models/issue.rb6
4 files changed, 5 insertions, 16 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 9c4c38b69..fbb4e1416 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -1107,13 +1107,6 @@ Style/RedundantBegin:
- 'test/unit/query_test.rb'
# This cop supports safe autocorrection (--autocorrect).
-Style/RedundantCondition:
- Exclude:
- - 'app/controllers/messages_controller.rb'
- - 'app/controllers/previews_controller.rb'
- - 'app/models/issue.rb'
-
-# This cop supports safe autocorrection (--autocorrect).
Style/RedundantConditional:
Exclude:
- 'app/controllers/workflows_controller.rb'
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index 5159bf540..22daf9f90 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -134,7 +134,7 @@ class MessagesController < ApplicationController
def preview
message = @board.messages.find_by_id(params[:id])
- @text = params[:text] ? params[:text] : nil
+ @text = params[:text] || nil
@previewed = message
render :partial => 'common/preview'
end
diff --git a/app/controllers/previews_controller.rb b/app/controllers/previews_controller.rb
index 9dd228a3d..744daa7c8 100644
--- a/app/controllers/previews_controller.rb
+++ b/app/controllers/previews_controller.rb
@@ -26,7 +26,7 @@ class PreviewsController < ApplicationController
if @issue
@previewed = @issue
end
- @text = params[:text] ? params[:text] : nil
+ @text = params[:text] || nil
render :partial => 'common/preview'
end
@@ -34,12 +34,12 @@ class PreviewsController < ApplicationController
if params[:id].present? && news = News.visible.find_by_id(params[:id])
@previewed = news
end
- @text = params[:text] ? params[:text] : nil
+ @text = params[:text] || nil
render :partial => 'common/preview'
end
def text
- @text = params[:text] ? params[:text] : nil
+ @text = params[:text] || nil
render :partial => 'common/preview'
end
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 2d004a78d..59b4e367e 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -1203,11 +1203,7 @@ class Issue < ApplicationRecord
end
def last_notes
- if @last_notes
- @last_notes
- else
- journals.visible.where.not(notes: '').reorder(:id => :desc).first.try(:notes)
- end
+ @last_notes || journals.visible.where.not(notes: '').reorder(:id => :desc).first.try(:notes)
end
# Preloads relations for a collection of issues