Sha256: dd1987c3e5ba8208200a52f03163f1b0eb94ff5d4b32898f4f7214ef49e3d1ea

Contents?: true

Size: 892 Bytes

Versions: 7

Compression:

Stored size: 892 Bytes

Contents

require 'puppet-strings/yard/handlers/json/base'
require 'puppet-strings/yard/parsers'
require 'puppet-strings/yard/parsers/json/parser'

class PuppetStrings::Yard::Handlers::JSON::TaskHandler < PuppetStrings::Yard::Handlers::JSON::Base
  handles PuppetStrings::Yard::Parsers::JSON::TaskStatement
  namespace_only

  process do
    object = PuppetStrings::Yard::CodeObjects::Task.new(statement)
    register object

    @kind = "Puppet Task #{object.name}."
    @statement = statement

    validate_description
    validate_params
  end

  def validate_description
    log.warn "Missing a description for #{@kind}." if @statement.docstring.empty?
  end

  def validate_params
    unless @statement.parameters.empty?
      @statement.parameters.each do |param, val|
        log.warn "Missing description for param '#{param}' in #{@kind}" if val['description'].nil?
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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