Class: AdLint::Postfilter::MessageSuppressionList

Inherits:
Object
  • Object
show all
Defined in:
lib/adlint/postfilter/suppress.rb

Instance Method Summary collapse

Constructor Details

#initialize(initial_header_suppression, platform_header_suppression, project_wide_suppressions, tunit_wide_suppressions, line_wise_suppressions) ⇒ MessageSuppressionList

Returns a new instance of MessageSuppressionList.



128
129
130
131
132
133
134
135
136
# File 'lib/adlint/postfilter/suppress.rb', line 128

def initialize(initial_header_suppression, platform_header_suppression,
               project_wide_suppressions,
               tunit_wide_suppressions, line_wise_suppressions)
  @initial_header_suppression = initial_header_suppression
  @platform_header_suppression = platform_header_suppression
  @p_index = create_p_index(project_wide_suppressions)
  @t_index = create_t_index(tunit_wide_suppressions)
  @l_index = create_l_index(line_wise_suppressions)
end

Instance Method Details

#apply_to(content) ⇒ Object



138
139
140
141
142
143
144
145
146
147
# File 'lib/adlint/postfilter/suppress.rb', line 138

def apply_to(content)
  content.each_with_index do |line, index|
    if line.filterable?
      supps = suppressions_for(line.message_id, line.fpath, line.line_no)
      if supps.any? { |supp| line.match_with?(supp) }
        content[index] = nil
      end
    end
  end
end