Maintenance: Activated rubocop Style/SelfAssignment.

This commit is contained in:
Thorsten Eckel 2021-07-16 16:10:31 +02:00 committed by Martin Gruner
parent e52b79a2f0
commit 814f7e997b
12 changed files with 16 additions and 23 deletions

View file

@ -166,13 +166,6 @@ Style/PerlBackrefs:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
Enabled: false
Style/SelfAssignment:
Description: >-
Checks for places where self-assignment shorthand should have
been used.
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
Enabled: false
Rails/ApplicationRecord:
Exclude:
- 'app/models/application_model.rb'

View file

@ -73,7 +73,7 @@ class LongPollingController < ApplicationController
count = 12
end
loop do
count = count - 1
count -= 1
queue = Sessions.queue(client_id)
if queue && queue[0]
logger.debug { "send #{queue.inspect} to #{client_id}" }

View file

@ -9,7 +9,7 @@ class TicketOnlineNotificationSeenJob < ApplicationJob
end
def perform(ticket_id, user_id)
user_id = user_id || 1
user_id ||= 1
# set all online notifications to seen
Transaction.execute do

View file

@ -164,7 +164,7 @@ stream all accounts
local_delay_before_reconnect = delay_before_reconnect
if channel.status_in == 'error'
local_delay_before_reconnect = local_delay_before_reconnect * 2
local_delay_before_reconnect *= 2
end
if @@channel_stream[channel_id].blank? && @@channel_stream_started_till_at[channel_id].present?
wait_in_seconds = @@channel_stream_started_till_at[channel_id] - (Time.zone.now - local_delay_before_reconnect.seconds)

View file

@ -151,7 +151,7 @@ job.run(true)
if last_run_at
diff = time - last_run_at
if diff.positive?
time = time + 10.minutes
time += 10.minutes
end
end
day_map = {
@ -180,8 +180,8 @@ job.run(true)
# start on next day at 00:00:00
time = day_to_check - day_to_check.sec.seconds
time = time - day_to_check.min.minutes
time = time - day_to_check.hour.hours
time -= day_to_check.min.minutes
time -= day_to_check.hour.hours
next
end
@ -202,7 +202,7 @@ job.run(true)
# move to [0-5]0:00 time stamps
day_to_check = day_to_check - day_to_check.min.minutes + min.minutes
day_to_check = day_to_check - day_to_check.sec.seconds
day_to_check -= day_to_check.sec.seconds
# loop minutes till next full hour
if day_to_check.min.nonzero?
@ -210,7 +210,7 @@ job.run(true)
if minute_counter.nonzero?
break if day_to_check.min.zero?
day_to_check = day_to_check + 10.minutes
day_to_check += 10.minutes
end
next if !timeplan['hours'][day_to_check.hour] && !timeplan['hours'][day_to_check.hour.to_s]
next if !timeplan['minutes'][match_minutes(day_to_check.min)] && !timeplan['minutes'][match_minutes(day_to_check.min).to_s]

View file

@ -84,7 +84,7 @@ class Transaction::Notification
if possible_recipients_additions.present?
# join unique entries
possible_recipients = possible_recipients | possible_recipients_additions.to_a
possible_recipients |= possible_recipients_additions.to_a
end
already_checked_recipient_ids = {}

View file

@ -24,7 +24,7 @@ class CalendarSubscriptions
events_data = []
@preferences.each_key do |object_name|
result = generic_call(object_name)
events_data = events_data + result
events_data += result
end
to_ical(events_data)
end

View file

@ -162,7 +162,7 @@ class String
elsif string.scan(%r{<a[[:space:]]}i).count < 5_000
string.gsub!(%r{<a[[:space:]].*?href=("|')(.+?)("|').*?>}ix) do
link = $2
counter = counter + 1
counter += 1
link_list += "[#{counter}] #{link}\n"
"[#{counter}] "
end

View file

@ -243,7 +243,7 @@ class Report::Base
# puts 'CT:' + ticket.created_at.to_s
diff = timestamp - ticket.created_at
#puts 'DIFF:' + diff.to_s
time_total = time_total + diff
time_total += diff
tickets += 1
end
if time_total.zero? || tickets.zero?

View file

@ -74,7 +74,7 @@ class Stats::TicketWaitingTime
end
if count_articles.positive?
average_time = average_time / count_articles
average_time /= count_articles
end
average_time

View file

@ -551,7 +551,7 @@ create a tweet or direct message from an article
def tweet_limit_reached(tweet, factor = 1)
max_count = 120
max_count = max_count * factor
max_count *= factor
type_id = Ticket::Article::Type.lookup(name: 'twitter status').id
created_at = Time.zone.now - 15.minutes
created_count = Ticket::Article.where('created_at > ? AND type_id = ?', created_at, type_id).count

View file

@ -199,7 +199,7 @@ class WebsocketServer
client_list.each_value do |client|
next if client[:meta][:type] == 'websocket'
clients = clients + 1
clients += 1
end
log 'info', "Status: ajax clients: #{clients}"
client_list.each do |client_id, client|