Skip to content
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

Merged
merged 2 commits into from
Apr 4, 2023
Merged

Added RuboCop. #165

merged 2 commits into from
Apr 4, 2023

Conversation

dblock
Copy link
Member

@dblock dblock commented Apr 3, 2023

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.

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
Copy link
Collaborator

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.

Copy link
Member Author

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!

@nhtruong nhtruong merged commit a8c421d into opensearch-project:main Apr 4, 2023
@dblock dblock deleted the rubocop branch April 4, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants