Module: SimpleCovLinterFormatter

Extended by:
SimpleCovLinterFormatter
Included in:
SimpleCovLinterFormatter
Defined in:
lib/simplecov_linter_formatter.rb,
lib/simplecov_linter_formatter/version.rb,
lib/simplecov_linter_formatter/file_line.rb,
lib/simplecov_linter_formatter/summary_builder.rb,
lib/simplecov_linter_formatter/text_lines_filter.rb,
lib/simplecov_linter_formatter/formatters/result_formatter.rb,
lib/simplecov_linter_formatter/exporters/json_result_exporter.rb,
lib/simplecov_linter_formatter/formatters/text_lines_formatter.rb,
lib/simplecov_linter_formatter/formatters/source_file_formatter.rb

Defined Under Namespace

Classes: FileLine, JsonResultExporter, ResultFormatter, SourceFileFormatter, SummaryBuilder, TextLinesFilter, TextLinesFormatter

Constant Summary collapse

SCOPES =
[:all, :own_changes]
SORTING_MODES =
[:coverage, :alphabet]
MSG_DIVIDER =
"-"
LINE_SECTIONS_DIVIDER =
":"
VERSION =
"0.2.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#json_filenameObject



29
30
31
# File 'lib/simplecov_linter_formatter.rb', line 29

def json_filename
  @json_filename || 'coverage.linter.json'
end

#summary_covered_bg_colorObject



73
74
75
# File 'lib/simplecov_linter_formatter.rb', line 73

def summary_covered_bg_color
  (@summary_covered_bg_color || :darkgreen).to_sym
end

#summary_enabledObject



49
50
51
# File 'lib/simplecov_linter_formatter.rb', line 49

def summary_enabled
  !!@summary_enabled
end

#summary_enabled_bgObject



69
70
71
# File 'lib/simplecov_linter_formatter.rb', line 69

def summary_enabled_bg
  !!@summary_enabled_bg
end

#summary_not_covered_bg_colorObject



77
78
79
# File 'lib/simplecov_linter_formatter.rb', line 77

def summary_not_covered_bg_color
  (@summary_not_covered_bg_color || :firebrick).to_sym
end

#summary_text_colorObject



81
82
83
# File 'lib/simplecov_linter_formatter.rb', line 81

def summary_text_color
  (@summary_text_color || :white).to_sym
end

Instance Method Details

#cover_all?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/simplecov_linter_formatter.rb', line 45

def cover_all?
  scope == :all
end

#scopeObject



41
42
43
# File 'lib/simplecov_linter_formatter.rb', line 41

def scope
  (@scope || :all).to_sym
end

#scope=(value) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/simplecov_linter_formatter.rb', line 33

def scope=(value)
  if !SCOPES.include?(value.to_sym)
    raise "Invalid scope. Must be one of: #{SCOPES.map(&:to_s).join(', ')}"
  end

  @scope = value
end

#setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



85
86
87
# File 'lib/simplecov_linter_formatter.rb', line 85

def setup
  yield self
end

#summary_coverage_sorting?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/simplecov_linter_formatter.rb', line 65

def summary_coverage_sorting?
  summary_files_sorting == :coverage
end

#summary_files_sortingObject



61
62
63
# File 'lib/simplecov_linter_formatter.rb', line 61

def summary_files_sorting
  (@summary_files_sorting || :coverage).to_sym
end

#summary_files_sorting=(value) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/simplecov_linter_formatter.rb', line 53

def summary_files_sorting=(value)
  if !SORTING_MODES.include?(value.to_sym)
    raise "Invalid summary_files_sorting. Must be one of: #{SORTING_MODES.map(&:to_s).join(', ')}"
  end

  @summary_files_sorting = value
end