Sha256: adac1d29151bee5da52764025e5dc2c1dfac59818310ac39da591c964da76767

Contents?: true

Size: 1004 Bytes

Versions: 1

Compression:

Stored size: 1004 Bytes

Contents

require 'pdk'
require 'pdk/util'
require 'pdk/cli/exec'
require 'pdk/validators/base_validator'

module PDK
  module Validate
    class PuppetLint < BaseValidator
      def self.name
        'puppet-lint'
      end

      def self.cmd
        'puppet-lint'
      end

      def self.pattern
        '**/*.pp'
      end

      def self.spinner_text
        _('Checking Puppet manifest style')
      end

      def self.parse_options(_options, targets)
        cmd_options = ['--json']

        cmd_options.concat(targets)
      end

      def self.parse_output(report, json_data)
        json_data.each do |offense|
          report.add_event(
            file:     offense['path'],
            source:   'puppet-lint',
            line:     offense['line'],
            column:   offense['column'],
            message:  offense['message'],
            test:     offense['check'],
            severity: offense['kind'],
            state:    :failure,
          )
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pdk-0.2.0 lib/pdk/validators/puppet/puppet_lint.rb