зеркало из
https://github.com/glebtv/telegram-bot.git
synced 2026-09-08 11:55:51 +03:00
Update rubopcop (#227)
* Update rubopcop [WIP] * Further rubocop fixes * Fix rubocop-rails cops * Fix spec * Disable rubocop suggestions * Run rubocop in github actions rather than in codeclimate
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7bcb0caded
Коммит
57b17f068c
@@ -1,9 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Telegram
|
||||
module Bot
|
||||
# Supposed to be used in development environments only.
|
||||
class UpdatesPoller
|
||||
class << self
|
||||
@@instances = {} # rubocop:disable ClassVars
|
||||
@@instances = {} # rubocop:disable Style/ClassVars
|
||||
|
||||
def instances
|
||||
@@instances
|
||||
@@ -36,7 +38,7 @@ module Telegram
|
||||
end
|
||||
|
||||
def log(&block)
|
||||
logger.info(&block) if logger
|
||||
logger&.info(&block)
|
||||
end
|
||||
|
||||
def start
|
||||
@@ -56,7 +58,7 @@ module Telegram
|
||||
def run
|
||||
while running
|
||||
updates = fetch_updates
|
||||
process_updates(updates) if updates && updates.any?
|
||||
process_updates(updates) if updates&.any?
|
||||
end
|
||||
end
|
||||
|
||||
@@ -82,8 +84,8 @@ module Telegram
|
||||
process_update(update)
|
||||
end
|
||||
end
|
||||
rescue StandardError => e
|
||||
logger.error { ([e.message] + e.backtrace).join("\n") } if logger
|
||||
rescue StandardError => exception
|
||||
logger&.error { ([exception.message] + exception.backtrace).join("\n") }
|
||||
end
|
||||
|
||||
# Override this method to setup custom error collector.
|
||||
@@ -102,10 +104,8 @@ module Telegram
|
||||
end
|
||||
|
||||
if defined?(Rails.application) && Rails.application.respond_to?(:reloader)
|
||||
def reloading_code
|
||||
Rails.application.reloader.wrap do
|
||||
yield
|
||||
end
|
||||
def reloading_code(&block)
|
||||
Rails.application.reloader.wrap(&block)
|
||||
end
|
||||
else
|
||||
def reloading_code
|
||||
|
||||
Ссылка в новой задаче
Block a user