10000 Enable `Layout/SpaceAroundOperators` cop · stephancom/activeadmin@7bd91d0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7bd91d0

Browse files
Enable Layout/SpaceAroundOperators cop
1 parent 386fb1c commit 7bd91d0

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ Layout/SpaceAfterComma:
111111
Layout/SpaceAroundEqualsInParameterDefault:
112112
Enabled: true
113113

114+
Layout/SpaceAroundOperators:
115+
Enabled: true
116+
114117
Layout/SpaceBeforeBlockBraces:
115118
Enabled: true
116119

features/step_definitions/action_link_steps.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
end
88

99
Then /^I should see the actions column with the class "([^"]*)" and the title "([^"]*)"$/ do |klass, title|
10-
expect(page).to have_css "th#{'.'+klass}", text: title
10+
expect(page).to have_css "th#{'.' + klass}", text: title
1111
end
1212

1313
Then /^I should see a dropdown menu item to "([^"]*)"$/ do |name|

features/step_definitions/format_steps.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
# Check first rows of the displayed CSV.
2323
Then /^I should download a CSV file with "([^"]*)" separator for "([^"]*)" containing:$/ do |sep, resource_name, table|
24-
body = page.driver.response.body
24+
body = page.driver.response.body
2525
content_type_header, content_disposition_header = %w[Content-Type Content-Disposition].map do |header_name|
2626
page.response_headers[header_name]
2727
end

features/step_definitions/user_steps.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def ensure_user_created(email)
3636

3737
Given /^override locale "([^"]*)" with "([^"]*)"$/ do |path, value|
3838
keys_value = path.split('.') + [value]
39-
locale_hash = keys_value.reverse.inject { |a, n| { n=>a } }
39+
locale_hash = keys_value.reverse.inject { |a, n| { n => a } }
4040
I18n.available_locales
4141
I18n.backend.store_translations(I18n.locale, locale_hash)
4242
end

lib/active_admin/view_helpers/breadcrumb_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ def breadcrumb_links(path = request.path)
1212
# 1. try using `display_name` if we can locate a DB object
1313
# 2. try using the model name translation
1414
# 3. default to calling `titlecase` on the URL fragment
15-
if part =~ /\A(\d+|[a-f0-9]{24}|(?:[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}))\z/ && parts[index-1]
15+
if part =~ /\A(\d+|[a-f0-9]{24}|(?:[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}))\z/ && parts[index - 1]
1616
parent = active_admin_config.belongs_to_config.try :target
17-
config = parent && parent.resource_name.route_key == parts[index-1] ? parent : active_admin_config
17+
config = parent && parent.resource_name.route_key == parts[index - 1] ? parent : active_admin_config
1818
name = display_name config.find_resource part
1919
end
2020
name ||= I18n.t "activerecord.models.#{part.singularize}", count: ::ActiveAdmin::Helpers::I18n::PLURAL_MANY_COUNT, default: part.titlecase

lib/ransack_ext.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# identically to the versions given in Ransack.
33
#
44
Ransack.configure do |config|
5-
{ 'contains'=>'cont', 'starts_with'=>'start', 'ends_with'=>'end' }.each do |old, current|
5+
{ 'contains' => 'cont', 'starts_with' => 'start', 'ends_with' => 'end' }.each do |old, current|
66
config.add_predicate old, Ransack::Constants::DERIVED_PREDICATES.detect { |q, _| q == current }[1]
77
end
88

9-
{ 'equals'=>'eq', 'greater_than'=>'gt', 'less_than'=>'lt' }.each do |old, current|
9+
{ 'equals' => 'eq', 'greater_than' => 'gt', 'less_than' => 'lt' }.each do |old, current|
1010
config.add_predicate old, arel_predicate: current
1111
end
1212

0 commit comments

Comments
 (0)
0