module PuppetRakeTasks::DepChecker::Resolver::Filter

Apply ignore rules to incidents and return the filtered results

Public Instance Methods

filtered() click to toggle source

@return [Hash] list with filtered incidents (cached).

# File lib/puppet_rake_tasks/depchecker/filter.rb, line 7
def filtered
  @filtered ||= filter_incidents
end

Private Instance Methods

filter_incidents() click to toggle source

Loop all incidents and apply the ignore filters for each module. Modules without no incidents (emtpy array) are also removed from the result. @return [Hash] filtered incidents.

# File lib/puppet_rake_tasks/depchecker/filter.rb, line 29
def filter_incidents
  intermediate = incidents.update(incidents) do |modulename, issues|
    filter_module_incidents(modulename, issues)
  end
  intermediate.reject { |_m, i| i.empty? }
end
filter_module_incidents(modulename, issues) click to toggle source

This method calls ignores_matches_incident for each issue and removes it if the result of the call is true. The ignores_matches_incident will loop all configured ignores (global/wildcards or specific for the module) @param issues [Array] An array with all issues related to the module to check. @param modulename [String] simple module name to filter incidents for. @return [Array] with filtered issues.

# File lib/puppet_rake_tasks/depchecker/filter.rb, line 19
def filter_module_incidents(modulename, issues)
  ## Reject all incidents that match an ignore rule
  issues.reject do |incident|
    ignores_matches_incident(modulename, incident)
  end
end