-
Notifications
You must be signed in to change notification settings - Fork 30
Add Rubocop configuration #130
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
base: main
Are you sure you want to change the base?
Conversation
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.
Just some things that jumped out to me.
class_name = if is_a? Class | ||
name | ||
else | ||
self.class.name | ||
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.
Perhaps even reduce it to a ternary
class_name = if is_a? Class | |
name | |
else | |
self.class.name | |
end | |
class_name = is_a?(Class) ? name : self.class.name |
if path !~ /\A#{Regexp.escape destdir}/ | ||
raise PuppetForge::InvalidPathInPackageError, :entry_path => path, :directory => destdir | ||
end | ||
return if /\A#{Regexp.escape destdir}/.match?(path) |
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.
Isn't this equal to
return if /\A#{Regexp.escape destdir}/.match?(path) | |
return path.start_with?(destdir) |
@@ -22,10 +21,10 @@ def initialize(json_response) | |||
end | |||
|
|||
def orm_resp_item(json_response) | |||
json_response.each do |key, value| | |||
json_response.each do |key, _value| |
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.
json_response.each do |key, _value| | |
json_response.each_key do |key| |
param_hash = {} | ||
params.each do |param| |
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.
This could also be
param_hash = params.to_h { |param| param.split('=') }
|
||
def to_json | ||
def to_json(*_args) | ||
data = @data.dup.merge('dependencies' => dependencies) | ||
|
||
contents = data.keys.map do |k| |
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 rubocop-performance should catch this and iterate on the pair
contents = data.keys.map do |k| | |
contents = data.map do |k, v| |
else | ||
source_uri = URI.parse("http://#{data['source']}") | ||
end | ||
source_uri = if %r{://}.match?(data['source']) |
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.
source_uri = if %r{://}.match?(data['source']) | |
source_uri = data['source']&.include?('://') |
Summary
Provide a detailed description of all the changes present in this pull request.
Additional Context
Add any additional context about the problem here.
Related Issues (if any)
Mention any related issues or pull requests.