Reputation: 1022
The Error -
Inspecting 1 file
C
Offenses:
hellotk.rb:7:17: C: Do not use semicolons to terminate expressions.
pack { padx 15; pady 15; side 'left'; }
^
1 file inspected, 1 offense detected
The File -
#!/usr/bin/ruby
require 'tk'
root = TkRoot.new { title 'Hello, World!' }
TkLabel.new(root) do
text 'Hello, World!'
pack { padx 15; pady 15; side 'left'; }
end
TkButton.new do
text 'Quit'
command 'exit'
pack('fill' => 'x')
end
Tk.mainloop
What would the appropriate formatting be to eliminate the ';' so that rubocop stops warning me that I am writing my file wrong? I want to eliminate this offense in the correct manner.
Upvotes: 2
Views: 1875
Reputation: 18784
It wants you to put your expressions on new lines, rather than separating them with a semicolon
pack {
padx 15
pady 15
side left
}
or
pack do
padx 15
pady 15
side left
end
Upvotes: 1