Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some unused method parameters #21722

Merged
merged 5 commits into from Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions fastlane/lib/fastlane/command_line_handler.rb
Expand Up @@ -26,14 +26,12 @@ def self.handle(args, options)
lane = platform_lane_info[0]
end

dot_env = Helper.test? ? nil : options.env

if FastlaneCore::FastlaneFolder.swift?
disable_runner_upgrades = options.disable_runner_upgrades || false
swift_server_port = options.swift_server_port
Fastlane::SwiftLaneManager.cruise_lane(lane, lane_parameters, dot_env, disable_runner_upgrades: disable_runner_upgrades, swift_server_port: swift_server_port)
Fastlane::SwiftLaneManager.cruise_lane(lane, lane_parameters, disable_runner_upgrades: disable_runner_upgrades, swift_server_port: swift_server_port)
else
Fastlane::LaneManager.cruise_lane(platform, lane, lane_parameters, dot_env)
Fastlane::LaneManager.cruise_lane(platform, lane, lane_parameters)
end
end

Expand Down
3 changes: 1 addition & 2 deletions fastlane/lib/fastlane/lane_manager.rb
Expand Up @@ -5,9 +5,8 @@ class LaneManager < LaneManagerBase
# @param platform The name of the platform to execute
# @param lane_name The name of the lane to execute
# @param parameters [Hash] The parameters passed from the command line to the lane
# @param env Dot Env Information
# @param A custom Fastfile path, this is used by fastlane.ci
def self.cruise_lane(platform, lane, parameters = nil, env = nil, fastfile_path = nil)
def self.cruise_lane(platform, lane, parameters = nil, fastfile_path = nil)
UI.user_error!("lane must be a string") unless lane.kind_of?(String) || lane.nil?
UI.user_error!("platform must be a string") unless platform.kind_of?(String) || platform.nil?
UI.user_error!("parameters must be a hash") unless parameters.kind_of?(Hash) || parameters.nil?
Expand Down
7 changes: 2 additions & 5 deletions fastlane/lib/fastlane/swift_lane_manager.rb
Expand Up @@ -5,8 +5,7 @@ module Fastlane
class SwiftLaneManager < LaneManagerBase
# @param lane_name The name of the lane to execute
# @param parameters [Hash] The parameters passed from the command line to the lane
# @param env Dot Env Information
def self.cruise_lane(lane, parameters = nil, env = nil, disable_runner_upgrades: false, swift_server_port: nil)
def self.cruise_lane(lane, parameters = nil, disable_runner_upgrades: false, swift_server_port: nil)
UI.user_error!("lane must be a string") unless lane.kind_of?(String) || lane.nil?
UI.user_error!("parameters must be a hash") unless parameters.kind_of?(Hash) || parameters.nil?

Expand Down Expand Up @@ -106,7 +105,7 @@ def self.cruise_swift_lane_in_thread(lane, parameters = nil, swift_server_port)
end
end

def self.swap_paths_in_target(target: nil, file_refs_to_swap: nil, expected_path_to_replacement_path_tuples: nil)
def self.swap_paths_in_target(file_refs_to_swap: nil, expected_path_to_replacement_path_tuples: nil)
made_project_updates = false
file_refs_to_swap.each do |file_ref|
expected_path_to_replacement_path_tuples.each do |preinstalled_config_relative_path, user_config_relative_path|
Expand Down Expand Up @@ -198,14 +197,12 @@ def self.link_user_configs_to_project(updated_message: nil)

# Swap in all new user supplied configs into the project
project_modified = swap_paths_in_target(
target: runner_target,
file_refs_to_swap: target_file_refs,
expected_path_to_replacement_path_tuples: new_user_tool_file_paths
)

# Swap out any configs the user has removed, inserting fastlane defaults
project_modified = swap_paths_in_target(
target: runner_target,
file_refs_to_swap: target_file_refs,
expected_path_to_replacement_path_tuples: user_tool_files_possibly_removed
) || project_modified
Expand Down
8 changes: 3 additions & 5 deletions fastlane/spec/command_line_handler_spec.rb
@@ -1,21 +1,19 @@
describe Fastlane do
describe Fastlane::CommandLineHandler do
it "properly handles default calls" do
expect(Fastlane::LaneManager).to receive(:cruise_lane).with("ios", "deploy", {}, nil)
expect(Fastlane::LaneManager).to receive(:cruise_lane).with("ios", "deploy", {})
Fastlane::CommandLineHandler.handle(["ios", "deploy"], {})
end

it "properly handles calls with custom parameters" do
expect(Fastlane::LaneManager).to receive(:cruise_lane).with("ios", "deploy",
{ key: "value", build_number: '123' },
nil)
{ key: "value", build_number: '123' })
Fastlane::CommandLineHandler.handle(["ios", "deploy", "key:value", "build_number:123"], {})
end

it "properly converts boolean values to real boolean variables" do
expect(Fastlane::LaneManager).to receive(:cruise_lane).with("ios", "deploy",
{ key: true, key2: false },
nil)
{ key: true, key2: false })
Fastlane::CommandLineHandler.handle(["ios", "deploy", "key:true", "key2:false"], {})
end
end
Expand Down
2 changes: 1 addition & 1 deletion fastlane/spec/lane_manager_spec.rb
Expand Up @@ -46,7 +46,7 @@
it "Supports running a lane with custom Fastfile path" do
path = "./fastlane/spec/fixtures/fastfiles/FastfileCruiseLane"

ff = Fastlane::LaneManager.cruise_lane(nil, 'test', nil, nil, path)
ff = Fastlane::LaneManager.cruise_lane(nil, 'test', nil, path)
lanes = ff.runner.lanes
expect(lanes[nil][:test].description).to eq(["test description for cruise lanes"])
expect(lanes[:ios][:apple].description).to eq([])
Expand Down
6 changes: 3 additions & 3 deletions frameit/lib/frameit/editor.rb
Expand Up @@ -325,7 +325,7 @@ def put_title_into_background_stacked(background, title, keyword)
end

def put_title_into_background(background, stack_title)
text_images = build_text_images(image.width - 2 * horizontal_frame_padding, image.height - 2 * vertical_frame_padding, stack_title)
text_images = build_text_images(image.width - 2 * horizontal_frame_padding, image.height - 2 * vertical_frame_padding)

keyword = text_images[:keyword]
title = text_images[:title]
Expand Down Expand Up @@ -400,7 +400,7 @@ def keyword_padding
end

# This will build up to 2 individual images with the title and optional keyword, which will then be added to the real image
def build_text_images(max_width, max_height, stack_title)
lacostej marked this conversation as resolved.
Show resolved Hide resolved
def build_text_images(max_width, max_height)
words = [:keyword, :title].keep_if { |a| fetch_text(a) } # optional keyword/title
results = {}
trim_boxes = {}
Expand Down Expand Up @@ -439,7 +439,7 @@ def build_text_images(max_width, max_height, stack_title)

results[key] = text_image

# Natively trimming the image with .trim will result in the loss of the common baseline between the text in all images when side-by-side (e.g. stack_title is false).
# Natively trimming the image with .trim will result in the loss of the common baseline between the text in all images when side-by-side.
# Hence retrieve the calculated trim bounding box without actually trimming:
calculated_trim_box = text_image.identify do |b|
b.format("%@") # CALCULATED: trim bounding box (without actually trimming), see: http://www.imagemagick.org/script/escape.php
Expand Down
4 changes: 2 additions & 2 deletions snapshot/lib/snapshot/setup.rb
Expand Up @@ -19,7 +19,7 @@ def self.create(path, is_swift_fastfile: false, print_instructions_on_failure: f

if File.exist?(snapfile_path)
if print_instructions_on_failure
print_instructions(snapshot_helper_filename: snapshot_helper_filename, snapfile_path: snapfile_path)
print_instructions(snapshot_helper_filename: snapshot_helper_filename)
return
else
UI.user_error!("Snapfile already exists at path '#{snapfile_path}'. Run 'fastlane snapshot' to generate screenshots.")
Expand All @@ -37,7 +37,7 @@ def self.create(path, is_swift_fastfile: false, print_instructions_on_failure: f
print_instructions(snapshot_helper_filename: snapshot_helper_filename, snapfile_path: snapfile_path)
end

def self.print_instructions(snapshot_helper_filename: nil, snapfile_path: nil)
def self.print_instructions(snapshot_helper_filename: nil)
puts("Open your Xcode project and make sure to do the following:".yellow)
puts("1) Add a new UI Test target to your project".yellow)
puts("2) Add the ./fastlane/#{snapshot_helper_filename} to your UI Test target".yellow)
Expand Down
45 changes: 23 additions & 22 deletions snapshot/lib/snapshot/simulator_launchers/simulator_launcher.rb
Expand Up @@ -109,33 +109,34 @@ def execute(retries = 0, command: nil, language: nil, locale: nil, launch_args:
end
}
]
error_proc = proc do |output, return_code|
self.collected_errors.concat(failed_devices.map do |device, messages|
"#{device}: #{messages.join(', ')}"
end)

cleanup_after_failure(devices, language, locale, launch_args, return_code)

# no exception raised... that means we need to retry
UI.error("Caught error... #{return_code}")

self.current_number_of_retries_due_to_failing_simulator += 1
if self.current_number_of_retries_due_to_failing_simulator < 20 && return_code != 65
# If the return code is not 65, we should assume its a simulator failure and retry
launch_simultaneously(devices, language, locale, launch_args)
elsif retries < launcher_config.number_of_retries
# If there are retries remaining, run the tests again
retry_tests(retries, command, language, locale, launch_args, devices)
else
# It's important to raise an error, as we don't want to collect the screenshots
UI.crash!("Too many errors... no more retries...") if launcher_config.stop_after_first_error
end
end
FastlaneCore::CommandExecutor.execute(command: command,
print_all: true,
print_command: true,
prefix: prefix_hash,
loading: "Loading...",
error: proc do |output, return_code|
self.collected_errors.concat(failed_devices.map do |device, messages|
"#{device}: #{messages.join(', ')}"
end)

cleanup_after_failure(devices, language, locale, launch_args, return_code)

# no exception raised... that means we need to retry
UI.error("Caught error... #{return_code}")

self.current_number_of_retries_due_to_failing_simulator += 1
if self.current_number_of_retries_due_to_failing_simulator < 20 && return_code != 65
# If the return code is not 65, we should assume its a simulator failure and retry
launch_simultaneously(devices, language, locale, launch_args)
elsif retries < launcher_config.number_of_retries
# If there are retries remaining, run the tests again
retry_tests(retries, command, language, locale, launch_args, devices)
else
# It's important to raise an error, as we don't want to collect the screenshots
UI.crash!("Too many errors... no more retries...") if launcher_config.stop_after_first_error
end
end)
error: error_proc)
end

def cleanup_after_failure(devices, language, locale, launch_args, return_code)
Expand Down