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

[Rubocop] Enable Lint/UselessAssignment

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