Maintenance: Update dependency rubocop to v1.85.0

This commit is contained in:
renovatebot
2026-03-01 19:51:55 +01:00
committed by Mantas Masalskis
parent ac134e8a3b
commit 1dd1f1c688
33 changed files with 64 additions and 60 deletions

View File

@@ -560,6 +560,10 @@ Style/ItBlockParameter:
Description: 'Allow to use it shorthand in blocks'
EnforcedStyle: only_numbered_parameters
Style/OneClassPerFile:
Description: 'Allow to have multiple classes in one file'
Enabled: false
# There is a warning in the cop about possible performance issues,
# see https://docs.rubocop.org/rubocop-rails/cops_rails.html#safety-railspluckinwhere.
Rails/PluckInWhere:

View File

@@ -343,6 +343,9 @@ GEM
bindata
faraday (~> 2.0)
faraday-follow_redirects
json-schema (6.1.0)
addressable (~> 2.8)
bigdecimal (>= 3.1, < 5)
jwt (2.10.2)
base64
koala (3.7.0)
@@ -378,6 +381,8 @@ GEM
net-smtp
marcel (1.0.4)
matrix (0.4.3)
mcp (0.7.1)
json-schema (>= 4.1)
messagebird-rest (5.0.0)
jwt (< 4)
method_source (1.1.0)
@@ -498,7 +503,7 @@ GEM
iniparse (~> 1.4)
rexml (>= 3.3.9)
parallel (1.27.0)
parser (3.3.10.1)
parser (3.3.10.2)
ast (~> 2.4.1)
racc
pg (1.6.3)
@@ -639,10 +644,11 @@ GEM
rspec-core (> 3.3)
rspec-support (3.13.7)
rszr (1.5.0)
rubocop (1.84.2)
rubocop (1.85.0)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
mcp (~> 0.6)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)

View File

@@ -9,8 +9,8 @@ module Gql::Mutations
field :success, Boolean, null: false, description: 'Was the save successful?'
def resolve(overviews_last_used:)
value_to_store = overviews_last_used.each_with_object({}) do |olu, value|
value[olu.overview.id.to_s] = olu.last_used_at
value_to_store = overviews_last_used.to_h do |olu|
[olu.overview.id.to_s, olu.last_used_at]
end
context.current_user.preferences[:overviews_last_used] = value_to_store

View File

@@ -34,8 +34,8 @@ module Gql::Types::Input
.tap do |result|
result[:group_ids_access_map] = result
.delete(:group_ids)
&.each_with_object({}) do |elem, memo|
memo[elem[:group_internal_id]] = elem[:access_type]
&.to_h do |elem|
[elem[:group_internal_id], elem[:access_type]]
end
end
end

View File

@@ -10,6 +10,6 @@ class UpdateCtiLogsByCallerJob < ApplicationJob
.offset(offset)
.each do |log|
log.update(preferences: preferences)
end
end
end
end

View File

@@ -3,7 +3,7 @@
class Channel::Driver::BaseEmailInbound < Channel::EmailParser
ACTIVE_CHECK_INTERVAL = 20
MessageResult = Struct.new(:success, :after_action, keyword_init: true)
MessageResult = Struct.new(:success, :after_action)
def fetchable?(_channel)
true

View File

@@ -70,7 +70,7 @@ returns
raise "Unable to parse empty file/string for #{self}." if data[:string].blank?
raise "Unable to parse file/string without header for #{self}." if header.blank?
raise "No records found in file/string for #{self}." if rows.first.blank?
raise "No lookup column like #{lookup_keys.map(&:to_s).join(',')} for #{self} found." if !header.intersect?(lookup_keys.map(&:to_s))
raise "No lookup column like #{lookup_keys.join(',')} for #{self} found." if !header.intersect?(lookup_keys.map(&:to_s))
rescue => e
return {
try: try,
@@ -83,7 +83,7 @@ returns
payload = rows.map do |row|
header.zip(row).to_h
.compact.transform_values(&:strip)
.transform_values { |value| (value.include?('~~~') ? value.split('~~~') : value) }
.transform_values { |value| value.include?('~~~') ? value.split('~~~') : value }
.except(nil).transform_keys(&:to_sym)
.except(*csv_attributes_ignored)
.merge(data[:fixed_params] || {})

View File

@@ -153,8 +153,8 @@ class CoreWorkflow::Attributes
# dont cache this else the result object will work with references and cache bugs occur
def visibility_default
object_elements.each_with_object({}) do |attribute, result|
result[ attribute[:name] ] = screen_value(attribute, 'shown') == false ? 'remove' : 'show'
object_elements.to_h do |attribute|
[attribute[:name], screen_value(attribute, 'shown') == false ? 'remove' : 'show']
end
end
@@ -167,8 +167,8 @@ class CoreWorkflow::Attributes
# dont cache this else the result object will work with references and cache bugs occur
def mandatory_default
object_elements.each_with_object({}) do |attribute, result|
result[ attribute[:name] ] = attribute_mandatory?(attribute)
object_elements.to_h do |attribute|
[attribute[:name], attribute_mandatory?(attribute)]
end
end
@@ -183,8 +183,8 @@ class CoreWorkflow::Attributes
# dont cache this else the result object will work with references and cache bugs occur
def readonly_default
object_elements.each_with_object({}) do |attribute, result|
result[ attribute[:name] ] = false
object_elements.to_h do |attribute|
[attribute[:name], false]
end
end

View File

@@ -7,19 +7,17 @@ class FormUpdater::ApplyValue::FormId < FormUpdater::ApplyValue::Base
end
def map_value(field:, config:)
attachments = []
UploadCache.new(config['value'])
attachments = UploadCache.new(config['value'])
.attachments
.reject(&:inline?)
.map do |attachment|
attachments << {
{
id: Gql::ZammadSchema.id_from_object(attachment),
name: attachment.filename,
size: attachment.size,
type: attachment.preferences['Content-Type'],
}
end
end
result['attachments'] ||= {}
result['attachments'][:value] = attachments

View File

@@ -19,8 +19,8 @@ class FormUpdater::Updater
@flags = {}
# Build lookup for relation fields for better usage.
@relation_fields = relation_fields.each_with_object({}) do |relation_field, lookup|
lookup[relation_field[:name]] = relation_field.to_h
@relation_fields = relation_fields.to_h do |relation_field|
[relation_field[:name], relation_field.to_h]
end
end

View File

@@ -6,8 +6,8 @@ module Taskbar::List
class_methods do
def reorder_list(user, order)
order_as_hash = order.each_with_object({}) do |elem, sum|
sum[elem[:id]] = elem[:prio]
order_as_hash = order.to_h do |elem|
[elem[:id], elem[:prio]]
end
ActiveRecord::Base.transaction do |transaction|

View File

@@ -7,7 +7,7 @@ class AI::Service
attr_reader :current_user, :context_data, :locale, :persistence_strategy, :additional_options, :regeneration_of
Result = Struct.new(:content, :stored_result, :fresh, :ai_analytics_run, keyword_init: true)
Result = Struct.new(:content, :stored_result, :fresh, :ai_analytics_run)
def self.list
@list ||= descendants.sort_by(&:name)

View File

@@ -10,8 +10,8 @@ class Certificate::X509 < OpenSSL::X509::Certificate
end
def extensions_as_hash
extensions.each_with_object({}) do |ext, hash|
hash[ext.oid] = ext.value.split(',').map(&:strip)
extensions.to_h do |ext|
[ext.oid, ext.value.split(',').map(&:strip)]
end
end

View File

@@ -2,7 +2,7 @@
class KnowledgeBase
class AccessibleCategories
CategoriesStruct = Struct.new(:editor, :reader, :public_reader, keyword_init: true) do
CategoriesStruct = Struct.new(:editor, :reader, :public_reader) do
def initialize(editor: [], reader: [], public_reader: [])
super
end

View File

@@ -29,14 +29,14 @@ module MonitoringHelper
end
def counts
INCLUDE_CLASSES.each_with_object({}) do |elem, memo|
memo[elem.table_name] = elem.count
INCLUDE_CLASSES.to_h do |elem|
[elem.table_name, elem.count]
end
end
def last_created_at
INCLUDE_CLASSES.each_with_object({}) do |elem, memo|
memo[elem.table_name] = elem.last&.created_at
INCLUDE_CLASSES.to_h do |elem|
[elem.table_name, elem.last&.created_at]
end
end

View File

@@ -6,15 +6,13 @@ class SecureMailing::Backend::HandlerSecurityOptions < SecureMailing::Backend::H
:possible?,
:active_by_default?,
:message,
:message_placeholders,
keyword_init: true
:message_placeholders
)
SECURITY_OPTIONS_RESULT = Struct.new(
:type,
:encryption,
:signing,
keyword_init: true
:signing
)
attr_reader :ticket, :article

View File

@@ -147,8 +147,8 @@ class Sequencer::Unit::Import::Freshdesk::ObjectAttribute::Config < Sequencer::U
end
def options
resource['choices'].each_with_object({}) do |choice, result|
result[choice] = choice
resource['choices'].to_h do |choice|
[choice, choice]
end
end
end

View File

@@ -2,7 +2,7 @@
module Service
class SystemAssets
SendableAsset = Struct.new(:content, :filename, :type, keyword_init: true)
SendableAsset = Struct.new(:content, :filename, :type)
def self.backend(identifier)
"#{name}::#{identifier.camelize}".safe_constantize

View File

@@ -218,7 +218,7 @@ returns
article.preferences[:signature_detection] = signature_line
article.save if article.changed?
end
end
true
end

View File

@@ -16,8 +16,8 @@ FactoryBot.define do
public_holidays do
next if public_holiday_date.blank?
Array(public_holiday_date).each_with_object({}) do |elem, memo|
memo[elem.to_s] = { active: true, summary: 'public holiday trait' }
Array(public_holiday_date).to_h do |elem|
[elem.to_s, { active: true, summary: 'public holiday trait' }]
end
end

View File

@@ -7,7 +7,7 @@ RSpec.describe Gql::Mutations::AIAssistance::TextTools::Run, :aggregate_failures
let(:agent) { create(:agent) }
let(:input) { Faker::Lorem.unique.sentence }
let(:ai_analytics_run) { create(:ai_analytics_run) }
let(:output) { Struct.new(:content, :stored_result, :ai_analytics_run, :fresh, keyword_init: true).new(content: Faker::Lorem.unique.paragraph, stored_result: nil, ai_analytics_run: ai_analytics_run, fresh: false) }
let(:output) { Struct.new(:content, :stored_result, :ai_analytics_run, :fresh).new(content: Faker::Lorem.unique.paragraph, stored_result: nil, ai_analytics_run: ai_analytics_run, fresh: false) }
let(:text_tool) { create(:ai_text_tool) }
let(:query) do

View File

@@ -276,7 +276,7 @@ RSpec.describe TriggerWebhookJob, type: :job do
context 'with customized payload' do
let(:customized_payload) { true }
let(:custom_payload) { '{"ticket":"#{ticket.title}"}' }
let(:custom_payload) { '{"ticket":"#{ticket.title}"}' } # rubocop:disable Lint/InterpolationCheck
let(:payload) do
{
ticket: ticket.title,

View File

@@ -52,8 +52,10 @@ RSpec.describe SearchKnowledgeBaseBackend do
SearchIndexBackend.make_request_and_validate(url, data: { index: { 'highlight.max_analyzed_offset': 1000 } }, method: :put)
end
let(:attachment) { fixture_file_upload('spec/fixtures/files/upload/lipsum.pdf') }
let :published_answer do
create(:knowledge_base_answer, :published, :with_attachment, attachment: File.open('spec/fixtures/files/upload/lipsum.pdf'), category: category)
create(:knowledge_base_answer, :published, :with_attachment, attachment:, category: category)
end
it 'lists item with an attachment' do

View File

@@ -17,14 +17,12 @@ RSpec.describe Sessions::Event::ChatSessionStart do
end
let!(:agent) do
agent = create(:agent, preferences: { chat: { active: { chat.id.to_s => 'on' } } })
file = File.open('test/data/image/1000x1000.png', 'rb')
contents = file.read
avatar = Avatar.add(
object: 'User',
o_id: agent.id,
default: true,
resize: {
content: contents,
content: File.binread('test/data/image/1000x1000.png'),
mime_type: 'image/jpg',
},
source: 'web',

View File

@@ -128,7 +128,7 @@ RSpec.describe Validations::TicketArticleValidator::WhatsappMessage do
instance = build(:whatsapp_article, :with_prepended_attachment,
sender_name: 'Agent',
ticket:,
attachment: File.open('spec/fixtures/files/upload/test.rtf'))
attachment: fixture_file_upload('spec/fixtures/files/upload/test.rtf', 'application/rtf'))
described_class.new(instance).validate

View File

@@ -12,7 +12,7 @@ RSpec.shared_examples 'CanPerformChanges', :aggregate_failures do |object_name:,
end
before do
stub_const('PERFORMABLE_STRUCT', Struct.new(:id, :perform, keyword_init: true))
stub_const('PERFORMABLE_STRUCT', Struct.new(:id, :perform))
end
context 'when data privacy deletion task should be created', if: data_privacy_deletion_task do

View File

@@ -114,7 +114,7 @@ RSpec.describe ObjectManager::Attribute::SetDefaults, time_zone: 'Europe/London'
context 'when overriding default to empty value' do
subject(:example) do
params = DEFAULT_VALUES.keys.each_with_object({}) { |elem, memo| memo["rspec_#{elem}"] = nil }
params = DEFAULT_VALUES.keys.to_h { |elem| ["rspec_#{elem}", nil] }
create(:ticket, params)
end

View File

@@ -6,7 +6,7 @@ RSpec.describe 'AI Assistance API endpoint', authenticated_as: :user, type: :req
let(:user) { create(:agent) }
let(:input) { Faker::Lorem.unique.sentence }
let(:ai_analytics_run) { create(:ai_analytics_run) }
let(:output) { Struct.new(:content, :stored_result, :fresh, :ai_analytics_run, keyword_init: true).new(content: Faker::Lorem.unique.paragraph, stored_result: nil, fresh: false, ai_analytics_run:) }
let(:output) { Struct.new(:content, :stored_result, :fresh, :ai_analytics_run).new(content: Faker::Lorem.unique.paragraph, stored_result: nil, fresh: false, ai_analytics_run:) }
describe '#text_tools' do
let(:params) do

View File

@@ -1671,14 +1671,12 @@ RSpec.describe 'User', performs_jobs: true, type: :request do
let(:user) { create(:user) }
let(:avatar_mime_type) { 'image/png' }
let(:avatar) do
file = File.open('test/data/image/1000x1000.png', 'rb')
contents = file.read
Avatar.add(
object: 'User',
o_id: user.id,
default: true,
resize: {
content: contents,
content: File.binread('test/data/image/1000x1000.png'),
mime_type: avatar_mime_type,
},
source: 'web',

View File

@@ -19,7 +19,7 @@ RSpec.describe Service::AIAssistance::TextTools do
end
let(:input) { 'Hello, wrld!' }
let(:expected_output) { Struct.new(:content, :stored_result, :fresh, keyword_init: true).new(content: 'Hello, world!', stored_result: nil, fresh: false) }
let(:expected_output) { Struct.new(:content, :stored_result, :fresh).new(content: 'Hello, world!', stored_result: nil, fresh: false) }
describe '#execute' do
context 'when valid text tool is used' do

View File

@@ -16,7 +16,7 @@ RSpec.describe 'Ticket create > Inline Image Replacement for AI Text Tools', aut
end
let(:ai_service_text_tool_result) do
Struct.new(:content, :stored_result, :ai_analytics_run, :fresh, keyword_init: true).new(
Struct.new(:content, :stored_result, :ai_analytics_run, :fresh).new(
content: 'This is a funny text with multiple images:<br>[[IMAGE_PLACEHOLDER_1]]<br>[[IMAGE_PLACEHOLDER_2]]<br>(AI EDITED)',
stored_result: nil,
ai_analytics_run: create(:ai_analytics_run),

View File

@@ -8,7 +8,7 @@ RSpec.describe 'Richtext Bubble Menu', authenticated_as: :authenticate, type: :s
let(:ai_assistance_text_tools) { true }
let(:ui_richtext_bubble_menu) { true }
let(:input) { 'Teh qwik braun foxx jumpz ova da laizi doge.' }
let(:output) { Struct.new(:content, :stored_result, :ai_analytics_run, :fresh, keyword_init: true).new(content: 'The quick brown fox jumps over the lazy dog.', stored_result: nil, ai_analytics_run: create(:ai_analytics_run), fresh: false) }
let(:output) { Struct.new(:content, :stored_result, :ai_analytics_run, :fresh).new(content: 'The quick brown fox jumps over the lazy dog.', stored_result: nil, ai_analytics_run: create(:ai_analytics_run), fresh: false) }
let(:text_tool_name) { Faker::Lorem.unique.sentence }
def authenticate

View File

@@ -10,7 +10,7 @@ RSpec.describe 'Ticket Zoom > Text Tools Analytics', authenticated_as: :authenti
let(:reply_body) { Faker::Lorem.unique.paragraph }
let(:ai_service_text_tool_result) do
Struct.new(:content, :stored_result, :ai_analytics_run, :fresh, keyword_init: true).new(
Struct.new(:content, :stored_result, :ai_analytics_run, :fresh).new(
content: Faker::Lorem.unique.paragraph,
stored_result: nil,
ai_analytics_run:,