Class: Danger::DangerCheckstyleFormat

Inherits:
Plugin
  • Object
show all
Defined in:
lib/checkstyle_format/plugin.rb

Overview

Danger plugin for checkstyle formatted xml file.

Examples:

Parse the XML file, and let the plugin do your reporting


checkstyle_format.report

See Also:

  • noboru-i/danger-checkstyle_format

Defined Under Namespace

Classes: CheckstyleError

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#base_pathString

Base path of ‘name` attributes in `file` tag. Defaults to nil.

Returns:

  • (String)


15
16
17
# File 'lib/checkstyle_format/plugin.rb', line 15

def base_path
  @base_path
end

Instance Method Details

#report(file, inline_mode = true) ⇒ void

This method returns an undefined value.

Report checkstyle warnings



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/checkstyle_format/plugin.rb', line 20

def report(file, inline_mode = true)
  raise "Please specify file name." if file.empty?
  raise "No checkstyle file was found at #{file}" unless File.exist? file
  errors = parse(file)

  puts errors.size

  if inline_mode
    send_inline_comment(errors)
  else
    raise "not implemented." # TODO: not implemented.
  end
end