From 0ace202ace342b389dba3e81181799bf7fdc2882 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 24 Sep 2016 11:00:46 +0800 Subject: [PATCH] automatic rubocop updates --- Gemfile | 1 + Rakefile | 1 + Vagrantfile | 3 ++- .../api/v1/deprecated_controller.rb | 3 ++- app/controllers/api/v1/mappings_controller.rb | 1 + app/controllers/api/v1/maps_controller.rb | 1 + app/controllers/api/v1/synapses_controller.rb | 1 + app/controllers/api/v1/tokens_controller.rb | 1 + app/controllers/api/v1/topics_controller.rb | 1 + app/controllers/api/v2/mappings_controller.rb | 1 + app/controllers/api/v2/maps_controller.rb | 1 + app/controllers/api/v2/restful_controller.rb | 9 +++++---- app/controllers/api/v2/sessions_controller.rb | 3 ++- app/controllers/api/v2/synapses_controller.rb | 1 + app/controllers/api/v2/tokens_controller.rb | 1 + app/controllers/api/v2/topics_controller.rb | 1 + app/controllers/application_controller.rb | 8 ++++---- app/controllers/main_controller.rb | 19 ++++++++++--------- app/controllers/mappings_controller.rb | 1 + app/controllers/maps_controller.rb | 13 +++++-------- app/controllers/messages_controller.rb | 1 + app/controllers/metacode_sets_controller.rb | 1 + app/controllers/synapses_controller.rb | 1 + app/controllers/topics_controller.rb | 1 + app/controllers/users/passwords_controller.rb | 3 ++- .../users/registrations_controller.rb | 1 + app/controllers/users_controller.rb | 1 + app/helpers/application_helper.rb | 1 + app/helpers/content_helper.rb | 1 + app/helpers/devise_helper.rb | 1 + app/helpers/in_metacode_sets_helper.rb | 1 + app/helpers/main_helper.rb | 1 + app/helpers/mapping_helper.rb | 1 + app/helpers/maps_helper.rb | 3 ++- app/helpers/metacode_sets_helper.rb | 1 + app/helpers/metacodes_helper.rb | 1 + app/helpers/synapses_helper.rb | 1 + app/helpers/topics_helper.rb | 5 +++-- app/helpers/users_helper.rb | 1 + app/mailers/application_mailer.rb | 1 + app/mailers/map_mailer.rb | 1 + app/models/application_record.rb | 1 + app/models/concerns/routing.rb | 1 + app/models/event.rb | 1 + .../events/conversation_started_on_map.rb | 1 + app/models/events/new_mapping.rb | 1 + app/models/events/user_present_on_map.rb | 1 + app/models/in_metacode_set.rb | 1 + app/models/map.rb | 3 ++- app/models/mapping.rb | 1 + app/models/message.rb | 1 + app/models/metacode.rb | 1 + app/models/metacode_set.rb | 1 + app/models/permitted_params.rb | 1 + app/models/star.rb | 1 + app/models/synapse.rb | 6 ++---- app/models/token.rb | 1 + app/models/topic.rb | 6 ++---- app/models/user.rb | 7 ++++--- app/models/user_map.rb | 1 + app/models/user_preference.rb | 3 ++- app/models/webhook.rb | 1 + app/models/webhooks/slack/base.rb | 1 + .../slack/conversation_started_on_map.rb | 1 + .../webhooks/slack/synapse_added_to_map.rb | 1 + .../webhooks/slack/topic_added_to_map.rb | 1 + .../webhooks/slack/user_present_on_map.rb | 1 + app/policies/application_policy.rb | 3 ++- app/policies/main_policy.rb | 1 + app/policies/map_policy.rb | 1 + app/policies/mapping_policy.rb | 1 + app/policies/message_policy.rb | 1 + app/policies/synapse_policy.rb | 1 + app/policies/token_policy.rb | 1 + app/policies/topic_policy.rb | 1 + .../api/v2/application_serializer.rb | 1 + app/serializers/api/v2/event_serializer.rb | 1 + app/serializers/api/v2/map_serializer.rb | 15 ++++++++------- app/serializers/api/v2/mapping_serializer.rb | 11 ++++++----- app/serializers/api/v2/metacode_serializer.rb | 9 +++++---- app/serializers/api/v2/synapse_serializer.rb | 13 +++++++------ app/serializers/api/v2/token_serializer.rb | 7 ++++--- app/serializers/api/v2/topic_serializer.rb | 15 ++++++++------- app/serializers/api/v2/user_serializer.rb | 9 +++++---- app/serializers/api/v2/webhook_serializer.rb | 1 + app/services/map_export_service.rb | 1 + app/services/perm.rb | 1 + app/services/webhook_service.rb | 1 + config.ru | 1 + config/application.rb | 1 + config/boot.rb | 1 + config/environment.rb | 1 + config/environments/development.rb | 1 + config/environments/production.rb | 1 + config/environments/test.rb | 1 + config/initializers/access_codes.rb | 1 + .../initializers/active_model_serializers.rb | 1 + .../application_controller_renderer.rb | 1 + config/initializers/assets.rb | 3 ++- config/initializers/backtrace_silencers.rb | 1 + config/initializers/cookies_serializer.rb | 1 + config/initializers/cors.rb | 1 + config/initializers/devise.rb | 1 + config/initializers/doorkeeper.rb | 1 + config/initializers/exception_notification.rb | 1 + .../initializers/filter_parameter_logging.rb | 1 + config/initializers/inflections.rb | 1 + config/initializers/kaminari_config.rb | 1 + config/initializers/mime_types.rb | 1 + config/initializers/new_framework_defaults.rb | 1 + config/initializers/paperclip.rb | 1 + config/initializers/secret_token.rb | 1 + config/initializers/session_store.rb | 1 + config/initializers/uservoice.rb | 1 + config/initializers/version.rb | 5 +++-- config/initializers/wrap_parameters.rb | 1 + config/puma.rb | 7 ++++--- config/routes.rb | 1 + config/spring.rb | 1 + lib/tasks/extensions.rake | 5 +++-- lib/tasks/heroku.rake | 3 ++- lib/tasks/perms.rake | 1 + script/rails | 1 + spec/api/v2/mappings_api_spec.rb | 1 + spec/api/v2/maps_api_spec.rb | 1 + spec/api/v2/synapses_api_spec.rb | 1 + spec/api/v2/tokens_api_spec.rb | 1 + spec/api/v2/topics_api_spec.rb | 1 + spec/controllers/mappings_controller_spec.rb | 1 + spec/controllers/maps_controller_spec.rb | 1 + spec/controllers/metacodes_controller_spec.rb | 1 + spec/controllers/synapses_controller_spec.rb | 1 + spec/controllers/topics_controller_spec.rb | 1 + spec/factories/mappings.rb | 1 + spec/factories/maps.rb | 1 + spec/factories/metacodes.rb | 1 + spec/factories/synapses.rb | 3 ++- spec/factories/tokens.rb | 1 + spec/factories/topics.rb | 1 + spec/factories/users.rb | 1 + spec/mailers/previews/map_mailer_preview.rb | 1 + spec/models/map_spec.rb | 1 + spec/models/mapping_spec.rb | 1 + spec/models/metacode_spec.rb | 1 + spec/models/synapse_spec.rb | 1 + spec/models/token_spec.rb | 1 + spec/models/topic_spec.rb | 1 + spec/policies/map_policy_spec.rb | 1 + spec/policies/mapping_policy_spec.rb | 1 + spec/policies/synapse_policy.rb | 1 + spec/policies/topic_policy_spec.rb | 1 + spec/rails_helper.rb | 1 + spec/spec_helper.rb | 1 + spec/support/controller_helpers.rb | 1 + spec/support/factory_girl.rb | 1 + spec/support/pundit.rb | 1 + spec/support/schema_matcher.rb | 1 + spec/support/simplecov.rb | 2 +- 158 files changed, 239 insertions(+), 93 deletions(-) diff --git a/Gemfile b/Gemfile index 4c58772c..b4a0967b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ +# frozen_string_literal: true source 'https://rubygems.org' ruby '2.3.0' diff --git a/Rakefile b/Rakefile index 30cf58f5..74eb42c7 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,5 @@ #!/usr/bin/env rake +# frozen_string_literal: true # 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. diff --git a/Vagrantfile b/Vagrantfile index 52e040cf..0fa3e8da 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,3 +1,4 @@ +# frozen_string_literal: true # -*- mode: ruby -*- # vi: set ft=ruby : @@ -31,7 +32,7 @@ sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '3112';" SCRIPT -VAGRANTFILE_API_VERSION = '2'.freeze +VAGRANTFILE_API_VERSION = '2' Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = 'trusty64' diff --git a/app/controllers/api/v1/deprecated_controller.rb b/app/controllers/api/v1/deprecated_controller.rb index ed68b897..6f6b5f15 100644 --- a/app/controllers/api/v1/deprecated_controller.rb +++ b/app/controllers/api/v1/deprecated_controller.rb @@ -1,8 +1,9 @@ +# frozen_string_literal: true module Api module V1 class DeprecatedController < ApplicationController def method_missing - render json: { error: "/api/v1 is deprecated! Please use /api/v2 instead." } + render json: { error: '/api/v1 is deprecated! Please use /api/v2 instead.' } end end end diff --git a/app/controllers/api/v1/mappings_controller.rb b/app/controllers/api/v1/mappings_controller.rb index 35c7d6bd..8ba6e704 100644 --- a/app/controllers/api/v1/mappings_controller.rb +++ b/app/controllers/api/v1/mappings_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V1 class MappingsController < DeprecatedController diff --git a/app/controllers/api/v1/maps_controller.rb b/app/controllers/api/v1/maps_controller.rb index 056810f1..0ff6f472 100644 --- a/app/controllers/api/v1/maps_controller.rb +++ b/app/controllers/api/v1/maps_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V1 class MapsController < DeprecatedController diff --git a/app/controllers/api/v1/synapses_controller.rb b/app/controllers/api/v1/synapses_controller.rb index e2111e95..32522e52 100644 --- a/app/controllers/api/v1/synapses_controller.rb +++ b/app/controllers/api/v1/synapses_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V1 class SynapsesController < DeprecatedController diff --git a/app/controllers/api/v1/tokens_controller.rb b/app/controllers/api/v1/tokens_controller.rb index c96b1065..9df2094a 100644 --- a/app/controllers/api/v1/tokens_controller.rb +++ b/app/controllers/api/v1/tokens_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V1 class TokensController < DeprecatedController diff --git a/app/controllers/api/v1/topics_controller.rb b/app/controllers/api/v1/topics_controller.rb index e974fff3..d316bfa8 100644 --- a/app/controllers/api/v1/topics_controller.rb +++ b/app/controllers/api/v1/topics_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V1 class TopicsController < DeprecatedController diff --git a/app/controllers/api/v2/mappings_controller.rb b/app/controllers/api/v2/mappings_controller.rb index 7f0d9513..86aba865 100644 --- a/app/controllers/api/v2/mappings_controller.rb +++ b/app/controllers/api/v2/mappings_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V2 class MappingsController < RestfulController diff --git a/app/controllers/api/v2/maps_controller.rb b/app/controllers/api/v2/maps_controller.rb index fd54fa7b..0bcd9bee 100644 --- a/app/controllers/api/v2/maps_controller.rb +++ b/app/controllers/api/v2/maps_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V2 class MapsController < RestfulController diff --git a/app/controllers/api/v2/restful_controller.rb b/app/controllers/api/v2/restful_controller.rb index de86dafd..d7a1856e 100644 --- a/app/controllers/api/v2/restful_controller.rb +++ b/app/controllers/api/v2/restful_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V2 class RestfulController < ActionController::Base @@ -101,9 +102,9 @@ module Api next_page = current_page < total_pages ? current_page + 1 : 0 base_url = request.base_url + request.path - nxt = request.query_parameters.merge(page: next_page).map{|x| x.join('=')}.join('&') - prev = request.query_parameters.merge(page: prev_page).map{|x| x.join('=')}.join('&') - last = request.query_parameters.merge(page: total_pages).map{|x| x.join('=')}.join('&') + nxt = request.query_parameters.merge(page: next_page).map { |x| x.join('=') }.join('&') + prev = request.query_parameters.merge(page: prev_page).map { |x| x.join('=') }.join('&') + last = request.query_parameters.merge(page: total_pages).map { |x| x.join('=') }.join('&') response.headers['Link'] = [ %(<#{base_url}?#{nxt}>; rel="next"), %(<#{base_url}?#{prev}>; rel="prev"), @@ -163,7 +164,7 @@ module Api builder = builder.order(sort => direction) end end - return builder + builder end def visible_records diff --git a/app/controllers/api/v2/sessions_controller.rb b/app/controllers/api/v2/sessions_controller.rb index 3aefa214..2aa93669 100644 --- a/app/controllers/api/v2/sessions_controller.rb +++ b/app/controllers/api/v2/sessions_controller.rb @@ -1,9 +1,10 @@ +# frozen_string_literal: true module Api module V2 class SessionsController < ApplicationController def create @user = User.find_by(email: params[:email]) - if @user && @user.valid_password(params[:password]) + if @user&.valid_password(params[:password]) sign_in(@user) render json: @user else diff --git a/app/controllers/api/v2/synapses_controller.rb b/app/controllers/api/v2/synapses_controller.rb index 6572997d..6484699e 100644 --- a/app/controllers/api/v2/synapses_controller.rb +++ b/app/controllers/api/v2/synapses_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V2 class SynapsesController < RestfulController diff --git a/app/controllers/api/v2/tokens_controller.rb b/app/controllers/api/v2/tokens_controller.rb index 6eeb102b..d1a6b255 100644 --- a/app/controllers/api/v2/tokens_controller.rb +++ b/app/controllers/api/v2/tokens_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V2 class TokensController < RestfulController diff --git a/app/controllers/api/v2/topics_controller.rb b/app/controllers/api/v2/topics_controller.rb index 74fa7105..22e534ce 100644 --- a/app/controllers/api/v2/topics_controller.rb +++ b/app/controllers/api/v2/topics_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V2 class TopicsController < RestfulController diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 58c996c5..7735c681 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ApplicationController < ActionController::Base include ApplicationHelper include Pundit @@ -60,10 +61,9 @@ class ApplicationController < ActionController::Base end def require_admin - unless authenticated? && admin? - redirect_to root_url, notice: 'You need to be an admin for that.' - return false - end + return true if authenticated? && admin? + redirect_to root_url, notice: 'You need to be an admin for that.' + false end def user diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index 01304328..0d6af64b 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MainController < ApplicationController include TopicsHelper include MapsHelper @@ -12,13 +13,13 @@ class MainController < ApplicationController def home @maps = policy_scope(Map).order('updated_at DESC').page(1).per(20) respond_to do |format| - format.html { - if !authenticated? - render 'main/home' - else - render 'maps/activemaps' - end - } + format.html do + if !authenticated? + render 'main/home' + else + render 'maps/activemaps' + end + end end end @@ -163,8 +164,8 @@ class MainController < ApplicationController @synapses = [] end - #limit to 5 results - @synapses = @synapses.to_a.slice(0,5) + # limit to 5 results + @synapses = @synapses.to_a.slice(0, 5) render json: autocomplete_synapse_array_json(@synapses) end diff --git a/app/controllers/mappings_controller.rb b/app/controllers/mappings_controller.rb index 3d162c0f..de2c8ea1 100644 --- a/app/controllers/mappings_controller.rb +++ b/app/controllers/mappings_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MappingsController < ApplicationController before_action :require_user, only: [:create, :update, :destroy] after_action :verify_authorized, except: :index diff --git a/app/controllers/maps_controller.rb b/app/controllers/maps_controller.rb index 7c4a74a7..8e7b4136 100644 --- a/app/controllers/maps_controller.rb +++ b/app/controllers/maps_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MapsController < ApplicationController before_action :require_user, only: [:create, :update, :access, :star, :unstar, :screenshot, :events, :destroy] after_action :verify_authorized, except: [:activemaps, :featuredmaps, :mymaps, :sharedmaps, :starredmaps, :usermaps] @@ -107,14 +108,14 @@ class MapsController < ApplicationController # GET maps/new def new - @map = Map.new(name: "Untitled Map", permission: "public", arranged: true) + @map = Map.new(name: 'Untitled Map', permission: 'public', arranged: true) authorize @map respond_to do |format| format.html do @map.user = current_user @map.save - redirect_to(map_path(@map) + '?new') + redirect_to(map_path(@map) + '?new') end end end @@ -305,9 +306,7 @@ class MapsController < ApplicationController @map = Map.find(params[:id]) authorize @map star = Star.find_by_map_id_and_user_id(@map.id, current_user.id) - if not star - star = Star.create(map_id: @map.id, user_id: current_user.id) - end + star = Star.create(map_id: @map.id, user_id: current_user.id) unless star respond_to do |format| format.json do @@ -321,9 +320,7 @@ class MapsController < ApplicationController @map = Map.find(params[:id]) authorize @map star = Star.find_by_map_id_and_user_id(@map.id, current_user.id) - if star - star.delete - end + star&.delete respond_to do |format| format.json do diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index ec59a2a4..dd3544e9 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MessagesController < ApplicationController before_action :require_user, except: [:show] after_action :verify_authorized diff --git a/app/controllers/metacode_sets_controller.rb b/app/controllers/metacode_sets_controller.rb index a57c557f..8fec58cc 100644 --- a/app/controllers/metacode_sets_controller.rb +++ b/app/controllers/metacode_sets_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MetacodeSetsController < ApplicationController before_action :require_admin diff --git a/app/controllers/synapses_controller.rb b/app/controllers/synapses_controller.rb index ddb3e5ab..8fc31688 100644 --- a/app/controllers/synapses_controller.rb +++ b/app/controllers/synapses_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class SynapsesController < ApplicationController include TopicsHelper diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index 30ac57fd..1b966ca2 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class TopicsController < ApplicationController include TopicsHelper diff --git a/app/controllers/users/passwords_controller.rb b/app/controllers/users/passwords_controller.rb index ee7b8667..bffe3ab6 100644 --- a/app/controllers/users/passwords_controller.rb +++ b/app/controllers/users/passwords_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Users::PasswordsController < Devise::PasswordsController protected @@ -5,7 +6,7 @@ class Users::PasswordsController < Devise::PasswordsController signed_in_root_path(resource) end - def after_sending_reset_password_instructions_path_for(resource_name) + def after_sending_reset_password_instructions_path_for(_resource_name) new_user_session_path if is_navigational_format? end end diff --git a/app/controllers/users/registrations_controller.rb b/app/controllers/users/registrations_controller.rb index 8895cfd2..21cd9666 100644 --- a/app/controllers/users/registrations_controller.rb +++ b/app/controllers/users/registrations_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Users::RegistrationsController < Devise::RegistrationsController before_action :configure_sign_up_params, only: [:create] before_action :configure_account_update_params, only: [:update] diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 0ea95211..a9fff9de 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class UsersController < ApplicationController before_action :require_user, only: [:edit, :update, :updatemetacodes] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 555a32d2..57b24106 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ApplicationHelper def get_metacodeset @m = current_user.settings.metacodes diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index 4a8820f0..4fb2fe84 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module ContentHelper def resource_name :user diff --git a/app/helpers/devise_helper.rb b/app/helpers/devise_helper.rb index 5081cba0..4b34effc 100644 --- a/app/helpers/devise_helper.rb +++ b/app/helpers/devise_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module DeviseHelper def devise_error_messages! resource.errors.to_a[0] diff --git a/app/helpers/in_metacode_sets_helper.rb b/app/helpers/in_metacode_sets_helper.rb index 52a47cdc..0c45fd98 100644 --- a/app/helpers/in_metacode_sets_helper.rb +++ b/app/helpers/in_metacode_sets_helper.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true module InMetacodeSetsHelper end diff --git a/app/helpers/main_helper.rb b/app/helpers/main_helper.rb index 826effed..33378f43 100644 --- a/app/helpers/main_helper.rb +++ b/app/helpers/main_helper.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true module MainHelper end diff --git a/app/helpers/mapping_helper.rb b/app/helpers/mapping_helper.rb index 7055739f..9dd903ca 100644 --- a/app/helpers/mapping_helper.rb +++ b/app/helpers/mapping_helper.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true module MappingHelper end diff --git a/app/helpers/maps_helper.rb b/app/helpers/maps_helper.rb index 3f60fe4d..8ca7b047 100644 --- a/app/helpers/maps_helper.rb +++ b/app/helpers/maps_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module MapsHelper ## this one is for building our custom JSON autocomplete format for typeahead def autocomplete_map_array_json(maps) @@ -16,7 +17,7 @@ module MapsHelper contributorTip = '' firstContributorImage = 'https://s3.amazonaws.com/metamaps-assets/site/user.png' - if m.contributors.count > 0 + if m.contributors.count.positive? firstContributorImage = m.contributors[0].image.url(:thirtytwo) m.contributors.each_with_index do |c, _index| userImage = c.image.url(:thirtytwo) diff --git a/app/helpers/metacode_sets_helper.rb b/app/helpers/metacode_sets_helper.rb index 668ceb5c..9a6e09c7 100644 --- a/app/helpers/metacode_sets_helper.rb +++ b/app/helpers/metacode_sets_helper.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true module MetacodeSetsHelper end diff --git a/app/helpers/metacodes_helper.rb b/app/helpers/metacodes_helper.rb index c896d26d..d00f1ef5 100644 --- a/app/helpers/metacodes_helper.rb +++ b/app/helpers/metacodes_helper.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true module MetacodesHelper end diff --git a/app/helpers/synapses_helper.rb b/app/helpers/synapses_helper.rb index 470292e5..471f0e05 100644 --- a/app/helpers/synapses_helper.rb +++ b/app/helpers/synapses_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module SynapsesHelper ## this one is for building our custom JSON autocomplete format for typeahead def autocomplete_synapse_generic_json(unique) diff --git a/app/helpers/topics_helper.rb b/app/helpers/topics_helper.rb index bb589e9a..32697db5 100644 --- a/app/helpers/topics_helper.rb +++ b/app/helpers/topics_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module TopicsHelper ## this one is for building our custom JSON autocomplete format for typeahead def autocomplete_array_json(topics) @@ -7,7 +8,7 @@ module TopicsHelper topic['id'] = t.id topic['label'] = t.name topic['value'] = t.name - topic['description'] = t.desc ? t.desc.truncate(70) : '' # make this return matched results + topic['description'] = t.desc ? t.desc&.truncate(70) # make this return matched results topic['type'] = t.metacode.name topic['typeImageURL'] = t.metacode.icon topic['permission'] = t.permission @@ -34,7 +35,7 @@ module TopicsHelper # add the node to the array array.push(node) - return array if count == 0 + return array if count.zero? count -= 1 diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 8144dfd8..379cf20a 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module UsersHelper # build custom json autocomplete for typeahead def autocomplete_user_array_json(users) diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index d934e218..59a2175a 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ApplicationMailer < ActionMailer::Base default from: 'team@metamaps.cc' layout 'mailer' diff --git a/app/mailers/map_mailer.rb b/app/mailers/map_mailer.rb index 94e8ebd5..e70d0b82 100644 --- a/app/mailers/map_mailer.rb +++ b/app/mailers/map_mailer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MapMailer < ApplicationMailer default from: 'team@metamaps.cc' diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 10a4cba8..767a072b 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end diff --git a/app/models/concerns/routing.rb b/app/models/concerns/routing.rb index 2f8467bf..ddbfad6f 100644 --- a/app/models/concerns/routing.rb +++ b/app/models/concerns/routing.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Routing extend ActiveSupport::Concern include Rails.application.routes.url_helpers diff --git a/app/models/event.rb b/app/models/event.rb index 90407314..02c6d698 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Event < ApplicationRecord KINDS = %w(user_present_on_map conversation_started_on_map topic_added_to_map synapse_added_to_map).freeze diff --git a/app/models/events/conversation_started_on_map.rb b/app/models/events/conversation_started_on_map.rb index 4ca922be..20fb89c1 100644 --- a/app/models/events/conversation_started_on_map.rb +++ b/app/models/events/conversation_started_on_map.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Events::ConversationStartedOnMap < Event # after_create :notify_users! diff --git a/app/models/events/new_mapping.rb b/app/models/events/new_mapping.rb index d7b91576..889c69bc 100644 --- a/app/models/events/new_mapping.rb +++ b/app/models/events/new_mapping.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Events::NewMapping < Event # after_create :notify_users! diff --git a/app/models/events/user_present_on_map.rb b/app/models/events/user_present_on_map.rb index 45726002..38d524ef 100644 --- a/app/models/events/user_present_on_map.rb +++ b/app/models/events/user_present_on_map.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Events::UserPresentOnMap < Event # after_create :notify_users! diff --git a/app/models/in_metacode_set.rb b/app/models/in_metacode_set.rb index de1f2514..78dc1c29 100644 --- a/app/models/in_metacode_set.rb +++ b/app/models/in_metacode_set.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class InMetacodeSet < ApplicationRecord belongs_to :metacode, class_name: 'Metacode', foreign_key: 'metacode_id' belongs_to :metacode_set, class_name: 'MetacodeSet', foreign_key: 'metacode_set_id' diff --git a/app/models/map.rb b/app/models/map.rb index f59eb790..9c30479f 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Map < ApplicationRecord belongs_to :user @@ -19,7 +20,7 @@ class Map < ApplicationRecord thumb: ['188x126#', :png] #:full => ['940x630#', :png] }, - default_url: 'https://s3.amazonaws.com/metamaps-assets/site/missing-map-white.png' + default_url: 'https://s3.amazonaws.com/metamaps-assets/site/missing-map-white.png' validates :name, presence: true validates :arranged, inclusion: { in: [true, false] } diff --git a/app/models/mapping.rb b/app/models/mapping.rb index eba7a6d2..f7219008 100644 --- a/app/models/mapping.rb +++ b/app/models/mapping.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Mapping < ApplicationRecord scope :topicmapping, -> { where(mappable_type: :Topic) } scope :synapsemapping, -> { where(mappable_type: :Synapse) } diff --git a/app/models/message.rb b/app/models/message.rb index 348c5d4e..682b7e51 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Message < ApplicationRecord belongs_to :user belongs_to :resource, polymorphic: true diff --git a/app/models/metacode.rb b/app/models/metacode.rb index 9b05bee5..c97c4fb5 100644 --- a/app/models/metacode.rb +++ b/app/models/metacode.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Metacode < ApplicationRecord has_many :in_metacode_sets has_many :metacode_sets, through: :in_metacode_sets diff --git a/app/models/metacode_set.rb b/app/models/metacode_set.rb index c52811fd..72bcc719 100644 --- a/app/models/metacode_set.rb +++ b/app/models/metacode_set.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MetacodeSet < ApplicationRecord belongs_to :user has_many :in_metacode_sets diff --git a/app/models/permitted_params.rb b/app/models/permitted_params.rb index 0ccea1c8..d0696985 100644 --- a/app/models/permitted_params.rb +++ b/app/models/permitted_params.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class PermittedParams < Struct.new(:params) %w(map synapse topic mapping token).each do |kind| define_method(kind) do diff --git a/app/models/star.rb b/app/models/star.rb index 52a77044..dcaaa559 100644 --- a/app/models/star.rb +++ b/app/models/star.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Star < ActiveRecord::Base belongs_to :user belongs_to :map diff --git a/app/models/synapse.rb b/app/models/synapse.rb index afd40a25..c7161469 100644 --- a/app/models/synapse.rb +++ b/app/models/synapse.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Synapse < ApplicationRecord belongs_to :user belongs_to :defer_to_map, class_name: 'Map', foreign_key: 'defer_to_map_id' @@ -44,10 +45,7 @@ class Synapse < ApplicationRecord # :nocov: def calculated_permission if defer_to_map - defer_to_map.permission - else - permission - end + defer_to_map&.permission end # :nocov: diff --git a/app/models/token.rb b/app/models/token.rb index 9103aebc..9cd93043 100644 --- a/app/models/token.rb +++ b/app/models/token.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Token < ApplicationRecord belongs_to :user diff --git a/app/models/topic.rb b/app/models/topic.rb index c250338b..09d61897 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Topic < ApplicationRecord include TopicsHelper @@ -74,10 +75,7 @@ class Topic < ApplicationRecord def calculated_permission if defer_to_map - defer_to_map.permission - else - permission - end + defer_to_map&.permission end def as_json(_options = {}) diff --git a/app/models/user.rb b/app/models/user.rb index 876e10cd..4da66e57 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'open-uri' class User < ApplicationRecord @@ -41,7 +42,7 @@ class User < ApplicationRecord default_url: 'https://s3.amazonaws.com/metamaps-assets/site/user.png' # Validate the attached image is image/jpg, image/png, etc - validates_attachment_content_type :image, content_type: %r(\Aimage/.*\Z) + validates_attachment_content_type :image, content_type: %r{\Aimage/.*\Z} # override default as_json def as_json(_options = {}) @@ -79,8 +80,8 @@ class User < ApplicationRecord end end - def starred_map?(map) - return self.stars.where(map_id: map.id).exists? + def starred_map?(map) + stars.where(map_id: map.id).exists? end def settings diff --git a/app/models/user_map.rb b/app/models/user_map.rb index c48cfb96..dc268047 100644 --- a/app/models/user_map.rb +++ b/app/models/user_map.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class UserMap < ApplicationRecord belongs_to :map belongs_to :user diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb index 3aadbdb3..29ca3948 100644 --- a/app/models/user_preference.rb +++ b/app/models/user_preference.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class UserPreference attr_accessor :metacodes @@ -9,7 +10,7 @@ class UserPreference array.push(metacode.id.to_s) if metacode rescue ActiveRecord::StatementInvalid if m == 'Action' - Rails.logger.warn("TODO: remove this travis workaround in user_preference.rb") + Rails.logger.warn('TODO: remove this travis workaround in user_preference.rb') end end end diff --git a/app/models/webhook.rb b/app/models/webhook.rb index 6389398e..65057411 100644 --- a/app/models/webhook.rb +++ b/app/models/webhook.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Webhook < ApplicationRecord belongs_to :hookable, polymorphic: true diff --git a/app/models/webhooks/slack/base.rb b/app/models/webhooks/slack/base.rb index 97cf1f04..960775dd 100644 --- a/app/models/webhooks/slack/base.rb +++ b/app/models/webhooks/slack/base.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Webhooks::Slack::Base = Struct.new(:event) do include Routing diff --git a/app/models/webhooks/slack/conversation_started_on_map.rb b/app/models/webhooks/slack/conversation_started_on_map.rb index 5fa325d0..daf2270e 100644 --- a/app/models/webhooks/slack/conversation_started_on_map.rb +++ b/app/models/webhooks/slack/conversation_started_on_map.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Webhooks::Slack::ConversationStartedOnMap < Webhooks::Slack::Base def text "There is a live conversation starting on map *#{event.map.name}*. #{view_map_on_metamaps('Join in!')}" diff --git a/app/models/webhooks/slack/synapse_added_to_map.rb b/app/models/webhooks/slack/synapse_added_to_map.rb index 5dc636e1..5157afa7 100644 --- a/app/models/webhooks/slack/synapse_added_to_map.rb +++ b/app/models/webhooks/slack/synapse_added_to_map.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Webhooks::Slack::SynapseAddedToMap < Webhooks::Slack::Base def text "\"*#{eventable.mappable.topic1.name}* #{eventable.mappable.desc || '->'} *#{eventable.mappable.topic2.name}*\" was added as a connection to the map *#{view_map_on_metamaps}*" diff --git a/app/models/webhooks/slack/topic_added_to_map.rb b/app/models/webhooks/slack/topic_added_to_map.rb index 07a20759..d3a19760 100644 --- a/app/models/webhooks/slack/topic_added_to_map.rb +++ b/app/models/webhooks/slack/topic_added_to_map.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Webhooks::Slack::TopicAddedToMap < Webhooks::Slack::Base def text "New #{eventable.mappable.metacode.name} topic *#{eventable.mappable.name}* was added to the map *#{view_map_on_metamaps}*" diff --git a/app/models/webhooks/slack/user_present_on_map.rb b/app/models/webhooks/slack/user_present_on_map.rb index 666d5121..c3185e48 100644 --- a/app/models/webhooks/slack/user_present_on_map.rb +++ b/app/models/webhooks/slack/user_present_on_map.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Webhooks::Slack::UserPresentOnMap < Webhooks::Slack::Base def text "Mapper *#{event.user.name}* has joined the map *#{event.map.name}*. #{view_map_on_metamaps('Map with them')}" diff --git a/app/policies/application_policy.rb b/app/policies/application_policy.rb index a9835c98..348ef5f2 100644 --- a/app/policies/application_policy.rb +++ b/app/policies/application_policy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class ApplicationPolicy attr_reader :user, :record @@ -39,7 +40,7 @@ class ApplicationPolicy # explicitly say they want to (E.g. seeing/editing/deleting private # maps - they should be able to, but not by accident) def admin_override - user && user.admin + user&.admin end def scope diff --git a/app/policies/main_policy.rb b/app/policies/main_policy.rb index 77ab373c..e0ffc30b 100644 --- a/app/policies/main_policy.rb +++ b/app/policies/main_policy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MainPolicy < ApplicationPolicy def initialize(user, _record) @user = user diff --git a/app/policies/map_policy.rb b/app/policies/map_policy.rb index 0a2b33ce..3894520c 100644 --- a/app/policies/map_policy.rb +++ b/app/policies/map_policy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MapPolicy < ApplicationPolicy class Scope < Scope def resolve diff --git a/app/policies/mapping_policy.rb b/app/policies/mapping_policy.rb index 1cd99783..efcb798b 100644 --- a/app/policies/mapping_policy.rb +++ b/app/policies/mapping_policy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MappingPolicy < ApplicationPolicy class Scope < Scope def resolve diff --git a/app/policies/message_policy.rb b/app/policies/message_policy.rb index 8df6e916..f35a2895 100644 --- a/app/policies/message_policy.rb +++ b/app/policies/message_policy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MessagePolicy < ApplicationPolicy class Scope < Scope def resolve diff --git a/app/policies/synapse_policy.rb b/app/policies/synapse_policy.rb index 310b3947..f9557e70 100644 --- a/app/policies/synapse_policy.rb +++ b/app/policies/synapse_policy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class SynapsePolicy < ApplicationPolicy class Scope < Scope def resolve diff --git a/app/policies/token_policy.rb b/app/policies/token_policy.rb index e150fec9..cd9a5ab7 100644 --- a/app/policies/token_policy.rb +++ b/app/policies/token_policy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class TokenPolicy < ApplicationPolicy class Scope < Scope def resolve diff --git a/app/policies/topic_policy.rb b/app/policies/topic_policy.rb index 7bca6770..2484ee54 100644 --- a/app/policies/topic_policy.rb +++ b/app/policies/topic_policy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class TopicPolicy < ApplicationPolicy class Scope < Scope def resolve diff --git a/app/serializers/api/v2/application_serializer.rb b/app/serializers/api/v2/application_serializer.rb index f943646c..55a9b8a0 100644 --- a/app/serializers/api/v2/application_serializer.rb +++ b/app/serializers/api/v2/application_serializer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V2 class ApplicationSerializer < ActiveModel::Serializer diff --git a/app/serializers/api/v2/event_serializer.rb b/app/serializers/api/v2/event_serializer.rb index 644598cf..c875056a 100644 --- a/app/serializers/api/v2/event_serializer.rb +++ b/app/serializers/api/v2/event_serializer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V2 class EventSerializer < ApplicationSerializer diff --git a/app/serializers/api/v2/map_serializer.rb b/app/serializers/api/v2/map_serializer.rb index 438f97ee..0a0be2c0 100644 --- a/app/serializers/api/v2/map_serializer.rb +++ b/app/serializers/api/v2/map_serializer.rb @@ -1,13 +1,14 @@ +# frozen_string_literal: true module Api module V2 class MapSerializer < ApplicationSerializer attributes :id, - :name, - :desc, - :permission, - :screenshot, - :created_at, - :updated_at + :name, + :desc, + :permission, + :screenshot, + :created_at, + :updated_at def self.embeddable { @@ -20,7 +21,7 @@ module Api } end - self.class_eval do + class_eval do embed_dat end end diff --git a/app/serializers/api/v2/mapping_serializer.rb b/app/serializers/api/v2/mapping_serializer.rb index dc36421e..19e7318e 100644 --- a/app/serializers/api/v2/mapping_serializer.rb +++ b/app/serializers/api/v2/mapping_serializer.rb @@ -1,11 +1,12 @@ +# frozen_string_literal: true module Api module V2 class MappingSerializer < ApplicationSerializer attributes :id, - :created_at, - :updated_at, - :mappable_id, - :mappable_type + :created_at, + :updated_at, + :mappable_id, + :mappable_type attribute :xloc, if: -> { object.mappable_type == 'Topic' } attribute :yloc, if: -> { object.mappable_type == 'Topic' } @@ -17,7 +18,7 @@ module Api } end - self.class_eval do + class_eval do embed_dat end end diff --git a/app/serializers/api/v2/metacode_serializer.rb b/app/serializers/api/v2/metacode_serializer.rb index 4f4daa35..16013e33 100644 --- a/app/serializers/api/v2/metacode_serializer.rb +++ b/app/serializers/api/v2/metacode_serializer.rb @@ -1,11 +1,12 @@ +# frozen_string_literal: true module Api module V2 class MetacodeSerializer < ApplicationSerializer attributes :id, - :name, - :manual_icon, - :color, - :aws_icon + :name, + :manual_icon, + :color, + :aws_icon end end end diff --git a/app/serializers/api/v2/synapse_serializer.rb b/app/serializers/api/v2/synapse_serializer.rb index 9ef86660..f647022c 100644 --- a/app/serializers/api/v2/synapse_serializer.rb +++ b/app/serializers/api/v2/synapse_serializer.rb @@ -1,12 +1,13 @@ +# frozen_string_literal: true module Api module V2 class SynapseSerializer < ApplicationSerializer attributes :id, - :desc, - :category, - :permission, - :created_at, - :updated_at + :desc, + :category, + :permission, + :created_at, + :updated_at def self.embeddable { @@ -16,7 +17,7 @@ module Api } end - self.class_eval do + class_eval do embed_dat end end diff --git a/app/serializers/api/v2/token_serializer.rb b/app/serializers/api/v2/token_serializer.rb index 18d15d15..8f86757b 100644 --- a/app/serializers/api/v2/token_serializer.rb +++ b/app/serializers/api/v2/token_serializer.rb @@ -1,10 +1,11 @@ +# frozen_string_literal: true module Api module V2 class TokenSerializer < ApplicationSerializer attributes :id, - :token, - :description, - :created_at + :token, + :description, + :created_at end end end diff --git a/app/serializers/api/v2/topic_serializer.rb b/app/serializers/api/v2/topic_serializer.rb index 48d1d6de..8da46a2a 100644 --- a/app/serializers/api/v2/topic_serializer.rb +++ b/app/serializers/api/v2/topic_serializer.rb @@ -1,13 +1,14 @@ +# frozen_string_literal: true module Api module V2 class TopicSerializer < ApplicationSerializer attributes :id, - :name, - :desc, - :link, - :permission, - :created_at, - :updated_at + :name, + :desc, + :link, + :permission, + :created_at, + :updated_at def self.embeddable { @@ -16,7 +17,7 @@ module Api } end - self.class_eval do + class_eval do embed_dat end end diff --git a/app/serializers/api/v2/user_serializer.rb b/app/serializers/api/v2/user_serializer.rb index fdfffae0..e97bc420 100644 --- a/app/serializers/api/v2/user_serializer.rb +++ b/app/serializers/api/v2/user_serializer.rb @@ -1,11 +1,12 @@ +# frozen_string_literal: true module Api module V2 class UserSerializer < ApplicationSerializer attributes :id, - :name, - :avatar, - :is_admin, - :generation + :name, + :avatar, + :is_admin, + :generation def avatar object.image.url(:sixtyfour) diff --git a/app/serializers/api/v2/webhook_serializer.rb b/app/serializers/api/v2/webhook_serializer.rb index 59d60283..3221e450 100644 --- a/app/serializers/api/v2/webhook_serializer.rb +++ b/app/serializers/api/v2/webhook_serializer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module Api module V2 class WebhookSerializer < ApplicationSerializer diff --git a/app/services/map_export_service.rb b/app/services/map_export_service.rb index c52b0802..bd256140 100644 --- a/app/services/map_export_service.rb +++ b/app/services/map_export_service.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class MapExportService < Struct.new(:user, :map) def json # marshal_dump turns OpenStruct into a Hash diff --git a/app/services/perm.rb b/app/services/perm.rb index 99897028..57e0816f 100644 --- a/app/services/perm.rb +++ b/app/services/perm.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Perm # e.g. Perm::ISSIONS ISSIONS = [:commons, :public, :private].freeze diff --git a/app/services/webhook_service.rb b/app/services/webhook_service.rb index 965f2c91..0efe9392 100644 --- a/app/services/webhook_service.rb +++ b/app/services/webhook_service.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class WebhookService def self.publish!(webhook:, event:) return false unless webhook.event_types.include? event.kind diff --git a/config.ru b/config.ru index 8a0f42cc..ab79c07d 100644 --- a/config.ru +++ b/config.ru @@ -1,3 +1,4 @@ +# frozen_string_literal: true # This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) diff --git a/config/application.rb b/config/application.rb index b80306c5..b629682a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require_relative 'boot' require 'csv' diff --git a/config/boot.rb b/config/boot.rb index e49b6649..f17b883c 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rubygems' require 'rails/commands/server' diff --git a/config/environment.rb b/config/environment.rb index 426333bb..12ea62f8 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Load the Rails application. require_relative 'application' diff --git a/config/environments/development.rb b/config/environments/development.rb index 407a30f3..b1654921 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Metamaps::Application.configure do # Settings specified here will take precedence over those in config/application.rb diff --git a/config/environments/production.rb b/config/environments/production.rb index 24ceed21..f9c94af6 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb diff --git a/config/environments/test.rb b/config/environments/test.rb index dac060f1..5f0b1ee2 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Metamaps::Application.configure do # Settings specified here will take precedence over those in config/application.rb diff --git a/config/initializers/access_codes.rb b/config/initializers/access_codes.rb index 4a220c97..543ce6e9 100644 --- a/config/initializers/access_codes.rb +++ b/config/initializers/access_codes.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true $codes = [] if ActiveRecord::Base.connection.data_source_exists? 'users' $codes = ActiveRecord::Base.connection.execute('SELECT code FROM users').map { |user| user['code'] } diff --git a/config/initializers/active_model_serializers.rb b/config/initializers/active_model_serializers.rb index aba3586b..929be340 100644 --- a/config/initializers/active_model_serializers.rb +++ b/config/initializers/active_model_serializers.rb @@ -1 +1,2 @@ +# frozen_string_literal: true ActiveModelSerializers.config.adapter = :json diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb index 51639b67..315ac48a 100644 --- a/config/initializers/application_controller_renderer.rb +++ b/config/initializers/application_controller_renderer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # ApplicationController.renderer.defaults.merge!( diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 31897cf4..4edab3b6 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. @@ -9,4 +10,4 @@ Rails.application.config.assets.quiet = true # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -Rails.application.config.assets.precompile += %w( webpacked/metamaps.bundle.js ) +Rails.application.config.assets.precompile += %w(webpacked/metamaps.bundle.js) diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 59385cdf..d0f0d3b5 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index f51a497e..74ea9274 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Specify a serializer for the signed and encrypted cookie jars. diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index a9a8dcff..cb46d3ef 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do origins '*' diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 8a87b3b9..a086584d 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb index 843fe831..33073f45 100644 --- a/config/initializers/doorkeeper.rb +++ b/config/initializers/doorkeeper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Doorkeeper.configure do # Change the ORM that doorkeeper will use (needs plugins) orm :active_record diff --git a/config/initializers/exception_notification.rb b/config/initializers/exception_notification.rb index 5423334e..db508b3c 100644 --- a/config/initializers/exception_notification.rb +++ b/config/initializers/exception_notification.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'exception_notification/rails' ExceptionNotification.configure do |config| diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4a994e1e..b7fe1231 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ac033bf9..aa7435fb 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/config/initializers/kaminari_config.rb b/config/initializers/kaminari_config.rb index b1d87b01..5b9883ab 100644 --- a/config/initializers/kaminari_config.rb +++ b/config/initializers/kaminari_config.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Kaminari.configure do |config| # config.default_per_page = 25 # config.max_per_page = nil diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index c7b0c86d..5e8d015a 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb index 0706cafd..d3c12d7b 100644 --- a/config/initializers/new_framework_defaults.rb +++ b/config/initializers/new_framework_defaults.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # # This file contains migration options to ease your Rails 5.0 upgrade. diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index 4a65d495..6f094b7c 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true Paperclip::Attachment.default_options[:url] = ':s3_domain_url' Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename' diff --git a/config/initializers/secret_token.rb b/config/initializers/secret_token.rb index e7f18911..4da6fb50 100644 --- a/config/initializers/secret_token.rb +++ b/config/initializers/secret_token.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb index d2dc13b6..57d69156 100644 --- a/config/initializers/session_store.rb +++ b/config/initializers/session_store.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_Metamaps_session' diff --git a/config/initializers/uservoice.rb b/config/initializers/uservoice.rb index df04eeaa..3aa65a46 100644 --- a/config/initializers/uservoice.rb +++ b/config/initializers/uservoice.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'uservoice-ruby' def current_sso_token diff --git a/config/initializers/version.rb b/config/initializers/version.rb index c378cb6f..ff08c330 100644 --- a/config/initializers/version.rb +++ b/config/initializers/version.rb @@ -1,2 +1,3 @@ -METAMAPS_VERSION = "2 build `git log -1 --pretty=%H`".freeze -METAMAPS_LAST_UPDATED = `git log -1 --pretty='%ad'`.split(' ').values_at(1,2,4).join(' ').freeze +# frozen_string_literal: true +METAMAPS_VERSION = '2 build `git log -1 --pretty=%H`' +METAMAPS_LAST_UPDATED = `git log -1 --pretty='%ad'`.split(' ').values_at(1, 2, 4).join(' ').freeze diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 36bb3e27..d65576db 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # # This file contains settings for ActionController::ParamsWrapper which diff --git a/config/puma.rb b/config/puma.rb index c7f311f8..da41eff9 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,19 +1,20 @@ +# frozen_string_literal: true # Puma can serve each request in a thread from an internal thread pool. # The `threads` method setting takes two numbers a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum, this matches the default thread size of Active Record. # -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }.to_i threads threads_count, threads_count # Specifies the `port` that Puma will listen on to receive requests, default is 3000. # -port ENV.fetch("PORT") { 3000 } +port ENV.fetch('PORT') { 3000 } # Specifies the `environment` that Puma will run in. # -environment ENV.fetch("RAILS_ENV") { "development" } +environment ENV.fetch('RAILS_ENV') { 'development' } # Specifies the number of `workers` to boot in clustered mode. # Workers are forked webserver processes. If using threads and workers together diff --git a/config/routes.rb b/config/routes.rb index 38fe274e..c64c188e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Metamaps::Application.routes.draw do use_doorkeeper root to: 'main#home', via: :get diff --git a/config/spring.rb b/config/spring.rb index be72de67..b0ca9589 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true %w( .ruby-version .ruby-gemset diff --git a/lib/tasks/extensions.rake b/lib/tasks/extensions.rake index bf07cec2..776c81e3 100644 --- a/lib/tasks/extensions.rake +++ b/lib/tasks/extensions.rake @@ -1,7 +1,8 @@ +# frozen_string_literal: true namespace :assets do task :js_compile do - system "npm install" - system "npm run build" + system 'npm install' + system 'npm run build' end end diff --git a/lib/tasks/heroku.rake b/lib/tasks/heroku.rake index a523a778..d7ce308f 100644 --- a/lib/tasks/heroku.rake +++ b/lib/tasks/heroku.rake @@ -1,9 +1,10 @@ +# frozen_string_literal: true require 'dotenv/tasks' namespace :heroku do desc 'Generate the Heroku gems manifest from gem dependencies' task gems: :dotenv do - RAILS_ENV = 'production'.freeze + RAILS_ENV = 'production' Rake::Task[:environment].invoke list = Rails.configuration.gems.collect do |g| _command, *options = g.send(:install_command) diff --git a/lib/tasks/perms.rake b/lib/tasks/perms.rake index 39cb9b27..bf087bd0 100644 --- a/lib/tasks/perms.rake +++ b/lib/tasks/perms.rake @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'dotenv/tasks' namespace :perms do diff --git a/script/rails b/script/rails index a861c543..1267847e 100644 --- a/script/rails +++ b/script/rails @@ -1,4 +1,5 @@ #!/usr/bin/env ruby.exe +# frozen_string_literal: true # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) diff --git a/spec/api/v2/mappings_api_spec.rb b/spec/api/v2/mappings_api_spec.rb index 4a1e3298..f3ec6a75 100644 --- a/spec/api/v2/mappings_api_spec.rb +++ b/spec/api/v2/mappings_api_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe 'mappings API', type: :request do diff --git a/spec/api/v2/maps_api_spec.rb b/spec/api/v2/maps_api_spec.rb index 7356ca72..77cbc24b 100644 --- a/spec/api/v2/maps_api_spec.rb +++ b/spec/api/v2/maps_api_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe 'maps API', type: :request do diff --git a/spec/api/v2/synapses_api_spec.rb b/spec/api/v2/synapses_api_spec.rb index f232b879..c422f3bc 100644 --- a/spec/api/v2/synapses_api_spec.rb +++ b/spec/api/v2/synapses_api_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe 'synapses API', type: :request do diff --git a/spec/api/v2/tokens_api_spec.rb b/spec/api/v2/tokens_api_spec.rb index c2e480a5..cd424ba0 100644 --- a/spec/api/v2/tokens_api_spec.rb +++ b/spec/api/v2/tokens_api_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe 'tokens API', type: :request do diff --git a/spec/api/v2/topics_api_spec.rb b/spec/api/v2/topics_api_spec.rb index 4781348a..9811071d 100644 --- a/spec/api/v2/topics_api_spec.rb +++ b/spec/api/v2/topics_api_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe 'topics API', type: :request do diff --git a/spec/controllers/mappings_controller_spec.rb b/spec/controllers/mappings_controller_spec.rb index bcd2b97f..8d1c424d 100644 --- a/spec/controllers/mappings_controller_spec.rb +++ b/spec/controllers/mappings_controller_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe MappingsController, type: :controller do diff --git a/spec/controllers/maps_controller_spec.rb b/spec/controllers/maps_controller_spec.rb index 278ec559..0f053dd9 100644 --- a/spec/controllers/maps_controller_spec.rb +++ b/spec/controllers/maps_controller_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe MapsController, type: :controller do diff --git a/spec/controllers/metacodes_controller_spec.rb b/spec/controllers/metacodes_controller_spec.rb index cb4116d4..b25017b9 100644 --- a/spec/controllers/metacodes_controller_spec.rb +++ b/spec/controllers/metacodes_controller_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe MetacodesController, type: :controller do diff --git a/spec/controllers/synapses_controller_spec.rb b/spec/controllers/synapses_controller_spec.rb index 15d91250..3a5310e4 100644 --- a/spec/controllers/synapses_controller_spec.rb +++ b/spec/controllers/synapses_controller_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe SynapsesController, type: :controller do diff --git a/spec/controllers/topics_controller_spec.rb b/spec/controllers/topics_controller_spec.rb index 315b931f..0d7e3010 100644 --- a/spec/controllers/topics_controller_spec.rb +++ b/spec/controllers/topics_controller_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe TopicsController, type: :controller do diff --git a/spec/factories/mappings.rb b/spec/factories/mappings.rb index bed0b754..1bcdf891 100644 --- a/spec/factories/mappings.rb +++ b/spec/factories/mappings.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true FactoryGirl.define do factory :mapping do xloc 0 diff --git a/spec/factories/maps.rb b/spec/factories/maps.rb index 14450c00..a95590e4 100644 --- a/spec/factories/maps.rb +++ b/spec/factories/maps.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true FactoryGirl.define do factory :map do sequence(:name) { |n| "Cool Map ##{n}" } diff --git a/spec/factories/metacodes.rb b/spec/factories/metacodes.rb index 543e4955..2ed71beb 100644 --- a/spec/factories/metacodes.rb +++ b/spec/factories/metacodes.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true FactoryGirl.define do factory :metacode do sequence(:name) { |n| "Cool Metacode ##{n}" } diff --git a/spec/factories/synapses.rb b/spec/factories/synapses.rb index db82fc39..6af8ca9e 100644 --- a/spec/factories/synapses.rb +++ b/spec/factories/synapses.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true FactoryGirl.define do factory :synapse do sequence(:desc) { |n| "Cool synapse ##{n}" } @@ -6,6 +7,6 @@ FactoryGirl.define do association :topic1, factory: :topic association :topic2, factory: :topic user - weight 1 # todo drop this column + weight 1 # TODO: drop this column end end diff --git a/spec/factories/tokens.rb b/spec/factories/tokens.rb index 3970d76f..6d5f110b 100644 --- a/spec/factories/tokens.rb +++ b/spec/factories/tokens.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true FactoryGirl.define do factory :token do user diff --git a/spec/factories/topics.rb b/spec/factories/topics.rb index f4c73f4c..a6048d7c 100644 --- a/spec/factories/topics.rb +++ b/spec/factories/topics.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true FactoryGirl.define do factory :topic do user diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 746f52b1..b5b20b9a 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # # This file supports three factories, because code and joinedwithcode # make things complicated! diff --git a/spec/mailers/previews/map_mailer_preview.rb b/spec/mailers/previews/map_mailer_preview.rb index 60310bf4..96d07c07 100644 --- a/spec/mailers/previews/map_mailer_preview.rb +++ b/spec/mailers/previews/map_mailer_preview.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Preview all emails at http://localhost:3000/rails/mailers/map_mailer class MapMailerPreview < ActionMailer::Preview def invite_to_edit_email diff --git a/spec/models/map_spec.rb b/spec/models/map_spec.rb index e70429be..3f3089cf 100644 --- a/spec/models/map_spec.rb +++ b/spec/models/map_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe Map, type: :model do diff --git a/spec/models/mapping_spec.rb b/spec/models/mapping_spec.rb index 54c72b88..343c19ee 100644 --- a/spec/models/mapping_spec.rb +++ b/spec/models/mapping_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe Mapping, type: :model do diff --git a/spec/models/metacode_spec.rb b/spec/models/metacode_spec.rb index c9b34527..49354898 100644 --- a/spec/models/metacode_spec.rb +++ b/spec/models/metacode_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe Metacode, type: :model do diff --git a/spec/models/synapse_spec.rb b/spec/models/synapse_spec.rb index 3bdb1ac4..c5b63a41 100644 --- a/spec/models/synapse_spec.rb +++ b/spec/models/synapse_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe Synapse, type: :model do diff --git a/spec/models/token_spec.rb b/spec/models/token_spec.rb index 50e89c02..82582218 100644 --- a/spec/models/token_spec.rb +++ b/spec/models/token_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe Token, type: :model do diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb index dbaac86d..50e6d74b 100644 --- a/spec/models/topic_spec.rb +++ b/spec/models/topic_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe Topic, type: :model do diff --git a/spec/policies/map_policy_spec.rb b/spec/policies/map_policy_spec.rb index 7dd33707..c08432dd 100644 --- a/spec/policies/map_policy_spec.rb +++ b/spec/policies/map_policy_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe MapPolicy, type: :policy do diff --git a/spec/policies/mapping_policy_spec.rb b/spec/policies/mapping_policy_spec.rb index 46b9c117..4010e589 100644 --- a/spec/policies/mapping_policy_spec.rb +++ b/spec/policies/mapping_policy_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe MappingPolicy, type: :policy do diff --git a/spec/policies/synapse_policy.rb b/spec/policies/synapse_policy.rb index 4c725e37..4d9d422c 100644 --- a/spec/policies/synapse_policy.rb +++ b/spec/policies/synapse_policy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe SynapsePolicy, type: :policy do diff --git a/spec/policies/topic_policy_spec.rb b/spec/policies/topic_policy_spec.rb index 7078496c..ef80e8dc 100644 --- a/spec/policies/topic_policy_spec.rb +++ b/spec/policies/topic_policy_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'rails_helper' RSpec.describe TopicPolicy, type: :policy do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index d14d6dbe..ddf0781c 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true ENV['RAILS_ENV'] ||= 'test' require 'spec_helper' require File.expand_path('../../config/environment', __FILE__) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a2b164b2..a3477eb7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true RSpec.configure do |config| config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true diff --git a/spec/support/controller_helpers.rb b/spec/support/controller_helpers.rb index 1672479f..1d24b7ca 100644 --- a/spec/support/controller_helpers.rb +++ b/spec/support/controller_helpers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # https://github.com/plataformatec/devise/wiki/How-To:-Stub-authentication-in-controller-specs require 'devise' diff --git a/spec/support/factory_girl.rb b/spec/support/factory_girl.rb index afae617a..0d10fa34 100644 --- a/spec/support/factory_girl.rb +++ b/spec/support/factory_girl.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # lets you type create(:user) instead of FactoryGirl.create(:user) RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods diff --git a/spec/support/pundit.rb b/spec/support/pundit.rb index 1fd8e296..6e8dc0ce 100644 --- a/spec/support/pundit.rb +++ b/spec/support/pundit.rb @@ -1 +1,2 @@ +# frozen_string_literal: true require 'pundit/rspec' diff --git a/spec/support/schema_matcher.rb b/spec/support/schema_matcher.rb index 207c5fa6..998771d9 100644 --- a/spec/support/schema_matcher.rb +++ b/spec/support/schema_matcher.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true RSpec::Matchers.define :match_json_schema do |schema_name| match do |response| schema_directory = Rails.root.join('doc', 'api', 'schemas').to_s diff --git a/spec/support/simplecov.rb b/spec/support/simplecov.rb index 8017e897..1d48d7c8 100644 --- a/spec/support/simplecov.rb +++ b/spec/support/simplecov.rb @@ -1,2 +1,2 @@ +# frozen_string_literal: true require 'simplecov' -