Sha256: 50cb18f3817b1618677b500edcb8b3861dc83c85e3ee172aa08424359d0d3f4b

Contents?: true

Size: 625 Bytes

Versions: 2

Compression:

Stored size: 625 Bytes

Contents

# frozen_string_literal: true

module SolargraphTestCoverage
  # Some guard functions for the diagnostics
  module ReporterGuards
    def test_file_exists?
      File.file? FileHelpers.test_file(@filename)
    end

    def in_test_dir?
      @filename.start_with? Config.full_test_dir
    end

    def test_support_file?
      in_test_dir? && !@filename.end_with?(Config.test_file_suffix)
    end

    def exclude_file?
      Config.exclude_paths.any? { |path| FileHelpers.relative_path(@filename).include? path }
    end

    def using_debugger?
      @source.code.match?(/(binding\.pry|byebug|debugger)/)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solargraph_test_coverage-0.3.1.1 lib/solargraph_test_coverage/reporter_guards.rb
solargraph_test_coverage-0.3.1 lib/solargraph_test_coverage/reporter_guards.rb