Sha256: 92911160a5d00ead52b4a5c408954d816b943016cda8e8ccc00bfba8637d308c

Contents?: true

Size: 1.87 KB

Versions: 30

Compression:

Stored size: 1.87 KB

Contents

# frozen_string_literal: true

# XXX: I should figure out how to use tagged releases in github.  Example:
# https://github.com/xsc/lein-ancient/issues/29
# https://github.com/xsc/lein-ancient/releases

require_relative 'linguist_source_file_globber'

module Quality
  # Configuration for running quality tool
  class Config
    attr_accessor :skip_tools, :verbose, :quality_name, :ratchet_name,
                  :output_dir, :punchlist_regexp,
                  :scalastyle_config, :scalastyle_exclude

    attr_writer :source_files_exclude_glob, :minimum_threshold

    extend Forwardable

    def_delegators(:@source_file_globber,
                   :ruby_files,
                   :python_files,
                   :js_files,
                   :markdown_files,
                   :shell_files,
                   :scala_files,
                   :source_and_doc_files,
                   :source_files,
                   :exclude_files=,
                   :exclude_files)

    def to_glob(files)
      "{#{files.join(',')}}"
    end

    def source_files_glob
      to_glob(source_files)
    end

    def source_and_doc_files_glob
      to_glob(source_and_doc_files)
    end

    def source_files_exclude_glob
      @source_files_exclude_glob || to_glob(exclude_files)
    end

    def all_output_files
      @dir.glob("#{output_dir}/*_high_water_mark")
    end

    def minimum_threshold
      @minimum_threshold ||= { bigfiles: 300 }
    end

    def initialize(quality_name: 'quality',
                   ratchet_name: 'ratchet',
                   source_file_globber: Quality::LinguistSourceFileGlobber.new,
                   dir: Dir)
      @quality_name = quality_name
      @ratchet_name = ratchet_name
      @skip_tools = []
      @output_dir = 'metrics'
      @verbose = false
      @source_file_globber = source_file_globber
      @dir = dir
      @source_files_exclude_glob = nil
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
quality-39.0.1 lib/quality/config.rb
quality-38.0.1 lib/quality/config.rb
quality-38.0.0 lib/quality/config.rb
quality-37.1.1 lib/quality/config.rb
quality-37.1.0 lib/quality/config.rb
quality-37.0.1 lib/quality/config.rb
quality-37.0.0 lib/quality/config.rb
quality-36.1.0 lib/quality/config.rb
quality-36.0.0 lib/quality/config.rb
quality-35.2.1 lib/quality/config.rb
quality-35.2.0 lib/quality/config.rb
quality-35.1.1 lib/quality/config.rb
quality-35.0.1 lib/quality/config.rb
quality-35.0.0 lib/quality/config.rb
quality-34.0.2 lib/quality/config.rb
quality-34.0.1 lib/quality/config.rb
quality-34.0.0 lib/quality/config.rb
quality-33.0.0 lib/quality/config.rb
quality-32.1.1 lib/quality/config.rb
quality-32.1.0 lib/quality/config.rb