Skip to content

Commit

Permalink
rubocop: fixed "Space missing inside block"
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Nov 26, 2014
1 parent 577f9ff commit fc712b4
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 34 deletions.
6 changes: 0 additions & 6 deletions .rubocop.yml
Expand Up @@ -122,12 +122,6 @@ Style/PredicateName:
Style/SignalException:
EnforcedStyle: only_raise

# Offense count: 52
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
Style/SpaceInsideBlockBraces:
Enabled: false

# Offense count: 24
# Cop supports --auto-correct.
Style/SpaceInsideBrackets:
Expand Down
2 changes: 1 addition & 1 deletion src/clients/inst_scc.rb
Expand Up @@ -396,7 +396,7 @@ def register_selected_addons

# move from selected to registered
product.registered
@selected_addons.reject! {|selected| selected.identifier == product.identifier}
@selected_addons.reject! { |selected| selected.identifier == product.identifier }
end
end

Expand Down
14 changes: 7 additions & 7 deletions src/lib/registration/sw_mgmt.rb
Expand Up @@ -104,7 +104,7 @@ def self.find_base_product
end

log.debug "Found base products: #{products}"
log.info "Found base products: #{products.map {|p| p["name"]}}"
log.info "Found base products: #{products.map { |p| p["name"] }}"
log.warn "More than one base product found!" if products.size > 1

products.first
Expand Down Expand Up @@ -232,12 +232,12 @@ def self.service_repos(product_service, only_updates: false)
log.info "Added service: #{service_name.inspect}"

# select only repositories belonging to the product services
repos = repo_data.select {|repo| service_name == repo["service"]}
repos = repo_data.select { |repo| service_name == repo["service"] }
log.info "Service repositories: #{repos}"

if only_updates
# leave only update repositories
repos.select! {|repo| repo["is_update_repo"]}
repos.select! { |repo| repo["is_update_repo"] }
log.info "Found update repositories: #{repos}"
end

Expand Down Expand Up @@ -315,7 +315,7 @@ def self.find_addon_updates(addons)
product["status"] == :installed && product["type"] != "base"
end

product_names = installed_addons.map {|a| "#{a["name"]}-#{a["version"]}-#{a["release"]}"}
product_names = installed_addons.map { |a| "#{a["name"]}-#{a["version"]}-#{a["release"]}" }
log.info "Installed addons: #{product_names}"

ret = addons.select do |addon|
Expand Down Expand Up @@ -370,13 +370,13 @@ def self.select_addon_products
products = Pkg.ResolvableProperties("", :product, "")
products.select! do |product|
product["status"] == :available &&
new_repos.any? {|new_repo| product["source"] == new_repo["SrcId"]}
new_repos.any? { |new_repo| product["source"] == new_repo["SrcId"] }
end
products.map! {|product| product["name"]}
products.map! { |product| product["name"] }

log.info "Products to install: #{products}"

products.all? {|product| Pkg.ResolvableInstall(product, :product)}
products.all? { |product| Pkg.ResolvableInstall(product, :product) }
end

private_class_method :each_repo
Expand Down
2 changes: 1 addition & 1 deletion src/lib/registration/ui/addon_selection_dialog.rb
Expand Up @@ -174,7 +174,7 @@ def handle_next_button

def handle_addon_selection(id)
# check whether it's an add-on ID (checkbox clicked)
addon = @addons.find {|a| a.identifier == id}
addon = @addons.find { |a| a.identifier == id }
return unless addon

show_addon_details(addon)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/registration/ui/autoyast_addon_dialog.rb
Expand Up @@ -110,7 +110,7 @@ def selected_addon
end

def find_addon(name)
addons.find {|a| a["name"] == name}
addons.find { |a| a["name"] == name }
end

def delete_addon
Expand Down
2 changes: 1 addition & 1 deletion src/lib/registration/ui/autoyast_config_workflow.rb
Expand Up @@ -113,7 +113,7 @@ def addons_eula
end

def collect_known_reg_codes
Hash[config.addons.map {|a| [a["name"], a["reg_code"]]}]
Hash[config.addons.map { |a| [a["name"], a["reg_code"]] }]
end

def addons_reg_codes
Expand Down
12 changes: 6 additions & 6 deletions test/addon_spec.rb
Expand Up @@ -43,7 +43,7 @@
)

addons = Registration::Addon.find_all(registration)
expect(addons.any? {|addon| addon.children.size == 1}).to be_true
expect(addons.any? { |addon| addon.children.size == 1 }).to be_true
expect(addons.any?(&:depends_on)).to be_true
end

Expand All @@ -57,8 +57,8 @@

addons = Registration::Addon.find_all(registration)

addon1 = addons.find { |addon| addon.name == "prod1"}
addon2 = addons.find { |addon| addon.name == "prod2"}
addon1 = addons.find { |addon| addon.name == "prod1" }
addon2 = addons.find { |addon| addon.name == "prod2" }

expect(addon1.registered?).to be_true
expect(addon2.registered?).to be_false
Expand All @@ -72,7 +72,7 @@

addons = Registration::Addon.find_all(registration)

ha = addons.find { |addon| addon.identifier == "sle-ha"}
ha = addons.find { |addon| addon.identifier == "sle-ha" }
ha_geo = ha.children.first

expect(ha.registered?).to be_true
Expand Down Expand Up @@ -101,7 +101,7 @@

it "do nothing if addon is not registered" do
expect(Registration::Addon.registered).to_not include(addon)
expect {addon.unregistered}.to_not raise_error
expect { addon.unregistered }.to_not raise_error
end
end

Expand Down Expand Up @@ -135,7 +135,7 @@
end

it "do nothing if addon is not selected" do
expect {addon.unselected}.to_not raise_error
expect { addon.unselected }.to_not raise_error
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/downloader_spec.rb
Expand Up @@ -42,7 +42,7 @@
with(an_instance_of(Net::HTTP::Get)).and_return(index)
expect_any_instance_of(Net::HTTP).to receive(:proxy?).and_return(false)

expect {Registration::Downloader.download(url)}.to raise_error Registration::DownloadError,
expect { Registration::Downloader.download(url) }.to raise_error Registration::DownloadError,
"Downloading #{url} failed: Not Found"
end

Expand Down
4 changes: 2 additions & 2 deletions test/eula_downloader_spec.rb
Expand Up @@ -16,7 +16,7 @@
Dir.mktmpdir do |tmpdir|
loader = Registration::EulaDownloader.new("https://example.com/eula", tmpdir)

expect {loader.download}.not_to raise_error
expect { loader.download }.not_to raise_error

# the index file is not saved
expect(Dir.entries(tmpdir)).to match_array([".", "..", "license.txt", "license.de.txt"])
Expand All @@ -33,7 +33,7 @@
Dir.mktmpdir do |tmpdir|
loader = Registration::EulaDownloader.new("http://example.com/eula", tmpdir)

expect {loader.download}.to raise_error RuntimeError, "Downloading failed"
expect { loader.download }.to raise_error RuntimeError, "Downloading failed"

# nothing saved
expect(Dir.entries(tmpdir)).to match_array([".", ".."])
Expand Down
2 changes: 1 addition & 1 deletion test/finish_dialog_test.rb
Expand Up @@ -68,7 +68,7 @@
end

it "raises RuntimeError if unknown action passed as first parameter" do
expect {subject.run("non_existing_action")}.to(
expect { subject.run("non_existing_action") }.to(
raise_error(RuntimeError)
)
end
Expand Down
8 changes: 4 additions & 4 deletions test/helpers_spec.rb
Expand Up @@ -85,7 +85,7 @@
expect(File).to receive(:exist?).with(cert_file).and_return(false)
expect(FileUtils).to receive(:cp).never

expect {Registration::Helpers.copy_certificate_to_target}.to_not raise_error
expect { Registration::Helpers.copy_certificate_to_target }.to_not raise_error
end

it "copies the certificate and updates all certificate links" do
Expand All @@ -96,7 +96,7 @@
expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash"),
SUSE::Connect::SSLCertificate::UPDATE_CERTIFICATES)

expect {Registration::Helpers.copy_certificate_to_target}.to_not raise_error
expect { Registration::Helpers.copy_certificate_to_target }.to_not raise_error
end
end

Expand All @@ -107,14 +107,14 @@
expect(File).to receive(:exist?).with(credentials).and_return(false)
expect(File).to receive(:unlink).never

expect {Registration::Helpers.reset_registration_status}.to_not raise_error
expect { Registration::Helpers.reset_registration_status }.to_not raise_error
end

it "removes system credentials if present" do
expect(File).to receive(:exist?).with(credentials).and_return(true)
expect(File).to receive(:unlink).with(credentials)

expect {Registration::Helpers.reset_registration_status}.to_not raise_error
expect { Registration::Helpers.reset_registration_status }.to_not raise_error
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/registration_spec.rb
Expand Up @@ -55,7 +55,7 @@
expect(Registration::SwMgmt).to receive(:add_service)

expect(Registration::Addon).to receive(:find_all).and_return(available_addons)
expect(available_addons.find { |addon| addon.identifier == "sle-sdk"}).to \
expect(available_addons.find { |addon| addon.identifier == "sle-sdk" }).to \
receive(:registered)

allow(File).to receive(:exist?).with(
Expand Down
2 changes: 1 addition & 1 deletion test/sw_mgmt_spec.rb
Expand Up @@ -119,7 +119,7 @@

describe ".copy_old_credentials" do
let(:root_dir) { "/mnt" }
let(:target_dir) {SUSE::Connect::Credentials::DEFAULT_CREDENTIALS_DIR}
let(:target_dir) { SUSE::Connect::Credentials::DEFAULT_CREDENTIALS_DIR }

before do
expect(Registration::SwMgmt).to receive(:zypp_config_writable!)
Expand Down
2 changes: 1 addition & 1 deletion test/url_helpers_spec.rb
Expand Up @@ -171,7 +171,7 @@

it "raises URI::InvalidURIError when URL is invalid" do
url = ":foo:"
expect {Registration::UrlHelpers.credentials_from_url(url)}.to raise_error(URI::InvalidURIError)
expect { Registration::UrlHelpers.credentials_from_url(url) }.to raise_error(URI::InvalidURIError)
end
end

Expand Down

0 comments on commit fc712b4

Please sign in to comment.