Skip to content
Permalink
Browse files

Add Rubocop.

  • Loading branch information...
ruebot committed Nov 8, 2017
1 parent c61df56 commit 7c08f9816006ec92df77dd7b3fecc03099e6bf95
Showing with 191 additions and 42 deletions.
  1. +29 −0 .rubocop.yml
  2. +13 −11 Gemfile
  3. +18 −0 Gemfile.lock
  4. +6 −2 Rakefile
  5. +2 −0 app/channels/application_cable/channel.rb
  6. +2 −0 app/channels/application_cable/connection.rb
  7. +3 −2 app/controllers/application_controller.rb
  8. +3 −0 app/controllers/pages_controller.rb
  9. +3 −0 app/controllers/sessions_controller.rb
  10. +4 −2 app/controllers/users_controller.rb
  11. +3 −0 app/helpers/application_helper.rb
  12. +3 −0 app/helpers/pages_helper.rb
  13. +3 −0 app/helpers/users_helper.rb
  14. +2 −0 app/jobs/application_job.rb
  15. +3 −0 app/mailers/application_mailer.rb
  16. +3 −0 app/models/application_record.rb
  17. +3 −0 app/models/user.rb
  18. +2 −0 config.ru
  19. +5 −1 config/application.rb
  20. +2 −0 config/boot.rb
  21. +2 −0 config/environment.rb
  22. +4 −1 config/environments/development.rb
  23. +18 −9 config/environments/production.rb
  24. +4 −1 config/environments/test.rb
  25. +2 −0 config/initializers/application_controller_renderer.rb
  26. +2 −0 config/initializers/assets.rb
  27. +6 −2 config/initializers/backtrace_silencers.rb
  28. +2 −0 config/initializers/cookies_serializer.rb
  29. +2 −0 config/initializers/filter_parameter_logging.rb
  30. +2 −0 config/initializers/inflections.rb
  31. +2 −0 config/initializers/mime_types.rb
  32. +2 −0 config/initializers/omniauth.rb
  33. +4 −1 config/initializers/wrap_parameters.rb
  34. +7 −4 config/puma.rb
  35. +4 −2 config/routes.rb
  36. +2 −0 config/spring.rb
  37. +3 −1 test/application_system_test_case.rb
  38. +2 −0 test/controllers/pages_controller_test.rb
  39. +3 −2 test/controllers/users_controller_test.rb
  40. +2 −0 test/models/user_test.rb
  41. +4 −1 test/test_helper.rb
@@ -0,0 +1,29 @@
require: rubocop-rspec

AllCops:
Exclude:
- '.internal_test_app/**/*'
- 'bin/**/*'
- 'db/**/*'
- 'lib/generators/warclight/templates/**/*'
- 'vendor/**/*'
TargetRubyVersion: 2.4
DisplayCopNames: true

Rails:
Enabled: true

RSpec/NestedGroups:
Max: 4

Rails/FilePath:
Exclude:
- config/environments/development.rb

Style/PercentLiteralDelimiters:
Exclude:
- config/spring.rb

Style/ClassAndModuleChildren:
Exclude:
- test/test_helper.rb
24 Gemfile
@@ -1,11 +1,12 @@
# frozen_string_literal: true

source 'https://rubygems.org'

git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
"https://github.com/#{repo_name}.git"
end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.4'
# Use sqlite3 as the database for Active Record
@@ -34,28 +35,29 @@ gem 'jbuilder', '~> 2.5'
# gem 'capistrano-rails', group: :development

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
# Call 'byebug' anywhere in the code to stop execution and get a
# debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
gem 'dotenv-rails'
gem 'rubocop', '~> 0.48.1'
gem 'rubocop-rspec', '~> 1.15.0'
gem 'selenium-webdriver'
end

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

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

## AUK
gem 'omniauth-github'
gem 'omniauth-twitter'
gem 'bootstrap-sass'
gem 'font-awesome-rails'
gem 'omniauth-github'
gem 'omniauth-twitter'
@@ -41,6 +41,7 @@ GEM
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
arel (8.0.0)
ast (2.3.0)
autoprefixer-rails (7.1.6)
execjs
bindex (0.5.0)
@@ -131,6 +132,9 @@ GEM
omniauth-twitter (1.4.0)
omniauth-oauth (~> 1.1)
rack
parser (2.4.0.0)
ast (~> 2.2)
powerpack (0.1.1)
public_suffix (3.0.0)
puma (3.10.0)
rack (2.0.3)
@@ -159,10 +163,21 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.2.2)
rake
rake (12.1.0)
rb-fsevent (0.10.2)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rubocop (0.48.1)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-rspec (1.15.1)
rubocop (>= 0.42.0)
ruby-progressbar (1.9.0)
ruby_dep (1.5.0)
rubyzip (1.2.1)
sass (3.5.2)
@@ -202,6 +217,7 @@ GEM
thread_safe (~> 0.1)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.3.0)
web-console (3.5.1)
actionview (>= 5.0)
activemodel (>= 5.0)
@@ -229,6 +245,8 @@ DEPENDENCIES
omniauth-twitter
puma (~> 3.7)
rails (~> 5.1.4)
rubocop (~> 0.48.1)
rubocop-rspec (~> 1.15.0)
sass-rails (~> 5.0)
selenium-webdriver
spring
@@ -1,6 +1,10 @@
# 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.
# frozen_string_literal: true

require_relative 'config/application'

Rails.application.load_tasks

require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)

task default: %i[rubocop]
@@ -1,3 +1,5 @@
# frozen_string_literal: true

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

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

# Application Controller methods.
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception

#private

def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
@@ -1,3 +1,6 @@
# frozen_string_literal: true

# Pages controller methods.
class PagesController < ApplicationController
def show
render template: "pages/#{params[:page]}"
@@ -1,3 +1,6 @@
# frozen_string_literal: true

# Session controller methods.
class SessionsController < ApplicationController
def create
@user = User.find_or_create_from_auth_hash(auth_hash)
@@ -1,4 +1,6 @@
# frozen_string_literal: true

# User controller methods.
class UsersController < ApplicationController
def index
end
def index; end
end
@@ -1,2 +1,5 @@
# frozen_string_literal: true

# Application helper.
module ApplicationHelper
end
@@ -1,2 +1,5 @@
# frozen_string_literal: true

# Pages helper methods.
module PagesHelper
end
@@ -1,2 +1,5 @@
# frozen_string_literal: true

# Users helper methods.
module UsersHelper
end
@@ -1,2 +1,4 @@
# frozen_string_literal: true

class ApplicationJob < ActiveJob::Base
end
@@ -1,3 +1,6 @@
# frozen_string_literal: true

# Application mailer methods.
class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
layout 'mailer'
@@ -1,3 +1,6 @@
# frozen_string_literal: true

# Application Record methods.
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
@@ -1,3 +1,6 @@
# frozen_string_literal: true

# User model methods.
class User < ApplicationRecord
def self.find_or_create_from_auth_hash(auth_hash)
user = where(
@@ -1,3 +1,5 @@
# frozen_string_literal: true

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

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

require_relative 'boot'

require 'rails/all'
@@ -7,11 +9,13 @@
Bundler.require(*Rails.groups)

module Auk
# Application methods.
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.1

# Settings in config/environments/* take precedence over those specified here.
# Settings in config/environments/* take precedence over those specified
# here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
end
@@ -1,3 +1,5 @@
# frozen_string_literal: true

ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

require 'bundler/setup' # Set up gems listed in the Gemfile.
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Load the Rails application.
require_relative 'application'

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

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Settings specified here will take precedence over those in
# config/application.rb.

# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
@@ -1,5 +1,8 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Settings specified here will take precedence over those in
# config/application.rb.

# Code is not reloaded between requests.
config.cache_classes = true
@@ -30,7 +33,8 @@
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false

# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# `config.assets.precompile` and `config.assets.version` have moved to
# config/initializers/assets.rb

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
@@ -42,28 +46,32 @@
# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# config.action_cable.allowed_request_origins = [ 'http://example.com',
# /http:\/\/example.*/ ]

# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# Force all access to the app over SSL, use Strict-Transport-Security, and use
# secure cookies.
# config.force_ssl = true

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug

# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
config.log_tags = [:request_id]

# Use a different cache store in production.
# config.cache_store = :mem_cache_store

# Use a real queuing backend for Active Job (and separate queues per environment)
# Use a real queuing backend for Active Job (and separate queues per
# environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "auk_#{Rails.env}"
config.action_mailer.perform_caching = false

# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# Set this to true and configure the email server for immediate delivery to
# raise delivery errors.
# config.action_mailer.raise_delivery_errors = false

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
@@ -78,9 +86,10 @@

# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new
# 'app-name')

if ENV["RAILS_LOG_TO_STDOUT"].present?
if ENV['RAILS_LOG_TO_STDOUT'].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
@@ -1,5 +1,8 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Settings specified here will take precedence over those in
# config/application.rb.

# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
@@ -1,3 +1,5 @@
# frozen_string_literal: true

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

# ActiveSupport::Reloader.to_prepare do
@@ -1,3 +1,5 @@
# 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.

0 comments on commit 7c08f98

Please sign in to comment.
You can’t perform that action at this time.