Skip to content

Commit

Permalink
Rubocop: Upgrade to 0.13 by disabling some (but not all) new cops
Browse files Browse the repository at this point in the history
  • Loading branch information
David Davis committed Sep 17, 2013
1 parent 4d411f5 commit ee29e49
Show file tree
Hide file tree
Showing 95 changed files with 79 additions and 101 deletions.
9 changes: 8 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ SpaceAroundBraces:
BlockNesting:
Enabled: false # change to 4

AvoidPerlBackrefs:
PerlBackrefs:
Enabled: false # remove me

AlignHash:
Enabled: false # remove me

AlignArray:
Enabled: false # remove me

# end TODO
Expand All @@ -34,6 +40,7 @@ AllCops:
# TODO: remove these other paths as we fix them
- spec/**
- test/**
- config/navigation.rb

MethodLength:
Description: 'Avoid methods longer than 30 lines of code.'
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/api/v1/proxies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ def rules
case route.name
when "api_proxy_consumer_deletionrecord_delete_path"
if !User.consumer?
consumer_gone, consumer_live = false
consumer_gone = false
begin
Resources::Candlepin::Consumer.get params[:id] # check with candlepin if system is Gone, raises RestClient::Gone
# a 200 means the system exists. the deletion record wont exist, but its
# not a permissions error
consumer_live = true
rescue RestClient::Gone
# the correct response is a 410, since the system has been deleted
consumer_gone = true
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v2/distributors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class Api::V2::DistributorsController < Api::V1::DistributorsController

include Api::V2::Rendering

end
end
1 change: 0 additions & 1 deletion app/controllers/api/v2/role_ldap_groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ def create
end

end

1 change: 0 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -718,4 +718,3 @@ def default_notify_options
end

end

2 changes: 1 addition & 1 deletion app/controllers/sync_management_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

# rubocop:disable AvoidClassVars
# rubocop:disable ClassVars
class SyncManagementController < ApplicationController
include TranslationHelper
include ActionView::Helpers::DateHelper
Expand Down
1 change: 0 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -382,4 +382,3 @@ def repo_selector(repositories, url, field = :repository_id, record = nil)
end
end
end

2 changes: 1 addition & 1 deletion app/helpers/errata_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def errata_title(errata)
# Provide the errata title in the format of Advisory: Title. (E.g. "RHSA_2011:1230 : Package X security update").
# Remove from the title the severity, if included.
title = errata.errata_id # the id contains the advisory
title += " : " + errata.title.sub(/Critical: |Important: |Moderate: |Low: /, "")
title + (" : " + errata.title.sub(/Critical: |Important: |Moderate: |Low: /, ""))
end

def errata_human_type(type)
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/gpg_keys_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def gpg_content_limit
GpgKey::MAX_CONTENT_LENGTH
end

end
end
2 changes: 1 addition & 1 deletion app/helpers/menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ def prune_menu(menu_items)
end
end

end
end
2 changes: 1 addition & 1 deletion app/helpers/packages_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def previewed_changelog(lines)
more_lines = number_with_delimiter(lines.length - 10)
link_to((_("Show %s more line(s)") % more_lines), "", class: "show-more-changelog")
end
html += content_tag "div", :class => "more-changelog" do
html + content_tag("div", :class => "more-changelog") do
format_changelog_changes(lines[10..-1].join("\n"))
end
end
Expand Down
1 change: 0 additions & 1 deletion app/helpers/products_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@ def get_products(options)
@product_hash
end
end

1 change: 0 additions & 1 deletion app/helpers/promotions_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ def show_new_button?(manage_promotion, manage_deletion)
end

end

1 change: 0 additions & 1 deletion app/helpers/providers_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,3 @@ def label_from_url(provider, url)
end

end

1 change: 0 additions & 1 deletion app/helpers/repositories_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ def gpg_keys
GpgKey.readable(current_organization)
end
end

1 change: 0 additions & 1 deletion app/lib/api/v2/rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@ def try_specific_collection_template(action, common_action, options = {})
end
end
end

1 change: 0 additions & 1 deletion app/lib/authorization_rules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,3 @@ def param_rules
end

end

8 changes: 4 additions & 4 deletions app/lib/http_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def get(a_path, headers = {})
result
rescue RestClient::Exception => e
raise_rest_client_exception e, a_path, "GET"
rescue Errno::ECONNREFUSED => e
rescue Errno::ECONNREFUSED
service = a_path.split("/").second
raise Errors::ConnectionRefusedException, _("A backend service [ %s ] is unreachable") % service.capitalize
end
Expand All @@ -111,7 +111,7 @@ def post(a_path, payload = {}, headers = {})
result
rescue RestClient::Exception => e
raise_rest_client_exception e, a_path, "POST"
rescue Errno::ECONNREFUSED => e
rescue Errno::ECONNREFUSED
service = a_path.split("/").second
raise Errors::ConnectionRefusedException, _("A backend service [ %s ] is unreachable") % service.capitalize
end
Expand All @@ -125,7 +125,7 @@ def put(a_path, payload = {}, headers = {})
result
rescue RestClient::Exception => e
raise_rest_client_exception e, a_path, "PUT"
rescue Errno::ECONNREFUSED => e
rescue Errno::ECONNREFUSED
service = a_path.split("/").second
raise Errors::ConnectionRefusedException, _("A backend service [ %s ] is unreachable") % service.capitalize
end
Expand All @@ -139,7 +139,7 @@ def delete(a_path = nil, headers = {})
result
rescue RestClient::Exception => e
raise_rest_client_exception e, a_path, "DELETE"
rescue Errno::ECONNREFUSED => e
rescue Errno::ECONNREFUSED
service = a_path.split("/").second
raise Errors::ConnectionRefusedException, _("A backend service [ %s ] is unreachable") % service.capitalize
end
Expand Down
2 changes: 1 addition & 1 deletion app/lib/navigation/dashboard_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def menu_dashboard
end

end
end
end
2 changes: 1 addition & 1 deletion app/lib/navigation/notifications_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ def menu_notifications
end

end
end
end
2 changes: 1 addition & 1 deletion app/lib/notifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@

# see {Notify} and what is defined inside the namespace
module Notifications
end
end
1 change: 0 additions & 1 deletion app/lib/notifications/notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,3 @@ def process_options(options)
return options
end
end

2 changes: 1 addition & 1 deletion app/lib/resources/candlepin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ def remove_content(product_id, content_id)
def create_unlimited_subscription(owner_key, product_id)
start_date ||= Date.today
# End it 100 years from now
end_date ||= start_date + 10950
end_date ||= start_date + 10_950

subscription = {
'startDate' => start_date,
Expand Down
2 changes: 1 addition & 1 deletion app/lib/validators/erratum_rule_params_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ def validate_each(record, attribute, value)
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/katello_label_format_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ def self.validate_length(record, attribute, value, max_length = 128, min_length
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/katello_url_format_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def validate_each(record, attribute, value)
end

end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/library_presence_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def validate_each(record, attribute, value)
record.errors[attribute] << N_("must contain '%s'") % "Library" if value.select {|e| e.library}.empty?
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/lock_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def validate(record)
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/no_trailing_space_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ def self.validate_trailing_space(record, attribute, value)
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/non_library_environment_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def validate_each(record, attribute, value)
record.errors[attribute] << N_("Cannot register a system to the '%s' environment") % "Library" if !record.environment.nil? && record.environment.library?
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/not_in_library_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def validate(record)
record.errors[:environment] << _("The '%s' environment cannot contain a changeset!") % "Library" if record.environment.library?
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/package_group_rule_params_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ def validate_each(record, attribute, value)
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/path_descendents_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ def is_duplicate?(record)
false
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/permission_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ def validate(record)
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/prior_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ def validate(record)
record.errors[:prior] << _("environment required") unless !record.prior.nil? || record.library?
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/repo_disablement_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ def validate(record)
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/rule_params_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ def validate_each(record, attribute, value)
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/rule_version_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ def validate_each(record, attribute, value)
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/self_reference_environment_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def validate(record)
record.errors[:base] << _("Environment cannot be in its own promotion path") if record.priors.select(:id).include? record.id
end
end
end
end
2 changes: 1 addition & 1 deletion app/lib/validators/serialized_params_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ def validate_each(record, attribute, value)
end
end
end
end
end
2 changes: 1 addition & 1 deletion app/models/authorization/content_view_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ def items(org, verbs)

end # end ClassMethods

end
end
3 changes: 0 additions & 3 deletions app/models/authorization/system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,16 @@ def any_systems_deletable?(systems)

included do
def readable?
sg_readable = false
sg_readable = !::SystemGroup.systems_readable(self.organization).where(:id => self.system_group_ids).empty?
environment.systems_readable? || sg_readable
end

def editable?
sg_editable = false
sg_editable = !::SystemGroup.systems_editable(self.organization).where(:id => self.system_group_ids).empty?
environment.systems_editable? || sg_editable
end

def deletable?
sg_deletable = false
sg_deletable = !::SystemGroup.systems_deletable(self.organization).where(:id => self.system_group_ids).empty?
environment.systems_deletable? || sg_deletable
end
Expand Down
1 change: 0 additions & 1 deletion app/models/candlepin/content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ def load_attributes(params)
params.each_pair {|k, v| instance_variable_set("@#{k}", v) unless v.nil? }
end
end

1 change: 0 additions & 1 deletion app/models/candlepin/product_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,3 @@ def refresh_repositories
end

end

1 change: 0 additions & 1 deletion app/models/changeset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,3 @@ def update_progress!(percent)
end

end

2 changes: 1 addition & 1 deletion app/models/cp_consumer_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ def cp_oauth_header
{ 'cp-consumer' => self.uuid }
end

end
end
2 changes: 1 addition & 1 deletion app/models/filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def clone_for_archive

def repos(env)
repos = self.products.map { |prod| prod.repos(env) }.flatten.reject(&:puppet?)
repos += repositories
repos + repositories
end

def puppet_repository
Expand Down
2 changes: 1 addition & 1 deletion app/models/glue/candlepin/consumer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def refresh_subscriptions
def del_candlepin_consumer
Rails.logger.debug "Deleting consumer in candlepin: #{name}"
Resources::Candlepin::Consumer.destroy(self.uuid)
rescue RestClient::Gone => e
rescue RestClient::Gone
#ignore already deleted system
true
rescue => e
Expand Down
Loading

0 comments on commit ee29e49

Please sign in to comment.