Skip to content

Commit

Permalink
Merge pull request #15954 from opf/rubocop-autocorrect
Browse files Browse the repository at this point in the history
Rubocop autocorrect
  • Loading branch information
ulferts authored Jun 25, 2024
2 parents 3b0529a + 3c968c9 commit 2bc71da
Show file tree
Hide file tree
Showing 44 changed files with 550 additions and 551 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ f3c99ee5dded81ad55f2b6f3706216d5fa765677
9e4934cd0a468f46d8f0fc0f11ebc2d4216f789c
6678cab48d443b5782fa93b171d62093819ee4fc
fa5d03eae00bc8931f99598a74ffd76e0cbca3da
b10e6d718cc49e3574837d97fab268e3ecb3fcbd
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
module Admin
class AttachmentsSettingsHeaderComponent < ApplicationComponent
def initialize(title:, selected:)
raise 'selected must 1, 2 or 3' if [1, 2, 3].exclude?(selected)
raise "selected must 1, 2 or 3" if [1, 2, 3].exclude?(selected)

@title = title
@selected = selected
end
Expand Down
6 changes: 3 additions & 3 deletions app/helpers/frontend_asset_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
#++

module FrontendAssetHelper
CLI_DEFAULT_PROXY = 'http://localhost:4200'.freeze
CLI_DEFAULT_PROXY = "http://localhost:4200".freeze

def self.assets_proxied?
ENV['OPENPROJECT_DISABLE_DEV_ASSET_PROXY'].blank? && !Rails.env.production? && cli_proxy.present?
ENV["OPENPROJECT_DISABLE_DEV_ASSET_PROXY"].blank? && !Rails.env.production? && cli_proxy.present?
end

def self.cli_proxy
ENV.fetch('OPENPROJECT_CLI_PROXY', CLI_DEFAULT_PROXY)
ENV.fetch("OPENPROJECT_CLI_PROXY", CLI_DEFAULT_PROXY)
end

##
Expand Down
1 change: 0 additions & 1 deletion app/models/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class Project < ApplicationRecord

include ::Scopes::Scoped


# Maximum length for project identifiers
IDENTIFIER_MAX_LENGTH = 100

Expand Down
4 changes: 2 additions & 2 deletions app/models/setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def respond_to_missing?(method_name, include_private = false)
private

def accessor_base_name(name)
name.to_s.sub(/(_writable\?)|(\?)|=\z/, '')
name.to_s.sub(/(_writable\?)|(\?)|=\z/, "")
end
end

Expand Down Expand Up @@ -337,7 +337,7 @@ def self.deserialize(name, value)

if definition.serialized? && value.is_a?(String)
deserialize_hash(value)
elsif value != ''.freeze && !value.nil?
elsif value != "".freeze && !value.nil?
read_formatted_setting(value, definition.format)
else
definition.format == :string ? value : nil
Expand Down
10 changes: 5 additions & 5 deletions app/models/work_package/exports/macros/attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ def self.resolve_match(type, model_s, id, attribute, work_package, user)
elsif model_s == "project"
resolve_project_match(id || work_package.project.id, type, attribute, user)
else
msg_macro_error I18n.t('export.macro.model_not_found', model: model_s)
msg_macro_error I18n.t("export.macro.model_not_found", model: model_s)
end
end

def self.msg_macro_error(message)
msg_inline I18n.t('export.macro.error', message:)
msg_inline I18n.t("export.macro.error", message:)
end

def self.msg_macro_error_rich_text
msg_inline I18n.t('export.macro.rich_text_unsupported')
msg_inline I18n.t("export.macro.rich_text_unsupported")
end

def self.msg_inline(message)
Expand All @@ -109,11 +109,11 @@ def self.resolve_label(model, attribute)

def self.resolve_work_package_match(id, type, attribute, user)
return resolve_label_work_package(attribute) if type == "label"
return msg_macro_error(I18n.t('export.macro.model_not_found', model: type)) unless type == "value"
return msg_macro_error(I18n.t("export.macro.model_not_found", model: type)) unless type == "value"

work_package = WorkPackage.visible(user).find_by(id:)
if work_package.nil?
return msg_macro_error(I18n.t('export.macro.resource_not_found', resource: "#{WorkPackage.name} #{id}"))
return msg_macro_error(I18n.t("export.macro.resource_not_found", resource: "#{WorkPackage.name} #{id}"))
end

resolve_value_work_package(work_package, attribute)
Expand Down
3 changes: 2 additions & 1 deletion app/services/projects/copy_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ def after_perform(call)
end

def copy_activated_custom_fields(call)
call.result.project_custom_field_ids = source.project_custom_field_ids
call.result.project_custom_field_ids = source.project_custom_field_ids
end

def contract_options
{ copy_source: source, validate_model: true }
end
Expand Down
2 changes: 1 addition & 1 deletion app/services/users/change_password_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def call(params)

def invalidate_tokens
::Users::DropTokensService
.new(current_user: current_user)
.new(current_user:)
.call!
end

Expand Down
4 changes: 2 additions & 2 deletions app/services/users/drop_tokens_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def call!(clear_invitation_tokens: true)
private

def invalidate_recovery_tokens
Token::Recovery.where(user: user).delete_all
Token::Recovery.where(user:).delete_all
end

def invalidate_invitation_tokens
Token::Invitation.where(user: user).delete_all
Token::Invitation.where(user:).delete_all
end
end
end
4 changes: 2 additions & 2 deletions db/migrate/20221115082403_add_ldap_tls_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def change
# Current LDAP library default is to not verify the certificate
MigratingAuthSource.reset_column_information

ldap_settings = Setting.find_by(name: 'ldap_tls_options')&.value
ldap_settings = Setting.find_by(name: "ldap_tls_options")&.value
migrate_ldap_settings(ldap_settings)
end
end
Expand All @@ -54,7 +54,7 @@ def migrate_ldap_settings(ldap_settings)
return if ldap_settings.blank?

parsed = Setting.deserialize_hash(ldap_settings)
verify_peer = parsed['verify_mode'] == OpenSSL::SSL::VERIFY_PEER
verify_peer = parsed["verify_mode"] == OpenSSL::SSL::VERIFY_PEER

MigratingAuthSource.update_all(verify_peer:)
rescue StandardError => e
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20240408132459_rename_delay_to_lag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ def change
rename_column :relations, :delay, :lag

# TODO remove after 14.0
add_column :relations, :delay, :virtual, type: :integer, as: 'lag', stored: true
add_column :relations, :delay, :virtual, type: :integer, as: "lag", stored: true
end
end
2 changes: 1 addition & 1 deletion db/migrate/20240410060041_remove_virtual_delay_column.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class RemoveVirtualDelayColumn < ActiveRecord::Migration[7.1]
def change
remove_column :relations, :delay, :virtual, type: :integer, as: 'lag', stored: true
remove_column :relations, :delay, :virtual, type: :integer, as: "lag", stored: true
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def derive_autocompleter_options(options)
options.reverse_merge!(
component: "opce-project-autocompleter",
defaultData: false,
filters: [{ name: 'active', operator: '=', values: ['t'] }],
filters: [{ name: "active", operator: "=", values: ["t"] }]
)

if options[:disabledProjects]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def association_changes(original, changed, *)
get_association_changes(original, changed, *)
end

def association_changes_multiple_attributes(original, changed, association, association_name, key, values)
def association_changes_multiple_attributes(original, changed, association, association_name, key, values)
list = {}
values.each do |value|
list.store(value, get_association_changes(original, changed, association, association_name, key, value))
Expand All @@ -69,7 +69,7 @@ def normalize_newlines(data)

def no_nil_to_empty_strings?(normalized_old_data, attribute, new_value)
old_value = normalized_old_data[attribute]
new_value != old_value && ([new_value, old_value] - ['', nil]).present?
new_value != old_value && ([new_value, old_value] - ["", nil]).present?
end

def journaled_attributes(object)
Expand Down Expand Up @@ -133,7 +133,7 @@ def select_and_combine_journals(journals, id, key, value)
if selected_journals.empty?
nil
else
selected_journals.sort.join(',')
selected_journals.sort.join(",")
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

require 'journal_changes'
require 'journal_formatter'
require 'cause_of_change'
require "journal_changes"
require "journal_formatter"
require "cause_of_change"

module Acts
end

Dir[File.expand_path('acts/journalized/*.rb', __dir__)].sort.each { |f| require f }
Dir[File.expand_path("acts/journalized/*.rb", __dir__)].sort.each { |f| require f }

module Acts
module Journalized
Expand Down
4 changes: 2 additions & 2 deletions lib_static/plugins/acts_as_journalized/lib/cause_of_change.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

require_relative 'cause_of_change/base'
require_relative 'cause_of_change/no_cause'
require_relative "cause_of_change/base"
require_relative "cause_of_change/no_cause"

module CauseOfChange
end
7 changes: 3 additions & 4 deletions modules/calendar/spec/features/calendar_widget_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@
overview_page.expect_and_dismiss_toaster message: I18n.t("js.notice_successful_update")
end

it 'shows the meeting' do
expect(page).to have_css('.fc-event', text: "Weekly", visible: :all)
page.find('.fc-event', text: "Weekly", visible: :all).click
it "shows the meeting" do
expect(page).to have_css(".fc-event", text: "Weekly", visible: :all)
page.find(".fc-event", text: "Weekly", visible: :all).click

expect(page).to have_current_path /meetings\/#{meeting.id}/
end

it "opens the work package full view when clicking a calendar entry" do

# Clicking the calendar entry goes to work package full screen
page.find(".fc-event-title", text: work_package.subject).click
wp_full_view.ensure_page_loaded
Expand Down
2 changes: 1 addition & 1 deletion modules/meeting/app/forms/meeting/title.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Meeting::Title < ApplicationForm
scheme: :secondary,
label: I18n.t(:button_cancel),
tag: :a,
data: { 'turbo-stream': true },
data: { "turbo-stream": true },
href: OpenProject::StaticRouting::StaticUrlHelpers.new.cancel_edit_meeting_path(@meeting)
)
end
Expand Down
48 changes: 24 additions & 24 deletions modules/meeting/app/models/activities/meeting_activity_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
#++

class Activities::MeetingActivityProvider < Activities::BaseActivityProvider
activity_provider_for type: 'meetings',
activity_provider_for type: "meetings",
activities: %i[meeting meeting_content],
permission: :view_meetings

def extend_event_query(query)
case activity
when :meeting_content
query.join(meetings_table).on(activity_journals_table[:meeting_id].eq(meetings_table[:id]))
join_cond = journals_table[:journable_type].eq('MeetingContent')
join_cond = journals_table[:journable_type].eq("MeetingContent")
query.join(meeting_contents_table).on(journals_table[:journable_id].eq(meeting_contents_table[:id]).and(join_cond))
else
super
Expand All @@ -46,17 +46,17 @@ def event_query_projection
case activity
when :meeting
[
activity_journal_projection_statement(:title, 'meeting_title'),
activity_journal_projection_statement(:start_time, 'meeting_start_time'),
activity_journal_projection_statement(:duration, 'meeting_duration'),
activity_journal_projection_statement(:project_id, 'project_id')
activity_journal_projection_statement(:title, "meeting_title"),
activity_journal_projection_statement(:start_time, "meeting_start_time"),
activity_journal_projection_statement(:duration, "meeting_duration"),
activity_journal_projection_statement(:project_id, "project_id")
]
else
[
projection_statement(meeting_contents_table, :type, 'meeting_content_type'),
projection_statement(meetings_table, :id, 'meeting_id'),
projection_statement(meetings_table, :title, 'meeting_title'),
projection_statement(meetings_table, :project_id, 'project_id')
projection_statement(meeting_contents_table, :type, "meeting_content_type"),
projection_statement(meetings_table, :id, "meeting_id"),
projection_statement(meetings_table, :title, "meeting_title"),
projection_statement(meetings_table, :project_id, "project_id")
]
end
end
Expand Down Expand Up @@ -86,13 +86,13 @@ def activity_journals_table
protected

def event_name(event)
case event['event_description']
when 'Agenda closed'
I18n.t('meeting_agenda_closed', scope: 'events')
when 'Agenda opened'
I18n.t('meeting_agenda_opened', scope: 'events')
when 'Minutes created'
I18n.t('meeting_minutes_created', scope: 'events')
case event["event_description"]
when "Agenda closed"
I18n.t("meeting_agenda_closed", scope: "events")
when "Agenda opened"
I18n.t("meeting_agenda_opened", scope: "events")
when "Minutes created"
I18n.t("meeting_minutes_created", scope: "events")
else
super
end
Expand All @@ -101,12 +101,12 @@ def event_name(event)
def event_title(event)
case activity
when :meeting
start_time = if event['meeting_start_time'].is_a?(String)
DateTime.parse(event['meeting_start_time'])
start_time = if event["meeting_start_time"].is_a?(String)
DateTime.parse(event["meeting_start_time"])
else
event['meeting_start_time']
event["meeting_start_time"]
end
end_time = start_time + event['meeting_duration'].to_f.hours
end_time = start_time + event["meeting_duration"].to_f.hours

fstart_with = format_date start_time
fstart_without = format_time start_time, false
Expand All @@ -121,9 +121,9 @@ def event_title(event)
def event_type(event)
case activity
when :meeting
'meeting'
"meeting"
else
event['meeting_content_type'].include?('Agenda') ? 'meeting-agenda' : 'meeting-minutes'
event["meeting_content_type"].include?("Agenda") ? "meeting-agenda" : "meeting-minutes"
end
end

Expand Down Expand Up @@ -164,6 +164,6 @@ def meeting_contents_table
end

def activity_id(event)
activity == :meeting ? event['journable_id'] : event['meeting_id']
activity == :meeting ? event["journable_id"] : event["meeting_id"]
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
expect(copy.start_time).to eq(meeting.start_time + 1.week)
end

context 'when the meeting is closed' do
context "when the meeting is closed" do
it "reopens the meeting" do
meeting.update! state: "closed"
expect(service_result).to be_success
Expand Down
2 changes: 1 addition & 1 deletion modules/reporting/lib/widget/cost_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def render_with_options(options, &)
@cost_types = options.delete(:cost_types)
@selected_type_id = options.delete(:selected_type_id)

super(options, &)
super
end

def render
Expand Down
2 changes: 1 addition & 1 deletion modules/reporting/lib/widget/reporting_widget.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Widget::ReportingWidget < ActionView::Base
attr_accessor :output_buffer, :controller, :config, :_content_for, :_routes, :subject

def self.new(subject)
super(subject).tap do |o|
super.tap do |o|
o.subject = subject
end
end
Expand Down
Loading

0 comments on commit 2bc71da

Please sign in to comment.