Class: RuboCop::Formatter::CheckstyleFormatter
- Inherits:
-
BaseFormatter
- Object
- BaseFormatter
- RuboCop::Formatter::CheckstyleFormatter
show all
- Includes:
- PathUtil
- Defined in:
- lib/rubocop/formatter/checkstyle_formatter.rb
Overview
Instance Method Summary
collapse
Instance Method Details
#file_finished(file, offences) ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/rubocop/formatter/checkstyle_formatter.rb', line 20
def file_finished(file, offences)
REXML::Element.new('file', @checkstyle).tap do |f|
path_name = file
path_name = relative_path(path_name) if !ENV.has_key?('RUBOCOP_CHECKSTYLE_FORMATTER_ABSOLUTE_PATH') && defined?(relative_path)
f.attributes['name'] = path_name
add_offences(f, offences)
end
end
|
#finished(_inspected_files) ⇒ Object
29
30
31
|
# File 'lib/rubocop/formatter/checkstyle_formatter.rb', line 29
def finished(_inspected_files)
@document.write(output, 2)
end
|
#started(_target_file) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/rubocop/formatter/checkstyle_formatter.rb', line 13
def started(_target_file)
@document = REXML::Document.new.tap do |d|
d << REXML::XMLDecl.new
end
@checkstyle = REXML::Element.new('checkstyle', @document)
end
|