diff --git a/.rubocop.yml b/.rubocop.yml
new file mode 100644
index 000000000..b07986d3f
--- /dev/null
+++ b/.rubocop.yml
@@ -0,0 +1,3 @@
+---
+inherit_gem:
+ rubocop-rails-omakase: rubocop.yml
diff --git a/Gemfile b/Gemfile
index c457ddcec..68b175f38 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,9 +5,9 @@ ruby "2.7.8"
gem "active_link_to"
gem "autoprefixer-rails"
gem "bourbon", "7.3.0"
+gem "cancancan"
gem "carrierwave", "~> 2.2.6"
gem "carrierwave-base64"
-gem "cancancan"
gem "config", "~> 2"
gem "devise"
gem "geocoder", "1.6.1"
@@ -25,8 +25,8 @@ gem "normalize-rails", "~> 4.1.1"
gem "omniauth"
gem "omniauth-github"
gem "omniauth-google-oauth2"
-gem "omniauth-vkontakte"
gem "omniauth-rails_csrf_protection"
+gem "omniauth-vkontakte"
gem "pg"
gem "phony_rails"
gem "puma"
@@ -54,8 +54,8 @@ gem "stackprof", require: false, platform: :mri
source "https://rails-assets.org" do
gem "rails-assets-cropper", "~> 2.3"
- gem "rails-assets-smartcrop", "~> 1.1"
gem "rails-assets-listjs", "~> 1.5"
+ gem "rails-assets-smartcrop", "~> 1.1"
end
group :development do
@@ -65,25 +65,25 @@ end
group :development, :test do
gem "awesome_print"
+ gem "brakeman", require: false
gem "bullet"
gem "bundler-audit", ">= 0.5.0", require: false
- gem "brakeman", require: false
gem "dotenv-rails"
- gem "faker"
gem "factory_bot_rails"
+ gem "faker"
gem "pry-byebug"
gem "pry-rails"
gem "rails-controller-testing"
gem "rspec-rails"
- gem "standard"
+ gem "rubocop-rails-omakase", require: false
end
group :test do
gem "formulaic"
gem "fuubar"
gem "launchy"
- gem "shoulda-matchers"
gem "shoulda-callback-matchers"
+ gem "shoulda-matchers"
gem "simplecov", require: false
gem "timecop"
gem "webmock"
diff --git a/Gemfile.lock b/Gemfile.lock
index c15b8f32c..04b753f9e 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -73,7 +73,7 @@ GEM
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
- ast (2.4.0)
+ ast (2.4.2)
autoprefixer-rails (9.6.1.1)
execjs
awesome_print (1.8.0)
@@ -93,13 +93,14 @@ GEM
thor (~> 1.0)
byebug (11.1.3)
cancancan (3.5.0)
- capybara (3.27.0)
+ capybara (3.39.2)
addressable
+ matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
- regexp_parser (~> 1.5)
+ regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
carrierwave (2.2.6)
activemodel (>= 5.0.0)
@@ -231,6 +232,7 @@ GEM
json (2.7.2)
jwt (2.8.1)
base64
+ language_server-protocol (3.17.0.3)
launchy (2.4.3)
addressable (~> 2.3)
listen (3.2.0)
@@ -245,6 +247,7 @@ GEM
net-pop
net-smtp
marcel (1.0.4)
+ matrix (0.4.2)
memoist (0.16.2)
memory_profiler (0.9.14)
meta-tags (2.20.0)
@@ -311,9 +314,10 @@ GEM
omniauth-oauth2 (>= 1.5, <= 1.8.0)
orm_adapter (0.5.0)
os (1.0.1)
- parallel (1.19.1)
- parser (2.7.0.1)
- ast (~> 2.4.0)
+ parallel (1.24.0)
+ parser (3.3.1.0)
+ ast (~> 2.4.1)
+ racc
pg (1.5.6)
phony (2.18.5)
phony_rails (0.14.13)
@@ -379,7 +383,7 @@ GEM
method_source
rake (>= 12.2)
thor (~> 1.0)
- rainbow (3.0.0)
+ rainbow (3.1.1)
rake (13.2.1)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
@@ -388,7 +392,7 @@ GEM
mail
redcarpet (3.5.1)
redis (3.3.3)
- regexp_parser (1.6.0)
+ regexp_parser (2.9.0)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
@@ -415,15 +419,33 @@ GEM
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.13.1)
- rubocop (0.83.0)
+ rubocop (1.63.3)
+ json (~> 2.3)
+ language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
- parser (>= 2.7.0.1)
+ parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
- rexml
+ regexp_parser (>= 1.8, < 3.0)
+ rexml (>= 3.2.5, < 4.0)
+ rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
- unicode-display_width (>= 1.4.0, < 2.0)
+ unicode-display_width (>= 2.4.0, < 3.0)
+ rubocop-ast (1.31.2)
+ parser (>= 3.3.0.4)
+ rubocop-minitest (0.9.0)
+ rubocop (>= 0.74)
rubocop-performance (1.5.2)
rubocop (>= 0.71.0)
+ rubocop-rails (2.23.1)
+ activesupport (>= 4.2.0)
+ rack (>= 1.1)
+ rubocop (>= 1.33.0, < 2.0)
+ rubocop-ast (>= 1.30.0, < 2.0)
+ rubocop-rails-omakase (1.0.0)
+ rubocop
+ rubocop-minitest
+ rubocop-performance
+ rubocop-rails
ruby-progressbar (1.10.1)
ruby-vips (2.2.1)
ffi (~> 1.12)
@@ -479,9 +501,6 @@ GEM
sprockets (>= 3.0.0)
ssrf_filter (1.1.2)
stackprof (0.2.13)
- standard (0.4.6)
- rubocop (~> 0.83.0)
- rubocop-performance (~> 1.5.2)
temple (0.10.3)
thor (1.3.1)
tilt (2.3.0)
@@ -494,7 +513,7 @@ GEM
uber (0.1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
- unicode-display_width (1.6.0)
+ unicode-display_width (2.5.0)
uniform_notifier (1.16.0)
version_gem (1.1.4)
warden (1.2.9)
@@ -577,6 +596,7 @@ DEPENDENCIES
redis
responders
rspec-rails
+ rubocop-rails-omakase
russian
sass-rails (~> 6.0)
shoulda-callback-matchers
@@ -585,7 +605,6 @@ DEPENDENCIES
slim-rails
sprockets (>= 3.0.0)
stackprof
- standard
timecop
toastr-rails
uglifier
diff --git a/Rakefile b/Rakefile
index a855a0b7b..9df936133 100644
--- a/Rakefile
+++ b/Rakefile
@@ -5,7 +5,7 @@ require File.expand_path("../config/application", __FILE__)
Rails.application.load_tasks
task(:default).clear
-task default: [:spec]
+task default: [ :spec ]
if defined? RSpec
task(:spec).clear
diff --git a/app/controllers/admin/places_controller.rb b/app/controllers/admin/places_controller.rb
index b8828a402..ca9b4d438 100644
--- a/app/controllers/admin/places_controller.rb
+++ b/app/controllers/admin/places_controller.rb
@@ -21,7 +21,7 @@ def place_params
:address,
:title,
:latitude,
- :longitude,
+ :longitude
]
params.require(:place).permit(*attributes)
end
diff --git a/app/controllers/admin/users_controller.rb b/app/controllers/admin/users_controller.rb
index 847bf53fa..6a5f447c5 100644
--- a/app/controllers/admin/users_controller.rb
+++ b/app/controllers/admin/users_controller.rb
@@ -22,7 +22,7 @@ def user_params
:first_name,
:last_name,
:phone,
- :role,
+ :role
]
params.require(:user).permit(*attributes)
end
diff --git a/app/controllers/events/attendees_controller.rb b/app/controllers/events/attendees_controller.rb
index 7f4edc38b..d0f4d0ddc 100644
--- a/app/controllers/events/attendees_controller.rb
+++ b/app/controllers/events/attendees_controller.rb
@@ -1,6 +1,6 @@
class Events::AttendeesController < ApplicationController
respond_to :html
- respond_to :csv, only: [:index]
+ respond_to :csv, only: [ :index ]
load_and_authorize_resource :event
authorize_resource class: false
skip_authorize_resource only: :index
diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb
index 0569d6bc7..6a7e39e5a 100644
--- a/app/controllers/events_controller.rb
+++ b/app/controllers/events_controller.rb
@@ -1,5 +1,5 @@
class EventsController < ApplicationController
- respond_to :json, only: [:create]
+ respond_to :json, only: [ :create ]
respond_to :ics, only: :ics
respond_to :rss, only: :feed
@@ -144,10 +144,10 @@ def whitelisted
:title,
:address,
:latitude,
- :longitude,
+ :longitude
],
has_attendees_limit: [],
- attendees_limit: [],
+ attendees_limit: []
]
end
end
diff --git a/app/controllers/places_controller.rb b/app/controllers/places_controller.rb
index ef89f4d84..1e775840e 100644
--- a/app/controllers/places_controller.rb
+++ b/app/controllers/places_controller.rb
@@ -17,9 +17,9 @@ def find
def to_yandex_geoobject(place)
{
addressLine: place.address,
- coordinates: [place.latitude, place.longitude],
+ coordinates: [ place.latitude, place.longitude ],
place_title: place.title,
- id: place.id,
+ id: place.id
}
end
end
diff --git a/app/controllers/users/avatars_controller.rb b/app/controllers/users/avatars_controller.rb
index ae48073d5..940db6f31 100644
--- a/app/controllers/users/avatars_controller.rb
+++ b/app/controllers/users/avatars_controller.rb
@@ -1,7 +1,7 @@
module Users
class AvatarsController < ApplicationController
before_action :authenticate_user!
- before_action :set_user, only: [:create, :update, :destroy]
+ before_action :set_user, only: [ :create, :update, :destroy ]
before_action :check_if_same_user_or_admin
def create
diff --git a/app/controllers/users/profile_controller.rb b/app/controllers/users/profile_controller.rb
index d55325afd..4d7b6ecfc 100644
--- a/app/controllers/users/profile_controller.rb
+++ b/app/controllers/users/profile_controller.rb
@@ -1,9 +1,9 @@
module Users
class ProfileController < ApplicationController
- before_action :authenticate_user!, except: [:sign_in]
- before_action :set_user, only: [:profile, :settings, :settings_update, :edit]
+ before_action :authenticate_user!, except: [ :sign_in ]
+ before_action :set_user, only: [ :profile, :settings, :settings_update, :edit ]
- authorize_resource class: User, except: [:sign_in, :sign_up_complete]
+ authorize_resource class: User, except: [ :sign_in, :sign_up_complete ]
def sign_in; end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index a3437e593..cbbf58b01 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,5 +1,5 @@
class UsersController < ApplicationController
- before_action :authenticate_user!, only: [:edit, :destroy]
+ before_action :authenticate_user!, only: [ :edit, :destroy ]
respond_to :html
load_and_authorize_resource
@@ -57,7 +57,7 @@ def user_params
:email,
:phone,
:hash_tag,
- :bio,
+ :bio
]
params.require(:user).permit(*user_attributes)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 38c6235c4..492aa2385 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,10 +1,9 @@
module ApplicationHelper
-
def default_meta_image
{
_: asset_url("share.png"),
width: 1200,
- height: 630,
+ height: 630
}
end
@@ -22,15 +21,15 @@ def default_meta_tags
url: root_url,
locale: "ru_RU",
type: "website",
- image: default_meta_image,
+ image: default_meta_image
},
twitter: {
image: asset_url("share.png"),
card: "summary_large_image",
site: "it_rostov",
title: :title,
- description: :description,
- },
+ description: :description
+ }
}
end
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb
index 08d00f851..b2a27c919 100644
--- a/app/helpers/events_helper.rb
+++ b/app/helpers/events_helper.rb
@@ -4,11 +4,11 @@ def events_fit_on_one_page?(events)
end
def quoted_title(event)
- ["«", event.title, "»"].join
+ [ "«", event.title, "»" ].join
end
def summary_info(event)
- [quoted_title(event), event.place.full_address, l(event.started_at, format: :date_time_full)].compact.join("
")
+ [ quoted_title(event), event.place.full_address, l(event.started_at, format: :date_time_full) ].compact.join("
")
end
def make_global(link)
@@ -37,7 +37,7 @@ def remove_from_event_link(event)
def to_yandex_location(place)
{
addressLine: place.full_address,
- coordinates: [place.latitude, place.longitude],
+ coordinates: [ place.latitude, place.longitude ]
}.to_json
end
end
diff --git a/app/helpers/user_helper.rb b/app/helpers/user_helper.rb
index e53a479f0..448cba052 100644
--- a/app/helpers/user_helper.rb
+++ b/app/helpers/user_helper.rb
@@ -13,26 +13,26 @@ def all_providers
name: t("socials.facebook"),
class: "fa fa-facebook",
buttonclass: "btn btn-fb",
- link: user_facebook_omniauth_authorize_path,
+ link: user_facebook_omniauth_authorize_path
},
google_oauth2: {
name: t("socials.google_plus"),
class: "fa fa-google-plus",
buttonclass: "btn btn-google",
- link: user_google_oauth2_omniauth_authorize_path,
+ link: user_google_oauth2_omniauth_authorize_path
},
vkontakte: {
name: t("socials.vk"),
class: "fa fa-vk",
buttonclass: "btn btn-vk",
- link: user_vkontakte_omniauth_authorize_path,
+ link: user_vkontakte_omniauth_authorize_path
},
github: {
name: t("socials.github"),
class: "fa fa-github",
buttonclass: "btn btn-github",
- link: user_github_omniauth_authorize_path,
- },
+ link: user_github_omniauth_authorize_path
+ }
}
end
@@ -43,7 +43,7 @@ def provider_buttons_info(user)
provider = a.provider.to_sym
link = a.link
button_class = all_providers[provider][:class]
- res[provider] = [link, button_class] unless link.nil?
+ res[provider] = [ link, button_class ] unless link.nil?
end
res
end
diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb
index 002a2cef1..da65612e7 100644
--- a/app/mailers/application_mailer.rb
+++ b/app/mailers/application_mailer.rb
@@ -2,4 +2,3 @@ class ApplicationMailer < ActionMailer::Base
default from: "no-reply@it61.info"
layout "mailer"
end
-
diff --git a/app/models/ability.rb b/app/models/ability.rb
index 443826603..490de4523 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -13,22 +13,22 @@ def initialize(user)
def give_fresh_privileges(user, persisted_in_db)
if persisted_in_db
- can [:edit, :update, :destroy], user
+ can [ :edit, :update, :destroy ], user
end
- can [:read, :active, :recent], User
- can [:read, :upcoming, :past, :ics], Event, published: true
+ can [ :read, :active, :recent ], User
+ can [ :read, :upcoming, :past, :ics ], Event, published: true
end
def give_mature_privileges(user, persisted_in_db)
if persisted_in_db
- can [:create], Event
- can [:attend, :leave], Event, published: true
+ can [ :create ], Event
+ can [ :attend, :leave ], Event, published: true
can :find, Place
- can [:profile, :edit, :settings, :settings_update], User, id: user.id
- can [:read, :edit, :update, :destroy], Event, organizer_id: user.id
- can [:create, :destroy], :attendee
- can [:index], attendee: { event: { organizer_id: user.id } }
+ can [ :profile, :edit, :settings, :settings_update ], User, id: user.id
+ can [ :read, :edit, :update, :destroy ], Event, organizer_id: user.id
+ can [ :create, :destroy ], :attendee
+ can [ :index ], attendee: { event: { organizer_id: user.id } }
end
if user.moderator?
diff --git a/app/models/event.rb b/app/models/event.rb
index f2d05633a..0b111d3bf 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -19,7 +19,7 @@ class Event < ActiveRecord::Base
validates :organizer, presence: true
validates :published_at, presence: true, if: :published?
validates :started_at, presence: true
- validates :has_attendees_limit, inclusion: { in: [true, false] }
+ validates :has_attendees_limit, inclusion: { in: [ true, false ] }
validates :attendees_limit, presence: true, numericality: { greater_than_or_equal_to: -1 }
delegate :title, :address, :latitude, :longitude, to: :place, prefix: true, allow_nil: true
@@ -93,15 +93,15 @@ def to_meta_tags
url: Rails.application.routes.url_helpers.event_url(self, host: ENV["APPLICATION_HOST"]),
locale: "ru_RU",
type: "website",
- image: cover.url,
+ image: cover.url
},
twitter: {
image: cover.url,
card: "summary_large_image",
site: "it_rostov",
title: :title,
- description: :description,
- },
+ description: :description
+ }
}
end
@@ -109,6 +109,6 @@ def to_meta_tags
def permalink_title
formatted_started_at = started_at.to_date.to_s if started_at.present?
- [formatted_started_at, title].compact.join(" ")
+ [ formatted_started_at, title ].compact.join(" ")
end
end
diff --git a/app/models/group.rb b/app/models/group.rb
index 7bf18f4fe..71a43d76c 100644
--- a/app/models/group.rb
+++ b/app/models/group.rb
@@ -6,6 +6,6 @@ class Group < ApplicationRecord
enum kind: {
general: 0,
developers: 1,
- organizers: 2,
+ organizers: 2
}
end
diff --git a/app/models/place.rb b/app/models/place.rb
index c5e234919..bd2056065 100644
--- a/app/models/place.rb
+++ b/app/models/place.rb
@@ -5,6 +5,6 @@ class Place < ApplicationRecord
validates :title, presence: true
def full_address
- [address, title].compact.reject(&:empty?).join(", ")
+ [ address, title ].compact.reject(&:empty?).join(", ")
end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index b4123e57f..a2402bedd 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -8,12 +8,12 @@ class User < ApplicationRecord
enum role: {
member: 0,
admin: 1,
- moderator: 2,
+ moderator: 2
}
# Devise modules
devise :rememberable, :trackable, :omniauthable,
- omniauth_providers: [:github, :facebook, :google_oauth2, :vkontakte]
+ omniauth_providers: [ :github, :facebook, :google_oauth2, :vkontakte ]
has_many :events_attendees, dependent: :destroy
has_many :social_accounts, dependent: :destroy
@@ -74,10 +74,10 @@ def self.avatar_from_auth(auth)
end
def self.to_csv
- attributes = %w{last_name first_name}
+ attributes = %w[last_name first_name]
CSV.generate(headers: true) do |csv|
- csv << ["Фамилия", "Имя", "Отметка"]
+ csv << [ "Фамилия", "Имя", "Отметка" ]
all.each do |user|
csv << attributes.map { |attr| user.send(attr) }
@@ -98,7 +98,7 @@ def display_name
end
def full_name
- [first_name, last_name].compact.join(" ").presence || name
+ [ first_name, last_name ].compact.join(" ").presence || name
end
def remember_me
diff --git a/app/uploaders/image_uploader.rb b/app/uploaders/image_uploader.rb
index 3a4278d07..1dfb25b9f 100644
--- a/app/uploaders/image_uploader.rb
+++ b/app/uploaders/image_uploader.rb
@@ -30,17 +30,17 @@ def store_dir
# Create different versions of your uploaded files:
version :square_500 do
- process resize_to_fit: [500, 500]
+ process resize_to_fit: [ 500, 500 ]
end
version :square_250 do
- process resize_to_fit: [250, 250]
+ process resize_to_fit: [ 250, 250 ]
end
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
- %w(jpg jpeg gif png)
+ %w[jpg jpeg gif png]
end
# Override the filename of the uploaded files:
diff --git a/config/application.rb b/config/application.rb
index f6bc69fe9..3ec0a4f72 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -17,13 +17,13 @@ class Application < Rails::Application
config.app_generators.scaffold_controller :responders_controller
- config.eager_load_paths += ["#{Rails.root}/lib"]
+ config.eager_load_paths += [ "#{Rails.root}/lib" ]
config.exceptions_app = self.routes
config.action_controller.action_on_unpermitted_parameters = :raise
- config.i18n.available_locales = [:en, :ru]
+ config.i18n.available_locales = [ :en, :ru ]
config.i18n.load_path += Dir["#{Rails.root}/config/locales/**/*.{rb,yml}"]
config.i18n.default_locale = :ru
diff --git a/config/boot.rb b/config/boot.rb
index b9e460cef..988a5ddc4 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,4 +1,4 @@
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
-require 'bundler/setup' # Set up gems listed in the Gemfile.
-require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
+require "bundler/setup" # Set up gems listed in the Gemfile.
+require "bootsnap/setup" # Speed up boot time by caching expensive operations.
diff --git a/config/environment.rb b/config/environment.rb
index 426333bb4..cac531577 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,5 +1,5 @@
# Load the Rails application.
-require_relative 'application'
+require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 3423a3312..b4a2aa2bc 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -14,7 +14,7 @@
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
- if Rails.root.join('tmp', 'caching-dev.txt').exist?
+ if Rails.root.join("tmp", "caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
diff --git a/config/environments/production.rb b/config/environments/production.rb
index cff85adf0..031242118 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -20,7 +20,7 @@
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
- config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
+ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
# Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass
@@ -43,7 +43,7 @@
config.log_level = :debug
# Prepend all log lines with the following tags.
- config.log_tags = [:request_id]
+ config.log_tags = [ :request_id ]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 6c3223f4d..b4597a94e 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -16,7 +16,7 @@
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
- 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
}
# Show full error reports and disable caching.
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index b973f9c3c..c03c104e6 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -3,16 +3,16 @@
config.mailer_sender = "no-reply@it61.info"
require "devise/orm/active_record"
- config.authentication_keys = [:email]
- config.case_insensitive_keys = [:email]
- config.strip_whitespace_keys = [:email]
- config.skip_session_storage = [:http_auth]
+ config.authentication_keys = [ :email ]
+ config.case_insensitive_keys = [ :email ]
+ config.strip_whitespace_keys = [ :email ]
+ config.skip_session_storage = [ :http_auth ]
config.stretches = Rails.env.test? ? 1 : 11
config.reconfirmable = false
config.expire_all_remember_me_on_sign_out = true
config.password_length = 6..128
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
- config.reset_password_keys = [:email]
+ config.reset_password_keys = [ :email ]
config.reset_password_within = 6.hours
config.sign_out_via = :delete
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb
index 63f8779fc..fbc1a8eae 100644
--- a/config/initializers/filter_parameter_logging.rb
+++ b/config/initializers/filter_parameter_logging.rb
@@ -1,4 +1,4 @@
# Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
-Rails.application.config.filter_parameters += [:password, :cover]
+Rails.application.config.filter_parameters += [ :password, :cover ]
diff --git a/config/initializers/rack_mini_profiler.rb b/config/initializers/rack_mini_profiler.rb
index 59acc02aa..8f83fa286 100644
--- a/config/initializers/rack_mini_profiler.rb
+++ b/config/initializers/rack_mini_profiler.rb
@@ -25,7 +25,7 @@
/^\/uploads/,
/^\/javascripts\//,
/^\/images\//,
- /^\/stylesheets\//,
+ /^\/stylesheets\//
]
# we DO NOT WANT mini-profiler loading on anything but real desktops and laptops
diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb
index bbfc3961b..6d55fe75d 100644
--- a/config/initializers/wrap_parameters.rb
+++ b/config/initializers/wrap_parameters.rb
@@ -5,7 +5,7 @@
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
- wrap_parameters format: [:json]
+ wrap_parameters format: [ :json ]
end
# To enable root element in JSON for ActiveRecord objects.
diff --git a/config/routes.rb b/config/routes.rb
index 913047c9f..325343821 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,6 @@
Rails.application.routes.draw do
devise_for :users, controllers: {
- omniauth_callbacks: "users/omniauth",
+ omniauth_callbacks: "users/omniauth"
}
devise_scope :user do
@@ -9,7 +9,7 @@
end
# Static pages
- %w(welcome about).each do |page_name|
+ %w[welcome about].each do |page_name|
get page_name, to: "pages##{page_name}"
end
@@ -27,12 +27,12 @@
get :active
get :recent
end
- resource :avatars, only: [:create, :destroy], controller: "users/avatars"
+ resource :avatars, only: [ :create, :destroy ], controller: "users/avatars"
end
resources :events do
scope module: :events do
- resources :attendees, only: [:create, :destroy, :index]
+ resources :attendees, only: [ :create, :destroy, :index ]
end
collection do
@@ -48,11 +48,11 @@
end
end
- resources :places, only: [:index] do
+ resources :places, only: [ :index ] do
get :find, to: "places#find", on: :collection
end
- get :feed, to: "events#feed", defaults: { format: 'rss' }
+ get :feed, to: "events#feed", defaults: { format: "rss" }
namespace :admin do
root "users#index"
diff --git a/db/migrate/20160701095205_create_places.rb b/db/migrate/20160701095205_create_places.rb
index 8b6a02b86..4a8fa089a 100644
--- a/db/migrate/20160701095205_create_places.rb
+++ b/db/migrate/20160701095205_create_places.rb
@@ -8,6 +8,6 @@ def change
t.timestamps null: false
end
- add_index :places, [:title, :address, :latitude, :longitude], unique: true
+ add_index :places, [ :title, :address, :latitude, :longitude ], unique: true
end
end
diff --git a/db/migrate/20160705080237_create_locations.rb b/db/migrate/20160705080237_create_locations.rb
index fd960aa53..2cccdd3ef 100644
--- a/db/migrate/20160705080237_create_locations.rb
+++ b/db/migrate/20160705080237_create_locations.rb
@@ -7,6 +7,6 @@ def change
t.timestamps null: false
end
- add_index :locations, [:event_id, :place_id, :extra_info], unique: true
+ add_index :locations, [ :event_id, :place_id, :extra_info ], unique: true
end
end
diff --git a/db/migrate/20160714140818_add_indexes_to_participant_entry_forms.rb b/db/migrate/20160714140818_add_indexes_to_participant_entry_forms.rb
index dcb485096..b1190860b 100644
--- a/db/migrate/20160714140818_add_indexes_to_participant_entry_forms.rb
+++ b/db/migrate/20160714140818_add_indexes_to_participant_entry_forms.rb
@@ -2,6 +2,6 @@ class AddIndexesToParticipantEntryForms < ActiveRecord::Migration[5.0]
def change
remove_index :participant_entry_forms, :user_id
remove_index :participant_entry_forms, :event_id
- add_index :participant_entry_forms, [:user_id, :event_id], unique: true
+ add_index :participant_entry_forms, [ :user_id, :event_id ], unique: true
end
end
diff --git a/db/migrate/20170316154814_create_events_attendees.rb b/db/migrate/20170316154814_create_events_attendees.rb
index 91a104be4..95ee167bb 100644
--- a/db/migrate/20170316154814_create_events_attendees.rb
+++ b/db/migrate/20170316154814_create_events_attendees.rb
@@ -7,6 +7,6 @@ def change
t.timestamps
end
- add_index :events_attendees, [:user_id, :event_id], unique: true
+ add_index :events_attendees, [ :user_id, :event_id ], unique: true
end
end
diff --git a/db/seeds.rb b/db/seeds.rb
index 74952f1df..46445b8c0 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -14,7 +14,7 @@
{ title: 'Свободное пространство «Циферблат»', address: 'проспект Соколова, 46', latitude: 47.225872, longitude: 39.720466, created_at: '2016-08-26 09:13:41.476870', updated_at: '2016-08-26 09:13:41.476870' },
{ title: 'DobroCowork University', address: 'улица 16-я Линия, 7В', latitude: 47.231355, longitude: 39.759354, created_at: '2016-08-26 09:14:22.045622', updated_at: '2016-08-26 09:14:22.045622' },
{ title: 'AZIMUT Hotel Sochi 3*', address: 'Сочи, Континентальный проспект, 6', latitude: 43.402584, longitude: 39.973099, created_at: '2016-08-26 09:14:48.345412', updated_at: '2016-08-26 09:14:48.345412' },
- { title: 'ДГТУ, Академия строительства и архитектуры', address: 'Социалистическая улица, 162/32', latitude: 47.223736, longitude: 39.732278, created_at: '2016-08-26 09:16:23.618108', updated_at: '2016-08-26 09:16:23.618108' },
+ { title: 'ДГТУ, Академия строительства и архитектуры', address: 'Социалистическая улица, 162/32', latitude: 47.223736, longitude: 39.732278, created_at: '2016-08-26 09:16:23.618108', updated_at: '2016-08-26 09:16:23.618108' }
])
# Groups
@@ -47,5 +47,5 @@
published_at: 1.day.ago,
# TODO(vitallium): Move to fixtures?
cover: Rack::Test::UploadedFile.new(File.join(Rails.root, "spec", "support", "files", "event_title_image.jpg"))
- },
+ }
])
diff --git a/lib/google_service.rb b/lib/google_service.rb
index 042062bf1..cd9c9864f 100644
--- a/lib/google_service.rb
+++ b/lib/google_service.rb
@@ -34,11 +34,11 @@ def self.to_google_calendar_obj(event)
location: event.place.full_address,
description: event.description? ? "" : event.description,
start: {
- dateTime: event.started_at.iso8601,
+ dateTime: event.started_at.iso8601
},
end: {
- dateTime: event.started_at.iso8601,
- },
+ dateTime: event.started_at.iso8601
+ }
}
end
end
diff --git a/lib/ics_service.rb b/lib/ics_service.rb
index f7852c2ef..371e408ea 100644
--- a/lib/ics_service.rb
+++ b/lib/ics_service.rb
@@ -12,7 +12,7 @@ def to_ics_calendar(event)
e.summary = event.title
e.description = event.description
e.location = place.full_address
- e.geo = [place.latitude, place.longitude]
+ e.geo = [ place.latitude, place.longitude ]
end
calendar.publish
@@ -22,7 +22,7 @@ def to_ics_calendar(event)
def file_options_for(event)
{
filename: filename(event),
- type: ics_type,
+ type: ics_type
}
end
diff --git a/lib/permalink_for.rb b/lib/permalink_for.rb
index cd948788c..720d8400c 100644
--- a/lib/permalink_for.rb
+++ b/lib/permalink_for.rb
@@ -3,7 +3,7 @@ module PermalinkFor
PERMALINK_TYPES = {
slug: SlugImplementation,
- pretty: PrettyImplementation,
+ pretty: PrettyImplementation
}.freeze
class_methods do
diff --git a/lib/permalink_for/pretty_implementation.rb b/lib/permalink_for/pretty_implementation.rb
index 55d8d98d9..e42cf258c 100644
--- a/lib/permalink_for/pretty_implementation.rb
+++ b/lib/permalink_for/pretty_implementation.rb
@@ -5,7 +5,7 @@ module PrettyImplementation
def to_param
return id if new_record?
target_field_value = send(permalink_configuration[:target_field])
- arr = [I18n.transliterate(target_field_value).parameterize, id]
+ arr = [ I18n.transliterate(target_field_value).parameterize, id ]
arr.delete("")
arr.join("-")
end
diff --git a/lib/permalink_for/slug_implementation.rb b/lib/permalink_for/slug_implementation.rb
index aec83372b..658b1d132 100644
--- a/lib/permalink_for/slug_implementation.rb
+++ b/lib/permalink_for/slug_implementation.rb
@@ -8,7 +8,7 @@ def permalink_validation_opts
{
presence: true,
uniqueness: true,
- format: { with: /\A[a-z0-9_-]+\Z/ },
+ format: { with: /\A[a-z0-9_-]+\Z/ }
}
end
end
diff --git a/lib/tasks/bundler_audit.rake b/lib/tasks/bundler_audit.rake
index 00c12637d..66171c0d9 100644
--- a/lib/tasks/bundler_audit.rake
+++ b/lib/tasks/bundler_audit.rake
@@ -4,8 +4,8 @@ if Rails.env.development? || Rails.env.test?
namespace :bundler do
desc "Updates the ruby-advisory-db and runs audit"
task :audit do
- %w(update check).each do |command|
- Bundler::Audit::CLI.start [command]
+ %w[update check].each do |command|
+ Bundler::Audit::CLI.start [ command ]
end
end
end
diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake
index d1eb848af..aca5e5aed 100644
--- a/lib/tasks/dev.rake
+++ b/lib/tasks/dev.rake
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
if Rails.env.development? || Rails.env.test?
require "factory_bot"
diff --git a/lib/tasks/developers.rake b/lib/tasks/developers.rake
index 984d8b60c..9f0b6d909 100644
--- a/lib/tasks/developers.rake
+++ b/lib/tasks/developers.rake
@@ -2,7 +2,7 @@ namespace :db do
require File.dirname(__FILE__) + "/importer/importer"
desc "Assigns developers to Developer group, usage: rake db:seed:users['data_file']"
- task :users, [:data_file] => :environment do |_t, args|
+ task :users, [ :data_file ] => :environment do |_t, args|
if args.data_file.blank? || !File.exist?(args.data_file)
raise "Data file can't be empty"
end
diff --git a/lib/tasks/importer/events_importer.rb b/lib/tasks/importer/events_importer.rb
index 7f8531454..559791c27 100644
--- a/lib/tasks/importer/events_importer.rb
+++ b/lib/tasks/importer/events_importer.rb
@@ -3,13 +3,13 @@ module EventsImporter
FIELDS_TO_SKIP = [
"published_to_google_calendar",
- "google_calendar_id",
+ "google_calendar_id"
].freeze
PREDEFINED_PLACES = [
{ key: "Южный IT-парк", id: 3 },
{ key: "MESTO", id: 2 },
- { key: "Место", id: 2 },
+ { key: "Место", id: 2 }
]
def import_events
diff --git a/lib/tasks/importer/importer.rb b/lib/tasks/importer/importer.rb
index d4aef209c..3d06354e4 100644
--- a/lib/tasks/importer/importer.rb
+++ b/lib/tasks/importer/importer.rb
@@ -10,7 +10,7 @@ class Importer
{ table: "users", reset: true },
{ table: "social_accounts", reset: true },
{ table: "events", reset: true },
- { table: "events_attendees", reset: true },
+ { table: "events_attendees", reset: true }
].freeze
def initialize(old_db, new_db)
diff --git a/lib/tasks/transition_data.rake b/lib/tasks/transition_data.rake
index 12a518e98..f6ff796b5 100644
--- a/lib/tasks/transition_data.rake
+++ b/lib/tasks/transition_data.rake
@@ -2,7 +2,7 @@ namespace :db do
require_relative "./importer/importer"
desc "Transition data from old database, usage: rake db:transition['old_db_name']"
- task :transition, [:old_database] => :environment do |_t, args|
+ task :transition, [ :old_database ] => :environment do |_t, args|
args.with_defaults(old_database: "it61_old")
old_db = args.old_database.to_sym
diff --git a/spec/controllers/errors_controller_spec.rb b/spec/controllers/errors_controller_spec.rb
index 34b9b5edf..99630bdf3 100644
--- a/spec/controllers/errors_controller_spec.rb
+++ b/spec/controllers/errors_controller_spec.rb
@@ -1,5 +1,4 @@
require 'rails_helper'
RSpec.describe ErrorsController, type: :controller do
-
end
diff --git a/spec/controllers/events_controller_spec.rb b/spec/controllers/events_controller_spec.rb
index 3c3adea14..245d3c176 100644
--- a/spec/controllers/events_controller_spec.rb
+++ b/spec/controllers/events_controller_spec.rb
@@ -107,7 +107,7 @@
expect(response.status).to eq(200)
expect(response).to render_template(:index)
- expect(assigns(:events)).to eq([event])
+ expect(assigns(:events)).to eq([ event ])
end
end
diff --git a/spec/factories/users.rb b/spec/factories/users.rb
index 159d1da7a..bb225ff09 100644
--- a/spec/factories/users.rb
+++ b/spec/factories/users.rb
@@ -1,5 +1,5 @@
FactoryBot.define do
- factory :user, aliases: [:organizer] do
+ factory :user, aliases: [ :organizer ] do
email { Faker::Internet.email }
first_name { Faker::Name.first_name }
last_name { Faker::Name.last_name }
diff --git a/spec/models/social_account_spec.rb b/spec/models/social_account_spec.rb
index 433ce7d68..bb564d210 100644
--- a/spec/models/social_account_spec.rb
+++ b/spec/models/social_account_spec.rb
@@ -1,9 +1,7 @@
RSpec.describe SocialAccount, type: :model do
-
describe "public class methods" do
context "responds to its methods" do
it { expect(SocialAccount).to respond_to(:link_for) }
end
end
-
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index d1c6f6c1c..9a1af422b 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -72,21 +72,21 @@
it { should have_abilities(:upcoming, Event) }
it { should have_abilities(:past, Event) }
- it { should_not have_abilities([:edit, :update, :destroy], user) }
- it { should_not have_abilities([:edit, :update, :destroy], event) }
- it { should_not have_abilities([:edit, :update, :destroy], published_event) }
- it { should_not have_abilities([:read], event) }
+ it { should_not have_abilities([ :edit, :update, :destroy ], user) }
+ it { should_not have_abilities([ :edit, :update, :destroy ], event) }
+ it { should_not have_abilities([ :edit, :update, :destroy ], published_event) }
+ it { should_not have_abilities([ :read ], event) }
end
context "when is an authorized user" do
let! (:user) { create(:user) }
it { should have_abilities(:read, User.new) }
# manage himself
- it { should have_abilities([:edit, :update, :destroy], user) }
- it { should have_abilities([:attend, :leave], published_event) }
+ it { should have_abilities([ :edit, :update, :destroy ], user) }
+ it { should have_abilities([ :attend, :leave ], published_event) }
- it { should_not have_abilities([:read, :edit, :update, :destroy], event) }
- it { should_not have_abilities([:attend, :leave], event) }
+ it { should_not have_abilities([ :read, :edit, :update, :destroy ], event) }
+ it { should_not have_abilities([ :attend, :leave ], event) }
end
context "when is a moderator" do
@@ -110,7 +110,7 @@
let!(:user) { create(:user) }
let!(:event) { create(:event, organizer: user) }
- it { should have_abilities([:read, :edit, :update, :destroy], event) }
+ it { should have_abilities([ :read, :edit, :update, :destroy ], event) }
it { should_not have_abilities(:publish, event) }
end
@@ -124,20 +124,19 @@
context 'with the connected GitHub social account' do
let!(:github_account) { create(:social_account, :github, user: user) }
- it { is_expected.to eq([github_account]) }
+ it { is_expected.to eq([ github_account ]) }
end
end
describe ".unlinked_social_providers" do
subject(:unlinked_social_providers) { user.unlinked_social_providers }
- it { is_expected.to eq(["github", "vkontakte", "google_oauth2"]) }
+ it { is_expected.to eq([ "github", "vkontakte", "google_oauth2" ]) }
context 'with the connected GitHub social account' do
let!(:github_account) { create(:social_account, user: user) }
- it { is_expected.to eq(["github", "google_oauth2"]) }
+ it { is_expected.to eq([ "github", "google_oauth2" ]) }
end
end
-
end
diff --git a/spec/support/cancan_matchers.rb b/spec/support/cancan_matchers.rb
index 2c11083af..fa6665df8 100644
--- a/spec/support/cancan_matchers.rb
+++ b/spec/support/cancan_matchers.rb
@@ -30,14 +30,14 @@
description do
obj_name = @obj.class.name
- obj_name = @obj.to_s.capitalize if [Class, Module, Symbol].
+ obj_name = @obj.to_s.capitalize if [ Class, Module, Symbol ].
include?(@obj.class)
"have abilities #{@expected_hash.keys.join(', ')} on #{obj_name}"
end
failure_message do
obj_name = @obj.class.name
- obj_name = @obj.to_s.capitalize if [Class, Module, Symbol].
+ obj_name = @obj.to_s.capitalize if [ Class, Module, Symbol ].
include?(@obj.class)
"expected user to have abilities: #{@expected_hash} for " \
"#{obj_name}, but got #{@actual_hash}"
@@ -64,7 +64,7 @@
description do
obj_name = @obj.class.name
- obj_name = @obj.to_s.capitalize if [Class, Module, Symbol].
+ obj_name = @obj.to_s.capitalize if [ Class, Module, Symbol ].
include?(@obj.class)
"not have abilities #{@expected_hash.keys.join(', ')} " \
"on #{obj_name}" if @expected_hash.present?
@@ -72,7 +72,7 @@
failure_message do
obj_name = @obj.class.name
- obj_name = @obj.to_s.capitalize if [Class, Module, Symbol].
+ obj_name = @obj.to_s.capitalize if [ Class, Module, Symbol ].
include?(@obj.class)
"expected user NOT to have abilities #{@expected_hash.keys.join(', ')} " \
"for #{obj_name}, but got #{@actual_hash}"