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

Commit e1bac29

Browse files
committed
Update rubocop to 0.93.1
Authored-by: Greg Cobb <gcobb@pivotal.io>
1 parent 5863555 commit e1bac29

File tree

9 files changed

+21
-15
lines changed

9 files changed

+21
-15
lines changed

.rubocop.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,11 @@ Lint/IdentityComparison:
448448
Lint/UselessTimes:
449449
Enabled: true
450450

451+
Lint/HashCompareByIdentity:
452+
Enabled: true
453+
454+
Lint/RedundantSafeNavigation:
455+
Enabled: true
456+
457+
Style/ClassEqualityComparison:
458+
Enabled: true

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.92.0'
91+
gem 'rubocop', '~> 0.93.1'
9292
gem 'timecop'
9393
gem 'webmock', '> 2.3.1'
9494
end

Gemfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,13 +395,13 @@ GEM
395395
activesupport (>= 3.0.0)
396396
mustache (~> 1.0, >= 0.99.4)
397397
rspec (~> 3.0)
398-
rubocop (0.92.0)
398+
rubocop (0.93.1)
399399
parallel (~> 1.10)
400400
parser (>= 2.7.1.5)
401401
rainbow (>= 2.2.2, < 4.0)
402-
regexp_parser (>= 1.7)
402+
regexp_parser (>= 1.8)
403403
rexml
404-
rubocop-ast (>= 0.5.0)
404+
rubocop-ast (>= 0.6.0)
405405
ruby-progressbar (~> 1.7)
406406
unicode-display_width (>= 1.4.0, < 2.0)
407407
rubocop-ast (1.0.1)
@@ -567,7 +567,7 @@ DEPENDENCIES
567567
rspec-rails (~> 3.9.1)
568568
rspec-wait
569569
rspec_api_documentation (>= 6.1.0)
570-
rubocop (~> 0.92.0)
570+
rubocop (~> 0.93.1)
571571
ruby-debug-ide (>= 0.7.0.beta4)
572572
rubyzip (>= 1.3.0)
573573
scientist (~> 1.1.0)

app/controllers/services/service_instances_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def route_binding_parameters(service_instance_guid, route_guid)
300300
end
301301

302302
def self.url_for_guid(guid, object=nil)
303-
if object.class == UserProvidedServiceInstance
303+
if object.instance_of?(UserProvidedServiceInstance)
304304
user_provided_path = VCAP::CloudController::UserProvidedServiceInstancesController.path
305305
"#{user_provided_path}/#{guid}"
306306
else

app/messages/validators/security_group_rule_validator.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def boolean?(value)
4747
end
4848

4949
def valid_protocol(protocol)
50-
protocol&.is_a?(String) && %w(tcp udp icmp all).include?(protocol)
50+
protocol.is_a?(String) && %w(tcp udp icmp all).include?(protocol)
5151
end
5252

5353
def validate_allowed_keys(rule, record, index)
@@ -83,9 +83,8 @@ def valid_icmp_format(field)
8383
field.is_a?(Integer) && field >= -1 && field <= 255
8484
end
8585

86-
# rubocop:todo Metrics/CyclomaticComplexity
8786
def valid_ports(ports)
88-
return false unless ports&.is_a?(String)
87+
return false unless ports.is_a?(String)
8988
return false if /[^\d\s\-,]/.match?(ports)
9089

9190
port_range = /\A\s*(\d+)\s*-\s*(\d+)\s*\z/.match(ports)
@@ -109,7 +108,6 @@ def valid_ports(ports)
109108

110109
false
111110
end
112-
# rubocop:enable Metrics/CyclomaticComplexity
113111

114112
def port_in_range(port)
115113
port > 0 && port < 65536

app/presenters/v2/process_model_presenter.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ def logger
6868
end
6969

7070
def buildpack_name_or_url(buildpack)
71-
if buildpack.class == VCAP::CloudController::CustomBuildpack
71+
if buildpack.instance_of?(VCAP::CloudController::CustomBuildpack)
7272
CloudController::UrlSecretObfuscator.obfuscate(buildpack.url)
73-
elsif buildpack.class == VCAP::CloudController::Buildpack
73+
elsif buildpack.instance_of?(VCAP::CloudController::Buildpack)
7474
buildpack.name
7575
end
7676
end

app/presenters/v3/service_instance_presenter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ServiceInstancePresenter < BasePresenter
1010
def to_hash
1111
hash = correct_order(
1212
hash_common.deep_merge(
13-
if service_instance.class == ManagedServiceInstance
13+
if service_instance.instance_of?(ManagedServiceInstance)
1414
hash_additions_managed
1515
else
1616
hash_additions_user_provided

lib/diego/action_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def codependent(actions)
5858
private
5959

6060
def action_already_wrapped?(action)
61-
action.class == Bbs::Models::Action
61+
action.instance_of?(Bbs::Models::Action)
6262
end
6363
end
6464

lib/services/service_brokers/v2/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def bind(binding, arbitrary_parameters: {}, accepts_incomplete: false)
139139
Errors::ServiceBrokerInvalidVolumeMounts,
140140
Errors::ServiceBrokerInvalidSyslogDrainUrl,
141141
Errors::ServiceBrokerResponseMalformed => e
142-
unless e.class == Errors::ServiceBrokerResponseMalformed && e.status == 200
142+
unless e.instance_of?(Errors::ServiceBrokerResponseMalformed) && e.status == 200
143143
@orphan_mitigator.cleanup_failed_bind(@attrs, binding)
144144
end
145145

0 commit comments

Comments
 (0)