Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@ OpenProject/AddPreviewForViewComponent:
# root. Note the gap this leaves: a spec that builds a work package and reads configuration off
# its `type` is the real bug and is no longer flagged here.

Performance/Casecmp:
Enabled: false

# Don't force us to use tag instead of content_tag
# as this breaks angular elements
Rails/ContentTag:
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/oauth/auth_base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ def application_http_redirect_uris
def application_native_redirect_uris
registered_redirect_uris
.reject { |url| url.start_with?("http", "urn") }
.map(&method(:parse_native_redirect_uri))
.compact
.filter_map { |url| parse_native_redirect_uri(url) }
end

def parse_native_redirect_uri(value)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/repositories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@
redirect_to project_settings_repository_path(@project)
end

def committers

Check warning on line 101 in app/controllers/repositories_controller.rb

View workflow job for this annotation

GitHub Actions / RuboCop

[rubocop] reported by reviewdog 🐶 Assignment Branch Condition size for `committers` is too high. [<11, 28, 6> 30.68/17] Raw Output: app/controllers/repositories_controller.rb:101:3: R: Metrics/AbcSize: Assignment Branch Condition size for `committers` is too high. [<11, 28, 6> 30.68/17]
@committers = @repository.committers
@users = @project.users.to_a
additional_user_ids = @committers.map(&:last).map(&:to_i) - @users.map(&:id)
additional_user_ids = @committers.map { |c| c.last.to_i } - @users.map(&:id)
@users += User.where(id: additional_user_ids) unless additional_user_ids.empty?
@users.compact!
@users.sort!
Expand Down
8 changes: 4 additions & 4 deletions app/models/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def validate_columns
end

def validate_sort_criteria
available_criteria = sortable_columns.map(&:name).map(&:to_s)
available_criteria = sortable_columns.map { |col| col.name.to_s }

sort_criteria.each do |name, _dir|
unless available_criteria.include? name.to_s
Expand Down Expand Up @@ -521,21 +521,21 @@ def valid_filter_subset!
end

def valid_group_by_subset!
unless groupable_columns.map(&:name).map(&:to_s).include?(group_by.to_s)
unless groupable_columns.map { |col| col.name.to_s }.include?(group_by.to_s)
self.group_by = nil
end
end

def valid_sort_criteria_subset!
available_criteria = sortable_columns.map(&:name).map(&:to_s)
available_criteria = sortable_columns.map { |col| col.name.to_s }

self.sort_criteria = sort_criteria.select do |criteria|
available_criteria.include? criteria.first.to_s
end
end

def valid_column_subset!
available_names = displayable_columns.map(&:name).map(&:to_sym)
available_names = displayable_columns.map { |col| col.name.to_sym }

self.column_names &= available_names
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/oauth_clients/set_attributes_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def replace_client_secret_with_nil(params)
cloned_param = params.clone

if cloned_param[:client_secret] == ""
cloned_param.merge!(client_secret: nil)
cloned_param[:client_secret] = nil
end

cloned_param
Expand Down
2 changes: 1 addition & 1 deletion app/services/projects/gantt_query_generator_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def default_gantt_query

milestone_ids = Type.milestone.pluck(:id).map(&:to_s)
if milestone_ids.any?
default_with_filter.merge!("f" => [{ "n" => "type", "o" => "=", "v" => milestone_ids }])
default_with_filter["f"] = [{ "n" => "type", "o" => "=", "v" => milestone_ids }]
end

JSON.dump(default_with_filter)
Expand Down
2 changes: 1 addition & 1 deletion app/services/work_packages/set_attributes_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def default_description?
TypeVariant
.pluck(:default_work_package_description)
.compact
.map(&method(:normalize_whitespace))
.map { |desc| normalize_whitespace(desc) }
.include?(normalize_whitespace(work_package.description))
end

Expand Down
6 changes: 3 additions & 3 deletions app/workers/work_packages/bulk_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

attr_accessor :work_packages, :user, :follow, :project, :target_project

def perform(user:, work_package_ids:, project:, target_project:, params:, follow:)

Check warning on line 37 in app/workers/work_packages/bulk_job.rb

View workflow job for this annotation

GitHub Actions / RuboCop

[rubocop] reported by reviewdog 🐶 Assignment Branch Condition size for `perform` is too high. [<8, 16, 0> 17.89/17] Raw Output: app/workers/work_packages/bulk_job.rb:37:5: R: Metrics/AbcSize: Assignment Branch Condition size for `perform` is too high. [<8, 16, 0> 17.89/17]
self.project = project
self.target_project = target_project
self.user = user
Expand All @@ -44,9 +44,9 @@
service_class
.new(user:, work_packages:)
.call(params)
.on_success(&method(:successful_status_update))
.on_failure(&method(:failure_status_update))
.then(&method(:wrap_result))
.on_success { |call| successful_status_update(call) }
.on_failure { |call| failure_status_update(call) }
.then { |call| wrap_result(call) }
end

def store_status?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def compile_links_for(configs, *)

def rendered_properties
@rendered_properties ||= begin
properties = changed_properties_as_api_name.select(&method(:property_supported?)) + STATIC_NON_LINK_PROPERTIES
properties = changed_properties_as_api_name.select { |prop| property_supported?(prop) } + STATIC_NON_LINK_PROPERTIES

if represented.exists_at_timestamp?
properties + STATIC_LINK_PROPERTIES
Expand Down
2 changes: 1 addition & 1 deletion modules/bim/lib/open_project/bim/bcf_xml/aggregations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def known_users
end

def unknown_mails
@instance_cache[:unknown_mails] ||= all_mails.map(&:downcase) - known_users.map(&:mail).map(&:downcase)
@instance_cache[:unknown_mails] ||= all_mails.map(&:downcase) - known_users.map { |user| user.mail.downcase }
end

def members
Expand Down
4 changes: 2 additions & 2 deletions modules/bim/lib/open_project/bim/bcf_xml/issue_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ def topic_due_date(topic_node)
def replace_comments
markup_node.xpath("./Comment").remove

Nokogiri::XML::Builder.with(markup_node, &method(:comments))
Nokogiri::XML::Builder.with(markup_node) { |xml| comments(xml) }
end

def replace_viewpoints
markup_node.xpath("./Viewpoints").remove

Nokogiri::XML::Builder.with(markup_node, &method(:viewpoints))
Nokogiri::XML::Builder.with(markup_node) { |xml| viewpoints(xml) }
end

##
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def before_perform(_service_result)

return create_queries_results.find(&:failure?) if create_queries_results.any?(&:failure?)

set_attributes(params.merge(query_ids: create_queries_results.map(&:result).map(&:id)))
set_attributes(params.merge(query_ids: create_queries_results.map { |result| result.result.id }))
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,9 @@ def self.settings

initializer "github.subscribe_to_notifications" do |app|
app.config.after_initialize do
::OpenProject::Notifications.subscribe("github.check_run",
&NotificationHandler.method(:check_run))
::OpenProject::Notifications.subscribe("github.issue_comment",
&NotificationHandler.method(:issue_comment))
::OpenProject::Notifications.subscribe("github.pull_request",
&NotificationHandler.method(:pull_request))
::OpenProject::Notifications.subscribe("github.check_run") { |payload| NotificationHandler.check_run(payload) }
::OpenProject::Notifications.subscribe("github.issue_comment") { |payload| NotificationHandler.issue_comment(payload) }
::OpenProject::Notifications.subscribe("github.pull_request") { |payload| NotificationHandler.pull_request(payload) }
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,13 @@ def self.settings
end

initializer "gitlab.subscribe_to_notifications" do
::OpenProject::Notifications.subscribe("gitlab.merge_request_hook",
&NotificationHandlers.method(:merge_request_hook))
::OpenProject::Notifications.subscribe("gitlab.note_hook",
&NotificationHandlers.method(:note_hook))
::OpenProject::Notifications.subscribe("gitlab.issue_hook",
&NotificationHandlers.method(:issue_hook))
::OpenProject::Notifications.subscribe("gitlab.push_hook",
&NotificationHandlers.method(:push_hook))
::OpenProject::Notifications.subscribe("gitlab.pipeline_hook",
&NotificationHandlers.method(:pipeline_hook))
::OpenProject::Notifications.subscribe("gitlab.merge_request_hook") do |payload|
NotificationHandlers.merge_request_hook(payload)
end
::OpenProject::Notifications.subscribe("gitlab.note_hook") { |payload| NotificationHandlers.note_hook(payload) }
::OpenProject::Notifications.subscribe("gitlab.issue_hook") { |payload| NotificationHandlers.issue_hook(payload) }
::OpenProject::Notifications.subscribe("gitlab.push_hook") { |payload| NotificationHandlers.push_hook(payload) }
::OpenProject::Notifications.subscribe("gitlab.pipeline_hook") { |payload| NotificationHandlers.pipeline_hook(payload) }
end

extend_api_response(:v3, :work_packages, :work_package,
Expand Down
2 changes: 1 addition & 1 deletion modules/grids/app/services/grids/set_attributes_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def cleanup_prohibited_widgets(widgets)
return if widgets&.any? || model.persisted?

# As it is a new record, we can do direct assignments without risking saving.
model.widgets = model.widgets.select(&method(:allowed_widget?))
model.widgets = model.widgets.select { |widget| allowed_widget?(widget) }
end

def allowed_widget?(widget)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def add_members!(new_users)
def remove_members!(users_to_remove)
return if users_to_remove.empty?

user_ids = users_to_remove.map(&method(:user_id))
user_ids = users_to_remove.map { |user| user_id(user) }

self.class.transaction do
# 1) Delete synchronized group MEMBERSHIPS from collection.
Expand Down
4 changes: 2 additions & 2 deletions modules/reporting/lib/report/walker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,21 @@
result.sort!
end

def body(result = nil, &)

Check warning on line 115 in modules/reporting/lib/report/walker.rb

View workflow job for this annotation

GitHub Actions / RuboCop

[rubocop] reported by reviewdog 🐶 Perceived complexity for `body` is too high. [11/8] Raw Output: modules/reporting/lib/report/walker.rb:115:3: R: Metrics/PerceivedComplexity: Perceived complexity for `body` is too high. [11/8]

Check warning on line 115 in modules/reporting/lib/report/walker.rb

View workflow job for this annotation

GitHub Actions / RuboCop

[rubocop] reported by reviewdog 🐶 Assignment Branch Condition size for `body` is too high. [<7, 23, 10> 26.04/17] Raw Output: modules/reporting/lib/report/walker.rb:115:3: R: Metrics/AbcSize: Assignment Branch Condition size for `body` is too high. [<7, 23, 10> 26.04/17]
return [*body(result)].each(&) if block_given?

result ||= query.result.tap { |r| sort(r) }
if result.row?
if result.final_row?
subresults = query.table.with_gaps_for(:column, result).map(&method(:walk_cell))
subresults = query.table.with_gaps_for(:column, result).map { |cell| walk_cell(cell) }
for_final_row.call result, subresults
else
subresults = result.map { |r| body(r) }
for_row.call result, subresults
end
else
# you only get here if no rows are defined
result.each_direct_result.map(&method(:walk_cell))
result.each_direct_result.map { |cell| walk_cell(cell) }
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def sanitize(string)
module WithRelations
def add_headers!(spreadsheet)
headers_0 = [I18n.t(:label_work_package_plural)] +
columns.size.times.map { |_| "" } +
Array.new(columns.size) { "" } +
[I18n.t("js.work_packages.tabs.relations")]

spreadsheet.add_headers headers_0, 0
Expand Down
Loading