Skip to content

Commit

Permalink
Re-enable HashAsLastArrayItem cop after a few tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
martinemde committed Dec 21, 2024
1 parent 6be247c commit d5c680c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ Style/CaseLikeIf:
Enabled: true

Style/HashAsLastArrayItem:
Enabled: false # Enabling makes some code worse and some better no matter the setting.
Enabled: true
EnforcedStyle: no_braces

Style/HashLikeCase:
Enabled: true
Expand Down
2 changes: 1 addition & 1 deletion app/avo/concerns/auditable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def in_audited_transaction(auditable:, admin_github_user:, action:, fields:, arg
changes = merge_changes!(changes, record.attributes.slice("id").transform_values { [_1, _1] }) if changes.key?("id")
changes = merge_changes!(changes, record.attributes.compact.transform_values { [_1, nil] }) if record.destroyed?

[key, { changes:, unchanged: record.attributes.except(*changes.keys) }]
[key, changes:, unchanged: record.attributes.except(*changes.keys)]
end

audit = Audit.create!(
Expand Down
6 changes: 3 additions & 3 deletions config/initializers/rack_attack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class Rack::Attack
mfa_password_edit_action = { controller: "passwords", action: "otp_edit" }

protected_ui_mfa_actions = [
otp_create_action,
mfa_password_edit_action,
{ controller: "totps", action: "create" },
{ controller: "totps", action: "destroy" },
{ controller: "multifactor_auths", action: "update" }
{ controller: "multifactor_auths", action: "update" },
otp_create_action,
mfa_password_edit_action
]

protected_api_key_actions = [
Expand Down
2 changes: 1 addition & 1 deletion test/models/version_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ class VersionTest < ActiveSupport::TestCase
@version = build(:version)
end

[/foo/, 1337, { foo: "bar" }].each do |example|
[/foo/, 1337, foo: "bar"].each do |example|
should "be invalid with authors as an Array of #{example.class}'s" do
assert_raise ActiveRecord::RecordInvalid do
@spec.authors = [example]
Expand Down

0 comments on commit d5c680c

Please sign in to comment.