Skip to content

Commit

Permalink
Fix rubocop warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Didrichsen <[email protected]>
  • Loading branch information
gavindidrichsen committed Jun 20, 2024
1 parent 90356a8 commit ca1498e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
12 changes: 5 additions & 7 deletions lib/puppet-strings/yard/code_objects/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ def source
end

def parameters
parameters = []
statement.parameters.each do |name, props|
parameters.push({ name: name.to_s,
tag_name: 'param',
text: props['description'] || '',
types: [props['type']] || '' })
statement.parameters.map do |name, props|
{ name: name.to_s,
tag_name: 'param',
text: props['description'] || '',
types: [props['type']] || '' }
end
parameters
end

# Converts the code object to a hash representation.
Expand Down
5 changes: 2 additions & 3 deletions lib/puppet-strings/yard/handlers/ruby/provider_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ def populate_provider_data(object)
parameters.each do |kvps|
next unless kvps.count >= 1

defaultfor = []
kvps.each do |kvp|
defaultfor << [node_as_string(kvp[0]) || kvp[0].source, node_as_string(kvp[1]) || kvp[1].source]
defaultfor = kvps.map do |kvp|
[node_as_string(kvp[0]) || kvp[0].source, node_as_string(kvp[1]) || kvp[1].source]
end
object.add_default(defaultfor)
end
Expand Down
12 changes: 6 additions & 6 deletions lib/puppet-strings/yard/parsers/puppet/statement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def initialize(parameter)
# @param object The Puppet parser model object that has parameters.
# @param [String] file The file containing the statement.
def initialize(object, file)
super(object, file)
super
@parameters = object.parameters.map { |parameter| Parameter.new(parameter) }
end
end
Expand All @@ -105,7 +105,7 @@ class ClassStatement < ParameterizedStatement
# @param [Puppet::Pops::Model::HostClassDefinition] object The model object for the class statement.
# @param [String] file The file containing the statement.
def initialize(object, file)
super(object, file)
super
@name = object.name
@parent_class = object.parent_class
end
Expand All @@ -119,7 +119,7 @@ class DefinedTypeStatement < ParameterizedStatement
# @param [Puppet::Pops::Model::ResourceTypeDefinition] object The model object for the defined type statement.
# @param [String] file The file containing the statement.
def initialize(object, file)
super(object, file)
super
@name = object.name
end
end
Expand All @@ -132,7 +132,7 @@ class FunctionStatement < ParameterizedStatement
# @param [Puppet::Pops::Model::FunctionDefinition] object The model object for the function statement.
# @param [String] file The file containing the statement.
def initialize(object, file)
super(object, file)
super
@name = object.name
return unless object.respond_to? :return_type

Expand All @@ -151,7 +151,7 @@ class PlanStatement < ParameterizedStatement
# @param [Puppet::Pops::Model::PlanDefinition] object The model object for the plan statement.
# @param [String] file The file containing the statement.
def initialize(object, file)
super(object, file)
super
@name = object.name
end
end
Expand All @@ -164,7 +164,7 @@ class DataTypeAliasStatement < Statement
# @param [Puppet::Pops::Model::TypeAlias] object The model object for the type statement.
# @param [String] file The file containing the statement.
def initialize(object, file)
super(object, file)
super

type_expr = object.type_expr
case type_expr
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet-strings/yard/tags/overload_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def has_tag?(name) # rubocop:disable Naming/PredicateName
# @param [Object] value The object to associate with this tag.
# @return [void]
def object=(value)
super(value)
super
@docstring.object = value
@docstring.tags.each { |tag| tag.object = value }
end
Expand Down

0 comments on commit ca1498e

Please sign in to comment.