Skip to content

Commit

Permalink
Rubocop adjustments and Additional Tests
Browse files Browse the repository at this point in the history
Configured Rubocop and made adjustments to remove most errors. Went from 500+ to 27, not including line-length issues which we have disabled.
Added back SimpleCov which was accidentally disabled.
Wrote additional tests and configured Guard to disable SimpleCov when it's running. 
.rubocop_todo.yml shows what Rubocop related issues remain.
Reconfigured Database Cleaner.
  • Loading branch information
blimey85 committed Jun 18, 2018
1 parent 3821f74 commit 4d446cb
Show file tree
Hide file tree
Showing 89 changed files with 1,815 additions and 527 deletions.
9 changes: 5 additions & 4 deletions .rspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
--color
--order random
--profile
--backtrace
--format Fuubar
#--order random
#--profile
#--backtrace
#--format Fuubar
--format documentation
--require rails_helper
97 changes: 97 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.5.1
DisplayCopNames: true
DisplayStyleGuide: true
Exclude:
- db/*
- db/migrate/*
- config/*
- config/environments/*
- config/initializers/*
- lib/tasks/*
- Rakefile
- 'vendor/**/*'
- 'node_modules/**/*'
- 'db/fixtures/**/*'
- 'tmp/**/*'
- 'bin/**/*'

Documentation:
Enabled: false

DotPosition:
EnforcedStyle: leading

Semicolon:
Enabled: false

# LAYOUT ##########
Layout/EmptyLinesAroundBlockBody:
Enabled: true

Layout/EmptyLinesAroundModuleBody:
Enabled: true

Layout/EmptyLinesAroundClassBody:
Enabled: true

Layout/EmptyLinesAroundMethodBody:
Enabled: true

# METRICS ##########
Metrics/AbcSize:
Enabled: false

Metrics/BlockLength:
Enabled: false

Metrics/ClassLength:
Enabled: false

Metrics/CyclomaticComplexity:
Enabled: false

Metrics/LineLength:
Enabled: false

Metrics/MethodLength:
Enabled: false

Metrics/ParameterLists:
Enabled: true
Max: 8

Metrics/PerceivedComplexity:
Enabled: true
Max: 18

# RAILS ##########
Rails:
Enabled: true

Rails/OutputSafety:
Enabled: false

Rails/SkipsModelValidations:
Enabled: false

# STYLE ##########
Style/BlockComments:
Enabled: false

Style/EmptyMethod:
EnforcedStyle: expanded

Style/FrozenStringLiteralComment:
Enabled: true

Style/Lambda:
EnforcedStyle: literal

Style/NestedTernaryOperator:
Enabled: false

Style/SymbolArray:
Enabled: false
51 changes: 51 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-06-16 12:54:50 -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: 3
# Cop supports --auto-correct.
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/FindBy:
Exclude:
- 'app/models/user.rb'

# Offense count: 8
# Configuration parameters: Include.
# Include: app/models/**/*.rb
Rails/InverseOf:
Exclude:
- 'app/models/conversation.rb'
- 'app/models/follow.rb'
- 'app/models/user.rb'

# Offense count: 12
# Configuration parameters: MinBodyLength.
Style/GuardClause:
Exclude:
- 'app/channels/conversation_channel.rb'
- 'app/channels/group_chats_channel.rb'
- 'app/controllers/dashboard_controller.rb'
- 'app/controllers/groups_controller.rb'
- 'app/controllers/posts_controller.rb'
- 'app/controllers/relationships_controller.rb'
- 'app/helpers/posts_helper.rb'

# Offense count: 4
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'app/channels/group_chats_channel.rb'
- 'app/controllers/comments_controller.rb'
- 'app/controllers/groups_controller.rb'
- 'app/controllers/posts_controller.rb'

# Offense count: 105
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 199
154 changes: 79 additions & 75 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,75 +1,79 @@
source 'https://rubygems.org'

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

ruby '2.5.1'

### Servers
gem 'rails', '~> 5.2'
gem 'pg'
gem 'puma', '~> 3.0'
gem 'redis', '~> 3.0'
gem 'sidekiq'

### Front End
gem 'acts_as_votable'
gem 'bootstrap-sass'
gem 'coffee-rails', '~> 4.2'
gem 'devise'
gem 'haml'
gem 'jbuilder', '~> 2.5'
gem 'jquery-rails'
gem 'kaminari'
gem 'paperclip'
gem 'rails_emoji_picker'
gem 'remotipart', '~> 1.2'
gem 'sass-rails', '~> 5.0'
gem 'simple_form'
gem 'uglifier', '>= 1.3.0'

### Utilities
gem 'bootsnap', require: false
gem 'dotenv-rails'
gem 'rails_admin'
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :development do
gem "awesome_print", require:"ap"
gem 'better_errors'
gem 'binding_of_caller'
gem 'guard-rspec'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'irbtools-more', require: 'irbtools/binding'
gem 'meta_request'
gem 'web-console'
end

group :development, :test do
gem 'bullet', '~> 5.6'
gem 'bundler-audit', '~> 0.6', require: false
gem 'capybara', '~> 3.1'
gem 'chromedriver-helper', '~> 1.1.0'
gem 'rspec-rails', '~> 3.7'
gem 'rubocop', '~> 0.49', require: false
gem 'rubocop-rspec', '~> 1.12', require: false
gem 'selenium-webdriver'
gem 'spring'
gem 'spring-commands-rspec'
gem 'spring-watcher-listen'
end

group :test do
gem 'brakeman', '~> 3.5', require: false
gem 'capybara-email'
gem 'database_cleaner'
gem 'faker', '~> 1.7'
gem 'factory_bot_rails'
gem 'fuubar', '~> 2.2.0'
gem 'metric_fu', '~> 4.12.0', require: false
gem 'shoulda-matchers', github: 'thoughtbot/shoulda-matchers', branch: 'master'
gem 'simplecov', '~> 0.14', require: false
gem 'test-prof'
end
# frozen_string_literal: true

source 'https://rubygems.org'

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

ruby '2.5.1'

### Servers
gem 'rails', '~> 5.2'

gem 'pg'
gem 'puma', '~> 3.0'
gem 'redis', '~> 3.0'
gem 'sidekiq'

### Front End
gem 'acts_as_votable'
gem 'bootstrap-sass'
gem 'coffee-rails', '~> 4.2'
gem 'devise'
gem 'haml'
gem 'jbuilder', '~> 2.5'
gem 'jquery-rails'
gem 'kaminari'
gem 'paperclip'
gem 'rails_emoji_picker'
gem 'remotipart', '~> 1.2'
gem 'sass-rails', '~> 5.0'
gem 'simple_form'
gem 'uglifier', '>= 1.3.0'

### Utilities
gem 'bootsnap', require: false
gem 'dotenv-rails'
gem 'rails_admin'
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :development do
gem 'awesome_print', require: 'ap'
gem 'better_errors'
gem 'binding_of_caller'
gem 'guard-rspec'
gem 'irbtools-more', require: 'irbtools/binding'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'meta_request'
gem 'web-console'
end

group :development, :test do
gem 'bullet', '~> 5.6'
gem 'bundler-audit', '~> 0.6', require: false
gem 'capybara', '~> 3.1'
gem 'chromedriver-helper', '~> 1.1.0'
gem 'rspec-rails', '~> 3.7'
gem 'rubocop', '~> 0.49', require: false
gem 'rubocop-rspec', '~> 1.12', require: false
gem 'selenium-webdriver'
# gem 'spring'
# gem 'spring-commands-rspec'
# gem 'spring-watcher-listen'
end

group :test do
gem 'brakeman', '~> 3.5', require: false
gem 'capybara-email'
gem 'database_cleaner'
gem 'factory_bot_rails'
gem 'faker', '~> 1.7'
gem 'fuubar', '~> 2.2.0'
gem 'metric_fu', '~> 4.12.0', require: false
gem 'shoulda-matchers', github: 'thoughtbot/shoulda-matchers', branch: 'master'
gem 'simplecov', '~> 0.14', require: false
gem 'simplecov-console', require: false
gem 'test-prof'
end
Loading

0 comments on commit 4d446cb

Please sign in to comment.