Skip to content

Commit

Permalink
make code more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Jun 9, 2024
1 parent bf7b684 commit 50f019a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inherit_gem:
Layout/LineLength:
Enabled: false

Style/IfUnlessModifier:
Enabled: false

# To match the gem name
Naming/FileName:
Exclude:
Expand Down
12 changes: 9 additions & 3 deletions lib/rspec-puppet-facts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ def self.common_facts

@common_facts[:mco_version] = MCollective::VERSION if mcollective?

@common_facts[:augeasversion] = Augeas.open(nil, nil, Augeas::NO_MODL_AUTOLOAD).get('/augeas/version') if augeas?
if augeas?
@common_facts[:augeasversion] = Augeas.open(nil, nil, Augeas::NO_MODL_AUTOLOAD).get('/augeas/version')
end
@common_facts = stringify_keys(@common_facts) if RSpec.configuration.facterdb_string_keys

@common_facts
Expand Down Expand Up @@ -296,7 +298,9 @@ def self.mcollective?
# @return [Array<Hash>]
# @api private
def self.meta_supported_os
raise StandardError, 'Unknown operatingsystem support in the metadata file!' unless metadata['operatingsystem_support'].is_a? Array
unless metadata['operatingsystem_support'].is_a? Array
raise StandardError, 'Unknown operatingsystem support in the metadata file!'
end

metadata['operatingsystem_support']
end
Expand All @@ -308,7 +312,9 @@ def self.meta_supported_os
# @api private
def self.metadata
return @metadata if @metadata
raise StandardError, "Can't find metadata.json... dunno why" unless File.file? metadata_file
unless File.file? metadata_file
raise StandardError, "Can't find metadata.json... dunno why"
end

content = File.read metadata_file
@metadata = JSON.parse content
Expand Down

0 comments on commit 50f019a

Please sign in to comment.