Sha256: 024d4b2b8019083581a037e21bce806a3d59976cb7e19afa64dba45e0b29cc16

Contents?: true

Size: 798 Bytes

Versions: 5

Compression:

Stored size: 798 Bytes

Contents

# frozen_string_literal: true

require_relative '../../test_queue'
require 'puppet-lint'

module TestQueue
  class Runner
    class PuppetLint < Runner
      def run_worker(iterator)
        errors = 0
        linter = PuppetLint.new
        iterator.each do |file|
          puts "Evaluating #{file}"
          linter.file = file
          linter.run
          errors += 1 if linter.errors?
        end
        errors
      end

      def summarize_worker(worker)
        lines = worker.lines

        files    = lines.grep(/^Evaluating/)
        errors   = lines.grep(/^ERROR/)
        warnings = lines.grep(/^WARNING/)

        worker.summary = "#{files.size} files, #{warnings.size} warnings, #{errors.size} errors"
        worker.failure_output = errors.join("\n")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
test-queue-0.11.1 lib/test_queue/runner/puppet_lint.rb
test-queue-0.11.0 lib/test_queue/runner/puppet_lint.rb
test-queue-0.10.0 lib/test_queue/runner/puppet_lint.rb
test-queue-0.9.0 lib/test_queue/runner/puppet_lint.rb
test-queue-0.8.0 lib/test_queue/runner/puppet_lint.rb