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

Commit 6cbaf87

Browse files
committed
Update to Rubocop 0.61.1
- 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
1 parent c198d9a commit 6cbaf87

File tree

12 files changed

+71
-45
lines changed

12 files changed

+71
-45
lines changed

.rubocop.yml

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ AllCops:
1010
TargetRubyVersion: 2.4
1111
DisplayCopNames: true
1212

13+
Layout/AlignArray:
14+
Exclude:
15+
- app/controllers/collections_controller.rb
16+
- app/jobs/wasapi_seed_job.rb
17+
18+
Lint/Void:
19+
Exclude:
20+
- app/helpers/collections_helper.rb
21+
1322
Metrics/AbcSize:
1423
Exclude:
1524
- app/controllers/collections_controller.rb
@@ -73,6 +82,14 @@ Metrics/PerceivedComplexity:
7382
Exclude:
7483
- app/helpers/wasapi_files_helper.rb
7584

85+
Naming/AccessorMethodName:
86+
Exclude:
87+
- app/helpers/dashboards_helper.rb
88+
89+
Naming/PredicateName:
90+
Exclude:
91+
- test/test_helper.rb
92+
7693
Rails:
7794
Enabled: true
7895

@@ -83,18 +100,18 @@ Rails/FilePath:
83100
Exclude:
84101
- config/environments/development.rb
85102

103+
Rails/HasManyOrHasOneDependent:
104+
Exclude:
105+
- app/models/collection.rb
106+
- app/models/user.rb
107+
86108
Rails/HttpPositionalArguments:
87109
Exclude:
88110
- test/controllers/dashboards_controller_test.rb
89111

90-
Style/AccessorMethodName:
91-
Exclude:
92-
- app/helpers/dashboards_helper.rb
93-
94-
Style/AlignArray:
112+
Security/Open:
95113
Exclude:
96-
- app/controllers/collections_controller.rb
97-
- app/jobs/wasapi_seed_job.rb
114+
- app/jobs/wasapi_download_job.rb
98115

99116
Style/BlockDelimiters:
100117
Exclude:
@@ -104,6 +121,10 @@ Style/ClassAndModuleChildren:
104121
Exclude:
105122
- test/test_helper.rb
106123

124+
Style/ExpandPathArguments:
125+
Exclude:
126+
- test/test_helper.rb
127+
107128
Style/GuardClause:
108129
Exclude:
109130
- app/helpers/collections_helper.rb
@@ -131,14 +152,14 @@ Style/PercentLiteralDelimiters:
131152
Exclude:
132153
- config/spring.rb
133154

134-
Style/PredicateName:
135-
Exclude:
136-
- test/test_helper.rb
137-
138155
Style/RedundantSelf:
139156
Exclude:
140157
- config/initializers/delayed_job_config.rb
141158

159+
Style/RescueStandardError:
160+
Exclude:
161+
- app/jobs/wasapi_download_job.rb
162+
142163
Style/StringLiterals:
143164
Exclude:
144165
- test/controllers/dashboards_controller_test.rb

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ gem 'os'
8383
gem 'parallel'
8484
gem 'rack', '>= 2.0.6' # https://nvd.nist.gov/vuln/detail/CVE-2018-16471 https://nvd.nist.gov/vuln/detail/CVE-2018-16470
8585
gem 'rails-html-sanitizer', '~> 1.0.4' # https://nvd.nist.gov/vuln/detail/CVE-2018-3741
86-
gem 'rubocop', '~> 0.48.1'
86+
gem 'rubocop', '~> 0.61.1'
8787
gem 'rubocop-rspec', '~> 1.15.0'
8888
gem 'rubyzip', '>= 1.2.2' # https://nvd.nist.gov/vuln/detail/CVE-2018-1000544
8989
gem 'sitemap_generator'

Gemfile.lock

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GIT
22
remote: https://github.com/bootstrap-ruby/bootstrap_form.git
3-
revision: 3408537040479643e488bcca00695eefbf13bd42
3+
revision: ae6b872c24dc79e1eb4385c7bc03e5c6719eb0d1
44
branch: master
55
specs:
66
bootstrap_form (4.0.0)
@@ -52,7 +52,7 @@ GEM
5252
ast (2.4.0)
5353
attr_encrypted (3.1.0)
5454
encryptor (~> 3.0.0)
55-
autoprefixer-rails (9.3.1)
55+
autoprefixer-rails (9.4.2)
5656
execjs
5757
bcrypt (3.1.12)
5858
bindex (0.5.0)
@@ -84,7 +84,7 @@ GEM
8484
coffee-script-source (1.12.2)
8585
concurrent-ruby (1.1.3)
8686
crass (1.0.4)
87-
daemons (1.2.6)
87+
daemons (1.3.0)
8888
delayed-web (0.4.5)
8989
rails (>= 3.2.13)
9090
delayed_job (4.1.5)
@@ -98,7 +98,7 @@ GEM
9898
encryptor (3.0.0)
9999
erubi (1.7.1)
100100
execjs (2.7.0)
101-
faraday (0.15.3)
101+
faraday (0.15.4)
102102
multipart-post (>= 1.2, < 3)
103103
ffi (1.9.25)
104104
figaro (1.1.1)
@@ -121,6 +121,7 @@ GEM
121121
i18n
122122
i18n (1.2.0)
123123
concurrent-ruby (~> 1.0)
124+
jaro_winkler (1.5.1)
124125
jbuilder (2.8.0)
125126
activesupport (>= 4.2.0)
126127
multi_json (>= 1.2)
@@ -191,7 +192,7 @@ GEM
191192
parser (2.5.3.0)
192193
ast (~> 2.4.0)
193194
pg (0.21.0)
194-
popper_js (1.14.3)
195+
popper_js (1.14.5)
195196
powerpack (0.1.2)
196197
public_suffix (3.0.3)
197198
puma (3.12.0)
@@ -221,24 +222,25 @@ GEM
221222
method_source
222223
rake (>= 0.8.7)
223224
thor (>= 0.18.1, < 2.0)
224-
rainbow (2.2.2)
225-
rake
225+
rainbow (3.0.0)
226226
rake (12.3.2)
227227
rb-fsevent (0.10.3)
228228
rb-inotify (0.9.10)
229229
ffi (>= 0.5.0, < 2)
230-
rubocop (0.48.1)
231-
parser (>= 2.3.3.1, < 3.0)
230+
rubocop (0.61.1)
231+
jaro_winkler (~> 1.5.1)
232+
parallel (~> 1.10)
233+
parser (>= 2.5, != 2.5.1.1)
232234
powerpack (~> 0.1)
233-
rainbow (>= 1.99.1, < 3.0)
235+
rainbow (>= 2.2.2, < 4.0)
234236
ruby-progressbar (~> 1.7)
235-
unicode-display_width (~> 1.0, >= 1.0.1)
237+
unicode-display_width (~> 1.4.0)
236238
rubocop-rspec (1.15.1)
237239
rubocop (>= 0.42.0)
238240
ruby-progressbar (1.10.0)
239241
ruby_dep (1.5.0)
240242
rubyzip (1.2.2)
241-
sass (3.6.0)
243+
sass (3.7.2)
242244
sass-listen (~> 4.0.0)
243245
sass-listen (4.0.0)
244246
rb-fsevent (~> 0.9, >= 0.9.4)
@@ -276,7 +278,7 @@ GEM
276278
ffi
277279
thor (0.20.3)
278280
thread_safe (0.3.6)
279-
tilt (2.0.8)
281+
tilt (2.0.9)
280282
time_difference (0.7.0)
281283
activesupport (~> 5.1)
282284
turbolinks (5.2.0)
@@ -337,7 +339,7 @@ DEPENDENCIES
337339
rack (>= 2.0.6)
338340
rails (~> 5.1.4)
339341
rails-html-sanitizer (~> 1.0.4)
340-
rubocop (~> 0.48.1)
342+
rubocop (~> 0.61.1)
341343
rubocop-rspec (~> 1.15.0)
342344
rubyzip (>= 1.2.2)
343345
sass-rails (~> 5.0)

app/controllers/application_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class ApplicationController < ActionController::Base
1010
# Confirms logged in user.
1111
def logged_in_user
1212
return false if logged_in?
13+
1314
redirect_to root_path
1415
end
1516
end

app/controllers/errors_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# Error controller methods.
44
class ErrorsController < ApplicationController
55
def not_found
6-
render status: 404
6+
render status: :not_found
77
end
88

99
def unacceptable
10-
render status: 422
10+
render status: :unprocessable_entity
1111
end
1212

1313
def internal_error
14-
render status: 500
14+
render status: :internal_server_error
1515
end
1616
end

app/controllers/users_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# User controller methods.
44
class UsersController < ApplicationController
5-
before_action :set_user, only: %i[show edit update destroy]
5+
before_action :set_user, only: %i[show edit update]
66
before_action :logged_in_user, only: %i[show edit update]
77
before_action :correct_user, only: %i[show edit update]
88
before_action :set_collections, only: %i[show]

app/helpers/dashboards_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
module DashboardsHelper
55
def job_length(start_time, end_time)
66
return if start_time.blank? || end_time.blank?
7+
78
TimeDifference.between(end_time, start_time).humanize
89
end
910

app/helpers/wasapi_files_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def disk_usage(user_id)
2222
if account.first.blank?
2323
return 0
2424
end
25+
2526
if account.first.present?
2627
account_path = ENV['DOWNLOAD_PATH'] + '/' + account.first.to_s
2728
number_to_human_size(`du -sb "#{account_path}"`.split("\t").first.to_i)

app/mailers/user_mailer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def notify_collection_failed(user_id, collection_id)
4343
@user = User.find(user_id)
4444
@collection = Collection.find(collection_id)
4545
mail(to: @user.email,
46-
cc: 'ruestn+auk@gmail.com',
46+
cc: 'nick@archivesunleashed.org',
4747
subject: 'We had a problem analyzing ' + @collection.title) do |format|
4848
format.text
4949
format.html

config/environments/development.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@
3737
config.action_mailer.delivery_method = :smtp
3838
config.action_mailer.default_url_options = { host: 'localhost:3000' }
3939
config.action_mailer.smtp_settings = {
40-
address: ENV['EMAIL_SERVER_NAME'],
41-
port: 587,
42-
domain: ENV['EMAIL_DOMAIN'],
43-
user_name: ENV['EMAIL_USERNAME'],
44-
password: ENV['EMAIL_PASSWORD'],
45-
authentication: :plain,
40+
address: ENV['EMAIL_SERVER_NAME'],
41+
port: 587,
42+
domain: ENV['EMAIL_DOMAIN'],
43+
user_name: ENV['EMAIL_USERNAME'],
44+
password: ENV['EMAIL_PASSWORD'],
45+
authentication: :plain,
4646
enable_starttls_auto: true
4747
}
4848

0 commit comments

Comments
 (0)