Skip to content

Commit

Permalink
fix rubocop warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-exz committed Oct 4, 2023
1 parent 7817f14 commit 31ea908
Show file tree
Hide file tree
Showing 71 changed files with 382 additions and 392 deletions.
70 changes: 36 additions & 34 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
source 'https://rubygems.org'
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.7.6'
gem 'slack-ruby-bot', '~> 0.16.1'
gem 'async-websocket', '~> 0.8.0'
gem 'bootstrap', '~> 4.5.0'
gem 'font-awesome-rails', '>= 4.7.0.8'
gem 'jquery-rails', '>= 4.6.0'
gem 'json'
gem 'mail'
gem 'actionview', '>= 6.1.7.3'
gem 'activesupport', '>= 6.1.7.3'
gem 'actionpack', '>= 6.1.7.4'
gem 'activestorage', '>= 6.1.7.4'
gem 'nokogiri', '>= 1.13.10'
gem 'activerecord', '>= 6.1.7.3'
gem 'whenever'
ruby "2.7.6"
gem "rubocop"
gem "slack-ruby-bot", "~> 0.16.1"
gem "async-websocket", "~> 0.8.0"
gem "bootstrap", "~> 4.5.0"
gem "font-awesome-rails", ">= 4.7.0.8"
gem "jquery-rails", ">= 4.6.0"
gem "json"
gem "mail"
gem "actionview", ">= 6.1.7.3"
gem "activesupport", ">= 6.1.7.3"
gem "actionpack", ">= 6.1.7.4"
gem "activestorage", ">= 6.1.7.4"
gem "nokogiri", ">= 1.13.10"
gem "activerecord", ">= 6.1.7.3"
gem "whenever"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.1.7.4'
gem "rails", "~> 6.1.7.4"
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
gem "sqlite3"
# Use Puma as the app server
gem 'puma', '~> 5.6.7'
gem "puma", "~> 5.6.7"
# Use SCSS for stylesheets
gem 'sass-rails', '~> 6.0', '>= 6.0.0'
gem "sass-rails", "~> 6.0", ">= 6.0.0"
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
gem "uglifier", ">= 1.3.0"
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 5.0', '>= 5.0.0'
gem "coffee-rails", "~> 5.0", ">= 5.0.0"
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
gem "turbolinks", "~> 5"
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.11', '>= 2.11.5'
gem "jbuilder", "~> 2.11", ">= 2.11.5"
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
Expand All @@ -47,29 +48,30 @@ gem 'jbuilder', '~> 2.11', '>= 2.11.5'
# gem 'capistrano-rails', group: :development

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false
gem "bootsnap", ">= 1.1.0", require: false

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem "byebug", platforms: [:mri, :mingw, :x64_mingw]
gem "standard", require: false
end

group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 4.2.1'
gem 'listen', '>= 3.0.5', '< 3.2'
gem "web-console", ">= 4.2.1"
gem "listen", ">= 3.0.5", "< 3.2"
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem "spring"
gem "spring-watcher-listen", "~> 2.0.0"
end

group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 3.37.1'
gem 'selenium-webdriver'
gem "capybara", ">= 3.37.1"
gem "selenium-webdriver"
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'chromedriver-helper', '>= 2.1.1'
gem "chromedriver-helper", ">= 2.1.1"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require_relative 'config/application'
require_relative "config/application"

Rails.application.load_tasks
2 changes: 1 addition & 1 deletion app/controllers/actions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def index
@actions = Action.all
respond_to do |format|
format.html # index.html.erb
format.xml { render xml: @actions }
format.xml { render xml: @actions }
format.json { render json: @actions }
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/answers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def index
@answers = Answer.all
respond_to do |format|
format.html # index.html.erb
format.xml { render xml: @answers }
format.xml { render xml: @answers }
format.json { render json: @answers }
end
end
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/duties_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ def index
@duties = Duty.all
respond_to do |format|
format.html # index.html.erb
format.xml { render xml: @duties }
format.xml { render xml: @duties }
format.json { render json: @duties }
end
end

def new
duty = Duty.new
Duty.new
end

def destroy
Expand All @@ -25,8 +25,8 @@ def edit
def update
@Duty = Duty.find(params[:id])
@Duty.update(
opsgenie_escalation_name: params[:duty][:opsgenie_escalation_name],
opsgenie_schedule_name: params[:duty][:opsgenie_schedule_name]
opsgenie_escalation_name: params[:duty][:opsgenie_escalation_name],
opsgenie_schedule_name: params[:duty][:opsgenie_schedule_name]
)
redirect_to duties_path(@duty)
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/messages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def index
@messages = Message.all
respond_to do |format|
format.html # index.html.erb
format.xml { render xml: @duties }
format.xml { render xml: @duties }
format.json { render json: @duties }
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def index
@users = User.all
respond_to do |format|
format.html # index.html.erb
format.xml { render xml: @duties }
format.xml { render xml: @duties }
format.json { render json: @duties }
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
layout 'mailer'
default from: "from@example.com"
layout "mailer"
end
2 changes: 1 addition & 1 deletion app/models/channel.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class Channel < ApplicationRecord
self.primary_key = 'slack_channel_id'
self.primary_key = "slack_channel_id"
end
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class User < ApplicationRecord
self.primary_key = 'slack_user_id'
self.primary_key = "slack_user_id"
end
1 change: 0 additions & 1 deletion bin/rails
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ rescue LoadError => e
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
12 changes: 6 additions & 6 deletions bot/commands/action_create.rb
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
module WhoIsOnDutyTodaySlackBotModule
module Commands
class ActionCreate
def self.call(client:,data:,match:)
def self.call(client:, data:, match:)
action = Action.new(
problem: match['expression'][/problem:(.*) action:/, 1],
action: match['expression'][/ action:(.*)$/, 1],
problem: match["expression"][/problem:(.*) action:/, 1],
action: match["expression"][/ action:(.*)$/, 1],
channel: data.channel
)

if action.save
client.web_client.chat_postMessage(
channel: data.channel,
text: I18n.t('commands.action.created.text'),
text: I18n.t("commands.action.created.text"),
thread_ts: data.thread_ts || data.ts,
as_user: true
)
else
client.web_client.chat_postMessage(
channel: data.channel,
text: I18n.t('commands.action.failed.text'),
text: I18n.t("commands.action.failed.text"),
thread_ts: data.thread_ts || data.ts,
as_user: true
)
end
end
end
end
end
end
8 changes: 4 additions & 4 deletions bot/commands/action_delete.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module WhoIsOnDutyTodaySlackBotModule
module Commands
class ActionDelete
def self.call(client:,data:,match:)
def self.call(client:, data:, match:)
Action.where(
problem: match['expression'][/problem:(.*)/, 1],
problem: match["expression"][/problem:(.*)/, 1],
channel: data.channel
).delete_all

client.web_client.chat_postMessage(
channel: data.channel,
text: I18n.t('commands.action.deleted.text'),
text: I18n.t("commands.action.deleted.text"),
thread_ts: data.thread_ts || data.ts,
as_user: true
)
end
end
end
end
end
6 changes: 3 additions & 3 deletions bot/commands/answer_delete_custom_text.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module WhoIsOnDutyTodaySlackBotModule
module Commands
class AnswerDeleteCustomText
def self.call(client:,data:)
def self.call(client:, data:)
Answer.where(channel_id: data.channel).delete_all

client.web_client.chat_postMessage(
channel: data.channel,
text: I18n.t('commands.answer.deleted.text'),
text: I18n.t("commands.answer.deleted.text"),
thread_ts: data.thread_ts || data.ts,
as_user: true
)
end
end
end
end
end
6 changes: 3 additions & 3 deletions bot/commands/answer_disable_hide_reason.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module WhoIsOnDutyTodaySlackBotModule
module Commands
class AnswerDisableHideReason
def self.call(client:,data:)
def self.call(client:, data:)
Answer.where(channel_id: data.channel).update_all(hide_reason: false)
client.web_client.chat_postMessage(
channel: data.channel,
text: I18n.t('commands.disable.hide_reason.text', name: client.self.name),
text: I18n.t("commands.disable.hide_reason.text", name: client.self.name),
thread_ts: data.thread_ts || data.ts,
as_user: true
)
end
end
end
end
end
8 changes: 4 additions & 4 deletions bot/commands/answer_enable_hide_reason.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
module WhoIsOnDutyTodaySlackBotModule
module Commands
class AnswerEnableHideReason
def self.call(client:,data:)
def self.call(client:, data:)
if Answer.where(channel_id: data.channel).update_all(hide_reason: true)
client.web_client.chat_postMessage(
channel: data.channel,
text: I18n.t('commands.enable.hide_reason.text', name: client.self.name),
text: I18n.t("commands.enable.hide_reason.text", name: client.self.name),
thread_ts: data.thread_ts || data.ts,
as_user: true
)
else
client.web_client.chat_postMessage(
channel: data.channel,
text: I18n.t('commands.enable.hide_reason.failed.text', name: client.self.name),
text: I18n.t("commands.enable.hide_reason.failed.text", name: client.self.name),
thread_ts: data.thread_ts || data.ts,
as_user: true
)
end
end
end
end
end
end
10 changes: 5 additions & 5 deletions bot/commands/answer_set_custom_text.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module WhoIsOnDutyTodaySlackBotModule
module Commands
class AnswerSetCustomText
def self.call(client:,data:,match:)
custom_text = match['expression']
def self.call(client:, data:, match:)
custom_text = match["expression"]
Answer.where(channel_id: data.channel).delete_all
answer = Answer.new
answer.body = custom_text
Expand All @@ -11,7 +11,7 @@ def self.call(client:,data:,match:)
if answer.save
client.web_client.chat_postMessage(
channel: data.channel,
text: I18n.t('commands.answer.created.text'),
text: I18n.t("commands.answer.created.text"),
thread_ts: data.thread_ts || data.ts,
as_user: true
)
Expand All @@ -24,12 +24,12 @@ def self.call(client:,data:,match:)
else
client.web_client.chat_postMessage(
channel: data.channel,
text: I18n.t('commands.answer.failed.text'),
text: I18n.t("commands.answer.failed.text"),
thread_ts: data.thread_ts || data.ts,
as_user: true
)
end
end
end
end
end
end
Loading

0 comments on commit 31ea908

Please sign in to comment.