Commit 57d061c9 authored by Kyle Fuller's avatar Kyle Fuller

[Rubocop] Enable Lint/UselessAssignment

parent dedd11ab
......@@ -9,10 +9,6 @@
Lint/UselessAccessModifier:
Enabled: false
# Offense count: 32
Lint/UselessAssignment:
Enabled: false
# Offense count: 1
Metrics/BlockNesting:
Max: 4
......
......@@ -344,7 +344,6 @@ module Pod
def dependencies_to_fetch
@deps_to_fetch ||= begin
deps_to_fetch = []
deps_to_fetch_if_needed = []
deps_with_external_source = podfile.dependencies.select(&:external_source)
if update_mode == :all
......@@ -668,7 +667,7 @@ module Pod
project_path = compute_user_project_path(target_definition)
user_project = Xcodeproj::Project.open(project_path)
targets = compute_user_project_targets(target_definition, user_project)
platform = compute_platform_for_target_definition(target_definition, targets)
compute_platform_for_target_definition(target_definition, targets)
archs = compute_archs_for_target_definition(target_definition, targets)
@archs_by_target_def[target_definition] = archs
else
......
......@@ -46,7 +46,7 @@ module Pod
run_prepare_command
rescue Informative
raise
rescue Object => e
rescue Object
UI.notice("Error installing #{root_spec.name}")
clean!
raise
......
......@@ -48,7 +48,7 @@ module Pod
product.path = product_name
target.user_build_configurations.each do |bc_name, type|
configuration = @native_target.add_build_configuration(bc_name, type)
@native_target.add_build_configuration(bc_name, type)
end
@native_target.build_configurations.each do |configuration|
......
......@@ -44,7 +44,7 @@ module Pod
argv = [name, url]
argv << '--shallow' if name =~ /^master(-\d+)?$/
Command::Repo::Add.new(CLAide::ARGV.new(argv)).run
rescue Informative => e
rescue Informative
raise Informative, "Unable to add a source with url `#{url}` " \
"named `#{name}`.\nYou can try adding it manually in " \
'`~/.cocoapods/repos` or via `pod repo add`.'
......@@ -197,7 +197,7 @@ module Pod
begin
output = git!('pull --ff-only')
UI.puts output if show_output && !config.verbose?
rescue Informative => e
rescue Informative
UI.warn 'CocoaPods was not able to update the ' \
"`#{source.name}` repo. If this is an unexpected issue " \
'and persists you can inspect it running ' \
......@@ -314,7 +314,7 @@ module Pod
return {} unless yaml_file.exist?
begin
YAMLHelper.load_file(yaml_file)
rescue Informative => e
rescue Informative
raise Informative, "There was an error reading '#{yaml_file}'.\n" \
'Please consult http://blog.cocoapods.org/' \
'Repairing-Our-Broken-Specs-Repository/ ' \
......@@ -432,8 +432,8 @@ module Pod
else
base = ''
end
base += path.gsub(/.git$/, '').gsub(/^\//, '').
split('/').join('-')
base + path.gsub(/.git$/, '').gsub(/^\//, '').split('/').join('-')
end
case url.to_s.downcase
......
......@@ -51,8 +51,8 @@ module Pod
it 'creates a Podfile with targets from the project' do
Dir.chdir(temporary_directory) do
project = Xcodeproj::Project.new(temporary_directory + 'test.xcodeproj')
target1 = project.new_target(:application, 'AppA', :ios)
target2 = project.new_target(:application, 'AppB', :ios)
project.new_target(:application, 'AppA', :ios)
project.new_target(:application, 'AppB', :ios)
project.save
run_command('init')
......
......@@ -49,7 +49,7 @@ module Pod
it 'should use the given template URL' do
template_url = 'https://github.com/custom/template.git'
@sut.any_instance.expects(:git!).with("clone '#{template_url}' TestPod").once
sut = run_command('lib', 'create', 'TestPod', template_url)
run_command('lib', 'create', 'TestPod', template_url)
end
it 'should use the default URL if no template URL is given' do
......
......@@ -68,7 +68,7 @@ module Pod
source.should.exist?
target.should.not.exist?
output = run_command('setup')
run_command('setup')
source.should.not.exist?
target.should.exist?
......
......@@ -46,7 +46,7 @@ module Pod
it "warns the user if the file specified in the license doesn't exists" do
@spec.stubs(:license).returns(:type => 'MIT', :file => 'MISSING')
text_from_spec = @generator.send(:license_text, @spec)
@generator.send(:license_text, @spec)
UI.warnings.should.include 'Unable to read the license file'
end
......
......@@ -524,7 +524,7 @@ module Pod
it 'uses the lowest deployment target of the user targets if inferring the platform' do
user_project = Xcodeproj::Project.new('path')
target1 = user_project.new_target(:application, 'Target', :ios)
configuration1 = target1.build_configuration_list.build_configurations.first
target1.build_configuration_list.build_configurations.first
target1.build_configuration_list.set_setting('SDKROOT', 'iphoneos')
target1.build_configuration_list.set_setting('IPHONEOS_DEPLOYMENT_TARGET', '4.0')
......
......@@ -92,7 +92,7 @@ module Pod
pod_target_1 = PodTarget.new([], nil, config.sandbox)
pod_target_1.file_accessors = []
installer = Installer::FileReferencesInstaller.new(config.sandbox, [pod_target_1], @project)
roots = installer.send(:file_accessors).should == []
installer.send(:file_accessors).should == []
end
end
......
......@@ -188,7 +188,7 @@ module Pod
it 'raises if no workspace could be selected' do
@integrator.expects(:user_project_paths).returns(%w( project1 project2 ))
e = lambda { @integrator.send(:workspace_path) }.should.raise Informative
lambda { @integrator.send(:workspace_path) }.should.raise Informative
end
it 'returns the paths of the user projects' do
......
......@@ -14,7 +14,7 @@ end
# @return [Podfile]
#
def generate_podfile(pods = ['JSONKit'])
podfile = Pod::Podfile.new do
Pod::Podfile.new do
platform :ios
xcodeproj SpecHelper.fixture('SampleProject/SampleProject'), 'Test' => :debug, 'App Store' => :release
pods.each { |name| pod name }
......@@ -24,7 +24,7 @@ end
# @return [Podfile]
#
def generate_local_podfile
podfile = Pod::Podfile.new do
Pod::Podfile.new do
platform :ios
xcodeproj SpecHelper.fixture('SampleProject/SampleProject'), 'Test' => :debug, 'App Store' => :release
pod 'Reachability', :path => SpecHelper.fixture('integration/Reachability')
......@@ -494,7 +494,7 @@ module Pod
it 'saves the project to the given path' do
Xcodeproj::Project.any_instance.stubs(:recreate_user_schemes)
path = temporary_directory + 'Pods/Pods.xcodeproj'
temporary_directory + 'Pods/Pods.xcodeproj'
@installer.pods_project.expects(:save)
@installer.send(:write_pod_project)
end
......@@ -601,8 +601,6 @@ module Pod
it 'runs the pre install hooks' do
installer_rep = stub
pod_rep = stub
library_rep = stub
@installer.expects(:installer_rep).returns(installer_rep)
@installer.podfile.expects(:pre_install!).with(installer_rep)
......@@ -611,7 +609,6 @@ module Pod
it 'run_podfile_post_install_hooks' do
installer_rep = stub
target_installer_data = stub
@installer.expects(:installer_rep).returns(installer_rep)
@installer.podfile.expects(:post_install!).with(installer_rep)
......@@ -623,9 +620,6 @@ module Pod
pod_target_osx = PodTarget.new([@spec], nil, config.sandbox)
pod_target_ios.stubs(:name).returns('label')
pod_target_osx.stubs(:name).returns('label')
library_ios_rep = stub
library_osx_rep = stub
target_installer_data = stub
@installer.stubs(:pod_targets).returns([pod_target_ios, pod_target_osx])
@installer.stubs(:installer_rep).returns(stub)
......
......@@ -42,14 +42,14 @@ module Pod
end
it 'adds the group for a development Pod' do
path = config.sandbox.pod_dir('BananaLib')
config.sandbox.pod_dir('BananaLib')
group = @project.add_pod_group('BananaLib', @path, true)
group.parent.should == @project.development_pods
group.name.should == 'BananaLib'
end
it 'configures the path of a new Pod group' do
path = config.sandbox.pod_dir('BananaLib')
config.sandbox.pod_dir('BananaLib')
group = @project.add_pod_group('BananaLib', @path)
group.source_tree.should == '<group>'
group.path.should == 'BananaLib'
......@@ -57,7 +57,7 @@ module Pod
end
it 'configures the path of a new Pod group as absolute if requested' do
path = config.sandbox.pod_dir('BananaLib')
config.sandbox.pod_dir('BananaLib')
group = @project.add_pod_group('BananaLib', @path, false, true)
group.source_tree.should == '<absolute>'
group.path.should == @path.to_s
......
......@@ -15,7 +15,7 @@ def set_up_test_repo_for_update
end
def merge_conflict_version_yaml
text = <<-VERSION.strip_heredoc
<<-VERSION.strip_heredoc
---
<<<<<<< HEAD
min: 0.18.1
......@@ -91,7 +91,7 @@ module Pod
Source::Aggregate.any_instance.expects(:generate_search_index).returns('BananaLib' => {})
Source::Aggregate.any_instance.expects(:update_search_index).never
SourcesManager.updated_search_index = nil
sets = SourcesManager.search_by_name('BananaLib', true)
SourcesManager.search_by_name('BananaLib', true)
end
it 'updates the search index before performing a search if it exits' do
......@@ -100,7 +100,7 @@ module Pod
Source::Aggregate.any_instance.expects(:generate_search_index).never
Source::Aggregate.any_instance.expects(:update_search_index).returns('BananaLib' => {})
SourcesManager.updated_search_index = nil
sets = SourcesManager.search_by_name('BananaLib', true)
SourcesManager.search_by_name('BananaLib', true)
end
it 'returns the path of the search index' do
......
......@@ -298,7 +298,7 @@ module Pod
validator.expects(:podfile_from_spec).with(:osx, nil, nil).once
validator.expects(:podfile_from_spec).with(:ios, nil, nil).once
validator.expects(:podfile_from_spec).with(:ios, '7.0', nil).once
podfile = validator.send(:perform_extensive_analysis, validator.spec)
validator.send(:perform_extensive_analysis, validator.spec)
end
describe '#podfile_from_spec' do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment