Skip to content

Commit b2fe14f

Browse files
committed
refactor: with rubocop
1 parent fe42e2f commit b2fe14f

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

.rubocop.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require: rubocop-factory_bot
2+
13
inherit_from:
24
- .rubocop_ruby.yml
35
- .rubocop_rails.yml
@@ -19,4 +21,4 @@ AllCops:
1921

2022
RSpec/DescribeClass:
2123
Exclude:
22-
- spec/system/*
24+
- spec/system/*

.rubocop_ruby.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -975,9 +975,10 @@ Style/SymbolArray:
975975
Style/SymbolProc:
976976
# A list of method names to be ignored by the check.
977977
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
978-
IgnoredMethods:
979-
- respond_to
980-
- define_method
978+
Enabled: true
979+
Exclude:
980+
- respond_to
981+
- define_method
981982

982983
Style/TernaryParentheses:
983984
EnforcedStyle: require_no_parentheses

app/jobs/decidim/cleaner/clean_admin_logs_job.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def perform
1010
next unless organization.delete_admin_logs?
1111

1212
Decidim::ActionLog.where(organization:)
13-
.where("created_at < ?", delete_admin_logs_before_date(organization))
13+
.where(created_at: ...delete_admin_logs_before_date(organization))
1414
.delete_all
1515
end
1616
end

app/jobs/decidim/cleaner/clean_deleted_users_data_job.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def remove_versions_for_deleted_users
1818
INNER JOIN decidim_users ON decidim_users.id = versions.item_id
1919
AND versions.item_type IN ('Decidim::User', 'Decidim::UserBaseEntity')
2020
SQL
21-
).where("deleted_at < ?", date_before_delete_user_versions).each do |version|
21+
).where(decidim_users: { deleted_at: ...date_before_delete_user_versions }).each do |version|
2222
version.destroy!
2323
Rails.logger.info "Version for user with id #{version.item_id} destroyed"
2424
end
@@ -31,7 +31,7 @@ def remove_versions_for_deleted_authorizations
3131
AND versions.item_type = 'Decidim::Authorization'
3232
SQL
3333
).where(item_type: "Decidim::Authorization", decidim_authorizations: { id: nil })
34-
.where("versions.created_at < ?", date_before_delete_authorization_versions)
34+
.where(versions: { created_at: ...date_before_delete_authorization_versions })
3535
.each do |version|
3636
version.destroy!
3737
Rails.logger.info "Version for authorization with id #{version.item_id} destroyed"

app/jobs/decidim/cleaner/clean_inactive_users_job.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ def perform
1212
send_warning(Decidim::User.unscoped.where(organization: organization)
1313
.not_deleted
1414
.where.not(email: "")
15-
.where("current_sign_in_at < ?", email_inactive_before_date(organization)))
15+
.where(current_sign_in_at: ...email_inactive_before_date(organization)))
1616
delete_user_and_send_email(Decidim::User.unscoped.where(organization: organization)
1717
.not_deleted
1818
.where.not(email: "")
19-
.where("warning_date < ?", delete_inactive_before_date(organization)))
19+
.where(warning_date: ...delete_inactive_before_date(organization)))
2020
end
2121
end
2222

lib/decidim/cleaner/engine.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ module Cleaner
88
# This is the engine that runs on the public interface of cleaner.
99
class Engine < ::Rails::Engine
1010
isolate_namespace Decidim::Cleaner
11-
1211
end
1312
end
1413
end

0 commit comments

Comments
 (0)