Class: Danger::DangerResharperInspectcode

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

Overview

Danger plugin for JetBrains ReSharper InspectCode.

Examples:

Parse the report XML file and do reporting

resharper_inspectcode.base_path = Dir.pwd
resharper_inspectcode.report 'report.xml'

See Also:

  • tumugin/danger-resharper_inspectcode

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dangerfile) ⇒ DangerResharperInspectcode



32
33
34
35
# File 'lib/resharper_inspectcode/plugin.rb', line 32

def initialize(dangerfile)
  super(dangerfile)
  @base_path ||= Dir.pwd
end

Instance Attribute Details

#base_pathString

Base path of report file



16
17
18
# File 'lib/resharper_inspectcode/plugin.rb', line 16

def base_path
  @base_path
end

Instance Method Details

#report(file) ⇒ Object

Report warnings



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

def report(file)
  raise "Please specify file name." if file.empty?

  filepath = @base_path + (@base_path.end_with?("/") ? "" : "/") + file
  raise "No report file was found at #{filepath}" unless File.exist?(filepath)

  issues = ReportParser.parse_report_xml(filepath)
  issues.each do |issue|
    warn(issue.message, file: issue.file, line: issue.line)
  end
end