Skip to content
This repository was archived by the owner on Jan 3, 2026. It is now read-only.

Conversation

@goofmint
Copy link
Owner

No description provided.

item.set('Boolean', true)
item.set('Array', [i, i * 2, i * 3, 'Orange', 'Tomato'])
item.set('Object', {test1: 'a', test2: 'b'})
item.set('Object', { test1: 'a', test2: 'b' })
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Redundant curly braces around a hash parameter.

# @todo = @todo.limit(20).inArray("Array", [4])
# @todo = @todo.limit(20).notInArray("Array", ['Orange'])
# @todo = @todo.limit(20).allInArray("Array", [1, 2, 4])
=begin
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Do not use block comments. :ref
  • Use only ascii symbols in comments. :ref

# @todo = @todo.limit(20).notInArray("Array", ['Orange'])
# @todo = @todo.limit(20).allInArray("Array", [1, 2, 4])
=begin
@todo = @todo.limit(20).where("String", 'テスト100').greaterThan("Integer", 1)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Use only ascii symbols in comments. :ref

# @todo = @todo.limit(20).allInArray("Array", [1, 2, 4])
=begin
@todo = @todo.limit(20).where("String", 'テスト100').greaterThan("Integer", 1)
@todo = @todo.limit(20).notEqualTo("String", 'テスト100')
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Use only ascii symbols in comments. :ref

=begin
@todo = @todo.limit(20).where("String", 'テスト100').greaterThan("Integer", 1)
@todo = @todo.limit(20).notEqualTo("String", 'テスト100')
@todo = @todo.limit(20).in("String", ['テスト100'])
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Use only ascii symbols in comments. :ref

testKey: 'testValue'
}
}
{ where: {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Redundant curly braces around a hash parameter.

}
{ where: {
testKey: 'testValue'
}}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Space inside } missing. :ref

item.set('Boolean', true)
item.set('Array', [i, i * 2, i * 3, 'Orange', 'Tomato'])
item.set('Object', {test1: 'a', test2: 'b'})
item.set('Object', { test1: 'a', test2: 'b' })
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Redundant curly braces around a hash parameter.


def deletable?
if self.acl['*'.to_sym][:write] == true
if acl['*'.to_sym][:write] == true
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||. :ref

end
alias :update :put
alias update put
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Use a guard clause instead of wrapping the code inside a conditional expression. :ref

queries.each do |k, v|
v = array2hash(v) if v.is_a? Array
value = URI.encode(v.is_a?(Hash) ? v.to_json : v.to_s).gsub("[", "%5B").gsub(":", "%3A").gsub("]", "%5D")
value = URI.encode(v.is_a?(Hash) ? v.to_json : v.to_s).gsub('[', '%5B').gsub(':', '%3A').gsub(']', '%5D')
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Line is too long. [113/80] :ref

signature_base << @domain
signature_base << path
signature_base << params.collect{|k,v| "#{k}=#{v}"}.join("&")
signature_base << params.collect{|k,v| "#{k}=#{v}"}.join('&')
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Space missing to the left of {.
  • Space between { and | missing.
  • Space missing after comma. :ref
  • Space missing inside }.

"#{key}=#{value}"
end.join("&")
path = path + (query == '' ? "" : "?"+query)
path = path + (query == '' ? '' : "?"+query)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Use self-assignment shorthand +=. :ref
  • Prefer single-quoted strings when you don't need string interpolation or special symbols. :ref
  • Surrounding space missing for operator +. :ref

boundary = SecureRandom.uuid
req.body = make_boundary(boundary, queries)
headers["Content-Type"] = "multipart/form-data; boundary=#{boundary}"
headers['Content-Type'] = "multipart/form-data; boundary=#{boundary}"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Line is too long. [81/80] :ref

boundary = SecureRandom.uuid
req.body = make_boundary(boundary, queries)
headers["Content-Type"] = "multipart/form-data; boundary=#{boundary}"
headers['Content-Type'] = "multipart/form-data; boundary=#{boundary}"
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Line is too long. [81/80] :ref

end
end
new_v = new_v.sort_by{|a, b| a.to_s}.to_h
new_v = new_v.sort_by{ |a, b| a.to_s }.to_h
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Space missing to the left of {.
  • Unused block argument - b. If it's necessary, use _ or _b as an argument name to indicate that it won't be used. :ref

v = array2hash(v) if v.is_a? Array
value = URI.encode(v.is_a?(Hash) ? v.to_json : v.to_s).gsub("[", "%5B").gsub(":", "%3A").gsub("]", "%5D")
value = URI.encode(v.is_a?(Hash) ? v.to_json : v.to_s)
.encode("UTF-8")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Align .encode with .encode on line 63.
  • Prefer single-quoted strings when you don't need string interpolation or special symbols. :ref

value = URI.encode(v.is_a?(Hash) ? v.to_json : v.to_s).gsub("[", "%5B").gsub(":", "%3A").gsub("]", "%5D")
value = URI.encode(v.is_a?(Hash) ? v.to_json : v.to_s)
.encode("UTF-8")
.gsub('[', '%5B')
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Align .gsub with .encode on line 63.

value = URI.encode(v.is_a?(Hash) ? v.to_json : v.to_s)
.encode("UTF-8")
.gsub('[', '%5B')
.gsub(':', '%3A')
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Align .gsub with .encode on line 63.

.encode("UTF-8")
.gsub('[', '%5B')
.gsub(':', '%3A')
.gsub(']', '%5D')
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Align .gsub with .encode on line 63.

params = params.sort_by{|a, b| a.to_s}.to_h
params = params.merge 'X-NCMB-Timestamp' => now
if [].respond_to?('to_h') # Array#to_h inpremented over ruby 2.1
params = params.sort_by { |a, b| a.to_s }.to_h
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Unused block argument - b. If it's necessary, use _ or _b as an argument name to indicate that it won't be used. :ref

else
sorted_params = {}
params = params.sort_by{|a, b| a.to_s}.each {|kv|
params = params.sort_by { |a, b| a.to_s }.each { |kv|
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Useless assignment to variable - params. :ref
  • Unused block argument - b. If it's necessary, use _ or _b as an argument name to indicate that it won't be used. :ref
  • Avoid using {...} for multi-line blocks. :ref

signature_base << params.collect { |k, v| "#{k}=#{v}" }.join('&')
Base64.encode64(
OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'),
@client_key,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Align the parameters of a method call if they span more than one line. :ref

Base64.encode64(
OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'),
@client_key,
signature_base.join("\n"))
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Align the parameters of a method call if they span more than one line. :ref

@goofmint
Copy link
Owner Author

Click here if you want to create rubocop's auto-correct Pull Request
Auto Correct by SideCI

See the documentation if you want to get more information about auto-correct.
Document

json = http.get(path, headers).body
else
json = JSON.parse(http.get(path, headers).body, symbolize_names: true)
json = JSON.parse(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Use 2 (not -5) spaces for indentation. :ref

end
rescue => e
@@last_error = e
@@last_error = e
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[rubocop]

  • Replace class var @@last_error with a class instance var. :ref

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants