Sha256: 9e42118ddfb58fc41da0c2c6a6fbe6b75865df77f206c6879aa9797068d0ba14

Contents?: true

Size: 768 Bytes

Versions: 7

Compression:

Stored size: 768 Bytes

Contents

module Xcov
  class IgnoreHandler

    attr_accessor :list

    def initialize
      @list = IgnoreHandler.read_ignore_file
    end

    def should_ignore_file filename
      return false if @list.empty?
      return true if @list.include?(filename)

      # Evaluate possible regexs
      return @list.any? { |pattern| filename =~ Regexp.new("#{pattern}$") }
    end

    # Static methods

    def self.read_ignore_file
      require "yaml"
      ignore_file_path = Xcov.config[:ignore_file_path]
      ignore_list = []
      begin
        ignore_list = YAML.load_file(ignore_file_path)
      rescue
        UI.message "Skipping file blacklisting as no ignore file was found at path #{ignore_file_path}".yellow
      end

      return ignore_list
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
xcov-0.11.3 lib/xcov/ignore_handler.rb
xcov-0.11.2 lib/xcov/ignore_handler.rb
xcov-0.11.1 lib/xcov/ignore_handler.rb
xcov-0.11 lib/xcov/ignore_handler.rb
xcov-0.10 lib/xcov/ignore_handler.rb
xcov-0.9 lib/xcov/ignore_handler.rb
xcov-0.8 lib/xcov/ignore_handler.rb