Class: Danger::DangerCheckstyleFormat
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerCheckstyleFormat
- Defined in:
- lib/checkstyle_format/plugin.rb
Overview
Danger plugin for checkstyle xml files.
Instance Attribute Summary collapse
-
#base_regex ⇒ String
Base regex for converting the full paths into relative paths.
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_regex ⇒ String
Base regex for converting the full paths into relative paths. Defaults to nil.
25 26 27 |
# File 'lib/checkstyle_format/plugin.rb', line 25 def base_regex @base_regex end |
Instance Method Details
#report(file, inline_mode: true) ⇒ void
This method returns an undefined value.
Report checkstyle warnings
30 31 32 33 34 35 36 37 |
# File 'lib/checkstyle_format/plugin.rb', line 30 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
42 43 44 45 46 47 48 |
# File 'lib/checkstyle_format/plugin.rb', line 42 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 |