module AdLint::Postfilter

Public Class Methods

install_config_template(config_fpath) click to toggle source
# File lib/adlint/postfilter/driver.rb, line 40
def install_config_template(config_fpath)
  FileUtils.cp(File.expand_path("conf.d/adlint_postfilter.yml", $etcdir),
               config_fpath)
end
run(config_fpath, command_line, src_vpath) click to toggle source
# File lib/adlint/postfilter/driver.rb, line 69
def run(config_fpath, command_line, src_vpath)
  command = AnalysisCommand.for(command_line, config_fpath, src_vpath)
  command.execute.exitstatus
end
transform_makefile(makefile_fpath) click to toggle source
# File lib/adlint/postfilter/driver.rb, line 46
def transform_makefile(makefile_fpath)
  orig_fpath = makefile_fpath.add_ext(".orig")
  FileUtils.mv(makefile_fpath, orig_fpath)

  File.open(makefile_fpath, "w") do |dst_io|
    dst_io.puts File.open(orig_fpath, "r") { |src_io|
      src_io.each_line.map do |line|
        case line
        when /^(ADLINT =) (.*adlint)$/,
             /^(ADLINT_SMA =) (.*adlint_sma)$/,
             /^(ADLINT_CHK =) (.*adlint_chk)$/
          "#{$1} adlint_flt -A #{$2}"
        when /^(ADLINT_CMA =) (.*adlint_cma)$/
          "#{$1} adlint_flt -V $(VPATH) -A #{$2}"
        else
          line.chomp
        end
      end
    }
  end
end

Private Instance Methods

install_config_template(config_fpath) click to toggle source
# File lib/adlint/postfilter/driver.rb, line 40
def install_config_template(config_fpath)
  FileUtils.cp(File.expand_path("conf.d/adlint_postfilter.yml", $etcdir),
               config_fpath)
end
run(config_fpath, command_line, src_vpath) click to toggle source
# File lib/adlint/postfilter/driver.rb, line 69
def run(config_fpath, command_line, src_vpath)
  command = AnalysisCommand.for(command_line, config_fpath, src_vpath)
  command.execute.exitstatus
end
transform_makefile(makefile_fpath) click to toggle source
# File lib/adlint/postfilter/driver.rb, line 46
def transform_makefile(makefile_fpath)
  orig_fpath = makefile_fpath.add_ext(".orig")
  FileUtils.mv(makefile_fpath, orig_fpath)

  File.open(makefile_fpath, "w") do |dst_io|
    dst_io.puts File.open(orig_fpath, "r") { |src_io|
      src_io.each_line.map do |line|
        case line
        when /^(ADLINT =) (.*adlint)$/,
             /^(ADLINT_SMA =) (.*adlint_sma)$/,
             /^(ADLINT_CHK =) (.*adlint_chk)$/
          "#{$1} adlint_flt -A #{$2}"
        when /^(ADLINT_CMA =) (.*adlint_cma)$/
          "#{$1} adlint_flt -V $(VPATH) -A #{$2}"
        else
          line.chomp
        end
      end
    }
  end
end