Sha256: 141fa386857b5e34a4fba2dd4918a36c76fdacb63b125e489d52e57d9d4c12a1

Contents?: true

Size: 1.24 KB

Versions: 7

Compression:

Stored size: 1.24 KB

Contents

class Onceover
  module CodeQuality
    module Lint

      # Apply linting to the manifests directory and each module under `site`
      LINT_PATHS = [
        "manifests",
      ]

      # use our default options unless user has created own settings
      if ! File.exist? ".puppet-lint.rc"
        LINT_OPTIONS = [
          "--relative",
          "--fail-on-warnings",
          "--no-double_quoted_strings-check",
          "--no-80chars-check",
          "--no-variable_scope-check",
          "--no-quoted_booleans-check",
        ].freeze
      else
        LINT_OPTIONS = [].freeze
      end

      def self.puppet
        status = true

        # wait until runtime to scan directories for unit tests
        lint_paths = LINT_PATHS.concat(
          CodeQuality::Environment.get_site_dirs.each { |site_dir|
            Dir.glob("#{site_dir}/*").select { |f| File.directory? f}
          }
        )
        lint_paths.each { |p|
          if Dir.exist?(p)
            CodeQuality::Formatter.start_test("lint in #{p}")
            output, ok = CodeQuality::Executor.run("puppet-lint #{LINT_OPTIONS.join ' '} #{p}")
            status &= ok
            CodeQuality::Formatter.end_test(output, ok)
          end
        }

        status
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
onceover-codequality-0.12.0 lib/onceover/codequality/lint.rb
onceover-codequality-0.11.0 lib/onceover/codequality/lint.rb
onceover-codequality-0.10.0 lib/onceover/codequality/lint.rb
onceover-codequality-0.9.0 lib/onceover/codequality/lint.rb
onceover-codequality-0.8.0 lib/onceover/codequality/lint.rb
onceover-codequality-0.7.2 lib/onceover/codequality/lint.rb
onceover-codequality-0.7.1 lib/onceover/codequality/lint.rb