Builds the markdown table displaying coverage on individual files
 @param [Array] covered_files
 @return [String] Markdown table
329366
def individual_coverage_message(covered_files)
      require 'terminal-table'

      message = "### Code Coverage\n\n"
      table = Terminal::Table.new(
        headings: %w(File Coverage),
        style: { border_i: '|' },
        rows: covered_files.map do |file|
          [file[:filename], "#{format('%.02f', file[:covered_percent])}%"]
        end
      ).to_s
      message + table.split("\n")[1..-2].join("\n")
    end
1193881
def obsolete_files
      out = (existing_files - new_files - new_dirs + replaced_files).to_a
      Jekyll::Hooks.trigger :clean, :on_obsolete, out
      out
    end
968056
def add_missing_covered_codes
      top_level_path = DeepCover.config.paths.detect do |path|
        next unless path.is_a?(String)
        path = File.expand_path(path)
        File.dirname(path) == path
      end
      if top_level_path
        # One of the paths is a root path.
        # Either a mistake, or the user wanted to check everything that gets loaded. Either way,
        # we will probably hang from searching the files to load. (and then loading them, as there
        # can be lots of ruby files) We prefer to warn the user and not do anything.
        suggestion = "#{top_level_path}/**/*.rb"
        warn ["Because the `paths` configured in DeepCover include #{top_level_path.inspect}, which is a root of your fs, ",
              'DeepCover will not attempt to find Ruby files that were not required. Your coverage report will not include ',
              'files that were not instrumented. This is to avoid extremely long wait times. If you actually want this to ',
              "happen, then replace the specified `paths` with #{suggestion.inspect}.",
             ].join
        return
      end

      DeepCover.all_tracked_file_paths.each do |path|
        covered_code(path, tracker_hits: :zeroes)
      end
      nil
    end
320803
def render(context)
      site = context.registers[:site]
      converter = site.getConverterImpl(::Jekyll::Converters::Markdown)
      converter.convert(render_block(context))
    end
510609
def compile(src)
      src = src.read() if src.respond_to?(:read)
      markdown = Redcarpet::Markdown.new(renderer, markdown_options)
      rendered = markdown.render(src)
      return rendered
    end
323090
def extendMarkdown(self, md, md_globals):
        
        md.parser.blockprocessors.add('table',
                                      TableProcessor(md.parser),
                                      '<hashheader')
1009020
def compile_markdown_file(source_file):
  ''''''
  template = pkg_resources.resource_string('md2remark.resources.templates', 'slideshow.mustache')

  renderer = pystache.Renderer(search_dirs='./templates')

  f = open(source_file, 'r')
  slideshow_md = f.read()
  f.close()
  slideshow_name = os.path.split(source_file)[1].split('.')[0]

  rendered_text = renderer.render(template, {'title': slideshow_name, 'slideshow': slideshow_md})  

  if not os.path.exists('md2remark_build'):
    os.makedirs('md2remark_build')
  
  f = open(os.path.join('md2remark_build', slideshow_name + '.html'), 'w')
  f.write(rendered_text)
  f.close()
1190543
def make_seg_table(workflow, seg_files, seg_names, out_dir, tags=None,
                  title_text=None, description=None):
    
    seg_files = list(seg_files)
    seg_names = list(seg_names)
    if tags is None: tags = []
    makedir(out_dir)
    node = PlotExecutable(workflow.cp, 'page_segtable', ifos=workflow.ifos,
                    out_dir=out_dir, tags=tags).create_node()
    node.add_input_list_opt('--segment-files', seg_files)
    quoted_seg_names = []
    for s in seg_names:
        quoted_seg_names.append("'" + s + "'")
    node.add_opt('--segment-names', ' '.join(quoted_seg_names))
    if description:
        node.add_opt('--description', "'" + description + "'")
    if title_text:
        node.add_opt('--title-text', "'" + title_text + "'")
    node.new_output_file_opt(workflow.analysis_time, '.html', '--output-file')
    workflow += node
    return node.output_files[0]
195317
def generate_coverage_report(coverage_xml, compare_branch,
                             html_report=None, css_file=None,
                             ignore_staged=False, ignore_unstaged=False,
                             exclude=None, src_roots=None):
    
    diff = GitDiffReporter(
        compare_branch, git_diff=GitDiffTool(), ignore_staged=ignore_staged,
        ignore_unstaged=ignore_unstaged, exclude=exclude)

    xml_roots = [cElementTree.parse(xml_root) for xml_root in coverage_xml]
    coverage = XmlCoverageReporter(xml_roots, src_roots)

    # Build a report generator
    if html_report is not None:
        css_url = css_file
        if css_url is not None:
            css_url = os.path.relpath(css_file, os.path.dirname(html_report))
        reporter = HtmlReportGenerator(coverage, diff, css_url=css_url)
        with open(html_report, "wb") as output_file:
            reporter.generate_report(output_file)
        if css_file is not None:
            with open(css_file, "wb") as output_file:
                reporter.generate_css(output_file)

    reporter = StringReportGenerator(coverage, diff)
    output_file = sys.stdout if six.PY2 else sys.stdout.buffer

    # Generate the report
    reporter.generate_report(output_file)
    return reporter.total_percent_covered()
1180475
def individual_report(coverage_path, current_project_path)
      if File.exist? coverage_path
        committed_files = git.modified_files + git.added_files

        unless current_project_path.nil?
          committed_files = committed_files.map do |s|
            current_project_path + '/' + s
          end
        end

        covered_files = JSON.parse(File.read(coverage_path), symbolize_names: true)[:files]
                            .select { |f| committed_files.include?(f[:filename]) }

        unless current_project_path.nil?
          covered_files.each { |f| f[:filename].sub!(%r{^#{current_project_path}/?}, '') }
        end

        return if covered_files.nil? || covered_files.empty?
        markdown individual_coverage_message(covered_files)
      else
        fail('Code coverage data not found')
      end
    end
235867
def generate_cover!
      return unless @config.cover
      cover_file = MarkupFile.new @config.cover
      markup = Markup::Renderer.new cover_file
      html = "<div class=\"cover\">\n#{markup.render}\n</div>"
      append_stylesheets(html)
      html = add_head(html)
      @coverfile.write(html)
      @coverfile.close
    end
604906
def is_toc_correct?
      filenames.all? do |filename|
        toc_file = Danger::Toc::MarkdownFile.new(filename)
        if !toc_file.exists?
          messaging.fail("The #{filename} file does not exist.", sticky: false)
          false
        elsif toc_file.good?
          true
        else
          markdown <<-MARKDOWN
Here's the expected TOC for #{filename}:

```markdown
# #{Danger::Toc.config.header}

#{toc_file.toc_from_headers.join("\n")}
```
          MARKDOWN
          if toc_file.has_toc?
            messaging.fail("The TOC found in #{filename} doesn't match the sections of the file.", sticky: false)
          else
            messaging.fail("The #{filename} file is missing a TOC.", sticky: false)
          end
          false
        end
      end
    end
1124679
def index
      @directories = Cmtool::Directory.roots

      respond_to do |format|
        format.html # index.html.erb
        format.xml  { render :xml => @directories }
      end
    end
353547
def parse_files(shellcheck_summary)
      shellcheck_summary.each do |element|
        file = element[:file]
        @files.add(file)
        level = element[:level]

        message = format_violation(file, element)

        if level == 'error'
          @error_count += 1
          fail(message, sticky: false)
        else
          if level == 'warning'
            @warning_count += 1
          elsif level == 'info'
            @info_count += 1
          else
            @style_count += 1
          end
          warn(message, sticky: false)
        end
      end
    end
518073
def model_attributes(model, ignored_tables, ignored_cols)
      return [] if model.abstract_class? && Rails::VERSION::MAJOR < 3

      if model.abstract_class?
        model.direct_descendants.reject {|m| ignored?(m.table_name, ignored_tables)}.inject([]) do |attrs, m|
          attrs.push(model_attributes(m, ignored_tables, ignored_cols)).flatten.uniq
        end
      elsif !ignored?(model.table_name, ignored_tables) && @existing_tables.include?(model.table_name)
        model.columns.reject { |c| ignored?(c.name, ignored_cols) }.collect { |c| c.name }
      else
        []
      end
    end
555215
def output_markdown(markdown_cont, output_file):
    
    if output_file:
        with open(output_file, 'w') as out:
            out.write(markdown_cont)
1222716
def results
      ActiveRecord::Base.connection.tables.each do |table|
        model = table.classify.constantize rescue next

        model.columns.each do |column|
          present = model.respond_to?(:nillify_attributes) && model.nillify_attributes.include?(column.name.to_sym)

          @results << [present, model.name, column.name] if include_column(column)
        end
      end

      @results
    end