From 12332cc6bf8c7fe9a869e9c46210f98764617896 Mon Sep 17 00:00:00 2001 From: Mark Moser Date: Sun, 18 Sep 2016 09:41:51 -0500 Subject: [PATCH] string literals; why not. --- .rubocop.yml | 4 ++++ Gemfile | 1 + Rakefile | 1 + app/controllers/accounts_controller.rb | 1 + app/controllers/application_controller.rb | 1 + app/controllers/auth_controller.rb | 1 + app/helpers/application_helper.rb | 1 + app/models/account.rb | 1 + app/models/application_record.rb | 1 + app/services/app_config.rb | 1 + app/services/crypt_serializer.rb | 1 + app/views/accounts/_account.json.jbuilder | 1 + app/views/accounts/index.json.jbuilder | 1 + app/views/accounts/show.json.jbuilder | 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/application_controller_renderer.rb | 1 + config/initializers/assets.rb | 1 + config/initializers/backtrace_silencers.rb | 1 + config/initializers/cookies_serializer.rb | 1 + config/initializers/filter_parameter_logging.rb | 1 + config/initializers/inflections.rb | 1 + config/initializers/mime_types.rb | 1 + config/initializers/new_framework_defaults.rb | 1 + config/initializers/session_store.rb | 1 + config/initializers/wrap_parameters.rb | 1 + config/puma.rb | 1 + config/routes.rb | 1 + config/spring.rb | 1 + db/migrate/20160828022337_create_accounts.rb | 1 + test/controllers/accounts_controller_test.rb | 1 + test/controllers/auth_controller_test.rb | 1 + test/models/account_test.rb | 1 + test/services/app_config_test.rb | 1 + test/services/crypt_serializer_test.rb | 1 + test/test_helper.rb | 1 + test/test_helpers/test_auth_helper.rb | 1 + 42 files changed, 45 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 66c747e..2b4f22a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -19,6 +19,10 @@ Style/ExtraSpacing: Exclude: - db/migrate/**/* +Style/FrozenStringLiteralComment: + Enabled: true + EnforcedStyle: always + Style/IndentationConsistency: EnforcedStyle: rails Exclude: diff --git a/Gemfile b/Gemfile index 2a3d6b1..223eaa6 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,4 @@ +# frozen_string_literal: true source 'https://rubygems.org' gem 'figaro', '~> 1.1.1' diff --git a/Rakefile b/Rakefile index e85f913..84f2bc3 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,4 @@ +# 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/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index bd9858f..d7352b9 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class AccountsController < ApplicationController before_action :set_account, only: [:show, :edit, :reveal, :update, :destroy] diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5ab006f..39b4c90 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 protect_from_forgery with: :exception diff --git a/app/controllers/auth_controller.rb b/app/controllers/auth_controller.rb index 277b0ff..2def987 100644 --- a/app/controllers/auth_controller.rb +++ b/app/controllers/auth_controller.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class AuthController < ApplicationController skip_before_action :verify_session diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be79..71249b9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,3 @@ +# frozen_string_literal: true module ApplicationHelper end diff --git a/app/models/account.rb b/app/models/account.rb index 5dc3232..f6034a3 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class Account < ApplicationRecord serialize :password, CryptSerializer end diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 141a300..736c87f 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 diff --git a/app/services/app_config.rb b/app/services/app_config.rb index 6ff45c4..7a5688a 100644 --- a/app/services/app_config.rb +++ b/app/services/app_config.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class AppConfig < Settingslogic source "#{Rails.root}/config/application.yml" namespace Rails.env diff --git a/app/services/crypt_serializer.rb b/app/services/crypt_serializer.rb index 9f2b656..d53ea84 100644 --- a/app/services/crypt_serializer.rb +++ b/app/services/crypt_serializer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'openssl' require 'base64' diff --git a/app/views/accounts/_account.json.jbuilder b/app/views/accounts/_account.json.jbuilder index 4c71aaa..c44ac72 100644 --- a/app/views/accounts/_account.json.jbuilder +++ b/app/views/accounts/_account.json.jbuilder @@ -1,2 +1,3 @@ +# frozen_string_literal: true json.extract! account, :id, :username, :password, :home, :site, :created_at, :updated_at json.url account_url(account, format: :json) diff --git a/app/views/accounts/index.json.jbuilder b/app/views/accounts/index.json.jbuilder index ea669ea..95b9fde 100644 --- a/app/views/accounts/index.json.jbuilder +++ b/app/views/accounts/index.json.jbuilder @@ -1 +1,2 @@ +# frozen_string_literal: true json.array! @accounts, partial: 'accounts/account', as: :account diff --git a/app/views/accounts/show.json.jbuilder b/app/views/accounts/show.json.jbuilder index 89a793f..6f4fd71 100644 --- a/app/views/accounts/show.json.jbuilder +++ b/app/views/accounts/show.json.jbuilder @@ -1 +1,2 @@ +# frozen_string_literal: true json.partial! "accounts/account", account: @account diff --git a/config.ru b/config.ru index f7ba0b5..7eae264 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_relative 'config/environment' diff --git a/config/application.rb b/config/application.rb index 8c33bae..066c664 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require_relative 'boot' require 'rails/all' diff --git a/config/boot.rb b/config/boot.rb index 30f5120..9be337a 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/environment.rb b/config/environment.rb index 426333b..12ea62f 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 6f71970..613b531 100644 --- a/config/environments/development.rb +++ b/config/environments/development.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/production.rb b/config/environments/production.rb index b632ddd..651fe79 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 30587ef..416a71c 100644 --- a/config/environments/test.rb +++ b/config/environments/test.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/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb index 51639b6..315ac48 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 01ef3e6..9287bcd 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. diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 59385cd..d0f0d3b 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 5a6a32d..2a72959 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/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4a994e1..b7fe123 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 ac033bf..aa7435f 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/mime_types.rb b/config/initializers/mime_types.rb index dc18996..6e1d16f 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 0706caf..d3c12d7 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/session_store.rb b/config/initializers/session_store.rb index 214740c..6d9784a 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: '_ftp_manager_session' diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index bbfc396..18c3825 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 c7f311f..14a0f44 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,3 +1,4 @@ +# 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 diff --git a/config/routes.rb b/config/routes.rb index ba456e8..cb15a7f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true Rails.application.routes.draw do get 'accounts/reveal/:id', to: 'accounts#reveal', as: :reveal_password resources :accounts diff --git a/config/spring.rb b/config/spring.rb index c9119b4..312295f 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true %w( .ruby-version .rbenv-vars diff --git a/db/migrate/20160828022337_create_accounts.rb b/db/migrate/20160828022337_create_accounts.rb index 7e93696..7252dd0 100644 --- a/db/migrate/20160828022337_create_accounts.rb +++ b/db/migrate/20160828022337_create_accounts.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true class CreateAccounts < ActiveRecord::Migration[5.0] def change create_table :accounts do |t| diff --git a/test/controllers/accounts_controller_test.rb b/test/controllers/accounts_controller_test.rb index 05f8f8e..781ad03 100644 --- a/test/controllers/accounts_controller_test.rb +++ b/test/controllers/accounts_controller_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'test_helper' class AccountsControllerTest < ActionDispatch::IntegrationTest diff --git a/test/controllers/auth_controller_test.rb b/test/controllers/auth_controller_test.rb index 2a7d2ec..0432321 100644 --- a/test/controllers/auth_controller_test.rb +++ b/test/controllers/auth_controller_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'test_helper' class AuthControllerTest < ActionDispatch::IntegrationTest diff --git a/test/models/account_test.rb b/test/models/account_test.rb index 6d1e104..e118582 100644 --- a/test/models/account_test.rb +++ b/test/models/account_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'test_helper' class AccountTest < ActiveSupport::TestCase diff --git a/test/services/app_config_test.rb b/test/services/app_config_test.rb index 6da84b3..eacf687 100644 --- a/test/services/app_config_test.rb +++ b/test/services/app_config_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'test_helper' class AppConfigTest < ActiveSupport::TestCase diff --git a/test/services/crypt_serializer_test.rb b/test/services/crypt_serializer_test.rb index f885dcd..4145cd7 100644 --- a/test/services/crypt_serializer_test.rb +++ b/test/services/crypt_serializer_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'test_helper' class CryptSerializerTest < ActiveSupport::TestCase diff --git a/test/test_helper.rb b/test/test_helper.rb index 4d806cc..1899563 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true ENV['RAILS_ENV'] ||= 'test' # https://github.com/colszowka/simplecov diff --git a/test/test_helpers/test_auth_helper.rb b/test/test_helpers/test_auth_helper.rb index d13d40e..12c4b20 100644 --- a/test/test_helpers/test_auth_helper.rb +++ b/test/test_helpers/test_auth_helper.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true module TestAuthHelper ## Monkey patch AuthController, because...auth. AuthController.class_eval do