Module: SolargraphTestCoverage::ReporterGuards

Included in:
ExampleStatusReporter, TestCoverageReporter
Defined in:
lib/solargraph_test_coverage/reporter_guards.rb

Overview

Some guard functions for the diagnostics

Instance Method Summary collapse

Instance Method Details

#exclude_file?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/solargraph_test_coverage/reporter_guards.rb', line 18

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

#in_test_dir?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/solargraph_test_coverage/reporter_guards.rb', line 10

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

#test_file_exists?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/solargraph_test_coverage/reporter_guards.rb', line 6

def test_file_exists?
  File.file? FileHelpers.test_file(@filename)
end

#test_support_file?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/solargraph_test_coverage/reporter_guards.rb', line 14

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

#using_debugger?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/solargraph_test_coverage/reporter_guards.rb', line 22

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