Class: WarningCounter

Inherits:
XCPretty::Simple
  • Object
show all
Defined in:
lib/warning_counter.rb

Instance Method Summary collapse

Constructor Details

#initialize(use_unicode, colorize) ⇒ WarningCounter

Returns a new instance of WarningCounter.



5
6
7
8
9
# File 'lib/warning_counter.rb', line 5

def initialize(use_unicode, colorize)
  super
  @warnings_hash = Set.new()
  @warning_count = 0
end

Instance Method Details

#format_compile_warning(file_name, file_path, reason, line, cursor) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/warning_counter.rb', line 21

def format_compile_warning(file_name, file_path, reason, line, cursor)
  key = "#{file_path}:#{reason}:#{line}"
  if not @warnings_hash.include?(key) 
    @warnings_hash.add(key)
    @warning_count += 1
  end  
  super
end

#format_ld_warning(message) ⇒ Object



11
12
13
14
# File 'lib/warning_counter.rb', line 11

def format_ld_warning(message)
  @warning_count += 1
  super
end

#format_test_summary(message, failures_per_suite) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/warning_counter.rb', line 30

def format_test_summary(message, failures_per_suite)
  File.open('warning-count.json', 'w') { |io|
    io.write JSON.generate(:warning_count => @warning_count)
  }
  File.open('warning-count.yaml', 'w') { |io|
    io.write Psych.dump('warning_count' => @warning_count)
  }
  super
end

#format_warning(message) ⇒ Object



16
17
18
19
# File 'lib/warning_counter.rb', line 16

def format_warning(message)
  @warning_count += 1
  super
end