Skip to content

Commit f8ed78e

Browse files
authored
Enable new cops, fix offenses, update todos (#4831)
And also remove unneeded configuration, order cops and cleanup stuff.
1 parent c2e771f commit f8ed78e

15 files changed

+545
-400
lines changed

.rubocop_cc.yml

Lines changed: 413 additions & 282 deletions
Large diffs are not rendered by default.

.rubocop_todo.yml

Lines changed: 119 additions & 87 deletions
Large diffs are not rendered by default.

app/actions/app_update.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def validate_stack_state(app, message, lifecycle)
9595
stack = Stack.find(name: message.buildpack_data.stack)
9696
return [] unless stack
9797

98-
if app.builds_dataset.count.zero?
98+
if app.builds_dataset.empty?
9999
StackStateValidator.validate_for_new_app!(stack)
100100
else
101101
StackStateValidator.validate_for_restaging!(stack)

app/actions/build_create.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def validate_stack_state!(lifecycle, app)
202202
end
203203

204204
def first_build_for_app?(app)
205-
app.builds_dataset.count.zero?
205+
app.builds_dataset.empty?
206206
end
207207
end
208208
end

app/actions/v2/app_update.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def validate_stack_state(app, request_attrs)
193193
stack = Stack.find(guid: request_attrs['stack_guid'])
194194
return unless stack
195195

196-
stack_warnings = if app.builds_dataset.count.zero?
196+
stack_warnings = if app.builds_dataset.empty?
197197
StackStateValidator.validate_for_new_app!(stack)
198198
else
199199
StackStateValidator.validate_for_restaging!(stack)

app/jobs/runtime/failed_jobs_cleanup.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def perform
2626
orphaned_delayed_jobs = Delayed::Job.
2727
where(Sequel.lit("run_at < CURRENT_TIMESTAMP - INTERVAL '?' DAY", force_delete_after))
2828

29-
unless orphaned_delayed_jobs.count.zero?
29+
unless orphaned_delayed_jobs.empty?
3030
logger.info("Deleting #{orphaned_delayed_jobs.count} orphaned Delayed Jobs older than #{force_delete_after} days")
3131

3232
orphaned_delayed_jobs.delete
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
Sequel.migration do
22
up do
33
alter_table :service_instances do
4-
# rubocop:disable Migration/IncludeStringSize
54
set_column_type :syslog_drain_url, String, text: true
6-
# rubocop:enable Migration/IncludeStringSize
75
end
86
end
97
end
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
Sequel.migration do
22
up do
33
alter_table :service_bindings do
4-
# rubocop:disable Migration/IncludeStringSize
54
set_column_type :syslog_drain_url, String, text: true
6-
# rubocop:enable Migration/IncludeStringSize
75
end
86
end
97
end

db/migrations/20180710115626_change_broker_catalog_descriptions_to_type_text.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@
66
# older brokers that may have long descriptions. Here we are disabling
77
# rubocop from checking the string size.
88
alter_table :services do
9-
# rubocop:disable Migration/IncludeStringSize
109
set_column_type :description, String, text: true
11-
# rubocop:enable Migration/IncludeStringSize
1210
end
1311

1412
alter_table :service_plans do
15-
# rubocop:disable Migration/IncludeStringSize
1613
set_column_type :description, String, text: true
17-
# rubocop:enable Migration/IncludeStringSize
1814
end
1915
end
2016
end

db/migrations/20180927105539_add_broker_name_and_guid_to_service_usage_event.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
# field type here.
66
# For the guid we have control, so we explicitly set a limit.
77

8-
# rubocop:disable Migration/IncludeStringSize
98
add_column :service_usage_events, :service_broker_name, String, null: true
10-
# rubocop:enable Migration/IncludeStringSize
119
add_column :service_usage_events, :service_broker_guid, String, null: true, size: 255
1210
end
1311
end

0 commit comments

Comments
 (0)