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

Fix layout cops #9229

Merged
merged 6 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/puppet/parameter/value.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def regex?
#
def convert(value)
case value
when Symbol, '' # can't intern an empty string
when Symbol, '' # can't intern an empty string
value
when String
value.intern
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/pops/evaluator/runtime3_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def accept(diagnostic)
super
IssueReporter.assert_and_report(self, {
:message => "Evaluation Error:",
:emit_warnings => true, # log warnings
:emit_warnings => true, # log warnings
:exception_class => Puppet::PreformattedError
})
if errors?
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/pops/parser/lexer2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class Lexer2
'default' => [:DEFAULT, 'default', 7],
'define' => [:DEFINE, 'define', 6],
'if' => [:IF, 'if', 2],
'elsif' => [:ELSIF, 'elsif', 5],
'elsif' => [:ELSIF, 'elsif', 5],
'else' => [:ELSE, 'else', 4],
'inherits' => [:INHERITS, 'inherits', 8],
'node' => [:NODE, 'node', 4],
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/pops/serialization/abstract_writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module Puppet::Pops
module Serialization
MAX_INTEGER = 0x7fffffffffffffff
MAX_INTEGER = 0x7fffffffffffffff
MIN_INTEGER = -0x8000000000000000

# Abstract class for protocol specific writers such as MsgPack or JSON
Expand Down
8 changes: 4 additions & 4 deletions lib/puppet/pops/validation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,15 @@ def ==(o)
alias eql? ==
# rubocop:enable Layout

def hash
@hash ||= [file, source_pos.offset, issue.issue_code, severity].hash
end

# Position is equal if the diagnostic is not located or if referring to the same offset
def same_position?(o)
source_pos.nil? && o.source_pos.nil? || source_pos.offset == o.source_pos.offset
end
private :same_position?

def hash
@hash ||= [file, source_pos.offset, issue.issue_code, severity].hash
end
end

# Formats a diagnostic for output.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/nameservice/directoryservice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ def getinfo(refresh = false)
# list, then report on the remaining list. Pretty whacky, ehh?
type_properties = [:name] + self.class.resource_type.validproperties
type_properties.delete(:ensure) if type_properties.include? :ensure
type_properties << :guid # append GeneratedUID so we just get the report here
type_properties << :guid # append GeneratedUID so we just get the report here
@property_value_cache_hash = self.class.single_report(@resource[:name], *type_properties)
[:uid, :gid].each do |param|
@property_value_cache_hash[param] = @property_value_cache_hash[param].to_i if @property_value_cache_hash and @property_value_cache_hash.include?(param)
Expand Down
3 changes: 1 addition & 2 deletions lib/puppet/provider/package/apt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ def checkforcdrom
# rubocop:enable Layout

if have_cdrom and @resource[:allowcdrom] != :true
raise Puppet::Error,
_("/etc/apt/sources.list contains a cdrom source; not installing. Use 'allowcdrom' to override this failure.")
raise Puppet::Error, _("/etc/apt/sources.list contains a cdrom source; not installing. Use 'allowcdrom' to override this failure.")
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/package/dnfmodule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def enable(args = @resource[:name])

def uninstall
execute([command(:dnf), 'module', 'remove', '-d', '0', '-e', self.class.error_level, '-y', @resource[:name]])
reset # reset module to the default stream
reset # reset module to the default stream
end

def disable(args = @resource[:name])
Expand Down
22 changes: 12 additions & 10 deletions lib/puppet/provider/package/yum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,16 +380,18 @@ def disableexcludes
def scan_options(options, key)
return [] unless options.is_a?(Enumerable)

values = options.map do |repo|
value = if repo.is_a?(String)
next unless repo.include?('=')

Hash[*repo.strip.split('=')] # make it a hash
else
repo
end
value[key]
end
values =
options.map do |repo|
value =
if repo.is_a?(String)
next unless repo.include?('=')

Hash[*repo.strip.split('=')] # make it a hash
else
repo
end
value[key]
end
values.compact.uniq
end
end
22 changes: 11 additions & 11 deletions lib/puppet/provider/user/aix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def parse_password(f)
match_obj[1]
end

#- **password**
# - **password**
# The user's password, in whatever encrypted format the local machine
# requires. Be sure to enclose any value that includes a dollar sign ($)
# in single quotes ('). Requires features manages_passwords.
Expand Down Expand Up @@ -312,49 +312,49 @@ def deletecmd
end

# UNSUPPORTED
#- **profile_membership**
# - **profile_membership**
# Whether specified roles should be treated as the only roles
# of which the user is a member or whether they should merely
# be treated as the minimum membership list. Valid values are
# `inclusive`, `minimum`.
# UNSUPPORTED
#- **profiles**
# - **profiles**
# The profiles the user has. Multiple profiles should be
# specified as an array. Requires features manages_solaris_rbac.
# UNSUPPORTED
#- **project**
# - **project**
# The name of the project associated with a user Requires features
# manages_solaris_rbac.
# UNSUPPORTED
#- **role_membership**
# - **role_membership**
# Whether specified roles should be treated as the only roles
# of which the user is a member or whether they should merely
# be treated as the minimum membership list. Valid values are
# `inclusive`, `minimum`.
# UNSUPPORTED
#- **roles**
# - **roles**
# The roles the user has. Multiple roles should be
# specified as an array. Requires features manages_roles.
# UNSUPPORTED
#- **key_membership**
# - **key_membership**
# Whether specified key value pairs should be treated as the only
# attributes
# of the user or whether they should merely
# be treated as the minimum list. Valid values are `inclusive`,
# `minimum`.
# UNSUPPORTED
#- **keys**
# - **keys**
# Specify user attributes in an array of keyvalue pairs Requires features
# manages_solaris_rbac.
# UNSUPPORTED
#- **allowdupe**
# - **allowdupe**
# Whether to allow duplicate UIDs. Valid values are `true`, `false`.
# UNSUPPORTED
#- **auths**
# - **auths**
# The auths the user has. Multiple auths should be
# specified as an array. Requires features manages_solaris_rbac.
# UNSUPPORTED
#- **auth_membership**
# - **auth_membership**
# Whether specified auths should be treated as the only auths
# of which the user is a member or whether they should merely
# be treated as the minimum membership list. Valid values are
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/util/checksums.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def sha224_file(filename, lite = false)
require_relative '../../puppet/ssl/openssl_loader'

digest = OpenSSL::Digest.new('SHA224')
checksum_file(digest, filename, lite)
checksum_file(digest, filename, lite)
end

def sha224_stream(lite = false, &block)
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/util/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def build_exception_trace(exception, combined_trace = true, puppet_trace = false
built_trace = format_backtrace(exception, combined_trace, puppet_trace)

if exception.respond_to?(:original)
original = exception.original
original = exception.original
unless original.nil?
built_trace << _('Wrapped exception:')
built_trace << original.message
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/util/provider_features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def feature_module
@features.each do |name, feature|
method = name.to_s + "?"
@feature_module.send(:define_method, method) do
(is_a?(Class) ? declared_feature?(name) : self.class.declared_feature?(name)) or feature.available?(self)
(is_a?(Class) ? declared_feature?(name) : self.class.declared_feature?(name)) or feature.available?(self)
end
end

Expand Down