Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making runner return the array of failures to enable file export #523

Closed
wants to merge 1 commit into from

Conversation

altcointrading
Copy link

If runner returns the data like this, in scripts some variation of the following can be done:

def htmlproof path
  options = { :assume_extension => true }
  errorfile = "#{path}/errors.csv"
  if File.directory?(path)
      res = HTMLProofer.check_directory(path, options).run
      `echo '' > #{errorfile}`
      CSV.open(errorfile, "a") do |csv|
        res.each do |row|
          csv << [row]
        end
      end
  end
end

The result is a CSV with one failure per row.

It would be really really handy to have the option to export the failures to a CSV!!

@altcointrading altcointrading requested a review from Floppy as a code owner July 4, 2019 09:08
count = @failures.length
failure_text = pluralize(count, 'failure', 'failures')
raise @logger.colorize :red, "HTML-Proofer found #{failure_text}!"
return @failures
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but you are removing the existing use case of printing errors on the command line for the sake of your specific use case of iterating over the failures in a script.

An option should be passed to enable the returning of these failures, or at least some TTY detection to note that when this is run from the terminal, the logging is the option.

@altcointrading
Copy link
Author

altcointrading commented Jul 6, 2019 via email

@gjtorikian
Copy link
Owner

I think this was superseded by #538

@gjtorikian gjtorikian closed this Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants