Skip to content

Commit

Permalink
Fixes #27249 - flip the comma cop
Browse files Browse the repository at this point in the history
  • Loading branch information
ares authored and mmoll committed Jul 9, 2019
1 parent ce287cf commit f2ee562
Show file tree
Hide file tree
Showing 224 changed files with 962 additions and 956 deletions.
6 changes: 6 additions & 0 deletions .rubocop.yml
Expand Up @@ -114,3 +114,9 @@ Style/MultipleComparison:

Rails/RefuteMethods:
Enabled: false

Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma

Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma
2 changes: 1 addition & 1 deletion app/controllers/about_controller.rb
Expand Up @@ -11,7 +11,7 @@ def index
{
:friendly_name => provider_class.constantize.provider_friendly_name,
:name => provider_name,
:status => enabled_providers.include?(provider_name) ? :installed : :absent
:status => enabled_providers.include?(provider_name) ? :installed : :absent,
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/base_controller.rb
Expand Up @@ -221,7 +221,7 @@ def search_options
def paginate_options
{
:page => params[:page],
:per_page => params[:per_page]
:per_page => params[:per_page],
}
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/api/graphql_controller.rb
Expand Up @@ -50,7 +50,7 @@ def execute_multiplexed_graphql_query
query: param['query'],
operation_name: param['operationName'],
variables: ensure_hash(param['variables']),
context: graphql_context
context: graphql_context,
}
end
ForemanGraphqlSchema.multiplex(queries)
Expand All @@ -68,7 +68,7 @@ def graphql_context
{
current_user: User.current,
request_id: request.uuid,
request_ip: request.ip
request_ip: request.ip,
}
end

Expand Down
4 changes: 2 additions & 2 deletions app/controllers/api/v2/dashboard_controller.rb
Expand Up @@ -33,8 +33,8 @@ def glossary
:good_hosts => _('Hosts without errors'),
:good_hosts_enabled => _('Hosts without errors, with alerts enabled'),
:percentage => _('Hosts without errors percent'),
:reports_missing => _('Hosts which are not reporting')
}
:reports_missing => _('Hosts which are not reporting'),
},
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v2/hosts_controller.rb
Expand Up @@ -274,7 +274,7 @@ def power_status

resp = {
id: @host.id,
statusText: _("Failed to fetch power status: %s") % e
statusText: _("Failed to fetch power status: %s") % e,
}

render json: resp.merge(PowerManager::PowerStatus::HOST_POWER[:na])
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/smart_proxies_controller.rb
Expand Up @@ -126,7 +126,7 @@ def modules_card
:logs => logs,
:features => @smart_proxy.features,
:features_started => @smart_proxy.features.count,
:names => logs.failed_module_names
:names => logs.failed_module_names,
}
rescue Foreman::Exception => exception
process_ajax_error exception
Expand Down Expand Up @@ -189,7 +189,7 @@ def version_mismatch_warning(proxy_versions_hash)
foreman_version = Foreman::Version.new.notag

{
:message => _('Core and proxy versions do not match. foreman: %{foreman_version}, foreman-proxy: %{proxy_version}') % {foreman_version: foreman_version, proxy_version: proxy_versions_hash['version']}
:message => _('Core and proxy versions do not match. foreman: %{foreman_version}, foreman-proxy: %{proxy_version}') % {foreman_version: foreman_version, proxy_version: proxy_versions_hash['version']},
}
end
end
4 changes: 2 additions & 2 deletions app/controllers/userdata_controller.rb
Expand Up @@ -21,7 +21,7 @@ def metadata
:hostname => @host.name,
:mac => @host.mac,
:'local-ipv4' => @host.ip,
:'local-hostname' => @host.name
:'local-hostname' => @host.name,
}
render plain: data.map { |key, value| "#{key}: #{value}" }.join("\n")
end
Expand Down Expand Up @@ -59,7 +59,7 @@ def skip_session

def find_host
query_params = {
ip: ip_from_request_env
ip: ip_from_request_env,
}

@host = Foreman::UnattendedInstallation::HostFinder.new(query_params: query_params).search
Expand Down
4 changes: 2 additions & 2 deletions app/graphql/mutations/base_mutation.rb
Expand Up @@ -66,7 +66,7 @@ def save_object(resource)

{
result_key => resource,
errors: errors
errors: errors,
}
end
end
Expand All @@ -75,7 +75,7 @@ def map_errors_to_path(resource)
resource.errors.map do |attribute, message|
{
path: ['attributes', attribute.to_s.camelize(:lower)],
message: message
message: message,
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/mutations/delete_mutation.rb
Expand Up @@ -18,7 +18,7 @@ def resolve(id:)

{
id: id,
errors: errors
errors: errors,
}
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/mutations/sign_in_user.rb
Expand Up @@ -32,7 +32,7 @@ def resolve(username:, password:)

{
token: user.jwt_token!,
user: user
user: user,
}
end
end
Expand Down
14 changes: 7 additions & 7 deletions app/helpers/application_helper.rb
Expand Up @@ -238,8 +238,8 @@ def flot_pie_chart(name, title, data, options = {})
:data => {
:title => title,
:series => data,
:url => options[:search] ? "#{request.script_name}/hosts?search=#{URI.encode(options.delete(:search))}" : "#"
}
:url => options[:search] ? "#{request.script_name}/hosts?search=#{URI.encode(options.delete(:search))}" : "#",
},
}.merge(options))
end

Expand All @@ -252,8 +252,8 @@ def flot_chart(name, xaxis_label, yaxis_label, data, options = {})
:'legend-options' => options.delete(:legend),
:'xaxis-label' => xaxis_label,
:'yaxis-label' => yaxis_label,
:series => data
}
:series => data,
},
}.merge(options))
end

Expand All @@ -280,8 +280,8 @@ def flot_bar_chart(name, xaxis_label, yaxis_label, data, options = {})
:'xaxis-label' => xaxis_label,
:'yaxis-label' => yaxis_label,
:chart => data,
:ticks => ticks
}
:ticks => ticks,
},
}.merge(options))
end

Expand Down Expand Up @@ -432,7 +432,7 @@ def options_for_puppetclass_selection(klass, type)
:'data-class-name' => klass.name,
:'data-type' => type,
:'data-url' => parameters_puppetclass_path(:id => klass.id),
:rel => 'twipsy'
:rel => 'twipsy',
}
end

Expand Down
10 changes: 5 additions & 5 deletions app/helpers/audits_helper.rb
Expand Up @@ -192,16 +192,16 @@ def nested_host_audit_breadcrumbs
items: [
{
caption: _("Hosts"),
url: (url_for(hosts_path) if authorized_for(hash_for_hosts_path))
url: (url_for(hosts_path) if authorized_for(hash_for_hosts_path)),
},
{
caption: @host.name,
url: (host_path(@host) if authorized_for(hash_for_host_path(@host)))
url: (host_path(@host) if authorized_for(hash_for_host_path(@host))),
},
{
caption: _('Audits'),
url: url_for(audits_path)
}
url: url_for(audits_path),
},
]
)
end
Expand Down Expand Up @@ -313,7 +313,7 @@ def user_info(audit)
'display_name' => audit.username.gsub(_('User'), ''),
'login' => login,
'search_path' => audits_path(:search => login ? "user = #{login}" : "username = \"#{audit.username}\""),
'audit_path' => audits_path(:search => "id=#{audit.id}")
'audit_path' => audits_path(:search => "id=#{audit.id}"),
}
end

Expand Down
6 changes: 3 additions & 3 deletions app/helpers/auth_source_ldaps_helper.rb
Expand Up @@ -8,23 +8,23 @@ def account_help_data
@account_help_data ||= {
'active_directory' => _("Example value is <code>DOMAIN\\foreman</code>"),
'free_ipa' => _("Example value is <code>uid=foreman,cn=users,cn=accounts,dc=example,dc=com</code>"),
'posix' => _("Example value is <code>uid=foreman,dc=example,dc=com</code>")
'posix' => _("Example value is <code>uid=foreman,dc=example,dc=com</code>"),
}
end

def base_dn_help_data
@base_dn_help_data ||= {
'active_directory' => _("Example value is <code>CN=Users,DC=example,DC=COM</code>"),
'free_ipa' => _("Example value is <code>cn=users,cn=accounts,dc=example,dc=com</code>"),
'posix' => _("Example value is <code>dc=example,dc=com</code>")
'posix' => _("Example value is <code>dc=example,dc=com</code>"),
}
end

def groups_base_dn_help_data
@groups_base_dn_help_data ||= {
'active_directory' => _("Example value is <code>CN=Users,DC=example,DC=com</code>"),
'free_ipa' => _("Example value is <code>cn=groups,cn=accounts,dc=example,dc=com</code> or <code>cn=ng,cn=compat,dc=example,dc=com</code> if you use netgroups"),
'posix' => _("Example value is <code>dc=example,dc=com</code>")
'posix' => _("Example value is <code>dc=example,dc=com</code>"),
}
end
end
4 changes: 2 additions & 2 deletions app/helpers/compute_resources_helper.rb
Expand Up @@ -28,7 +28,7 @@ def power_action_html(vm)
if vm.ready?
{
:data => { :confirm => _("Are you sure you want to power %{act} %{vm}?") % { :act => action_string(vm).downcase.strip, :vm => vm }},
:class => "btn btn-danger"
:class => "btn btn-danger",
}
else
{ :class => "btn btn-info" }
Expand All @@ -49,7 +49,7 @@ def pause_action_html(vm)
else
{
:data => { :confirm => _("Are you sure you want to %{act} %{vm}?") % { :act => pause_action, :vm => vm } },
:class => "btn btn-danger"
:class => "btn btn-danger",
}
end
end
Expand Down
6 changes: 3 additions & 3 deletions app/helpers/compute_resources_vms_helper.rb
Expand Up @@ -51,7 +51,7 @@ def supports_spice_xpi?
def spice_data_attributes(console)
options = {
:port => console[:proxy_port],
:password => console[:password]
:password => console[:password],
}
if supports_spice_xpi?
options.merge!(
Expand Down Expand Up @@ -206,7 +206,7 @@ def ovirt_vms_data
"<span #{vm_power_class(vm.ready?)}>#{vm_state(vm)}</span>",
action_buttons(vm_power_action(vm, authorizer),
vm_import_action(vm),
display_delete_if_authorized(hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.id).merge(:auth_object => @compute_resource, :authorizer => authorizer)))
display_delete_if_authorized(hash_for_compute_resource_vm_path(:compute_resource_id => @compute_resource, :id => vm.id).merge(:auth_object => @compute_resource, :authorizer => authorizer))),
]
end
JSON.fast_generate(data).html_safe
Expand Down Expand Up @@ -282,7 +282,7 @@ def vm_console_action(vm)
:id => vm.identity
),
{
:class => "btn btn-info"
:class => "btn btn-info",
}
)
end
Expand Down
6 changes: 3 additions & 3 deletions app/helpers/dashboard_helper.rb
Expand Up @@ -17,7 +17,7 @@ def dashboard_actions
end
),
auto_refresh_button(:defaults_to => false),
documentation_button
documentation_button,
]
end

Expand Down Expand Up @@ -61,7 +61,7 @@ def get_overview_json(report, options = {})
[_('Pending changes'), report[:pending_hosts_enabled], report_color[:pending_hosts_enabled]],
[_('Out of sync'), report[:out_of_sync_hosts_enabled], report_color[:out_of_sync_hosts_enabled]],
[_('No report'), report[:reports_missing], report_color[:reports_missing]],
[_('Notification disabled'), report[:disabled_hosts], report_color[:disabled_hosts]]
[_('Notification disabled'), report[:disabled_hosts], report_color[:disabled_hosts]],
].to_json
end

Expand Down Expand Up @@ -110,7 +110,7 @@ def report_color
:pending_hosts_enabled => "#80699B",
:out_of_sync_hosts_enabled => "#3D96AE",
:reports_missing => "#DB843D",
:disabled_hosts => "#92A8CD"
:disabled_hosts => "#92A8CD",
}
end

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/external_logout_helper.rb
Expand Up @@ -5,7 +5,7 @@ def external_logout_props
caption: Setting[:login_text],
logoSrc: image_path("login_logo.png"),
submitLink: extlogin_users_path,
backgroundUrl: nil
backgroundUrl: nil,
}
end

Expand Down
6 changes: 3 additions & 3 deletions app/helpers/fact_values_helper.rb
Expand Up @@ -59,11 +59,11 @@ def fact_breadcrumbs
items: [
{
caption: _("Facts Values"),
url: (url_for(fact_values_path) if authorized_for(hash_for_fact_values_path))
url: (url_for(fact_values_path) if authorized_for(hash_for_fact_values_path)),
},
{
caption: params[:host_id]
}
caption: params[:host_id],
},
],
resource_url: api_hosts_path(thin: true),
switcher_item_url: host_facts_path(':name'),
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/hosts_and_hostgroups_helper.rb
Expand Up @@ -35,7 +35,7 @@ def realm_field(f, can_override = false, override = false)
{ :include_blank => true,
:disable_button => can_override ? _(INHERIT_TEXT) : nil,
:disable_button_enabled => override && !explicit_value?(:realm_id),
:user_set => user_set?(:realm_id)
:user_set => user_set?(:realm_id),
},
{ :help_inline => :indicator }
).html_safe
Expand Down
12 changes: 6 additions & 6 deletions app/helpers/hosts_helper.rb
Expand Up @@ -157,7 +157,7 @@ def multiple_actions
[_('Disable Notifications'), multiple_disable_hosts_path],
[_('Enable Notifications'), multiple_enable_hosts_path],
[_('Disassociate Hosts'), multiple_disassociate_hosts_path],
[_('Rebuild Config'), rebuild_config_hosts_path]
[_('Rebuild Config'), rebuild_config_hosts_path],
]
actions.insert(1, [_('Build Hosts'), multiple_build_hosts_path]) if SETTINGS[:unattended]
actions << [_('Assign Organization'), select_multiple_organization_hosts_path] if SETTINGS[:organizations_enabled]
Expand Down Expand Up @@ -258,8 +258,8 @@ def overview_fields(host)
[
_("Status"),
content_tag(:span, ''.html_safe, :class => host_global_status_icon_class(global_status.status)) +
content_tag(:span, _(global_status.to_label), :class => host_global_status_class(global_status.status))
]
content_tag(:span, _(global_status.to_label), :class => host_global_status_class(global_status.status)),
],
]
fields += host_detailed_status_list(host)
fields += [[_("Build duration"), build_duration(host)]]
Expand Down Expand Up @@ -294,7 +294,7 @@ def host_detailed_status_list(host)
[
_(status.name),
content_tag(:span, ' '.html_safe, :class => host_global_status_icon_class(status.to_global)) +
content_tag(:span, _(status.to_label), :class => host_global_status_class(status.to_global))
content_tag(:span, _(status.to_label), :class => host_global_status_class(status.to_global)),
]
end.compact
end
Expand Down Expand Up @@ -328,7 +328,7 @@ def host_title_actions(host)
:id => "build-review",
:data => { :toggle => 'modal',
:target => '#review_before_build',
:url => review_before_build_host_path(:id => host)
:url => review_before_build_host_path(:id => host),
}
)
end
Expand Down Expand Up @@ -397,7 +397,7 @@ def show_appropriate_host_buttons(host)
link_to_if_authorized(_("Audits"), hash_for_host_audits_path(:host_id => @host), :title => _("Host audit entries"), :class => 'btn btn-default'),
(link_to_if_authorized(_("Facts"), hash_for_host_facts_path(:host_id => host), :title => _("Browse host facts"), :class => 'btn btn-default') if host.fact_values.any?),
(link_to_if_authorized(_("Reports"), hash_for_host_config_reports_path(:host_id => host), :title => _("Browse host config management reports"), :class => 'btn btn-default') if host.reports.any?),
(link_to(_("YAML"), externalNodes_host_path(:name => host), :title => _("Puppet external nodes YAML dump"), :class => 'btn btn-default') if SmartProxy.with_features("Puppet").any?)
(link_to(_("YAML"), externalNodes_host_path(:name => host), :title => _("Puppet external nodes YAML dump"), :class => 'btn btn-default') if SmartProxy.with_features("Puppet").any?),
].compact
end

Expand Down

0 comments on commit f2ee562

Please sign in to comment.