Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Commit

Permalink
Update to Rubocop 0.61.1
Browse files Browse the repository at this point in the history
- Resolves #221
- Closes #216
- Update Gemfile/Gemfile.lock
- Update Rubocop config
- Update codebase for new cop rules
- Update failed email address
- TODO:
  - Fix: Rails/HasManyOrHasOneDependent
  - Fix: Lint/Void
  - Fix: Style/ExpandPathArguments
  - Fix: Style/RescueStandardError
  - Fix: Security/Open
  • Loading branch information
ruebot committed Dec 11, 2018
1 parent c198d9a commit 6cbaf87
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 45 deletions.
43 changes: 32 additions & 11 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ AllCops:
TargetRubyVersion: 2.4
DisplayCopNames: true

Layout/AlignArray:
Exclude:
- app/controllers/collections_controller.rb
- app/jobs/wasapi_seed_job.rb

Lint/Void:
Exclude:
- app/helpers/collections_helper.rb

Metrics/AbcSize:
Exclude:
- app/controllers/collections_controller.rb
Expand Down Expand Up @@ -73,6 +82,14 @@ Metrics/PerceivedComplexity:
Exclude:
- app/helpers/wasapi_files_helper.rb

Naming/AccessorMethodName:
Exclude:
- app/helpers/dashboards_helper.rb

Naming/PredicateName:
Exclude:
- test/test_helper.rb

Rails:
Enabled: true

Expand All @@ -83,18 +100,18 @@ Rails/FilePath:
Exclude:
- config/environments/development.rb

Rails/HasManyOrHasOneDependent:
Exclude:
- app/models/collection.rb
- app/models/user.rb

Rails/HttpPositionalArguments:
Exclude:
- test/controllers/dashboards_controller_test.rb

Style/AccessorMethodName:
Exclude:
- app/helpers/dashboards_helper.rb

Style/AlignArray:
Security/Open:
Exclude:
- app/controllers/collections_controller.rb
- app/jobs/wasapi_seed_job.rb
- app/jobs/wasapi_download_job.rb

Style/BlockDelimiters:
Exclude:
Expand All @@ -104,6 +121,10 @@ Style/ClassAndModuleChildren:
Exclude:
- test/test_helper.rb

Style/ExpandPathArguments:
Exclude:
- test/test_helper.rb

Style/GuardClause:
Exclude:
- app/helpers/collections_helper.rb
Expand Down Expand Up @@ -131,14 +152,14 @@ Style/PercentLiteralDelimiters:
Exclude:
- config/spring.rb

Style/PredicateName:
Exclude:
- test/test_helper.rb

Style/RedundantSelf:
Exclude:
- config/initializers/delayed_job_config.rb

Style/RescueStandardError:
Exclude:
- app/jobs/wasapi_download_job.rb

Style/StringLiterals:
Exclude:
- test/controllers/dashboards_controller_test.rb
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ gem 'os'
gem 'parallel'
gem 'rack', '>= 2.0.6' # https://nvd.nist.gov/vuln/detail/CVE-2018-16471 https://nvd.nist.gov/vuln/detail/CVE-2018-16470
gem 'rails-html-sanitizer', '~> 1.0.4' # https://nvd.nist.gov/vuln/detail/CVE-2018-3741
gem 'rubocop', '~> 0.48.1'
gem 'rubocop', '~> 0.61.1'
gem 'rubocop-rspec', '~> 1.15.0'
gem 'rubyzip', '>= 1.2.2' # https://nvd.nist.gov/vuln/detail/CVE-2018-1000544
gem 'sitemap_generator'
Expand Down
30 changes: 16 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/bootstrap-ruby/bootstrap_form.git
revision: 3408537040479643e488bcca00695eefbf13bd42
revision: ae6b872c24dc79e1eb4385c7bc03e5c6719eb0d1
branch: master
specs:
bootstrap_form (4.0.0)
Expand Down Expand Up @@ -52,7 +52,7 @@ GEM
ast (2.4.0)
attr_encrypted (3.1.0)
encryptor (~> 3.0.0)
autoprefixer-rails (9.3.1)
autoprefixer-rails (9.4.2)
execjs
bcrypt (3.1.12)
bindex (0.5.0)
Expand Down Expand Up @@ -84,7 +84,7 @@ GEM
coffee-script-source (1.12.2)
concurrent-ruby (1.1.3)
crass (1.0.4)
daemons (1.2.6)
daemons (1.3.0)
delayed-web (0.4.5)
rails (>= 3.2.13)
delayed_job (4.1.5)
Expand All @@ -98,7 +98,7 @@ GEM
encryptor (3.0.0)
erubi (1.7.1)
execjs (2.7.0)
faraday (0.15.3)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.9.25)
figaro (1.1.1)
Expand All @@ -121,6 +121,7 @@ GEM
i18n
i18n (1.2.0)
concurrent-ruby (~> 1.0)
jaro_winkler (1.5.1)
jbuilder (2.8.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
Expand Down Expand Up @@ -191,7 +192,7 @@ GEM
parser (2.5.3.0)
ast (~> 2.4.0)
pg (0.21.0)
popper_js (1.14.3)
popper_js (1.14.5)
powerpack (0.1.2)
public_suffix (3.0.3)
puma (3.12.0)
Expand Down Expand Up @@ -221,24 +222,25 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rainbow (2.2.2)
rake
rainbow (3.0.0)
rake (12.3.2)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rubocop (0.48.1)
parser (>= 2.3.3.1, < 3.0)
rubocop (0.61.1)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
unicode-display_width (~> 1.4.0)
rubocop-rspec (1.15.1)
rubocop (>= 0.42.0)
ruby-progressbar (1.10.0)
ruby_dep (1.5.0)
rubyzip (1.2.2)
sass (3.6.0)
sass (3.7.2)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
Expand Down Expand Up @@ -276,7 +278,7 @@ GEM
ffi
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.8)
tilt (2.0.9)
time_difference (0.7.0)
activesupport (~> 5.1)
turbolinks (5.2.0)
Expand Down Expand Up @@ -337,7 +339,7 @@ DEPENDENCIES
rack (>= 2.0.6)
rails (~> 5.1.4)
rails-html-sanitizer (~> 1.0.4)
rubocop (~> 0.48.1)
rubocop (~> 0.61.1)
rubocop-rspec (~> 1.15.0)
rubyzip (>= 1.2.2)
sass-rails (~> 5.0)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ApplicationController < ActionController::Base
# Confirms logged in user.
def logged_in_user
return false if logged_in?

redirect_to root_path
end
end
6 changes: 3 additions & 3 deletions app/controllers/errors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# Error controller methods.
class ErrorsController < ApplicationController
def not_found
render status: 404
render status: :not_found
end

def unacceptable
render status: 422
render status: :unprocessable_entity
end

def internal_error
render status: 500
render status: :internal_server_error
end
end
2 changes: 1 addition & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# User controller methods.
class UsersController < ApplicationController
before_action :set_user, only: %i[show edit update destroy]
before_action :set_user, only: %i[show edit update]
before_action :logged_in_user, only: %i[show edit update]
before_action :correct_user, only: %i[show edit update]
before_action :set_collections, only: %i[show]
Expand Down
1 change: 1 addition & 0 deletions app/helpers/dashboards_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
module DashboardsHelper
def job_length(start_time, end_time)
return if start_time.blank? || end_time.blank?

TimeDifference.between(end_time, start_time).humanize
end

Expand Down
1 change: 1 addition & 0 deletions app/helpers/wasapi_files_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def disk_usage(user_id)
if account.first.blank?
return 0
end

if account.first.present?
account_path = ENV['DOWNLOAD_PATH'] + '/' + account.first.to_s
number_to_human_size(`du -sb "#{account_path}"`.split("\t").first.to_i)
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/user_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def notify_collection_failed(user_id, collection_id)
@user = User.find(user_id)
@collection = Collection.find(collection_id)
mail(to: @user.email,
cc: '[email protected]',
cc: '[email protected]',
subject: 'We had a problem analyzing ' + @collection.title) do |format|
format.text
format.html
Expand Down
12 changes: 6 additions & 6 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host: 'localhost:3000' }
config.action_mailer.smtp_settings = {
address: ENV['EMAIL_SERVER_NAME'],
port: 587,
domain: ENV['EMAIL_DOMAIN'],
user_name: ENV['EMAIL_USERNAME'],
password: ENV['EMAIL_PASSWORD'],
authentication: :plain,
address: ENV['EMAIL_SERVER_NAME'],
port: 587,
domain: ENV['EMAIL_DOMAIN'],
user_name: ENV['EMAIL_USERNAME'],
password: ENV['EMAIL_PASSWORD'],
authentication: :plain,
enable_starttls_auto: true
}

Expand Down
12 changes: 6 additions & 6 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@
host: ENV['BASE_HOSTNAME']
}
config.action_mailer.smtp_settings = {
address: ENV['EMAIL_SERVER_NAME'],
port: 587,
domain: ENV['EMAIL_DOMAIN'],
user_name: ENV['EMAIL_USERNAME'],
password: ENV['EMAIL_PASSWORD'],
authentication: :plain,
address: ENV['EMAIL_SERVER_NAME'],
port: 587,
domain: ENV['EMAIL_DOMAIN'],
user_name: ENV['EMAIL_USERNAME'],
password: ENV['EMAIL_PASSWORD'],
authentication: :plain,
enable_starttls_auto: true
}

Expand Down
4 changes: 2 additions & 2 deletions test/models/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def setup
valid_addresses.each do |valid_address|
@user.email = valid_address
assert @user.valid?,
'#{valid_address.inspect} should be valid'
"#{valid_address.inspect} should be valid"
end
end

Expand All @@ -55,7 +55,7 @@ def setup
invalid_addresses.each do |invalid_address|
@user_one.email = invalid_address
assert_not @user_one.valid?,
'#{invalid_address.inspect} should be invalid'
"#{invalid_address.inspect} should be invalid"
end
end

Expand Down

0 comments on commit 6cbaf87

Please sign in to comment.