Showing 72 of 72 total issues
Line is too long. [91/80] Open
BosClient::Error.const_set(name.to_sym, Class.new(BosClient::Error)).new(message)
- Exclude checks
Unnecessary utf-8 encoding comment. Open
# encoding: UTF-8
- Exclude checks
Unnecessary utf-8 encoding comment. Open
# encoding: UTF-8
- Exclude checks
URI.encode
method is obsolete and should not be used. Instead, use CGI.escape
, URI.encode_www_form
or URI.encode_www_form_component
depending on your specific use case. Open
url_path = URI.encode(uri.path)
- Read upRead up
- Exclude checks
This cop identifies places where URI.escape
can be replaced by
CGI.escape
, URI.encode_www_form
or URI.encode_www_form_component
depending on your specific use case.
Also this cop identifies places where URI.unescape
can be replaced by
CGI.unescape
, URI.decode_www_form
or URI.decode_www_form_component
depending on your specific use case.
Example:
# bad
URI.escape('http://example.com')
URI.encode('http://example.com')
# good
CGI.escape('http://example.com')
URI.encode_www_form([['example', 'param'], ['lang', 'en']])
URI.encode_www_form(page: 10, locale: 'en')
URI.encode_www_form_component('http://example.com')
# bad
URI.unescape(enc_uri)
URI.decode(enc_uri)
# good
CGI.unescape(enc_uri)
URI.decode_www_form(enc_uri)
URI.decode_www_form_component(enc_uri)
Unnecessary utf-8 encoding comment. Open
# encoding: UTF-8
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression. Open
if ret[:data][:code]
- Read upRead up
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression
Example:
# bad
def test
if something
work
end
end
# good
def test
return unless something
work
end
# also good
def test
work if something
end
# bad
if something
raise 'exception'
else
ok
end
# good
raise 'exception' if something
ok
Missing top-level class documentation comment. Open
class Object
- Read upRead up
- Exclude checks
This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.
The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.
Example:
# bad
class Person
# ...
end
# good
# Description/Explanation of Person class
class Person
# ...
end
Line is too long. [82/80] Open
raise BosClient::Error.bos_error ret[:data][:code], ret[:data][:message]
- Exclude checks
Add an empty line after magic comments. Open
module BosClient
- Read upRead up
- Exclude checks
Checks for a newline after the final magic comment.
Example:
# good
# frozen_string_literal: true
# Some documentation for Person
class Person
# Some code
end
# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
# Some code
end
Line is too long. [83/80] Open
@bucket_host = "#{BosClient.scheme}://#{@name}.#{@location}.#{BosClient.url}"
- Exclude checks
Don't use parentheses around a method call. Open
objs.map { |obj| BosClient::Object.new ({bucket: self}.merge(obj)) }
- Read upRead up
- Exclude checks
This cop checks for redundant parentheses.
Example:
# bad
(x) if ((y.z).nil?)
# good
x if y.z.nil?
Add an empty line after magic comments. Open
require 'openssl'
- Read upRead up
- Exclude checks
Checks for a newline after the final magic comment.
Example:
# good
# frozen_string_literal: true
# Some documentation for Person
class Person
# Some code
end
# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
# Some code
end