class Danger::DangerResharperInspectcode

Danger plugin for JetBrains ReSharper InspectCode. @example Parse the report XML file and do reporting

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

@see tumugin/danger-resharper_inspectcode @tags C#, InspectCode, lint

Attributes

base_path[RW]

Base path of report file

@return [String]

Public Class Methods

new(dangerfile) click to toggle source
Calls superclass method
# File lib/resharper_inspectcode/plugin.rb, line 33
def initialize(dangerfile)
  super(dangerfile)
  @base_path ||= Dir.pwd
end

Public Instance Methods

report(file) click to toggle source

Report warnings @param file [String] File path of ReSharper InspectCode report file @return [void]

# File lib/resharper_inspectcode/plugin.rb, line 21
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