diff options
author | Go MAEDA <maeda@farend.jp> | 2024-07-11 09:35:32 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2024-07-11 09:35:32 +0000 |
commit | 47d7dd0187c432a2236fec3510dbfbd1aa3efd4a (patch) | |
tree | 177be8c7d26cb0ba80bc673226fce215252e9325 | |
parent | 480975a0f5e947f86921b144cb47c970f1e4c4d4 (diff) | |
download | redmine-47d7dd0187c432a2236fec3510dbfbd1aa3efd4a.tar.gz redmine-47d7dd0187c432a2236fec3510dbfbd1aa3efd4a.zip |
Fix RuboCop offense Style/CollectionCompact (#39887).
git-svn-id: https://svn.redmine.org/redmine/trunk@22921 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | .rubocop_todo.yml | 9 | ||||
-rw-r--r-- | app/controllers/issues_controller.rb | 9 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 2 | ||||
-rw-r--r-- | lib/redmine/sudo_mode.rb | 2 |
4 files changed, 6 insertions, 16 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2cc27735a..5f4cd446d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -179,7 +179,6 @@ Layout/MultilineOperationIndentation: # This cop supports safe autocorrection (--autocorrect). Layout/SpaceAfterComma: Exclude: - - 'app/controllers/projects_controller.rb' - 'lib/redmine/configuration.rb' - 'lib/redmine/helpers/time_report.rb' - 'lib/redmine/imap.rb' @@ -900,14 +899,6 @@ Style/ClassVars: - 'lib/redmine/wiki_formatting/markdown/formatter.rb' - 'test/helpers/activities_helper_test.rb' -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: AllowedReceivers. -Style/CollectionCompact: - Exclude: - - 'app/controllers/issues_controller.rb' - - 'app/controllers/projects_controller.rb' - - 'lib/redmine/sudo_mode.rb' - # This cop supports safe autocorrection (--autocorrect). Style/ColonMethodCall: Exclude: diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 5fbb0f7c2..089da28a7 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -700,11 +700,10 @@ class IssuesController < ApplicationController def redirect_after_create if params[:continue] url_params = {} - url_params[:issue] = - { - :tracker_id => @issue.tracker, - :parent_issue_id => @issue.parent_issue_id - }.reject {|k, v| v.nil?} + url_params[:issue] = { + :tracker_id => @issue.tracker, + :parent_issue_id => @issue.parent_issue_id + }.compact url_params[:back_url] = params[:back_url].presence if params[:project_id] diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 91616d619..f9a390c58 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -115,7 +115,7 @@ class ProjectsController < ApplicationController format.html do flash[:notice] = l(:notice_successful_create) if params[:continue] - attrs = {:parent_id => @project.parent_id}.reject {|k,v| v.nil?} + attrs = {:parent_id => @project.parent_id}.compact redirect_to new_project_path(attrs) else redirect_to settings_project_path(@project) diff --git a/lib/redmine/sudo_mode.rb b/lib/redmine/sudo_mode.rb index 90a8a2679..dd1876f11 100644 --- a/lib/redmine/sudo_mode.rb +++ b/lib/redmine/sudo_mode.rb @@ -47,7 +47,7 @@ module Redmine # # taken from https://github.com/brianhempel/hash_to_hidden_fields def hash_to_hidden_fields(hash) - cleaned_hash = hash.to_unsafe_h.reject {|k, v| v.nil?} + cleaned_hash = hash.to_unsafe_h.compact pairs = cleaned_hash.to_query.split(Rack::Utils::DEFAULT_SEP) tags = pairs.map do |pair| key, value = pair.split('=', 2).map {|str| Rack::Utils.unescape(str)} |