Class: Danger::DangerCheckstyleFormat
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerCheckstyleFormat
- Defined in:
- lib/checkstyle_format/plugin.rb
Overview
Danger plugin for checkstyle formatted xml file.
Instance Attribute Summary collapse
-
#base_path ⇒ String
Base path of ‘name` attributes in `file` tag.
Instance Method Summary collapse
-
#report(file, inline_mode = true) ⇒ void
Report checkstyle warnings.
-
#report_by_text(text, inline_mode = true) ⇒ void
Report checkstyle warnings by XML text.
Instance Attribute Details
#base_path ⇒ String
Base path of ‘name` attributes in `file` tag. Defaults to nil.
23 24 25 |
# File 'lib/checkstyle_format/plugin.rb', line 23 def base_path @base_path end |
Instance Method Details
#report(file, inline_mode = true) ⇒ void
This method returns an undefined value.
Report checkstyle warnings
28 29 30 31 32 33 34 |
# File 'lib/checkstyle_format/plugin.rb', line 28 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.read(file)) send_comment(errors, inline_mode) end |
#report_by_text(text, inline_mode = true) ⇒ void
This method returns an undefined value.
Report checkstyle warnings by XML text
39 40 41 42 43 44 |
# File 'lib/checkstyle_format/plugin.rb', line 39 def report_by_text(text, inline_mode = true) raise "Please specify xml text." if text.empty? errors = parse(text) send_comment(errors, inline_mode) end |