Permalink
Browse files

Fix nag errors

Major change was every file that had Frozen String Literal needed
to have a blank line underneath that so almost every ruby
file needed that alteration.
  • Loading branch information...
MicFin committed Aug 30, 2017
1 parent cc84ac4 commit 90a6f309e692886d4cc278c3d26b3e78e2433ce1
Showing with 59 additions and 10 deletions.
  1. +1 −0 Gemfile
  2. +1 −0 Rakefile
  3. +1 −0 app/channels/application_cable/channel.rb
  4. +1 −0 app/channels/application_cable/connection.rb
  5. +1 −0 app/controllers/application_controller.rb
  6. +2 −1 app/controllers/examples_controller.rb
  7. +2 −1 app/controllers/open_read_controller.rb
  8. +1 −0 app/controllers/protected_controller.rb
  9. +2 −1 app/controllers/users_controller.rb
  10. +1 −0 app/jobs/application_job.rb
  11. +1 −0 app/mailers/application_mailer.rb
  12. +1 −0 app/models/application_record.rb
  13. +1 −0 app/models/concerns/authentication.rb
  14. +1 −0 app/models/example.rb
  15. +1 −0 app/models/user.rb
  16. +1 −0 app/serializers/user_login_serializer.rb
  17. +1 −0 app/serializers/user_serializer.rb
  18. +1 −0 bin/add-code-block.rb
  19. +1 −0 bin/rspec
  20. +1 −0 bin/rubocop
  21. +1 −0 config.ru
  22. +1 −0 config/application.rb
  23. +1 −0 config/boot.rb
  24. +1 −0 config/environment.rb
  25. +1 −0 config/environments/development.rb
  26. +1 −0 config/environments/production.rb
  27. +1 −0 config/environments/test.rb
  28. +1 −0 config/initializers/active_model_serializers.rb
  29. +1 −0 config/initializers/application_controller_renderer.rb
  30. +1 −0 config/initializers/backtrace_silencers.rb
  31. +3 −2 config/initializers/cors.rb
  32. +1 −0 config/initializers/filter_parameter_logging.rb
  33. +1 −0 config/initializers/inflections.rb
  34. +1 −0 config/initializers/mime_types.rb
  35. +1 −0 config/initializers/new_framework_defaults.rb
  36. +1 −0 config/initializers/wrap_parameters.rb
  37. +1 −0 config/puma.rb
  38. +3 −2 config/routes.rb
  39. +3 −2 config/spring.rb
  40. +1 −0 db/examples.rb
  41. +1 −0 db/migrate/001_create_users.rb
  42. +1 −0 db/migrate/002_create_examples.rb
  43. +1 −0 db/seeds.rb
  44. +2 −1 lib/tasks/db.rake
  45. +1 −0 lib/tasks/test.rake
  46. +1 −0 spec/controllers/users_spec.rb
  47. +1 −0 spec/models/user_spec.rb
  48. +1 −0 spec/requests/users_spec.rb
  49. +1 −0 spec/routing/users_spec.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true

#
source 'https://rubygems.org'
ruby '2.4.1'
@@ -1,4 +1,5 @@
# 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.
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module ApplicationCable
# class Channel < ActionCable::Channel::Base
# end
@@ -1,4 +1,5 @@
# frozen_string_literal: true

module ApplicationCable
# class Connection < ActionCable::Connection::Base
# end
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Do not inherit from this class unless you know what you're doing
# See ProtectedController and OpenReadController
class ApplicationController < ActionController::API
@@ -1,6 +1,7 @@
# frozen_string_literal: true

class ExamplesController < OpenReadController
before_action :set_example, only: [:update, :destroy]
before_action :set_example, only: %i[update destroy]

# GET /examples
# GET /examples.json
@@ -1,7 +1,8 @@
# frozen_string_literal: true

# Inherit from this class to allow unauthenticate access to read actions
class OpenReadController < ProtectedController
READ_ACTIONS = [:index, :show].freeze
READ_ACTIONS = %i[index show].freeze
skip_before_action :authenticate, only: READ_ACTIONS
before_action :set_current_user, only: READ_ACTIONS
end
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Inherit from this class to require authenticated access to all actions
class ProtectedController < ApplicationController
before_action :authenticate
@@ -1,6 +1,7 @@
# frozen_string_literal: true

class UsersController < ProtectedController
skip_before_action :authenticate, only: [:signup, :signin]
skip_before_action :authenticate, only: %i[signup signin]

# POST '/sign-up'
def signup
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class ApplicationJob; end
# class ApplicationJob < ActiveJob::Base
# end
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class ApplicationMailer; end
# class ApplicationMailer < ActionMailer::Base
# default from: 'from@example.com'
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
@@ -1,4 +1,5 @@
# frozen_string_literal: true

#
module Authentication
extend ActiveSupport::Concern
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class Example < ApplicationRecord
belongs_to :user
validates :text, :user, presence: true
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class User < ApplicationRecord
include Authentication
has_many :examples
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class UserLoginSerializer < ActiveModel::Serializer
attributes :id, :email, :token

@@ -1,4 +1,5 @@
# frozen_string_literal: true

class UserSerializer < ActiveModel::Serializer
attributes :id, :email
end
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
# frozen_string_literal: true


infile_name = ARGV[0]
infile_name || abort('filename required')
outfile = $stdout
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
# frozen_string_literal: true


# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
# frozen_string_literal: true


# This file was generated by Bundler.
#
# The application 'rubocop' is installed as part of a gem, and
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# This file is used by Rack-based servers to start the application.

require_relative 'config/environment'
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require_relative 'boot'

require 'rails'
@@ -1,4 +1,5 @@
# frozen_string_literal: true

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
ENV['PORT'] ||= 'GA'.each_byte.reduce('') { |a, e| a + format('%x', e) }

@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Load the Rails application.
require_relative 'application'

@@ -1,4 +1,5 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in
# config/application.rb.
@@ -1,4 +1,5 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in
# config/application.rb.
@@ -1,4 +1,5 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in
# config/application.rb.
@@ -1,3 +1,4 @@
# frozen_string_literal: true

# Root keys on json resources
ActiveModelSerializers.config.adapter = :json
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# ApplicationController.renderer.defaults.merge!(
@@ -1,4 +1,5 @@
# 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
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Avoid CORS issues when API is called from the frontend app.
@@ -19,12 +20,12 @@
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins do |origin, _env|
'*' == ENV['CLIENT_ORIGIN'] ||
ENV['CLIENT_ORIGIN'] == '*' ||
origin == ENV['CLIENT_ORIGIN'] ||
origin == development_client_origin
end
resource '*',
headers: :any,
methods: [:options, :head, :get, :delete, :patch, :put, :post]
methods: %i[options head get delete patch put post]
end
end
@@ -1,4 +1,5 @@
# 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.
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Add new inflection rules using the following format. Inflections
@@ -1,4 +1,5 @@
# 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:
@@ -1,4 +1,5 @@
# 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.
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper
@@ -1,4 +1,5 @@
# 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
@@ -1,9 +1,10 @@
# frozen_string_literal: true

Rails.application.routes.draw do
resources :examples, except: [:new, :edit]
resources :examples, except: %i[new edit]
post '/sign-up' => 'users#signup'
post '/sign-in' => 'users#signin'
delete '/sign-out/:id' => 'users#signout'
patch '/change-password/:id' => 'users#changepw'
resources :users, only: [:index, :show]
resources :users, only: %i[index show]
end
@@ -1,7 +1,8 @@
# frozen_string_literal: true
%w(

%w[
.ruby-version
.rbenv-vars
tmp/restart.txt
tmp/caching-dev.txt
).each { |path| Spring.watch(path) }
].each { |path| Spring.watch(path) }
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# This file should contain all the record creation needed to experiment with
# your app during development.
#
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
@@ -1,4 +1,5 @@
# frozen_string_literal: true

class CreateExamples < ActiveRecord::Migration
def change
create_table :examples do |t|
@@ -1,4 +1,5 @@
# frozen_string_literal: true

# This file should contain all the record creation needed to seed the database
# with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the
@@ -1,4 +1,5 @@
# frozen_string_literal: true

namespace :db do
desc 'Load example data from db/examples.rb'
task examples: :environment do
@@ -8,7 +9,7 @@ namespace :db do
unless Rails.env == 'production'
desc 'Drop and setup the development database with examples'
task nuke_pave:
%w(environment db:drop db:create db:migrate db:seed db:examples) do
%w[environment db:drop db:create db:migrate db:seed db:examples] do
puts "Nuke and pave of #{Rails.env} complete."
end
end
@@ -1,4 +1,5 @@
# frozen_string_literal: true

unless Rails.env.production?
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:test)
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe UsersController do
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe User do
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'Authentication API' do
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe 'routes for users' do

0 comments on commit 90a6f30

Please sign in to comment.