3 # Triggers if a c or cpp header is present
4 class CHeaderRule < FileRule
8 options = args.pop if args.last.is_a?(Hash)
13 def process_source_file(source_file)
14 return unless ['c','cpp'].include?(source_file.polyglot)
16 ['c','cpp'].each do |lang|
17 next unless source_file.language_breakdown(lang)
18 md = regexp.match(source_file.language_breakdown(lang).code)
19 @count += (md && md.size).to_i
25 header_term = "(" + headers.join("|") + ")"
26 Regexp.new("include\s+['<\"]#{ header_term }[\">']", Regexp::IGNORECASE)