Sha256: 3a271cb075e3eff714fc4e1ef6ae2e9e3a83fda7a8ea6dcc63a76dc59e8cbe42

Contents?: true

Size: 1.86 KB

Versions: 2

Compression:

Stored size: 1.86 KB

Contents

# XXX: This should be moved out of rake directory
module Quality
  # Configuration for running quality tool
  class Config
    # Name of quality task.
    # Defaults to :quality.
    attr_accessor :quality_name

    # Name of ratchet task.
    # Defaults to :ratchet.
    attr_accessor :ratchet_name

    # Array of strings describing tools to be skipped--e.g., ["cane"]
    #
    # Defaults to []
    attr_accessor :skip_tools

    # Log command executation
    #
    # Defaults to false
    attr_accessor :verbose

    # Array of directory names which contain ruby files to analyze.
    #
    # Defaults to %w(app lib test spec feature), which translates to *.rb in
    # the base directory, as well as those directories.
    attr_writer :ruby_dirs

    # Array of directory names which contain any type of source
    # files to analyze.
    #
    # Defaults to the same as ruby_dirs
    attr_writer :source_dirs

    # Relative path to output directory where *_high_water_mark
    # files will be read/written
    #
    # Defaults to .
    attr_accessor :output_dir

    def ruby_dirs
      @ruby_dirs ||= %w(app lib test spec feature)
    end

    def source_dirs
      @source_dirs ||= ruby_dirs.clone
    end

    def source_files_glob(dirs = source_dirs,
                          extensions = 'rb,swift,cpp,c,java,py')
      File.join("{#{dirs.join(',')}}", '**', "*.{#{extensions}}")
    end

    def ruby_files_glob
      source_files_glob(ruby_dirs, 'rb')
    end

    def ruby_files
      @globber.glob('{*.rb,Rakefile}')
        .concat(@globber.glob(ruby_files_glob)).join(' ')
    end

    def initialize(quality_name: 'quality',
                   ratchet_name: 'ratchet',
                   globber: fail)
      @quality_name, @ratchet_name = quality_name, ratchet_name
      @skip_tools = []
      @output_dir = 'metrics'
      @verbose = false
      @globber = globber
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
quality-5.0.1 lib/quality/rake/config.rb
quality-5.0.0 lib/quality/rake/config.rb