Skip to content

Commit aa7cd9c

Browse files
authored
Fix warnings in project (#356)
1 parent 12b07c4 commit aa7cd9c

File tree

7 files changed

+14
-8
lines changed

7 files changed

+14
-8
lines changed

Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ end
1515
group :test do
1616
gem 'cztop'
1717
end
18+
19+
# Tests are failing on Ruby 3.3 because warnings related to OpenStruct are being written to the standard error output.
20+
# This is being captured by Open3.capture2e and then mistakenly parsed as JSON.
21+
# This gem can be removed when json gem is updated
22+
gem 'ostruct'

lib/iruby/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def register_kernel(argv)
265265
opts.on(
266266
"--display-name=VALUE", String,
267267
"Specify the display name for the kernelspec. This is helpful when you have multiple IRuby kernels."
268-
) {|v| kernel_display_name = v }
268+
) {|v| params.display_name = v }
269269

270270
# TODO: --profile
271271
# TODO: --prefix

lib/iruby/backend.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def initialize
5050
@irb = IRB::Irb.new(@workspace)
5151
@eval_path = @irb.context.irb_path
5252
IRB.conf[:MAIN_CONTEXT] = @irb.context
53+
@completor = IRB::RegexpCompletor.new
5354
end
5455

5556
def eval_binding
@@ -62,7 +63,8 @@ def eval(code, store_history)
6263
end
6364

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

6870
private

lib/iruby/display.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ def ascii?(mime)
113113
if FORCE_TEXT_TYPES.include?(mime)
114114
true
115115
else
116-
MIME::Type.new(mime).ascii?
116+
MIME::Type.new("content-type" => mime).ascii?
117117
end
118118
end
119119

120120
private def render_mimebundle(obj, exact_mime, fuzzy_mime)
121121
data = {}
122122
include_mime = [exact_mime].compact
123-
formats, metadata = obj.to_iruby_mimebundle(include: include_mime)
123+
formats, _metadata = obj.to_iruby_mimebundle(include: include_mime)
124124
formats.each do |mime, value|
125125
if fuzzy_mime.nil? || mime.include?(fuzzy_mime)
126126
data[mime] = value
@@ -407,7 +407,6 @@ def format(mime = nil, &block)
407407

408408
type { Gruff::Base }
409409
format 'image' do |obj|
410-
image = obj.to_image
411410
format_magick_image.(obj.to_image)
412411
end
413412

lib/iruby/ostream.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def writelines(lines)
4848

4949
# Called by irb
5050
def set_encoding(extern, intern)
51-
a = extern
51+
extern
5252
end
5353

5454
private

test/iruby/application/kernel_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def setup
8383

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

86-
out, status = Open3.capture2e(*iruby_command("console"), in: :close)
86+
_out, status = Open3.capture2e(*iruby_command("console"), in: :close)
8787
assert status.success?
8888
assert_path_exist log_file
8989
assert_match(/\bINFO -- bootfile: !!! LOG MESSAGE FROM BOOT FILE !!!$/, File.read(log_file))

test/iruby/application/register_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def setup
6161
test("a new IRuby kernel `#{DEFAULT_KERNEL_NAME}` will be installed in JUPYTER_DATA_DIR") do
6262
assert_path_not_exist @kernel_json
6363

64-
out, status = Open3.capture2e(*iruby_command("register"))
64+
_out, status = Open3.capture2e(*iruby_command("register"))
6565
assert status.success?
6666
assert_path_exist @kernel_json
6767

0 commit comments

Comments
 (0)