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

Commit 9448bd3

Browse files
committed
Update rubocop to 0.89.0
- Fairly big jump because of various bugs with rubocop between 0.83 and 0.89 - Disable Style/RedundantRegexpCharacterClass and Style/RedundantRegexpEscape to avoid messing with existing regular expressions - Disable Lint/BinaryOperatorWithIdenticalOperands because it errors - Disable Lint/EmptyConditionalBody because there are places where it is useful to document possible cases with empty conditional bodies - Disable Lint/MissingSuper. This might be nice to enable in the future, but it involves too many changes for this commit. - Disable Style/CaseLikeIf because I don't care about this style. - Disable Style/OptionalBooleanParameter. This might be nice to change in the future, but it involves changing to many method interfaces for this commit. - Disable Style/RedundantAssignment because "redundant" naming of return values is useful for documentation - Disable Style/StringConcatenation because it involves too many changes for this commit. The auto correct also messes up nested quotes. - Disable Bundler/OrderedGems because it clobbers gem upgrade history for marginal gain. Authored-by: Greg Cobb <gcobb@pivotal.io>
1 parent 9abb743 commit 9448bd3

File tree

57 files changed

+191
-101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+191
-101
lines changed

.rubocop.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,89 @@ Layout/EmptyLinesAroundAttributeAccessor:
325325
Style/SlicingWithRange:
326326
Enabled: true
327327

328+
Lint/DeprecatedOpenSSLConstant:
329+
Enabled: true
330+
331+
Lint/MixedRegexpCaptureTypes:
332+
Enabled: true
333+
334+
Style/RedundantRegexpCharacterClass:
335+
Enabled: false
336+
337+
Style/RedundantRegexpEscape:
338+
Enabled: false
339+
340+
Lint/BinaryOperatorWithIdenticalOperands:
341+
Enabled: false
342+
343+
Lint/DuplicateElsifCondition:
344+
Enabled: true
345+
346+
Lint/DuplicateRescueException:
347+
Enabled: true
348+
349+
Lint/EmptyConditionalBody:
350+
Enabled: false
351+
352+
Lint/FloatComparison:
353+
Enabled: true
354+
355+
Lint/MissingSuper:
356+
Enabled: false
357+
358+
Lint/OutOfRangeRegexpRef:
359+
Enabled: true
360+
361+
Lint/SelfAssignment:
362+
Enabled: true
363+
364+
Lint/TopLevelReturnWithArgument:
365+
Enabled: true
366+
367+
Lint/UnreachableLoop:
368+
Enabled: true
369+
370+
Style/AccessorGrouping:
371+
Enabled: true
372+
373+
Style/ArrayCoercion:
374+
Enabled: true
375+
376+
Style/BisectedAttrAccessor:
377+
Enabled: true
378+
379+
Style/CaseLikeIf:
380+
Enabled: false
381+
382+
Style/ExplicitBlockArgument:
383+
Enabled: true
384+
385+
Style/GlobalStdStream:
386+
Enabled: true
387+
388+
Style/HashAsLastArrayItem:
389+
Enabled: true
390+
391+
Style/HashLikeCase:
392+
Enabled: true
393+
394+
Style/OptionalBooleanParameter:
395+
Enabled: false
396+
397+
Style/RedundantAssignment:
398+
Enabled: false
399+
400+
Style/RedundantFetchBlock:
401+
Enabled: true
402+
403+
Style/RedundantFileExtensionInRequire:
404+
Enabled: true
405+
406+
Style/SingleArgumentDig:
407+
Enabled: true
408+
409+
Style/StringConcatenation:
410+
Enabled: false
411+
412+
Bundler/OrderedGems:
413+
Enabled: false

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ group :test do
8888
gem 'rspec-rails', '~> 3.9.1'
8989
gem 'rspec-wait'
9090
gem 'rspec_api_documentation', '>= 6.1.0'
91-
gem 'rubocop', '~> 0.83.0'
91+
gem 'rubocop', '~> 0.89.0'
9292
gem 'timecop'
9393
gem 'webmock', '> 2.3.1'
9494
end

Gemfile.lock

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ GEM
343343
rb-inotify (0.10.1)
344344
ffi (~> 1.0)
345345
recursive-open-struct (1.1.2)
346+
regexp_parser (1.8.2)
346347
representable (3.0.4)
347348
declarative (< 0.1.0)
348349
declarative-option (< 0.2.0)
@@ -394,13 +395,17 @@ GEM
394395
activesupport (>= 3.0.0)
395396
mustache (~> 1.0, >= 0.99.4)
396397
rspec (~> 3.0)
397-
rubocop (0.83.0)
398+
rubocop (0.89.1)
398399
parallel (~> 1.10)
399-
parser (>= 2.7.0.1)
400+
parser (>= 2.7.1.1)
400401
rainbow (>= 2.2.2, < 4.0)
402+
regexp_parser (>= 1.7)
401403
rexml
404+
rubocop-ast (>= 0.3.0, < 1.0)
402405
ruby-progressbar (~> 1.7)
403406
unicode-display_width (>= 1.4.0, < 2.0)
407+
rubocop-ast (0.8.0)
408+
parser (>= 2.7.1.5)
404409
ruby-debug-ide (0.7.2)
405410
rake (>= 0.8.1)
406411
ruby-mysql (2.9.14)
@@ -562,7 +567,7 @@ DEPENDENCIES
562567
rspec-rails (~> 3.9.1)
563568
rspec-wait
564569
rspec_api_documentation (>= 6.1.0)
565-
rubocop (~> 0.83.0)
570+
rubocop (~> 0.89.0)
566571
ruby-debug-ide (>= 0.7.0.beta4)
567572
rubyzip (>= 1.3.0)
568573
scientist (~> 1.1.0)

app/actions/organization_quotas_create.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ class OrganizationQuotasCreate
33
class Error < ::StandardError
44
end
55

6+
# rubocop:todo Metrics/CyclomaticComplexity
67
def create(message)
78
org_quota = nil
89

@@ -36,6 +37,7 @@ def create(message)
3637
rescue Sequel::ValidationFailed => e
3738
validation_error!(e, message)
3839
end
40+
# rubocop:enable Metrics/CyclomaticComplexity
3941

4042
private
4143

app/actions/route_create.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ def validation_error_routing_api!(error)
113113
end
114114
end
115115

116+
# rubocop:todo Metrics/CyclomaticComplexity
116117
def validation_error_host!(error, host, domain)
117118
if error.errors.on(:host)&.include?(:domain_conflict)
118119
error!("Route conflicts with domain '#{host}.#{domain.name}'.")
@@ -154,7 +155,9 @@ def validation_error_host!(error, host, domain)
154155
error!('Paths are not supported for TCP routes.')
155156
end
156157
end
158+
# rubocop:enable Metrics/CyclomaticComplexity
157159

160+
# rubocop:todo Metrics/CyclomaticComplexity
158161
def validation_error_path!(error, host, path, domain)
159162
if error.errors.on(:path)&.include?(:path_not_supported_for_internal_domain)
160163
error!('Paths are not supported for internal domains.')
@@ -187,6 +190,7 @@ def validation_error_path!(error, host, path, domain)
187190
end
188191
end
189192
end
193+
# rubocop:enable Metrics/CyclomaticComplexity
190194

191195
def validation_error_port!(error, host, port, domain)
192196
if error.errors.on(:port)&.include?(:port_required)

app/actions/space_diff_manifest.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
module VCAP::CloudController
55
class SpaceDiffManifest
6+
# rubocop:todo Metrics/CyclomaticComplexity
67
def self.filter_manifest_app_hash(manifest_app_hash)
78
if manifest_app_hash.key? 'sidecars'
89
manifest_app_hash['sidecars'] = manifest_app_hash['sidecars'].map do |hash|
@@ -56,7 +57,9 @@ def self.filter_manifest_app_hash(manifest_app_hash)
5657

5758
manifest_app_hash
5859
end
60+
# rubocop:enable Metrics/CyclomaticComplexity
5961

62+
# rubocop:todo Metrics/CyclomaticComplexity
6063
def self.generate_diff(app_manifests, space)
6164
json_diff = []
6265
recognized_top_level_keys = NamedAppManifestMessage.allowed_keys.map(&:to_s)
@@ -105,6 +108,7 @@ def self.generate_diff(app_manifests, space)
105108
end
106109
end
107110
end
111+
# rubocop:enable Metrics/CyclomaticComplexity
108112

109113
json_diff
110114
end

app/actions/v2/app_update.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def update_lifecycle(app, process, request_attrs)
100100
end
101101

102102
def docker_data_changed(process, request_attrs)
103-
requested_docker_image = request_attrs.dig('docker_image') || ''
103+
requested_docker_image = request_attrs['docker_image'] || ''
104104
requested_docker_username = request_attrs.dig('docker_credentials', 'username')
105105
requested_docker_password = request_attrs.dig('docker_credentials', 'password')
106106

app/controllers/base/model_controller.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,7 @@ def find_guid(guid, find_model=model)
331331
class << self
332332
include VCAP::CloudController
333333

334-
attr_accessor :attributes
335-
attr_accessor :to_many_relationships
336-
attr_accessor :to_one_relationships
334+
attr_accessor :attributes, :to_many_relationships, :to_one_relationships
337335

338336
# path_guid
339337
#

app/controllers/v3/spaces_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
require 'messages/space_update_message'
66
require 'messages/space_update_isolation_segment_message'
77
require 'messages/spaces_list_message'
8-
require 'messages/space_security_groups_list_message.rb'
8+
require 'messages/space_security_groups_list_message'
99
require 'messages/space_show_message'
1010
require 'actions/space_update_isolation_segment'
1111
require 'actions/space_create'
1212
require 'actions/space_update'
1313
require 'actions/space_delete_unmapped_routes'
1414
require 'fetchers/space_list_fetcher'
1515
require 'fetchers/space_fetcher'
16-
require 'fetchers/security_group_list_fetcher.rb'
16+
require 'fetchers/security_group_list_fetcher'
1717
require 'jobs/v3/space_delete_unmapped_routes_job'
1818

1919
class SpacesV3Controller < ApplicationController

app/decorators/field_service_instance_offering_decorator.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def initialize(fields)
1212
@fields = fields[:'service_plan.service_offering'].to_set.intersection(self.class.allowed)
1313
end
1414

15+
# rubocop:todo Metrics/CyclomaticComplexity
1516
def decorate(hash, service_instances)
1617
managed_service_instances = service_instances.select(&:managed_instance?)
1718
return hash if managed_service_instances.empty?
@@ -42,6 +43,7 @@ def decorate(hash, service_instances)
4243

4344
hash
4445
end
46+
# rubocop:enable Metrics/CyclomaticComplexity
4547

4648
private
4749

0 commit comments

Comments
 (0)