Maintenance: Activated rubocop Style/SelfAssignment.
This commit is contained in:
parent
e52b79a2f0
commit
814f7e997b
12 changed files with 16 additions and 23 deletions
|
@ -166,13 +166,6 @@ Style/PerlBackrefs:
|
||||||
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
|
||||||
Enabled: false
|
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:
|
Rails/ApplicationRecord:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/application_model.rb'
|
- 'app/models/application_model.rb'
|
||||||
|
|
|
@ -73,7 +73,7 @@ class LongPollingController < ApplicationController
|
||||||
count = 12
|
count = 12
|
||||||
end
|
end
|
||||||
loop do
|
loop do
|
||||||
count = count - 1
|
count -= 1
|
||||||
queue = Sessions.queue(client_id)
|
queue = Sessions.queue(client_id)
|
||||||
if queue && queue[0]
|
if queue && queue[0]
|
||||||
logger.debug { "send #{queue.inspect} to #{client_id}" }
|
logger.debug { "send #{queue.inspect} to #{client_id}" }
|
||||||
|
|
|
@ -9,7 +9,7 @@ class TicketOnlineNotificationSeenJob < ApplicationJob
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform(ticket_id, user_id)
|
def perform(ticket_id, user_id)
|
||||||
user_id = user_id || 1
|
user_id ||= 1
|
||||||
|
|
||||||
# set all online notifications to seen
|
# set all online notifications to seen
|
||||||
Transaction.execute do
|
Transaction.execute do
|
||||||
|
|
|
@ -164,7 +164,7 @@ stream all accounts
|
||||||
|
|
||||||
local_delay_before_reconnect = delay_before_reconnect
|
local_delay_before_reconnect = delay_before_reconnect
|
||||||
if channel.status_in == 'error'
|
if channel.status_in == 'error'
|
||||||
local_delay_before_reconnect = local_delay_before_reconnect * 2
|
local_delay_before_reconnect *= 2
|
||||||
end
|
end
|
||||||
if @@channel_stream[channel_id].blank? && @@channel_stream_started_till_at[channel_id].present?
|
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)
|
wait_in_seconds = @@channel_stream_started_till_at[channel_id] - (Time.zone.now - local_delay_before_reconnect.seconds)
|
||||||
|
|
|
@ -151,7 +151,7 @@ job.run(true)
|
||||||
if last_run_at
|
if last_run_at
|
||||||
diff = time - last_run_at
|
diff = time - last_run_at
|
||||||
if diff.positive?
|
if diff.positive?
|
||||||
time = time + 10.minutes
|
time += 10.minutes
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
day_map = {
|
day_map = {
|
||||||
|
@ -180,8 +180,8 @@ job.run(true)
|
||||||
|
|
||||||
# start on next day at 00:00:00
|
# start on next day at 00:00:00
|
||||||
time = day_to_check - day_to_check.sec.seconds
|
time = day_to_check - day_to_check.sec.seconds
|
||||||
time = time - day_to_check.min.minutes
|
time -= day_to_check.min.minutes
|
||||||
time = time - day_to_check.hour.hours
|
time -= day_to_check.hour.hours
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ job.run(true)
|
||||||
|
|
||||||
# move to [0-5]0:00 time stamps
|
# 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.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
|
# loop minutes till next full hour
|
||||||
if day_to_check.min.nonzero?
|
if day_to_check.min.nonzero?
|
||||||
|
@ -210,7 +210,7 @@ job.run(true)
|
||||||
if minute_counter.nonzero?
|
if minute_counter.nonzero?
|
||||||
break if day_to_check.min.zero?
|
break if day_to_check.min.zero?
|
||||||
|
|
||||||
day_to_check = day_to_check + 10.minutes
|
day_to_check += 10.minutes
|
||||||
end
|
end
|
||||||
next if !timeplan['hours'][day_to_check.hour] && !timeplan['hours'][day_to_check.hour.to_s]
|
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]
|
next if !timeplan['minutes'][match_minutes(day_to_check.min)] && !timeplan['minutes'][match_minutes(day_to_check.min).to_s]
|
||||||
|
|
|
@ -84,7 +84,7 @@ class Transaction::Notification
|
||||||
|
|
||||||
if possible_recipients_additions.present?
|
if possible_recipients_additions.present?
|
||||||
# join unique entries
|
# join unique entries
|
||||||
possible_recipients = possible_recipients | possible_recipients_additions.to_a
|
possible_recipients |= possible_recipients_additions.to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
already_checked_recipient_ids = {}
|
already_checked_recipient_ids = {}
|
||||||
|
|
|
@ -24,7 +24,7 @@ class CalendarSubscriptions
|
||||||
events_data = []
|
events_data = []
|
||||||
@preferences.each_key do |object_name|
|
@preferences.each_key do |object_name|
|
||||||
result = generic_call(object_name)
|
result = generic_call(object_name)
|
||||||
events_data = events_data + result
|
events_data += result
|
||||||
end
|
end
|
||||||
to_ical(events_data)
|
to_ical(events_data)
|
||||||
end
|
end
|
||||||
|
|
|
@ -162,7 +162,7 @@ class String
|
||||||
elsif string.scan(%r{<a[[:space:]]}i).count < 5_000
|
elsif string.scan(%r{<a[[:space:]]}i).count < 5_000
|
||||||
string.gsub!(%r{<a[[:space:]].*?href=("|')(.+?)("|').*?>}ix) do
|
string.gsub!(%r{<a[[:space:]].*?href=("|')(.+?)("|').*?>}ix) do
|
||||||
link = $2
|
link = $2
|
||||||
counter = counter + 1
|
counter += 1
|
||||||
link_list += "[#{counter}] #{link}\n"
|
link_list += "[#{counter}] #{link}\n"
|
||||||
"[#{counter}] "
|
"[#{counter}] "
|
||||||
end
|
end
|
||||||
|
|
|
@ -243,7 +243,7 @@ class Report::Base
|
||||||
# puts 'CT:' + ticket.created_at.to_s
|
# puts 'CT:' + ticket.created_at.to_s
|
||||||
diff = timestamp - ticket.created_at
|
diff = timestamp - ticket.created_at
|
||||||
#puts 'DIFF:' + diff.to_s
|
#puts 'DIFF:' + diff.to_s
|
||||||
time_total = time_total + diff
|
time_total += diff
|
||||||
tickets += 1
|
tickets += 1
|
||||||
end
|
end
|
||||||
if time_total.zero? || tickets.zero?
|
if time_total.zero? || tickets.zero?
|
||||||
|
|
|
@ -74,7 +74,7 @@ class Stats::TicketWaitingTime
|
||||||
end
|
end
|
||||||
|
|
||||||
if count_articles.positive?
|
if count_articles.positive?
|
||||||
average_time = average_time / count_articles
|
average_time /= count_articles
|
||||||
end
|
end
|
||||||
|
|
||||||
average_time
|
average_time
|
||||||
|
|
|
@ -551,7 +551,7 @@ create a tweet or direct message from an article
|
||||||
|
|
||||||
def tweet_limit_reached(tweet, factor = 1)
|
def tweet_limit_reached(tweet, factor = 1)
|
||||||
max_count = 120
|
max_count = 120
|
||||||
max_count = max_count * factor
|
max_count *= factor
|
||||||
type_id = Ticket::Article::Type.lookup(name: 'twitter status').id
|
type_id = Ticket::Article::Type.lookup(name: 'twitter status').id
|
||||||
created_at = Time.zone.now - 15.minutes
|
created_at = Time.zone.now - 15.minutes
|
||||||
created_count = Ticket::Article.where('created_at > ? AND type_id = ?', created_at, type_id).count
|
created_count = Ticket::Article.where('created_at > ? AND type_id = ?', created_at, type_id).count
|
||||||
|
|
|
@ -199,7 +199,7 @@ class WebsocketServer
|
||||||
client_list.each_value do |client|
|
client_list.each_value do |client|
|
||||||
next if client[:meta][:type] == 'websocket'
|
next if client[:meta][:type] == 'websocket'
|
||||||
|
|
||||||
clients = clients + 1
|
clients += 1
|
||||||
end
|
end
|
||||||
log 'info', "Status: ajax clients: #{clients}"
|
log 'info', "Status: ajax clients: #{clients}"
|
||||||
client_list.each do |client_id, client|
|
client_list.each do |client_id, client|
|
||||||
|
|
Loading…
Reference in a new issue