Class: Periphery::CheckstyleParser::Listener

Inherits:
Object
  • Object
show all
Includes:
REXML::StreamListener
Defined in:
lib/periphery/checkstyle_parser.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeListener

Returns a new instance of Listener.



17
18
19
20
# File 'lib/periphery/checkstyle_parser.rb', line 17

def initialize
  @current_file = nil
  @results = []
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



15
16
17
# File 'lib/periphery/checkstyle_parser.rb', line 15

def results
  @results
end

Instance Method Details

#tag_end(name) ⇒ Object



33
34
35
# File 'lib/periphery/checkstyle_parser.rb', line 33

def tag_end(name)
  @current_file = nil if name == 'file'
end

#tag_start(name, attrs) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/periphery/checkstyle_parser.rb', line 22

def tag_start(name, attrs)
  case name
  when 'file'
    @current_file = relative_path(attrs['name'])
  when 'error'
    if @current_file
      @results << ScanResult.new(@current_file, attrs['line'].to_i, attrs['column'].to_i, attrs['message'])
    end
  end
end