Sha256: 1671410e217ae14fb2296c96050e6906a73b6dcefc7354d333f31d130b2f53be

Contents?: true

Size: 1.13 KB

Versions: 7

Compression:

Stored size: 1.13 KB

Contents

require 'puppet-strings/yard/handlers/helpers'
require 'puppet-strings/yard/handlers/puppet/base'
require 'puppet-strings/yard/parsers'
require 'puppet-strings/yard/code_objects'

# Implements the handler for Puppet defined types.
class PuppetStrings::Yard::Handlers::Puppet::DefinedTypeHandler < PuppetStrings::Yard::Handlers::Puppet::Base
  handles PuppetStrings::Yard::Parsers::Puppet::DefinedTypeStatement

  process do
    # Register the object
    object = PuppetStrings::Yard::CodeObjects::DefinedType.new(statement)
    register object

    # Log a warning if missing documentation
    log.warn "Missing documentation for Puppet defined type '#{object.name}' at #{statement.file}:#{statement.line}." if object.docstring.empty? && object.tags.empty?

    # Set the parameter types
    set_parameter_types(object)

    # Mark the defined type as public if it doesn't already have an api tag
    object.add_tag YARD::Tags::Tag.new(:api, 'public') unless object.has_tag? :api

    # Warn if a summary longer than 140 characters was provided
    PuppetStrings::Yard::Handlers::Helpers.validate_summary_tag(object) if object.has_tag? :summary
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
puppet-strings-2.5.0 lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb
puppet-strings-2.4.0 lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb
puppet-strings-2.3.1 lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb
puppet-strings-2.3.0 lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb
puppet-strings-2.2.0 lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb
puppet-strings-2.1.0 lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb
puppet-strings-2.0.0 lib/puppet-strings/yard/handlers/puppet/defined_type_handler.rb