diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..7001086 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,18 @@ +AllCops: + Exclude: + - vendor/**/* + +Metrics: + Enabled: false + +Metrics/LineLength: + Max: 256 + Enabled: false + +Style/Documentation: + Enabled: false + +Style/FrozenStringLiteralComment: + Enabled: false + +inherit_from: .rubocop_todo.yml diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..4d09c97 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,13 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2018-07-05 20:42:49 -0400 using RuboCop version 0.57.2. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 2 +Style/MixinUsage: + Exclude: + - 'bin/setup' + - 'bin/update' diff --git a/Gemfile b/Gemfile index 90a670f..56e61e2 100644 --- a/Gemfile +++ b/Gemfile @@ -3,14 +3,15 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.5.1' -gem 'rails', '~> 5.2.0' -gem 'puma', '~> 3.11' -gem 'mongoid' gem 'bootsnap', '>= 1.1.0', require: false +gem 'mongoid' +gem 'puma', '~> 3.11' +gem 'rails', '~> 5.2.0' gem 'rack-cors' group :development, :test do + gem 'rubocop' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index af2982a..8762243 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,6 +43,7 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) arel (9.0.0) + ast (2.4.0) bootsnap (1.3.0) msgpack (~> 1.0) bson (4.3.0) @@ -55,6 +56,7 @@ GEM activesupport (>= 4.2.0) i18n (1.0.1) concurrent-ruby (~> 1.0) + jaro_winkler (1.5.1-x86_64-darwin-17) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) @@ -80,6 +82,10 @@ GEM nio4r (2.3.1) nokogiri (1.8.4) mini_portile2 (~> 2.3.0) + parallel (1.12.1) + parser (2.5.1.0) + ast (~> 2.4.0) + powerpack (0.1.2) puma (3.11.4) rack (2.0.5) rack-cors (1.0.2) @@ -109,10 +115,20 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) + rainbow (3.0.0) rake (12.3.1) rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) + rubocop (0.57.2) + jaro_winkler (~> 1.5.1) + parallel (~> 1.10) + parser (>= 2.5) + powerpack (~> 0.1) + rainbow (>= 2.2.2, < 4.0) + ruby-progressbar (~> 1.7) + unicode-display_width (~> 1.0, >= 1.0.1) + ruby-progressbar (1.9.0) ruby_dep (1.5.0) spring (2.0.2) activesupport (>= 4.2) @@ -130,6 +146,7 @@ GEM thread_safe (0.3.6) tzinfo (1.2.5) thread_safe (~> 0.1) + unicode-display_width (1.4.0) websocket-driver (0.7.0) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) @@ -144,6 +161,7 @@ DEPENDENCIES puma (~> 3.11) rack-cors rails (~> 5.2.0) + rubocop spring spring-watcher-listen (~> 2.0.0) diff --git a/bin/rails b/bin/rails index 5badb2f..7a8ff81 100755 --- a/bin/rails +++ b/bin/rails @@ -1,6 +1,6 @@ #!/usr/bin/env ruby begin - load File.expand_path('../spring', __FILE__) + load File.expand_path('spring', __dir__) rescue LoadError => e raise unless e.message.include?('spring') end diff --git a/bin/rake b/bin/rake index d87d5f5..0ba8c48 100755 --- a/bin/rake +++ b/bin/rake @@ -1,6 +1,6 @@ #!/usr/bin/env ruby begin - load File.expand_path('../spring', __FILE__) + load File.expand_path('spring', __dir__) rescue LoadError => e raise unless e.message.include?('spring') end diff --git a/bin/spring b/bin/spring index fb2ec2e..991bd4e 100755 --- a/bin/spring +++ b/bin/spring @@ -8,7 +8,7 @@ unless defined?(Spring) require 'bundler' lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) - spring = lockfile.specs.detect { |spec| spec.name == "spring" } + spring = lockfile.specs.detect { |spec| spec.name == 'spring' } if spring Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path gem 'spring', spring.version diff --git a/config/application.rb b/config/application.rb index c9684c3..86101ae 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,15 +1,15 @@ require_relative 'boot' -require "rails" +require 'rails' # Pick the frameworks you want: -require "active_model/railtie" -require "active_job/railtie" +require 'active_model/railtie' +require 'active_job/railtie' # require "active_record/railtie" # require "active_storage/engine" -require "action_controller/railtie" -require "action_mailer/railtie" -require "action_view/railtie" -require "action_cable/engine" +require 'action_controller/railtie' +require 'action_mailer/railtie' +require 'action_view/railtie' +require 'action_cable/engine' # require "sprockets/railtie" # require "rails/test_unit/railtie" diff --git a/config/environments/development.rb b/config/environments/development.rb index cdd9d62..56f2a0e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -35,7 +35,6 @@ # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Raises error for missing translations # config.action_view.raise_on_missing_translations = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 1f5579e..2f565a7 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -42,7 +42,7 @@ config.log_level = :debug # Prepend all log lines with the following tags. - config.log_tags = [ :request_id ] + config.log_tags = [:request_id] # Use a different cache store in production. # config.cache_store = :mem_cache_store @@ -71,7 +71,7 @@ # require 'syslog/logger' # 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) diff --git a/config/puma.rb b/config/puma.rb index a5eccf8..f123039 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -4,16 +4,16 @@ # 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 } +threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 } 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