-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
rubocop: Fix Style cops #180
Conversation
|
||
# Offense count: 1 | ||
# This cop supports unsafe autocorrection (--autocorrect-all). | ||
Style/RedundantSort: |
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.
Doesn't #181 solve that?
@@ -379,9 +371,6 @@ def self.facter_version_to_loose_requirement_string(version) | |||
elsif /\A[0-9]+\Z/.match?(version) | |||
# Interpret 3 as < 4 | |||
"< #{version.to_i + 1}" | |||
else | |||
# This would be the same as the strict requirement |
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 originally wrote this because it explicitly documents the flow. Is it worth keeping that?
unless metadata['operatingsystem_support'].is_a? Array | ||
fail StandardError, 'Unknown operatingsystem support in the metadata file!' | ||
end | ||
raise StandardError, 'Unknown operatingsystem support in the metadata file!' unless metadata['operatingsystem_support'].is_a? Array |
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'd say this is less readable. Can we disable the guard condition cop?
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.
unless File.file? metadata_file | ||
fail StandardError, "Can't find metadata.json... dunno why" | ||
end | ||
raise StandardError, "Can't find metadata.json... dunno why" unless File.file? metadata_file |
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.
Same here
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.
@@ -397,13 +386,13 @@ def self.facter_version_for_puppet_version(puppet_version) | |||
fd = File.open(json_path, 'rb:UTF-8') | |||
data = JSON.parse(fd.read) | |||
|
|||
version_map = data.map { |_, versions| | |||
version_map = data.map do |_, versions| |
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.
In #183 I do more refactoring that I think helps. I'd expect .map.compact
to be flagged in rubocop-performance.
if augeas? | ||
@common_facts[:augeasversion] = Augeas.open(nil, nil, Augeas::NO_MODL_AUTOLOAD).get('/augeas/version') | ||
end | ||
@common_facts[:augeasversion] = Augeas.open(nil, nil, Augeas::NO_MODL_AUTOLOAD).get('/augeas/version') if augeas? |
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'm not happy with the condition given the line length. AFAIK the guard condition cop supports line lengths, but we disabled that cop so the guard condition cop is too trigger happy.
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.
No description provided.