Skip to content

Commit

Permalink
Maintenance: Activated rubocop Style/SelfAssignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsteneckel authored and mgruner committed Jul 19, 2021
1 parent e52b79a commit 814f7e9
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 23 deletions.
7 changes: 0 additions & 7 deletions .rubocop/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/long_polling_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def message_receive
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}" }
Expand Down
2 changes: 1 addition & 1 deletion app/jobs/ticket_online_notification_seen_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def lock_key
end

def perform(ticket_id, user_id)
user_id = user_id || 1
user_id ||= 1

# set all online notifications to seen
Transaction.execute do
Expand Down
2 changes: 1 addition & 1 deletion app/models/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def self.stream

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)
Expand Down
10 changes: 5 additions & 5 deletions app/models/job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def next_run_at_calculate(time = Time.zone.now)
if last_run_at
diff = time - last_run_at
if diff.positive?
time = time + 10.minutes
time += 10.minutes
end
end
day_map = {
Expand Down Expand Up @@ -180,8 +180,8 @@ def next_run_at_calculate(time = Time.zone.now)

# 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

Expand All @@ -202,15 +202,15 @@ def next_run_at_calculate(time = Time.zone.now)

# 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?
(0..5).each do |minute_counter|
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]
Expand Down
2 changes: 1 addition & 1 deletion app/models/transaction/notification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def perform

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 = {}
Expand Down
4 changes: 2 additions & 2 deletions lib/calendar_subscriptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def initialize(user)
def all
events_data = []
@preferences.each_key do |object_name|
result = generic_call(object_name)
events_data = events_data + result
result = generic_call(object_name)
events_data += result
end
to_ical(events_data)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/core_ext/string.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def html2text(string_only = false, strict = false)
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
Expand Down
2 changes: 1 addition & 1 deletion lib/report/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def self.time_average(data)
# 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?
Expand Down
2 changes: 1 addition & 1 deletion lib/stats/ticket_waiting_time.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def self.calculate_average(ticket_ids, start_time)
end

if count_articles.positive?
average_time = average_time / count_articles
average_time /= count_articles
end

average_time
Expand Down
2 changes: 1 addition & 1 deletion lib/twitter_sync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ def get_state(channel, tweet, ticket = nil)

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
Expand Down
2 changes: 1 addition & 1 deletion lib/websocket_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def self.log_status
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|
Expand Down

0 comments on commit 814f7e9

Please sign in to comment.