-
Notifications
You must be signed in to change notification settings - Fork 46
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
Added RuboCop. #165
Added RuboCop. #165
Conversation
c9e4cfe
to
618e8b5
Compare
Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
@@ -424,14 +433,14 @@ def apply_headers(client, options) | |||
end | |||
|
|||
def find_value(hash, regex) | |||
key_value = hash.find { |k,v| k.to_s.downcase =~ regex } | |||
key_value = hash.find { |k, _v| k.to_s.downcase =~ regex } | |||
if key_value | |||
hash.delete(key_value[0]) | |||
key_value[1] | |||
end |
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.
(Not relevant to this PR but just a fun thought)
This could be a one-liner :P
hash.delete (hash.keys.find { |k| k.to_s.downcase =~ regex })
Because Hash#delete
will also return the value if the key is present, else nil
is returned.
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.
I think a good next step is to actually go through the code, fix rubocop violations instead of ignoring them, and improve things like these!
Description
Added RuboCop, target version is 2.5 which is our minimum Ruby. Ran
rubocop -a ; rubocop --auto-gen-config
.I added it at top level. It changed a few files :)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.