Skip to content

Fix warnings in project #356

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

Merged
merged 1 commit into from
Nov 14, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ end
group :test do
gem 'cztop'
end

# Tests are failing on Ruby 3.3 because warnings related to OpenStruct are being written to the standard error output.
# This is being captured by Open3.capture2e and then mistakenly parsed as JSON.
# This gem can be removed when json gem is updated
gem 'ostruct'
2 changes: 1 addition & 1 deletion lib/iruby/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def register_kernel(argv)
opts.on(
"--display-name=VALUE", String,
"Specify the display name for the kernelspec. This is helpful when you have multiple IRuby kernels."
) {|v| kernel_display_name = v }
) {|v| params.display_name = v }

# TODO: --profile
# TODO: --prefix
Expand Down
4 changes: 3 additions & 1 deletion lib/iruby/backend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def initialize
@irb = IRB::Irb.new(@workspace)
@eval_path = @irb.context.irb_path
IRB.conf[:MAIN_CONTEXT] = @irb.context
@completor = IRB::RegexpCompletor.new
end

def eval_binding
Expand All @@ -62,7 +63,8 @@ def eval(code, store_history)
end

def complete(code)
IRB::InputCompletor::CompletionProc.call(code)
# preposing and postposing never used, so they are empty, pass only target as code
@completor.completion_candidates('', code, '', bind: @workspace.binding)
end

private
Expand Down
5 changes: 2 additions & 3 deletions lib/iruby/display.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ def ascii?(mime)
if FORCE_TEXT_TYPES.include?(mime)
true
else
MIME::Type.new(mime).ascii?
MIME::Type.new("content-type" => mime).ascii?
end
end

private def render_mimebundle(obj, exact_mime, fuzzy_mime)
data = {}
include_mime = [exact_mime].compact
formats, metadata = obj.to_iruby_mimebundle(include: include_mime)
formats, _metadata = obj.to_iruby_mimebundle(include: include_mime)
formats.each do |mime, value|
if fuzzy_mime.nil? || mime.include?(fuzzy_mime)
data[mime] = value
Expand Down Expand Up @@ -407,7 +407,6 @@ def format(mime = nil, &block)

type { Gruff::Base }
format 'image' do |obj|
image = obj.to_image
format_magick_image.(obj.to_image)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/iruby/ostream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def writelines(lines)

# Called by irb
def set_encoding(extern, intern)
a = extern
extern
end

private
Expand Down
2 changes: 1 addition & 1 deletion test/iruby/application/kernel_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def setup

add_kernel_options("--log=#{log_file}", boot_file)

out, status = Open3.capture2e(*iruby_command("console"), in: :close)
_out, status = Open3.capture2e(*iruby_command("console"), in: :close)
assert status.success?
assert_path_exist log_file
assert_match(/\bINFO -- bootfile: !!! LOG MESSAGE FROM BOOT FILE !!!$/, File.read(log_file))
Expand Down
2 changes: 1 addition & 1 deletion test/iruby/application/register_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def setup
test("a new IRuby kernel `#{DEFAULT_KERNEL_NAME}` will be installed in JUPYTER_DATA_DIR") do
assert_path_not_exist @kernel_json

out, status = Open3.capture2e(*iruby_command("register"))
_out, status = Open3.capture2e(*iruby_command("register"))
assert status.success?
assert_path_exist @kernel_json

Expand Down
Loading