-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid Ruby warnings #319
Avoid Ruby warnings #319
Conversation
lib/github_api/error.rb
Outdated
@@ -21,7 +21,7 @@ def initialize(message = $!) | |||
end | |||
|
|||
def backtrace | |||
if @response_message && @response_message.respond_to?(:backtrace) | |||
if defined?(@response_message) && @response_message && @response_message.respond_to?(:backtrace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [104/80]
@@ -35,7 +35,7 @@ def list(*args) | |||
# | |||
# @api public | |||
def get(*args) | |||
params = arguments(args, required: [:owner, :repo, :id]).params | |||
arguments(args, required: [:owner, :repo, :id]).params |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use %i or %I for an array of symbols.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@piotrmurach If I fix this according to the RuboCop rules now in place, the code will be invalid Ruby for the MRI 1.9.3 that's in the Travis test matrix.
lib/github_api/client/markdown.rb
Outdated
@@ -49,7 +49,7 @@ def render(*args) | |||
# | |||
def render_raw(*args) | |||
params = arguments(args).params | |||
mime_type, params['data'] = params['mime'], args.shift | |||
_mime_type, params['data'] = params['mime'], args.shift |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use parallel assignment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
lib/github_api/error.rb
Outdated
if | ||
defined?(@response_message) && | ||
@response_message && | ||
@response_message.respond_to?(:backtrace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align the operands of a condition in an if statement spanning multiple lines.
lib/github_api/error.rb
Outdated
if @response_message && @response_message.respond_to?(:backtrace) | ||
if | ||
defined?(@response_message) && | ||
@response_message && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align the operands of a condition in an if statement spanning multiple lines.
lib/github_api/error.rb
Outdated
@@ -21,7 +21,10 @@ def initialize(message = $!) | |||
end | |||
|
|||
def backtrace | |||
if @response_message && @response_message.respond_to?(:backtrace) | |||
if | |||
defined?(@response_message) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place the condition on the same line as if.
lib/github_api/error.rb
Outdated
if | ||
defined?(@response_message) && | ||
@response_message && | ||
@response_message.respond_to?(:backtrace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align the operands of a condition in an if statement spanning multiple lines.
lib/github_api/error.rb
Outdated
if @response_message && @response_message.respond_to?(:backtrace) | ||
if | ||
defined?(@response_message) && | ||
@response_message && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align the operands of a condition in an if statement spanning multiple lines.
lib/github_api/error.rb
Outdated
@@ -21,7 +21,10 @@ def initialize(message = $!) | |||
end | |||
|
|||
def backtrace | |||
if @response_message && @response_message.respond_to?(:backtrace) | |||
if | |||
defined?(@response_message) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place the condition on the same line as if.
1 similar comment
3a8d875
to
295fde5
Compare
Thanks for cleaning things up! ❤️ |
This PR was made when working on removing warnings in another project, and there were a few warnings output from this project.
To avoid warnings, this PR: