Skip to content
Open
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
1 change: 0 additions & 1 deletion ruby/app/controller/controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
class SomeController < Rails::ActionController

end
23 changes: 9 additions & 14 deletions ruby/code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,29 @@
# encoding: ascii

# Raises "use of deprecated BigDecimal.new"
a = { 'hello' => 'world', 'testing' => BigDecimal.new(123.456, 3) }
a = { 'hello' => 'world', 'testing' => BigDecimal(123.456, 3) }

# Raises "`while`/`until` detected in `begin` block"
begin
do_something
end while a == b

# Raises "multiple comparison detected"
x < y < z
10 <= x <= 20
x < y && y < z
10 <= x && x <= 20

# Raises "empty rescue block detected"
begin
bar
rescue
rescue StandardError
end

# Raises "redundant `else`-clause detected"
if bar
else
end

# Raises "unused method arguments detected"
def some_method(bar)
def some_method(_bar)
puts 'Hello'
end

Expand All @@ -49,17 +48,16 @@ def some_method
end

# Raises "Deprecated way of initializing OpenSSL::Cipher and OpenSSL::Digest"
OpenSSL::Cipher::AES.new(128, :GCM)
OpenSSL::Cipher.new('aes-128-gcm')

# Raises "put empty method definitions on a single line"
# Also raises "multiple methods with same name in the same scope" as we have a
# method with same name above
def some_method
end
def some_method; end

# Raises "Invalid annotation keyword format detected"
def foo
# TODO Replace this with bar
# TODO: Replace this with bar
do_something
end

Expand All @@ -70,14 +68,11 @@ def foo
# Raises "Hash merging can be replaced by hash key assignment"
my_hash.merge!('key': value)


# Raises "Use `size` instead of `count`"
[1, 2, 3].count

file_path = 'path/to/some/file'
unless File.exist?(file_path)
FileUtils.remove file_path
end
FileUtils.remove file_path unless File.exist?(file_path)

case current_year when 1985..
dont_time_travel
Expand Down