From a1b5495e8999ed08dbab1bdb9df4bf65813c632d Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Mon, 21 Apr 2025 05:57:01 +0000 Subject: [PATCH] Fix Rubocop Style/ArgumentsForwarding (#42496). git-svn-id: https://svn.redmine.org/redmine/trunk@23698 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/icons_helper.rb | 18 +++--- app/helpers/principal_memberships_helper.rb | 18 +++--- app/helpers/reports_helper.rb | 4 +- app/helpers/routes_helper.rb | 62 ++++++++++----------- app/models/custom_field.rb | 4 +- app/models/group.rb | 4 +- app/models/issue.rb | 8 +-- app/models/issue_relation.rb | 4 +- app/models/journal.rb | 4 +- app/models/mail_handler.rb | 4 +- app/models/member.rb | 4 +- app/models/project.rb | 8 +-- app/models/repository.rb | 8 +-- app/models/repository/bazaar.rb | 4 +- app/models/repository/cvs.rb | 4 +- app/models/repository/filesystem.rb | 4 +- app/models/repository/git.rb | 4 +- app/models/repository/mercurial.rb | 4 +- app/models/user.rb | 4 +- app/models/version.rb | 8 +-- lib/redmine/field_format.rb | 4 +- lib/redmine/i18n.rb | 4 +- lib/redmine/plugin.rb | 8 +-- lib/redmine/sort_criteria.rb | 4 +- lib/redmine/subclass_factory.rb | 4 +- 25 files changed, 103 insertions(+), 103 deletions(-) diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb index 077bae158..f96315c75 100644 --- a/app/helpers/icons_helper.rb +++ b/app/helpers/icons_helper.rb @@ -36,23 +36,23 @@ module IconsHelper end end - def file_icon(entry, name, **options) + def file_icon(entry, name, **) if entry.is_dir? - sprite_icon("folder", name, **options) + sprite_icon("folder", name, **) else icon_name = icon_for_mime_type(Redmine::MimeType.css_class_of(name)) - sprite_icon(icon_name, name, **options) + sprite_icon(icon_name, name, **) end end - def principal_icon(principal, **options) + def principal_icon(principal, **) raise ArgumentError, "First argument has to be a Principal, was #{principal.inspect}" unless principal.is_a?(Principal) principal_class = principal.class.name.downcase - sprite_icon('group', **options) if ['groupanonymous', 'groupnonmember', 'group'].include?(principal_class) + sprite_icon('group', **) if ['groupanonymous', 'groupnonmember', 'group'].include?(principal_class) end - def activity_event_type_icon(event_type, **options) + def activity_event_type_icon(event_type, **) icon_name = case event_type when 'reply' 'comments' @@ -64,7 +64,7 @@ module IconsHelper event_type end - sprite_icon(icon_name, **options) + sprite_icon(icon_name, **) end def scm_change_icon(action, name, **options) @@ -79,7 +79,7 @@ module IconsHelper sprite_icon(icon_name, name, size: 14) end - def notice_icon(type, **options) + def notice_icon(type, **) icon_name = case type when 'notice' 'checked' @@ -87,7 +87,7 @@ module IconsHelper 'warning' end - sprite_icon(icon_name, **options) + sprite_icon(icon_name, **) end private diff --git a/app/helpers/principal_memberships_helper.rb b/app/helpers/principal_memberships_helper.rb index d9caf4f50..e69324247 100644 --- a/app/helpers/principal_memberships_helper.rb +++ b/app/helpers/principal_memberships_helper.rb @@ -38,27 +38,27 @@ module PrincipalMembershipsHelper end end - def new_principal_membership_path(principal, *args) + def new_principal_membership_path(principal, *) if principal.is_a?(Group) - new_group_membership_path(principal, *args) + new_group_membership_path(principal, *) else - new_user_membership_path(principal, *args) + new_user_membership_path(principal, *) end end - def edit_principal_membership_path(principal, *args) + def edit_principal_membership_path(principal, *) if principal.is_a?(Group) - edit_group_membership_path(principal, *args) + edit_group_membership_path(principal, *) else - edit_user_membership_path(principal, *args) + edit_user_membership_path(principal, *) end end - def principal_membership_path(principal, membership, *args) + def principal_membership_path(principal, membership, *) if principal.is_a?(Group) - group_membership_path(principal, membership, *args) + group_membership_path(principal, membership, *) else - user_membership_path(principal, membership, *args) + user_membership_path(principal, membership, *) end end end diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb index 6390ecbdb..f8df59b00 100644 --- a/app/helpers/reports_helper.rb +++ b/app/helpers/reports_helper.rb @@ -34,9 +34,9 @@ module ReportsHelper a end - def aggregate_link(data, criteria, *args) + def aggregate_link(data, criteria, *) a = aggregate data, criteria - a > 0 ? link_to(h(a), *args) : '-' + a > 0 ? link_to(h(a), *) : '-' end def aggregate_path(project, field, row, options={}) diff --git a/app/helpers/routes_helper.rb b/app/helpers/routes_helper.rb index f5d6dbd38..a27ea783e 100644 --- a/app/helpers/routes_helper.rb +++ b/app/helpers/routes_helper.rb @@ -20,83 +20,83 @@ module RoutesHelper # Returns the path to project issues or to the cross-project # issue list if project is nil - def _project_issues_path(project, *args) + def _project_issues_path(project, *) if project - project_issues_path(project, *args) + project_issues_path(project, *) else - issues_path(*args) + issues_path(*) end end - def _project_issues_url(project, *args) + def _project_issues_url(project, *) if project - project_issues_url(project, *args) + project_issues_url(project, *) else - issues_url(*args) + issues_url(*) end end - def _project_news_path(project, *args) + def _project_news_path(project, *) if project - project_news_index_path(project, *args) + project_news_index_path(project, *) else - news_index_path(*args) + news_index_path(*) end end - def _new_project_issue_path(project, *args) + def _new_project_issue_path(project, *) if project - new_project_issue_path(project, *args) + new_project_issue_path(project, *) else - new_issue_path(*args) + new_issue_path(*) end end - def _project_calendar_path(project, *args) - project ? project_calendar_path(project, *args) : issues_calendar_path(*args) + def _project_calendar_path(project, *) + project ? project_calendar_path(project, *) : issues_calendar_path(*) end - def _project_gantt_path(project, *args) - project ? project_gantt_path(project, *args) : issues_gantt_path(*args) + def _project_gantt_path(project, *) + project ? project_gantt_path(project, *) : issues_gantt_path(*) end - def _time_entries_path(project, issue, *args) + def _time_entries_path(project, issue, *) if project - project_time_entries_path(project, *args) + project_time_entries_path(project, *) else - time_entries_path(*args) + time_entries_path(*) end end - def _report_time_entries_path(project, issue, *args) + def _report_time_entries_path(project, issue, *) if project - report_project_time_entries_path(project, *args) + report_project_time_entries_path(project, *) else - report_time_entries_path(*args) + report_time_entries_path(*) end end - def _new_time_entry_path(project, issue, *args) + def _new_time_entry_path(project, issue, *) if issue - new_issue_time_entry_path(issue, *args) + new_issue_time_entry_path(issue, *) elsif project - new_project_time_entry_path(project, *args) + new_project_time_entry_path(project, *) else - new_time_entry_path(*args) + new_time_entry_path(*) end end # Returns the path to bulk update issues or to issue path # if only one issue is selected for bulk update - def _bulk_update_issues_path(issue, *args) + def _bulk_update_issues_path(issue, *) if issue - issue_path(issue, *args) + issue_path(issue, *) else - bulk_update_issues_path(*args) + bulk_update_issues_path(*) end end - def board_path(board, *args) - project_board_path(board.project, board, *args) + def board_path(board, *) + project_board_path(board.project, board, *) end end diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb index ae6d108f4..d14b67bdb 100644 --- a/app/models/custom_field.rb +++ b/app/models/custom_field.rb @@ -336,12 +336,12 @@ class CustomField < ApplicationRecord args.include?(field_format) end - def self.human_attribute_name(attribute_key_name, *args) + def self.human_attribute_name(attribute_key_name, *) attr_name = attribute_key_name.to_s if attr_name == 'url_pattern' attr_name = "url" end - super(attr_name, *args) + super(attr_name, *) end def css_classes diff --git a/app/models/group.rb b/app/models/group.rb index ea5454558..300b59b46 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -94,12 +94,12 @@ class Group < Principal destroy_all end - def self.human_attribute_name(attribute_key_name, *args) + def self.human_attribute_name(attribute_key_name, *) attr_name = attribute_key_name.to_s if attr_name == 'lastname' attr_name = "name" end - super(attr_name, *args) + super(attr_name, *) end def self.anonymous diff --git a/app/models/issue.rb b/app/models/issue.rb index 59b4e367e..ac3b40bf1 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -268,7 +268,7 @@ class Issue < ApplicationRecord end alias :base_reload :reload - def reload(*args) + def reload(*) @workflow_rule_by_attribute = nil @assignable_versions = nil @relations = nil @@ -277,7 +277,7 @@ class Issue < ApplicationRecord @total_estimated_hours = nil @last_updated_by = nil @last_notes = nil - base_reload(*args) + base_reload(*) end # Overrides Redmine::Acts::Customizable::InstanceMethods#available_custom_fields @@ -469,7 +469,7 @@ class Issue < ApplicationRecord end # Overrides assign_attributes so that project and tracker get assigned first - def assign_attributes(new_attributes, *args) + def assign_attributes(new_attributes, *) return if new_attributes.nil? attrs = new_attributes.dup @@ -480,7 +480,7 @@ class Issue < ApplicationRecord send :"#{attr}=", attrs.delete(attr) end end - super(attrs, *args) + super(attrs, *) end def attributes=(new_attributes) diff --git a/app/models/issue_relation.rb b/app/models/issue_relation.rb index e55875e4d..80af22b89 100644 --- a/app/models/issue_relation.rb +++ b/app/models/issue_relation.rb @@ -22,9 +22,9 @@ class IssueRelation < ApplicationRecord class Relations < Array include Redmine::I18n - def initialize(issue, *args) + def initialize(issue, *) @issue = issue - super(*args) + super(*) end def to_s(*args) diff --git a/app/models/journal.rb b/app/models/journal.rb index 179e60c24..039b182e2 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -157,8 +157,8 @@ class Journal < ApplicationRecord end end - def visible?(*args) - journalized.visible?(*args) + def visible?(*) + journalized.visible?(*) end # Returns a string of css classes diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb index b6858d96a..5d246a572 100644 --- a/app/models/mail_handler.rb +++ b/app/models/mail_handler.rb @@ -55,8 +55,8 @@ class MailHandler < ActionMailer::Base end # Receives an email and rescues any exception - def self.safe_receive(*args) - receive(*args) + def self.safe_receive(*) + receive(*) rescue => e Rails.logger.error "MailHandler: an unexpected error occurred when receiving email: #{e.message}" return false diff --git a/app/models/member.rb b/app/models/member.rb index b0d5c35fc..1f597c96c 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -45,9 +45,9 @@ class Member < ApplicationRecord end) alias :base_reload :reload - def reload(*args) + def reload(*) @managed_roles = nil - base_reload(*args) + base_reload(*) end def role diff --git a/app/models/project.rb b/app/models/project.rb index c438be16d..b3bf88c94 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -358,12 +358,12 @@ class Project < ApplicationRecord end end - def self.find_by_param(*args) - self.find(*args) + def self.find_by_param(*) + self.find(*) end alias :base_reload :reload - def reload(*args) + def reload(*) @principals = nil @users = nil @shared_versions = nil @@ -382,7 +382,7 @@ class Project < ApplicationRecord @override_members = nil @assignable_users = nil @last_activity_date = nil - base_reload(*args) + base_reload(*) end def to_param diff --git a/app/models/repository.rb b/app/models/repository.rb index a1e81baf3..f4092fc96 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -69,12 +69,12 @@ class Repository < ApplicationRecord end end - def self.human_attribute_name(attribute_key_name, *args) + def self.human_attribute_name(attribute_key_name, *) attr_name = attribute_key_name.to_s if attr_name == "log_encoding" attr_name = "commit_logs_encoding" end - super(attr_name, *args) + super(attr_name, *) end # Removes leading and trailing whitespace @@ -369,8 +369,8 @@ class Repository < ApplicationRecord subclasses.collect {|klass| [klass.scm_name, klass.name]} end - def self.factory(klass_name, *args) - repository_class(klass_name).new(*args) rescue nil + def self.factory(klass_name, *) + repository_class(klass_name).new(*) rescue nil end def self.repository_class(class_name) diff --git a/app/models/repository/bazaar.rb b/app/models/repository/bazaar.rb index d9cffe810..fc42c1235 100644 --- a/app/models/repository/bazaar.rb +++ b/app/models/repository/bazaar.rb @@ -22,12 +22,12 @@ require 'redmine/scm/adapters/bazaar_adapter' class Repository::Bazaar < Repository validates_presence_of :url, :log_encoding - def self.human_attribute_name(attribute_key_name, *args) + def self.human_attribute_name(attribute_key_name, *) attr_name = attribute_key_name.to_s if attr_name == "url" attr_name = "path_to_repository" end - super(attr_name, *args) + super(attr_name, *) end def self.scm_adapter_class diff --git a/app/models/repository/cvs.rb b/app/models/repository/cvs.rb index a5fce91bb..d055428a5 100644 --- a/app/models/repository/cvs.rb +++ b/app/models/repository/cvs.rb @@ -27,14 +27,14 @@ class Repository::Cvs < Repository 'root_url', :if => lambda {|repository, user| repository.new_record?}) - def self.human_attribute_name(attribute_key_name, *args) + def self.human_attribute_name(attribute_key_name, *) attr_name = attribute_key_name.to_s if attr_name == "root_url" attr_name = "cvsroot" elsif attr_name == "url" attr_name = "cvs_module" end - super(attr_name, *args) + super(attr_name, *) end def self.scm_adapter_class diff --git a/app/models/repository/filesystem.rb b/app/models/repository/filesystem.rb index 9347de0f3..c27044a9a 100644 --- a/app/models/repository/filesystem.rb +++ b/app/models/repository/filesystem.rb @@ -25,12 +25,12 @@ require 'redmine/scm/adapters/filesystem_adapter' class Repository::Filesystem < Repository validates_presence_of :url - def self.human_attribute_name(attribute_key_name, *args) + def self.human_attribute_name(attribute_key_name, *) attr_name = attribute_key_name.to_s if attr_name == "url" attr_name = "root_directory" end - super(attr_name, *args) + super(attr_name, *) end def self.scm_adapter_class diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index b6b3c8336..c94acb01d 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -25,10 +25,10 @@ class Repository::Git < Repository safe_attributes 'report_last_commit' - def self.human_attribute_name(attribute_key_name, *args) + def self.human_attribute_name(attribute_key_name, *) attr_name = attribute_key_name.to_s attr_name = 'path_to_repository' if attr_name == 'url' - super(attr_name, *args) + super(attr_name, *) end def self.scm_adapter_class diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb index 8794cde75..1d1a3c4ff 100644 --- a/app/models/repository/mercurial.rb +++ b/app/models/repository/mercurial.rb @@ -30,12 +30,12 @@ class Repository::Mercurial < Repository # number of changesets to fetch at once FETCH_AT_ONCE = 100 - def self.human_attribute_name(attribute_key_name, *args) + def self.human_attribute_name(attribute_key_name, *) attr_name = attribute_key_name.to_s if attr_name == "url" attr_name = "path_to_repository" end - super(attr_name, *args) + super(attr_name, *) end def self.scm_adapter_class diff --git a/app/models/user.rb b/app/models/user.rb index 4210a6a87..1839613c7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -170,7 +170,7 @@ class User < Principal end alias :base_reload :reload - def reload(*args) + def reload(*) @name = nil @roles = nil @projects_by_role = nil @@ -181,7 +181,7 @@ class User < Principal @builtin_role = nil @visible_project_ids = nil @managed_roles = nil - base_reload(*args) + base_reload(*) end def mail diff --git a/app/models/version.rb b/app/models/version.rb index 51c7c0417..707ed59dc 100644 --- a/app/models/version.rb +++ b/app/models/version.rb @@ -211,8 +211,8 @@ class Version < ApplicationRecord end # Version files have same visibility as project files - def attachments_visible?(*args) - project.present? && project.attachments_visible?(*args) + def attachments_visible?(*) + project.present? && project.attachments_visible?(*) end def attachments_deletable?(usr=User.current) @@ -220,10 +220,10 @@ class Version < ApplicationRecord end alias :base_reload :reload - def reload(*args) + def reload(*) @default_project_version = nil @visible_fixed_issues = nil - base_reload(*args) + base_reload(*) end def start_date diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb index 2a76f2c46..3e87eeb38 100644 --- a/lib/redmine/field_format.rb +++ b/lib/redmine/field_format.rb @@ -110,8 +110,8 @@ module Redmine end private_class_method :add - def self.field_attributes(*args) - CustomField.store_accessor :format_store, *args + def self.field_attributes(*) + CustomField.store_accessor(:format_store, *) end field_attributes :url_pattern, :full_width_layout diff --git a/lib/redmine/i18n.rb b/lib/redmine/i18n.rb index f41e69474..a79b4fc68 100644 --- a/lib/redmine/i18n.rb +++ b/lib/redmine/i18n.rb @@ -65,9 +65,9 @@ module Redmine end # Localizes the given args with user's language - def lu(user, *args) + def lu(user, *) lang = user.try(:language).presence || Setting.default_language - ll(lang, *args) + ll(lang, *) end def format_date(date) diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb index 447bed666..74ae4efaf 100644 --- a/lib/redmine/plugin.rb +++ b/lib/redmine/plugin.rb @@ -406,8 +406,8 @@ module Redmine # Meeting.find_events('scrums', User.current, 5.days.ago, Date.today, :project => foo) # events for project foo only # # Note that :view_scrums permission is required to view these events in the activity view. - def activity_provider(*args) - Redmine::Activity.register(*args) + def activity_provider(*) + Redmine::Activity.register(*) end # Registers a wiki formatter. @@ -423,8 +423,8 @@ module Redmine # Examples: # wiki_format_provider(:custom_formatter, CustomFormatter, :label => "My custom formatter") # - def wiki_format_provider(name, *args) - Redmine::WikiFormatting.register(name, *args) + def wiki_format_provider(name, *) + Redmine::WikiFormatting.register(name, *) end # Register plugin models that use acts_as_attachable. diff --git a/lib/redmine/sort_criteria.rb b/lib/redmine/sort_criteria.rb index 461cd3ac1..01cb95871 100644 --- a/lib/redmine/sort_criteria.rb +++ b/lib/redmine/sort_criteria.rb @@ -48,8 +48,8 @@ module Redmine normalize! end - def add(*args) - self.class.new(self).add!(*args) + def add(*) + self.class.new(self).add!(*) end def first_key diff --git a/lib/redmine/subclass_factory.rb b/lib/redmine/subclass_factory.rb index 0905f907a..53db6696b 100644 --- a/lib/redmine/subclass_factory.rb +++ b/lib/redmine/subclass_factory.rb @@ -38,10 +38,10 @@ module Redmine end # Returns an instance of the given subclass name - def new_subclass_instance(class_name, *args) + def new_subclass_instance(class_name, *) klass = get_subclass(class_name) if klass - klass.new(*args) + klass.new(*) end end end