def check_spelling(files = nil)
      # Installs my fork of the spell checker if needed
      # my fork has line numbers + indexes
      system "npm install -g orta/node-markdown-spellcheck" unless mdspell_installed?

      # Check that this is in the user's PATH after installing
      raise "mdspell is not in the user's PATH, or it failed to install" unless mdspell_installed?

      markdown_files = get_files files

      arguments = ["-r"]
      skip_words = ignored_words || []

      arguments.push("-n") if ignore_numbers
      arguments.push("-a") if ignore_acronyms
      arguments.push("--#{language}")

      File.write(".spelling", skip_words.join("\n"))
      result_texts = Hash[markdown_files.to_a.uniq.collect { |md| [md, `mdspell #{md} #{arguments.join(" ")}`.strip] }]
      spell_issues = result_texts.select { |path, output| output.include? "spelling errors found" }
      File.unlink(".spelling")

      # Get some metadata about the local setup
      current_slug = env.ci_source.repo_slug

      if spell_issues.count > 0
        message = "### Spell Checker found issues\n\n"
        spell_issues.each do |path, output|
          github_loc = "/#{current_slug}/tree/#{github.branch_for_head}/#{path}"
          message << "#### [#{path}](#{github_loc})\n\n"

          message << "Line | Typo |\n"
          message << "| --- | ------ |\n"

          output.lines[1..-3].each do |line|
            index_info = line.strip.split("|").first
            index_line, index = index_info.split(":").map { |n| n.to_i }

            file = File.read(path)

            unknown_word = file[index..-1].split(" ").first

            error_text = line.strip.split("|")[1..-1].join("|").strip
            error = error_text.gsub(unknown_word, "**" + unknown_word + "**")

            message << "#{index_line} | #{error} | \n"
          end
          markdown message
        end
      end
    end
def check_spelling(files = nil)
      # Installs my fork of the spell checker if needed
      # my fork has line numbers + indexes
      system "npm install -g orta/node-markdown-spellcheck" unless mdspell_installed?

      # Check that this is in the user's PATH after installing
      raise "mdspell is not in the user's PATH, or it failed to install" unless mdspell_installed?

      markdown_files = get_files files

      arguments = ["-r"]
      skip_words = ignored_words || []

      arguments.push("-n") if ignore_numbers
      arguments.push("-a") if ignore_acronyms
      arguments.push("--#{language}")

      File.write(".spelling", skip_words.join("\n"))
      result_texts = Hash[markdown_files.to_a.uniq.collect { |md| [md, `mdspell #{md} #{arguments.join(" ")}`.strip] }]
      spell_issues = result_texts.select { |path, output| output.include? "spelling errors found" }
      File.unlink(".spelling")

      # Get some metadata about the local setup
      current_slug = env.ci_source.repo_slug

      if spell_issues.count > 0
        message = "### Spell Checker found issues\n\n"
        spell_issues.each do |path, output|
          github_loc = "/#{current_slug}/tree/#{github.branch_for_head}/#{path}"
          message << "#### [#{path}](#{github_loc})\n\n"

          message << "Line | Typo |\n"
          message << "| --- | ------ |\n"

          output.lines[1..-3].each do |line|
            index_info = line.strip.split("|").first
            index_line, index = index_info.split(":").map { |n| n.to_i }

            file = File.read(path)

            unknown_word = file[index..-1].split(" ").first

            error_text = line.strip.split("|")[1..-1].join("|").strip
            error = error_text.gsub(unknown_word, "**" + unknown_word + "**")

            message << "#{index_line} | #{error} | \n"
          end
          markdown message
        end
      end
    end
Runs a markdown-specific spell checker, against a corpus of `.markdown` and `.md` files.

 @param   [String] files
          A globbed string which should return the files that you want to spell check, defaults to nil.
          if nil, modified and added files from the diff will be used.
 @return  [void]