diff --git a/.config.reek b/.config.reek new file mode 100644 index 0000000..15b2ca1 --- /dev/null +++ b/.config.reek @@ -0,0 +1,56 @@ +IrresponsibleModule: + exclude: + - Room538::Application + - ApplicationCable::Channel + - ApplicationCable::Connection + - ApplicationHelper + - ApplicationJob +UncommunicativeModuleName: + exclude: + - Room538 + +"config/": + IrresponsibleModule: + enabled: false + NestedIterators: + enabled: false + UtilityFunction: + enabled: false + +"app/controllers": + IrresponsibleModule: + enabled: false + NestedIterators: + max_allowed_nesting: 2 + UnusedPrivateMethod: + enabled: false + InstanceVariableAssumption: + enabled: false + +"app/helpers": + IrresponsibleModule: + enabled: false + UtilityFunction: + enabled: fals + +"db/migrate": + IrresponsibleModule: + enabled: false + TooManyStatements: + enabled: false + DuplicateMethodCall: + enabled: false + FeatureEnvy: + enabled: false + UncommunicativeVariableName: + enabled: false + +"spec/": + IrresponsibleModule: + enabled: false + UncommunicativeMethodName: + enabled: false + DuplicateMethodCall: + enabled: false + UtilityFunction: + enabled: false diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..15b7aa7 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,13 @@ +Rails: + Enabled: true + +Metrics/LineLength: + Max: 120 + +Style/Documentation: + Exclude: + - 'spec/**/*' + - 'app/controllers/application_controller.rb' + - 'app/helpers/application_helper.rb' + - 'app/mailers/application_mailer.rb' + - 'app/models/application_record.rb' diff --git a/Gemfile b/Gemfile index 80bbf49..463c143 100644 --- a/Gemfile +++ b/Gemfile @@ -1,53 +1,31 @@ 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.0.1' -# Use postgresql as the database for Active Record +gem 'coffee-rails', '~> 4.2' +gem 'jbuilder', '~> 2.5' +gem 'jquery-rails' gem 'pg', '~> 0.18' -# Use Puma as the app server gem 'puma', '~> 3.0' -# Use SCSS for stylesheets +gem 'rails', '~> 5.0.1' gem 'sass-rails', '~> 5.0' -# Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' -# Use CoffeeScript for .coffee assets and views -gem 'coffee-rails', '~> 4.2' -# See https://github.com/rails/execjs#readme for more supported runtimes -# gem 'therubyracer', platforms: :ruby - -# Use jquery as the JavaScript library -gem 'jquery-rails' -# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' -# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem 'jbuilder', '~> 2.5' -# Use Redis adapter to run Action Cable in production -# gem 'redis', '~> 3.0' -# Use ActiveModel has_secure_password -# gem 'bcrypt', '~> 3.1.7' - -# Use Capistrano for deployment -# gem 'capistrano-rails', group: :development +gem 'uglifier', '>= 1.3.0' group :development, :test do - # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platform: :mri 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' - # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'reek', require: false + gem 'rubocop', require: false 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] diff --git a/Gemfile.lock b/Gemfile.lock index 13879c1..99f34e7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,8 +39,17 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) arel (7.1.4) + ast (2.3.0) + axiom-types (0.1.1) + descendants_tracker (~> 0.0.4) + ice_nine (~> 0.11.0) + thread_safe (~> 0.3, >= 0.3.1) builder (3.2.3) byebug (9.0.6) + codeclimate-engine-rb (0.4.0) + virtus (~> 1.0) + coercible (1.0.0) + descendants_tracker (~> 0.0.1) coffee-rails (4.2.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.2.x) @@ -50,12 +59,16 @@ GEM coffee-script-source (1.12.2) concurrent-ruby (1.0.4) debug_inspector (0.0.2) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) + equalizer (0.0.11) erubis (2.7.0) execjs (2.7.0) ffi (1.9.17) globalid (0.3.7) activesupport (>= 4.1.0) i18n (0.7.0) + ice_nine (0.11.2) jbuilder (2.6.1) activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) @@ -80,7 +93,10 @@ GEM nio4r (1.2.1) nokogiri (1.7.0.1) mini_portile2 (~> 2.1.0) + parser (2.3.3.1) + ast (~> 2.2) pg (0.19.0) + powerpack (0.1.1) puma (3.6.2) rack (2.0.1) rack-test (0.6.3) @@ -108,10 +124,22 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) + rainbow (2.2.1) rake (12.0.0) rb-fsevent (0.9.8) rb-inotify (0.9.8) ffi (>= 0.5.0) + reek (4.5.4) + codeclimate-engine-rb (~> 0.4.0) + parser (~> 2.3.1, >= 2.3.1.2) + rainbow (~> 2.0) + rubocop (0.47.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) + ruby-progressbar (1.8.1) sass (3.4.23) sass-rails (5.0.6) railties (>= 4.0.0, < 6) @@ -141,6 +169,12 @@ GEM thread_safe (~> 0.1) uglifier (3.0.4) execjs (>= 0.3.0, < 3) + unicode-display_width (1.1.3) + virtus (1.0.5) + axiom-types (~> 0.1) + coercible (~> 1.0) + descendants_tracker (~> 0.0, >= 0.0.3) + equalizer (~> 0.0, >= 0.0.9) web-console (3.4.0) actionview (>= 5.0) activemodel (>= 5.0) @@ -162,6 +196,8 @@ DEPENDENCIES pg (~> 0.18) puma (~> 3.0) rails (~> 5.0.1) + reek + rubocop sass-rails (~> 5.0) spring spring-watcher-listen (~> 2.0.0) 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 1277c00..a84a8b7 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_record/railtie" -require "action_controller/railtie" -require "action_mailer/railtie" -require "action_view/railtie" -require "action_cable/engine" -require "sprockets/railtie" +require 'active_model/railtie' +require 'active_job/railtie' +require 'active_record/railtie' +require 'action_controller/railtie' +require 'action_mailer/railtie' +require 'action_view/railtie' +require 'action_cable/engine' +require 'sprockets/railtie' # require "rails/test_unit/railtie" # Require the gems listed in Gemfile, including any gems diff --git a/config/environments/development.rb b/config/environments/development.rb index 6f71970..2d3d4f9 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -13,7 +13,7 @@ config.consider_all_requests_local = true # Enable/disable caching. By default caching is disabled. - if Rails.root.join('tmp/caching-dev.txt').exist? + if Rails.root.join('tmp', 'caching-dev.txt').exist? config.action_controller.perform_caching = true config.cache_store = :memory_store diff --git a/config/environments/production.rb b/config/environments/production.rb index 9fdd413..a90dd57 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -47,7 +47,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 @@ -75,7 +75,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 c7f311f..786af49 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 }.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/db/schema.rb b/db/schema.rb index 2611543..ed41a18 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,8 +11,6 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 0) do - # These are extensions that must be enabled in order to support this database - enable_extension "plpgsql" - + enable_extension 'plpgsql' end