lib/xcprofiler/danger_reporter.rb in danger-xcprofiler-0.3.1 vs lib/xcprofiler/danger_reporter.rb in danger-xcprofiler-0.4.0
- old
+ new
@@ -1,19 +1,22 @@
require 'xcprofiler'
require 'pathname'
module Danger
class DangerReporter < Xcprofiler::AbstractReporter
- def initialize(dangerfile, thresholds, inline_mode, working_dir)
+ def initialize(dangerfile, thresholds, inline_mode, working_dir, ignored_files)
super({})
@dangerfile = dangerfile
@thresholds = thresholds
@inline_mode = inline_mode
@working_dir = working_dir
+ @ignored_files = ignored_files
end
def report!(executions)
+ executions.reject! { |execution| ignored_files.any? { |pattern| File.fnmatch(pattern, execution.path) } }
+
if @inline_mode
inline_report(executions)
else
markdown_report(executions)
end
@@ -66,8 +69,12 @@
executions.each do |e|
message << "| #{e.filename} | #{e.line} | #{e.method_name} | #{e.time} |\n"
end
message
+ end
+
+ def ignored_files
+ [@ignored_files].flatten.compact
end
end
end